Skip to content

Commit d445bf1

Browse files
committed
Fix missing reference unwrap before gc_possible_root() call in JIT
1 parent cb82014 commit d445bf1

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

ext/opcache/jit/zend_jit_ir.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11510,6 +11510,25 @@ static int zend_jit_bind_global(zend_jit_ctx *jit, const zend_op *opline, uint32
1151011510
ir_END_list(end_inputs);
1151111511
ir_IF_TRUE(if_non_zero);
1151211512

11513+
if (op1_info & (MAY_BE_REF|MAY_BE_GUARD)) {
11514+
ir_ref if_ref, ref_ref, if_collectable;
11515+
11516+
if_ref = jit_if_Z_TYPE(jit, op1_addr, IS_REFERENCE);
11517+
ir_IF_TRUE(if_ref);
11518+
11519+
ref_ref = ir_ADD_OFFSET(ref2, offsetof(zend_reference, val));
11520+
11521+
if_collectable = jit_if_COLLECTABLE_ref(jit, ref_ref);
11522+
ir_IF_FALSE(if_collectable);
11523+
ir_END_list(end_inputs);
11524+
ir_IF_TRUE(if_collectable);
11525+
11526+
ref_ref = jit_Z_PTR_ref(jit, ref_ref);
11527+
11528+
ir_MERGE_WITH_EMPTY_FALSE(if_ref);
11529+
ref2 = ir_PHI_2(IR_ADDR, ref_ref, ref2);
11530+
}
11531+
1151311532
// JIT: GC_ZVAL_CHECK_POSSIBLE_ROOT(variable_ptr)
1151411533
if_may_not_leak = jit_if_GC_MAY_NOT_LEAK(jit, ref2);
1151511534
ir_IF_TRUE(if_may_not_leak);

0 commit comments

Comments
 (0)