[php-src] PR #22764: Fix GH-GH-22763: Clear ZREG_TYPE_ONLY flag for in-register vars in zend_jit_snapshot_handler()
| From: | arnaud-lb | Date: | Thu, 16 Jul 2026 14:08:54 +0000 |
| Subject: | [php-src] PR #22764: Fix GH-GH-22763: Clear ZREG_TYPE_ONLY flag for in-register vars in zend_jit_snapshot_handler() | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-37092@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22764
Author: arnaud-lb
Fixes GH-22763.
The reproducer triggers an assertion in
zend_jit_use_reg() because a var has
jit->ra[var].ref == IR_NULL but jit->ra[var].flags doesn't
contain ZREG_LOAD.
This happens because of the following events:
* An in-register variable is spilled to the VM stack frame by IR (IR_REG_SPILL_SPECIAL)
* zend_jit_snapshot_handler() set the stack descriptor to .flags = ZREG_TYPE_ONLY, .reg = ZREG_NONE
* During a subsequent call to zend_jit_snapshot_handler(), the reg is not IR_REG_SPILL_SPECIAL
anymore, so .reg is set but .flags remains ZREG_TYPE_ONLY which is inconsistent
* A side trace inherits from this stack descriptor
* zend_jit_trace_deoptimization() doesn't set jit->ra[var].ref for this var
because .flags == ZREG_TYPE_ONLY, which causes the assertion failure later
Fix by removing irrelevant flags when setting reg in zend_jit_snapshot_handler().