Skip to content

Commit 8c9bfa1

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Tracing JIT: Fixed reference counting when escape because of IS_UNDEF element
2 parents d4a7e4d + d7ac39b commit 8c9bfa1

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

ext/opcache/jit/zend_jit_arm64.dasc

+12
Original file line numberDiff line numberDiff line change
@@ -3602,6 +3602,18 @@ static int zend_jit_escape_if_undef_r0(dasm_State **Dst, int var, uint32_t flags
36023602

36033603
ZEND_ASSERT(opline);
36043604

3605+
if ((opline-1)->opcode != ZEND_FETCH_CONSTANT
3606+
&& (opline-1)->opcode != ZEND_FETCH_LIST_R
3607+
&& ((opline-1)->op1_type & (IS_VAR|IS_TMP_VAR))
3608+
&& !(flags & ZEND_JIT_EXIT_FREE_OP1)) {
3609+
val_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, (opline-1)->op1.var);
3610+
3611+
| IF_NOT_ZVAL_REFCOUNTED val_addr, >2, ZREG_TMP1, ZREG_TMP2
3612+
| GET_ZVAL_PTR TMP1, val_addr, TMP2
3613+
| GC_ADDREF TMP1, TMP2w
3614+
|2:
3615+
}
3616+
36053617
| LOAD_IP_ADDR (opline - 1)
36063618
| b ->trace_escape
36073619
|1:

ext/opcache/jit/zend_jit_x86.dasc

+12
Original file line numberDiff line numberDiff line change
@@ -3953,6 +3953,18 @@ static int zend_jit_escape_if_undef_r0(dasm_State **Dst, int var, uint32_t flags
39533953

39543954
ZEND_ASSERT(opline);
39553955

3956+
if ((opline-1)->opcode != ZEND_FETCH_CONSTANT
3957+
&& (opline-1)->opcode != ZEND_FETCH_LIST_R
3958+
&& ((opline-1)->op1_type & (IS_VAR|IS_TMP_VAR))
3959+
&& !(flags & ZEND_JIT_EXIT_FREE_OP1)) {
3960+
val_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, (opline-1)->op1.var);
3961+
3962+
| IF_NOT_ZVAL_REFCOUNTED val_addr, >2
3963+
| GET_ZVAL_PTR r0, val_addr
3964+
| GC_ADDREF r0
3965+
|2:
3966+
}
3967+
39563968
| LOAD_IP_ADDR (opline - 1)
39573969
| jmp ->trace_escape
39583970
|1:

0 commit comments

Comments
 (0)