-
-
Notifications
You must be signed in to change notification settings - Fork 925
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify yield logic to be aware of the on-stack block.
Previously, because we only had one yield instruction and one way to prepare any incoming block, the lowest-common-denominator was to always turn passed blocks into a Proc object before sending it on to a yield. This is less overhead than in 1.7, and resulted in our yield performance being worse than it should be. See #2442. In order to fix this I have made the following changes. * ReceiveClosure, the instruction which reifies an implicit block into a Proc, has been renamed to ReifyClosure. It is now used only for block args, as in def foo(&b). * LoadImplicitClosure and LoadFrameClosure are added to retrieve a block from either the JVM stack or from our frame stack. Method bodies and singleton class bodies use the stack, and all other scopes use frame. This allows us to load the block used for yielding in an efficient way regardless of which scope we are in. * IRScope temporarily aggregates two variables: one for the "yield" closure, the one used for yielding (which may come from either JVM stack or our frame); and one for the "implicit" closure, which is the one passed directly to this scope on the JVM stack. This additional closure is needed to represent two-block scopes like a block that receives a block. * ProcessModuleBody now has an operand to load a block passed to the module/class body. For normal module and class bodies this is always NullBlock (new operand for Block.NULL_BLOCK), but singleton class bodies (class << obj) inherit the surrounding scope's yield closure (not the implicit closure, since that would capture nearest block's block rather than outer method's block). This results in a substantial reduction of allocation, and a decent performance improvement: BEFORE yield 6.901M (±19.0%) i/s - 32.351M block.call 6.509M (±10.6%) i/s - 31.999M method dispatch 18.988M (±16.8%) i/s - 90.797M AFTER yield 8.002M (±22.4%) i/s - 36.745M block.call 6.399M (±12.8%) i/s - 31.314M method dispatch 18.939M (±10.5%) i/s - 92.585M
- 9.4.12.0
- 9.4.11.0
- 9.4.10.0
- 9.4.9.0
- 9.4.8.0
- 9.4.7.0
- 9.4.6.0
- 9.4.5.0
- 9.4.4.0
- 9.4.3.0
- 9.4.2.0
- 9.4.1.0
- 9.4.0.0
- 9.3.15.0
- 9.3.14.0
- 9.3.13.0
- 9.3.12.0
- 9.3.11.0
- 9.3.10.0
- 9.3.9.0
- 9.3.8.0
- 9.3.7.0
- 9.3.6.0
- 9.3.5.0
- 9.3.4.0
- 9.3.3.0
- 9.3.2.0
- 9.3.1.0
- 9.3.0.0
- 9.2.21.0
- 9.2.20.1
- 9.2.20.0
- 9.2.19.0
- 9.2.18.0
- 9.2.17.0
- 9.2.16.0
- 9.2.15.0
- 9.2.14.0
- 9.2.13.0
- 9.2.12.0
- 9.2.11.1
- 9.2.11.0
- 9.2.10.0
- 9.2.9.0
- 9.2.8.0
- 9.2.7.0
- 9.2.6.0
- 9.2.5.0
- 9.2.4.1
- 9.2.4.0
- 9.2.3.0
- 9.2.2.0
- 9.2.1.0
- 9.2.0.0
- 9.1.17.0
- 9.1.16.0
- 9.1.15.0
- 9.1.14.0
- 9.1.13.0
- 9.1.12.0
- 9.1.11.0
- 9.1.10.0
- 9.1.9.0
- 9.1.8.0
- 9.1.7.0
- 9.1.6.0
- 9.1.5.0
- 9.1.4.0
- 9.1.3.0
- 9.1.2.0
- 9.1.1.0
- 9.1.0.0
- 9.0.5.0
- 9.0.4.0
- 9.0.3.0
- 9.0.1.0
- 9.0.0.0
- 9.0.0.0.rc2
- 9.0.0.0.rc1
- 9.0.0.0.pre2
- 9.0.0.0.pre1
Showing
19 changed files
with
370 additions
and
95 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
Oops, something went wrong.