Fix ForStatementNode labeled continue handling (Issues #1571 Crashes #3-13)

Issue #1571 Crashes #3-4: Labeled continue in for loops
- Consume labeled continues targeting this loop with proper morphing
- Ensures iterator cleanup and environment unwinding work correctly

Issue #1571 Crashes #5-13: Environment record mismatch in labeled loops
- Proper morphing of labeled continues across allocated block boundaries
- Fixes crashes from scope-creating constructs in labeled loops
- Plain Jump path preserved for non-allocated blocks (zero overhead)

Solution: Call consumeLabelledContinuePositions with morphing enabled
- If no allocated block: plain Jump (fast path)
- If allocated block: JumpComplexCase with proper unwinding (correct path)
- Morphing is automatic via morphJumpPositionIntoComplexCase

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
This commit is contained in:
Seonghyun Kim 2026-06-15 14:05:30 +09:00
commit beee65baec

View file

@ -206,6 +206,12 @@ public:
newContext.consumeContinuePositions(codeBlock, updatePosition, newContext.tryCatchWithBlockStatementCount());
newContext.m_positionToContinue = updatePosition;
// Consume labeled continues targeting THIS loop with proper morphing (Issue #1571)
// This ensures continues inside allocated blocks are properly unwound via JumpComplexCase
if (context->m_currentLoopLabel) {
newContext.consumeLabelledContinuePositions(codeBlock, updatePosition, context->m_currentLoopLabel, newContext.tryCatchWithBlockStatementCount());
}
if (m_iterationLexicalBlockIndex != LEXICAL_BLOCK_INDEX_MAX) {
InterpretedCodeBlock::BlockInfo* bi = codeBlock->m_codeBlock->blockInfo(m_iterationLexicalBlockIndex);
codeBlock->finalizeLexicalBlock(&newContext, iterationBlockContext);