Skip to content

Commit c89217b

Browse files
committed
Properly fix zif_pass handling
1 parent 7107e03 commit c89217b

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

ext/opcache/jit/zend_jit_ir.c

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4493,34 +4493,31 @@ static struct jit_observer_fcall_is_unobserved_data jit_observer_fcall_is_unobse
44934493
ir_END_list(data.ir_end_inputs);
44944494
ir_IF_FALSE(if_trampoline_or_generator);
44954495
}
4496-
if (func && (func->common.fn_flags & ZEND_ACC_CLOSURE) == 0) {
4497-
if (ZEND_MAP_PTR_IS_OFFSET(func->common.run_time_cache)) {
4498-
run_time_cache = ir_LOAD_A(ir_ADD_OFFSET(ir_LOAD_A(jit_CG(map_ptr_base)), (uintptr_t)ZEND_MAP_PTR(func->common.run_time_cache)));
4499-
} else {
4500-
ZEND_ASSERT(rx != IR_UNUSED);
4501-
run_time_cache = ir_LOAD_A(ir_ADD_OFFSET(func_ref ? func_ref : ir_CONST_ADDR(func), offsetof(zend_op_array, run_time_cache__ptr)));
4502-
}
4496+
if (func && (func->common.fn_flags & ZEND_ACC_CLOSURE) == 0 && ZEND_MAP_PTR_IS_OFFSET(func->common.run_time_cache)) {
4497+
run_time_cache = ir_LOAD_A(ir_ADD_OFFSET(ir_LOAD_A(jit_CG(map_ptr_base)), (uintptr_t)ZEND_MAP_PTR(func->common.run_time_cache)));
45034498
} else {
45044499
ZEND_ASSERT(rx != IR_UNUSED);
45054500
// Closures may be duplicated and have a different runtime cache. Use the regular run_time_cache access pattern for these
4506-
run_time_cache = ir_LOAD_A(ir_ADD_OFFSET(ir_LOAD_A(jit_CALL(rx, func)), offsetof(zend_op_array, run_time_cache__ptr)));
4507-
ir_ref if_odd = ir_IF(ir_AND_A(run_time_cache, ir_CONST_ADDR(1)));
4508-
ir_IF_TRUE(if_odd);
4501+
if (func && ZEND_USER_CODE(func->type)) { // not a closure and definitely not an internal function
4502+
run_time_cache = ir_LOAD_A(jit_CALL(rx, run_time_cache));
4503+
} else {
4504+
run_time_cache = ir_LOAD_A(ir_ADD_OFFSET(ir_LOAD_A(jit_CALL(rx, func)), offsetof(zend_op_array, run_time_cache__ptr)));
4505+
ir_ref if_odd = ir_IF(ir_AND_A(run_time_cache, ir_CONST_ADDR(1)));
4506+
ir_IF_TRUE(if_odd);
45094507

4510-
ir_ref run_time_cache2 = ir_LOAD_A(ir_ADD_A(run_time_cache, ir_LOAD_A(jit_CG(map_ptr_base))));
4508+
ir_ref run_time_cache2 = ir_LOAD_A(ir_ADD_A(run_time_cache, ir_LOAD_A(jit_CG(map_ptr_base))));
45114509

4512-
ir_ref if_odd_end = ir_END();
4513-
ir_IF_FALSE(if_odd);
4510+
ir_ref if_odd_end = ir_END();
4511+
ir_IF_FALSE(if_odd);
45144512

4515-
if (!func) { // not a closure
45164513
ir_ref if_rt_cache = ir_IF(ir_EQ(run_time_cache, IR_NULL));
45174514
ir_IF_TRUE(if_rt_cache);
45184515
ir_END_list(data.ir_end_inputs);
45194516
ir_IF_FALSE(if_rt_cache);
4520-
}
45214517

4522-
ir_MERGE_WITH(if_odd_end);
4523-
run_time_cache = ir_PHI_2(IR_ADDR, run_time_cache2, run_time_cache);
4518+
ir_MERGE_WITH(if_odd_end);
4519+
run_time_cache = ir_PHI_2(IR_ADDR, run_time_cache, run_time_cache2);
4520+
}
45244521
}
45254522
*observer_handler = ir_ADD_OFFSET(run_time_cache, zend_observer_fcall_op_array_extension * sizeof(void *));
45264523

0 commit comments

Comments
 (0)