Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Backport LocalJumpError and EQQ fixes from 9.2 #4812
Fixes #4686. Fixes #4577. The logic here adds finally wrappers around all call paths that receive a block. When the call exits, the block is marked "escaped" since it no longer has a method activation to go with it. This indicates that non-local flow, like break, should immediately trigger a LocalJumpError. This passes specs but has not been tested extensively with other types of call forms that receive blocks.
Most case/when will have neither an undefined case value (for bare case statements) nor multiple values for a given when (splatted) so in those cases we can simply do a plain eqq call + isTrue. The unusual cases will still go to the old isEQQ logic, so there may be value in optimizing that path later. The main logic in isEQQ is the processing of a splatted array of when values in sequence, and a small bit of logic that simply checks truthiness of the when value for a bare case statement. This change reduces the bytecode for all case/when, and by more than half for the typical form. It also allows the === call to be optimized with invokedynamic like a normal call.