Skip to content

Commit d237989

Browse files
committed
Avoid reference counting when RETURN CV
1 parent 38f9d95 commit d237989

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

ext/opcache/jit/zend_jit_trace.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3455,6 +3455,13 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
34553455
goto jit_failure;
34563456
}
34573457
for (j = 0 ; j < op_array->last_var; j++) {
3458+
if (opline->op1_type == IS_CV
3459+
&& EX_VAR_TO_NUM(opline->op1.var) == j
3460+
&& !(op1_info & MAY_BE_REF)
3461+
&& JIT_G(current_frame)
3462+
&& TRACE_FRAME_IS_RETURN_VALUE_USED(JIT_G(current_frame))) {
3463+
continue;
3464+
}
34583465
// TODO: get info from trace ???
34593466
uint32_t info = zend_ssa_cv_info(opline, op_array, op_array_ssa, j);
34603467
zend_uchar type = STACK_TYPE(stack, j);

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9928,8 +9928,10 @@ static int zend_jit_return(dasm_State **Dst, const zend_op *opline, const zend_o
99289928
op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_R0, 0);
99299929
}
99309930
| ZVAL_COPY_VALUE ret_addr, MAY_BE_ANY, op1_addr, op1_info, ZREG_R0, ZREG_R2
9931-
| // TODO: JIT: if (EXPECTED(!(EX_CALL_INFO() & ZEND_CALL_CODE))) ZVAL_NULL(retval_ptr); ???
9932-
| TRY_ADDREF op1_info, ah, r2
9931+
if (JIT_G(trigger) != ZEND_JIT_ON_HOT_TRACE || (op1_info & MAY_BE_REF) || (return_value_used != 1)) {
9932+
| // TODO: JIT: if (EXPECTED(!(EX_CALL_INFO() & ZEND_CALL_CODE))) ZVAL_NULL(retval_ptr); ???
9933+
| TRY_ADDREF op1_info, ah, r2
9934+
}
99339935
} else {
99349936
if (op1_info & MAY_BE_REF) {
99359937
zend_jit_addr ref_addr = ZEND_ADDR_MEM_ZVAL(ZREG_R0, offsetof(zend_reference, val));

0 commit comments

Comments
 (0)