Skip to content

Fix GH-24471: Tracing JIT reads stale float temporary on side exit - #24484

Open
jorgsowa wants to merge 1 commit into
php:PHP-8.4from
jorgsowa:fix-gh24471
Open

jorgsowa wants to merge 1 commit into
php:PHP-8.4from
jorgsowa:fix-gh24471

Conversation

@jorgsowa

@jorgsowa jorgsowa commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

A CV was bound to its VM slot even when its IR ref came from an earlier opline, e.g. MUL x, 1.0 folded to x, or a CSE'd expression. That ref can also belong to another live var. The snapshot then sees the value spilled to a VM slot and marks that var type_only, but the slot belongs to the CV, so on exit the VM reads a stale value from the var's own slot.

The fix skips the binding when the ref was emitted before the current opline. Only the tracing JIT is affected.

No measurable cost on Symfony Demo or Zend/bench.php: callgrind instructions are within noise and JIT code size is identical.

Fixes GH-24471

Don't bind a CV to its VM slot when its IR ref was emitted by an earlier
opline (e.g. MUL by 1.0 folded to op1, or a CSE'd expression). The ref
may be shared with another live var, whose snapshot entry would then be
wrongly marked type_only.

Fixes phpGH-24471
@jorgsowa
jorgsowa marked this pull request as ready for review October 24, 2026 18:09
@jorgsowa
jorgsowa requested a review from dstogov as a code owner October 24, 2026 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant