Skip to content

GH-24206: Tracing JIT loses loop-carried CV when its loop PHI is reloaded from memory - #24209

Open
ndossche wants to merge 1 commit into
php:PHP-8.4from
ndossche:fix-24206
Open

ndossche wants to merge 1 commit into
php:PHP-8.4from
ndossche:fix-24206

Conversation

@ndossche

@ndossche ndossche commented Oct 8, 2026

Copy link
Copy Markdown
Member

exit_5: 0040/0038/11 CV0($string):string CV1($startOffset):int(type_only) CV3($strlen):int(r12:1) CV4($charPos):int(type_only) CV5($foundChars):int(type_only) CV6($invalid):bool CV7($i):int(rcx:1) CV8($char):string CV9($size):int(rdx:1) CV10($j):int(type_only)

Inside the JITted loop, $size is in a register.
At the start of each loop iteration, the compiled code doesn't take $size from that register. It reads $size from memory. That's because $size from before the loop isn't a single type ([null, long]) so it cannot be in a register there. But at the end of the loop iteration, right when it backedges, JIT doesn't write this back from register into memory... It's kept type-only.

…eloaded from memory

> exit_5: 0040/0038/11 CV0($string):string CV1($startOffset):int(type_only) CV3($strlen):int(r12:1) CV4($charPos):int(type_only) CV5($foundChars):int(type_only) CV6($invalid):bool CV7($i):int(rcx:1) CV8($char):string CV9($size):int(rdx:1) CV10($j):int(type_only)

Inside the JITted loop, `$size` is in a register.
At the start of each loop iteration, the compiled code doesn't take `$size` from that register. It reads `$size` from memory.
That's because `$size` from before the loop isn't a single type (`[null, long]`) so it cannot be in a register _there_.
But at the _end_ of the loop iteration, right when it backedges, JIT doesn't write this back from register into memory... It's kept type-only.
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.

Tracing JIT with global register allocation corrupts UTF-8 scanning

1 participant