Skip to content

Commit

Permalink
Revert "More accurate reference-counter inference"
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nikic committed Jul 7, 2020
1 parent e45f705 commit 15c265b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
10 changes: 5 additions & 5 deletions ext/opcache/Optimizer/zend_inference.c
Original file line number Diff line number Diff line change
Expand Up @@ -1972,15 +1972,15 @@ uint32_t zend_array_element_type(uint32_t t1, int write, int insert)
if (tmp & MAY_BE_ARRAY) {
tmp |= MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
}
if (tmp & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
if (t1 & MAY_BE_ARRAY_OF_REF) {
if (!write) {
/* can't be REF because of ZVAL_COPY_DEREF() usage */
tmp |= MAY_BE_RCN;
} else if (t1 & MAY_BE_ARRAY_OF_REF) {
tmp |= MAY_BE_REF | MAY_BE_RC1 | MAY_BE_RCN;
} else {
tmp |= MAY_BE_RC1 | MAY_BE_RCN;
} else {
tmp |= MAY_BE_REF | MAY_BE_RC1 | MAY_BE_RCN;
}
} else if (tmp & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
tmp |= MAY_BE_RC1 | MAY_BE_RCN;
}
}
if (write) {
Expand Down
9 changes: 1 addition & 8 deletions ext/opcache/jit/zend_jit_x86.dasc
Original file line number Diff line number Diff line change
Expand Up @@ -5571,9 +5571,6 @@ static int zend_jit_assign_dim(dasm_State **Dst, const zend_op *opline, const ze
if (op1_info & (MAY_BE_ARRAY_OF_REF|MAY_BE_OBJECT)) {
var_info |= MAY_BE_REF;
}
if (var_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
var_info |= MAY_BE_RC1;
}
| // value = zend_assign_to_variable(variable_ptr, value, OP_DATA_TYPE);
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)) {
return 0;
Expand Down Expand Up @@ -5784,9 +5781,6 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, const
if (op1_info & (MAY_BE_ARRAY_OF_REF|MAY_BE_OBJECT)) {
var_info |= MAY_BE_REF;
}
if (var_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
var_info |= MAY_BE_RC1;
}

if (!zend_jit_fetch_dimension_address_inner(Dst, opline, BP_VAR_RW, op1_info, op2_info, 8, 8, NULL, NULL)) {
return 0;
Expand Down Expand Up @@ -11138,8 +11132,7 @@ static int zend_jit_fetch_obj(dasm_State **Dst, const zend_op *opline, const zen
|9: // END
if (opline->op1_type != IS_UNUSED && !use_this && !op1_indirect) {
if (opline->op1_type == IS_VAR
&& opline->opcode == ZEND_FETCH_OBJ_W
&& (op1_info & MAY_BE_RC1)) {
&& opline->opcode == ZEND_FETCH_OBJ_W) {
zend_jit_addr orig_op1_addr = OP1_ADDR();

| IF_NOT_ZVAL_REFCOUNTED orig_op1_addr, >1
Expand Down

0 comments on commit 15c265b

Please sign in to comment.