forked from jruby/jruby
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Force a Thread's block to optimize eagerly
The block of code passed to Thread.new is frequently only executed once during a program's runtime, and in such cases there's often heavy lifting performed within the block such as an IO or Queue loop. Because we do not support any form of on-stack replacement, these blocks may never fully optimize and will remain in whatever execution mode JRuby starts them in (usually the slowest "startup" interpreter). This patch adds logic from Thread.new into the block body to force completion of builds steps that would optimize the body. This is akin to the behavior of the command-line target script, which we also eagerly compile due to the great number of single-script utilities and benchmarks in the Ruby ecosystem. This patch also plumbs that force-ability through the other "buildable" execution units: methods and block-based methods like define_method. This may become useful in the future to have more direct control over when a target block or method optimizes.
- Loading branch information
Showing
8 changed files
with
132 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters