Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
this fixes the remaining stale
$xissue from the first follow-up in GH-24683.the tracing jit can move a cv-bound copy for a transient assignment before the loop guards. if that copy spills into the cv's vm slot, it overwrites the incoming value before the assignment should actually run. a side exit can then resume with the wrong value.
the change makes
zend_jit_var_supports_reg()reject register allocation for this specific kind of assignment when the previous value is still live and comes from a loop-header phi. the arithmetic can still be optimized, but the assignment itself uses an explicit store that stays after the relevant guards.i added two phpt tests: one with the original B reproducer and another smaller loop-entry case that fails naturally on x86_64.
on my linux x86_64 builds, the smaller case goes from 501 wrong results to 0, and a varied-input test goes from 2335 wrong to 0. the relevant traces still compile and execute.
i also ran five complete jit test configurations across php 8.4 and 8.5, with 2531 passes, 50 skips and no failures.
on the current php-8.4 submission branch, a fresh debug build passed the complete jit directory with 513 passes, 11 skips and no failures. both B phpts also passed separately, and the original, smaller loop and varied-input runs returned 0 wrong with tracing active.
@ChrisOrlando independently tested the patch on an apple m1 using native arm64 builds of php 8.5.12. the original B reproducer went from 252 wrong results to 0, with the same relevant traces compiling before and after. both new phpt tests passed on the patched builds.
there's still one initial trace compilation abort in the original reproducer on my x86_64 setup due to the existing fixed spill-frame limit. the relevant case-2 trace compiles afterward. the reporter also observed the initial abort with and without the patch on arm64.
this is separate from the A+C changes in #24762. B-only fixes the original B case but doesn't replace the CSE correction, and the larger workload tested by the reporter still needs A+C.
refs GH-24683.