Fix returning from LEAVE to surrounding scope #1785
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When a LEAVE phaser is run during an unwind, there is no valid return_address set in the LEAVE phasers caller frame. (It return_address is actually set to cur_op which is still the one that started the unwind in some unrelated frame.) Thus when a
return
in a LEAVE happens, the handler of the outer frame is missed, becausesearch_frame_handlers_lex()
validates that thereturn_address
lies in the handlers area. Luckily there is a flag set on the LEAVE's outer frame:MVM_FRAME_FLAG_EXIT_HAND_RUN. We can simply check for that flag and ignore the frame handlers area. This is fine to do, because frames that have an exit handler attached can not be inlined. This fixes:
which before this fix printed
Fixes #1784