Skip to content

Commit 89b82ef

Browse files
authored
Fix GH-16996: 8.4 tracing JIT phpseclib failures (#17030)
* Fix GH-16996: 8.4 tracing JIT phpseclib failures This prevents conflicts caused by spilling to bound PHP stack slots by creating copies. * Fix build
1 parent c5ce74c commit 89b82ef

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

ext/opcache/jit/zend_jit_ir.c

+10-2
Original file line numberDiff line numberDiff line change
@@ -1332,8 +1332,16 @@ static void zend_jit_def_reg(zend_jit_ctx *jit, zend_jit_addr addr, ir_ref val)
13321332
ZEND_ASSERT(jit->ra && jit->ra[var].ref == IR_NULL);
13331333

13341334
/* Negative "var" has special meaning for IR */
1335-
if (val > 0 && !zend_jit_spilling_may_cause_conflict(jit, var, val)) {
1336-
val = ir_bind(&jit->ctx, -EX_NUM_TO_VAR(jit->ssa->vars[var].var), val);
1335+
if (val > 0) {
1336+
if (jit->ctx.binding) {
1337+
ir_ref old = ir_binding_find(&jit->ctx, val);
1338+
if (old && old != -EX_NUM_TO_VAR(jit->ssa->vars[var].var)) {
1339+
val = ir_emit2(&jit->ctx, IR_OPT(IR_COPY, jit->ctx.ir_base[val].type), val, 1);
1340+
}
1341+
}
1342+
if (!zend_jit_spilling_may_cause_conflict(jit, var, val)) {
1343+
val = ir_bind(&jit->ctx, -EX_NUM_TO_VAR(jit->ssa->vars[var].var), val);
1344+
}
13371345
}
13381346
jit->ra[var].ref = val;
13391347

0 commit comments

Comments
 (0)