[php-src] PR #21368: Fix GH-21267: JIT infinite loop on FETCH_OBJ_R with IS_UNDEF property
| From: | iliaal | Date: | Sat, 07 Mar 2026 00:28:42 +0000 |
| Subject: | [php-src] PR #21368: Fix GH-21267: JIT infinite loop on FETCH_OBJ_R with IS_UNDEF property | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-35115@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/21368
Author: iliaal
Fixes https://github.com/php/php-src/issues/21267
When JIT compiles a side trace for
FETCH_OBJ_R on a known property, the
IS_UNDEF guard was conditionally skipped when a result type guard
(MAY_BE_GUARD) was present and current_frame was set. The assumption was
that deoptimization from the result type guard would handle IS_UNDEF by dispatching to
opline->handler to re-execute in the interpreter.
However, when a side trace is compiled and linked into the parent trace's exit stub, it
replaces opline->handler with the JIT code entry point. When unset()
makes a property IS_UNDEF, the deoptimization path jumps to
opline->handler which now points back to the same JIT code, creating an infinite
loop. The loop never calls zend_jit_trace_exit(), so no exit counters are bumped and no
blacklisting occurs.
The fix removes the conditional skip and always generates the IS_UNDEF guard on hot
traces, ensuring the exit stub is taken when the property is undefined.
Test note: gh21267.phpt overrides opcache.jit_hot_* counters to defaults
because run-tests.php forces them to 1, which changes trace compilation order and prevents the bug
from triggering.