Skip to content

Commit 15c265b

Browse files
committed
Revert "More accurate reference-counter inference"
This reverts commit b35255a. Temporarily revert this, because it causes a memory leak on the ext/intl/tests/bug72241.phpt test case, because temporary arrays are not handled correctly.
1 parent e45f705 commit 15c265b

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

ext/opcache/Optimizer/zend_inference.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1972,15 +1972,15 @@ uint32_t zend_array_element_type(uint32_t t1, int write, int insert)
19721972
if (tmp & MAY_BE_ARRAY) {
19731973
tmp |= MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
19741974
}
1975-
if (tmp & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
1975+
if (t1 & MAY_BE_ARRAY_OF_REF) {
19761976
if (!write) {
19771977
/* can't be REF because of ZVAL_COPY_DEREF() usage */
1978-
tmp |= MAY_BE_RCN;
1979-
} else if (t1 & MAY_BE_ARRAY_OF_REF) {
1980-
tmp |= MAY_BE_REF | MAY_BE_RC1 | MAY_BE_RCN;
1981-
} else {
19821978
tmp |= MAY_BE_RC1 | MAY_BE_RCN;
1979+
} else {
1980+
tmp |= MAY_BE_REF | MAY_BE_RC1 | MAY_BE_RCN;
19831981
}
1982+
} else if (tmp & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
1983+
tmp |= MAY_BE_RC1 | MAY_BE_RCN;
19841984
}
19851985
}
19861986
if (write) {

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5571,9 +5571,6 @@ static int zend_jit_assign_dim(dasm_State **Dst, const zend_op *opline, const ze
55715571
if (op1_info & (MAY_BE_ARRAY_OF_REF|MAY_BE_OBJECT)) {
55725572
var_info |= MAY_BE_REF;
55735573
}
5574-
if (var_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
5575-
var_info |= MAY_BE_RC1;
5576-
}
55775574
| // value = zend_assign_to_variable(variable_ptr, value, OP_DATA_TYPE);
55785575
if (!zend_jit_assign_to_variable(Dst, opline, op_array, var_addr, var_info, -1, (opline+1)->op1_type, (opline+1)->op1, op3_addr, val_info, res_addr, 0)) {
55795576
return 0;
@@ -5784,9 +5781,6 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, const
57845781
if (op1_info & (MAY_BE_ARRAY_OF_REF|MAY_BE_OBJECT)) {
57855782
var_info |= MAY_BE_REF;
57865783
}
5787-
if (var_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
5788-
var_info |= MAY_BE_RC1;
5789-
}
57905784

57915785
if (!zend_jit_fetch_dimension_address_inner(Dst, opline, BP_VAR_RW, op1_info, op2_info, 8, 8, NULL, NULL)) {
57925786
return 0;
@@ -11138,8 +11132,7 @@ static int zend_jit_fetch_obj(dasm_State **Dst, const zend_op *opline, const zen
1113811132
|9: // END
1113911133
if (opline->op1_type != IS_UNUSED && !use_this && !op1_indirect) {
1114011134
if (opline->op1_type == IS_VAR
11141-
&& opline->opcode == ZEND_FETCH_OBJ_W
11142-
&& (op1_info & MAY_BE_RC1)) {
11135+
&& opline->opcode == ZEND_FETCH_OBJ_W) {
1114311136
zend_jit_addr orig_op1_addr = OP1_ADDR();
1114411137

1114511138
| IF_NOT_ZVAL_REFCOUNTED orig_op1_addr, >1

0 commit comments

Comments
 (0)