Skip to content

Conversation

@fglock
Copy link
Owner

@fglock fglock commented Jan 5, 2026

Fixes control flow propagation for last SKIP through function calls in scalar context.

Problem

Test #2 in skip_control_flow.t was failing:

sub inner2 { last SKIP }
sub outer2 { my $x = inner2(); return $x; }
SKIP: { my $r = outer2(); }

The last SKIP in inner2() wasn't exiting the SKIP block because the control flow marker wasn't being checked after outer2() returned.

Solution

Added registry check in EmitBlock.java after each statement in simple labeled blocks (≤3 statements without loop constructs). The check:

  • Calls RuntimeControlFlowRegistry.hasMarker()
  • If marker present, calls checkLoopAndGetAction(labelName)
  • Jumps to nextLabel if action != 0

Limited to simple blocks to avoid ASM VerifyError in complex code.

Results

  • ✅ skip_control_flow.t: all 3 tests pass
  • ✅ make: passes with no regressions
  • ✅ No ASM errors

fglock added 18 commits January 2, 2026 21:56
Add registry check after each statement in simple labeled blocks (≤3 statements)
to handle non-local control flow like 'last SKIP' through function calls.

The check:
- Only applies to labeled blocks without loop constructs
- Checks RuntimeControlFlowRegistry after each statement
- Jumps to nextLabel if matching control flow detected
- Limited to simple blocks to avoid ASM VerifyError

Results:
- skip_control_flow.t: all 3 tests pass
- make: passes with no regressions
@fglock fglock force-pushed the master branch 2 times, most recently from 97346c2 to 469f6cc Compare January 6, 2026 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants