Skip to content

Commit c1f14b8

Browse files
committed
Fixed reference-counting
1 parent e069032 commit c1f14b8

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10591,15 +10591,11 @@ static int zend_jit_fetch_dim_read(dasm_State **Dst,
1059110591
}
1059210592
}
1059310593

10594-
if (op1_avoid_refcounting) {
10595-
SET_STACK_REG(JIT_G(current_frame)->stack,
10596-
EX_VAR_TO_NUM(opline->op1.var), ZREG_NONE);
10597-
}
10598-
1059910594
if ((res_info & MAY_BE_GUARD)
1060010595
&& JIT_G(current_frame)
1060110596
&& (op1_info & (MAY_BE_ANY|MAY_BE_UNDEF)) == MAY_BE_ARRAY) {
1060210597
uint32_t flags = 0;
10598+
uint32_t old_op1_info = 0;
1060310599
uint32_t old_info;
1060410600
zend_jit_trace_stack *stack = JIT_G(current_frame)->stack;
1060510601
int32_t exit_point;
@@ -10613,6 +10609,7 @@ static int zend_jit_fetch_dim_read(dasm_State **Dst,
1061310609
flags |= ZEND_JIT_EXIT_FREE_OP2;
1061410610
}
1061510611
if ((opline->result_type & (IS_VAR|IS_TMP_VAR))
10612+
&& !(flags & ZEND_JIT_EXIT_FREE_OP1)
1061610613
&& (res_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))
1061710614
&& (ssa_op+1)->op1_use == ssa_op->result_def
1061810615
&& !(op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF) - (MAY_BE_STRING|MAY_BE_LONG)))
@@ -10621,6 +10618,11 @@ static int zend_jit_fetch_dim_read(dasm_State **Dst,
1062110618
ssa->var_info[ssa_op->result_def].avoid_refcounting = 1;
1062210619
}
1062310620

10621+
if (op1_avoid_refcounting) {
10622+
old_op1_info = STACK_INFO(stack, EX_VAR_TO_NUM(opline->op1.var));
10623+
SET_STACK_REG(stack, EX_VAR_TO_NUM(opline->op1.var), ZREG_NONE);
10624+
}
10625+
1062410626
if (!(op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF) - (MAY_BE_STRING|MAY_BE_LONG)))) {
1062510627
old_info = STACK_INFO(stack, EX_VAR_TO_NUM(opline->result.var));
1062610628
SET_STACK_TYPE(stack, EX_VAR_TO_NUM(opline->result.var), IS_UNKNOWN);
@@ -10647,6 +10649,10 @@ static int zend_jit_fetch_dim_read(dasm_State **Dst,
1064710649
return 0;
1064810650
}
1064910651
}
10652+
10653+
if (op1_avoid_refcounting) {
10654+
SET_STACK_INFO(stack, EX_VAR_TO_NUM(opline->op1.var), old_op1_info);
10655+
}
1065010656
}
1065110657

1065210658
if (op1_info & MAY_BE_REF) {
@@ -11647,6 +11653,7 @@ static int zend_jit_fetch_obj(dasm_State **Dst,
1164711653
| LOAD_ZVAL_ADDR r0, prop_addr
1164811654

1164911655
if ((opline->result_type & (IS_VAR|IS_TMP_VAR))
11656+
&& !(flags & ZEND_JIT_EXIT_FREE_OP1)
1165011657
&& (res_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))
1165111658
&& (ssa_op+1)->op1_use == ssa_op->result_def
1165211659
&& zend_jit_may_avoid_refcounting(opline+1)) {

0 commit comments

Comments
 (0)