[php-src] PR #24699: Fix GH-24438: Preserve indirect types in JIT side traces
| From: | aasul | Date: | Sun, 25 Oct 2026 18:52:57 +0000 |
| Subject: | [php-src] PR #24699: Fix GH-24438: Preserve indirect types in JIT side traces | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-39875@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/24699
Author: aasul
Fixes #24438
the tracing jit can enter a side trace at
SEND_FUNC_ARG after a
FETCH_DIM_FUNC_ARG has already executed in the parent trace.
when regular ssa information isn't available, zend_jit_trace_build_tssa()
initializes live-in temporaries with a fallback type mask that doesn't include
MAY_BE_INDIRECT. this can leave an indirect operand without the corresponding type
information.
zend_jit_send_ref() relies on that bit to emit the conditional indirect dereference.
without it, the jit can handle the temporary incorrectly when a dynamic call switches between
by-value and by-reference arguments.
the fix adds MAY_BE_INDIRECT to the temporary fallback mask. it also adds a phpt
regression test that alternates between by-value and by-reference calls and verifies that the
correct array elements are updated.
i tested the change on php 8.5.13-dev using linux x86_64 debug nts builds from the same source
revision. the original implementation fails the regression test with an assertion in
zval_get_long_func(), while the patched version passes with the expected values.
the full ext/opcache/tests/jit/ suite completed with 515 passes, no failures and 10
skips due to missing extensions or platform requirements.
i also verified that the original reproducer produces the same warnings as the interpreter after the
fix. additional checks involving existing references, array aliasing and copy-on-write behavior
matched interpreter results.
the original issue reproduces on php 8.4.28-dev as well. the patch was developed and validated on
php 8.5; php 8.4 patch validation is not yet included in these results.
release, zts and other architectures haven't been tested locally.