Skip to content

Fix VM ?: merge blocks and pre/post inc compliance (#137)#1149

Merged
PurHur merged 1 commit into
masterfrom
fix/cfg-merge-ternary-scope
May 23, 2026
Merged

Fix VM ?: merge blocks and pre/post inc compliance (#137)#1149
PurHur merged 1 commit into
masterfrom
fix/cfg-merge-ternary-scope

Conversation

@PurHur
Copy link
Copy Markdown
Owner

@PurHur PurHur commented May 23, 2026

Summary

  • Fix VM execution of CFG merge blocks (?:, branch joins) where sparse scope slot indices were corrupted by variadic Frame construction (empty echo after ternary, broken setcookie() return in expressions).
  • On merge blocks only: assign $frame->scope without reindexing and resolve operands via findSlot on the merge block.
  • Add compliance PHPTs for pre/post increment/decrement and FrameScopeSlotTest.

Test plan

  • tar … | docker run … ./script/ci-fast.sh (22 failures vs 41 on master with same harness tar path; RealWorld 71→1 failure)
  • MiniWebAppVmCliTest, web_setcookie RealWorld case, echo true ? "1" : "0" manual VM check

Closes #137

Made with Cursor

CFG join blocks (ternary, branch merges) use sparse scope slot indices.
Variadic Frame construction reindexed those slots, so echo after ?:
printed empty output and setcookie return values were lost.

Preserve slot indices on merge blocks only; resolve merge operands via
findSlot on the merge block. Add compliance PHPTs for ++/-- and a unit gate.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur PurHur force-pushed the fix/cfg-merge-ternary-scope branch from ae26580 to b0f9ca2 Compare May 23, 2026 18:52
@PurHur PurHur merged commit b127e0d into master May 23, 2026
@PurHur PurHur deleted the fix/cfg-merge-ternary-scope branch May 23, 2026 18:52
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.

Language: Pre/post increment and decrement (++/--)

1 participant