Skip to content

Commit f890375

Browse files
committed
Use reference-counting instead of duplication
1 parent db0cd64 commit f890375

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ext/opcache/Optimizer/sccp.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,11 @@ static zend_bool try_replace_op1(
235235
sccp_ctx *ctx, zend_op *opline, zend_ssa_op *ssa_op, int var, zval *value) {
236236
if (ssa_op->op1_use == var && can_replace_op1(ctx->op_array, opline, ssa_op)) {
237237
zval zv;
238-
ZVAL_DUP(&zv, value);
238+
ZVAL_COPY(&zv, value);
239239
if (zend_optimizer_update_op1_const(ctx->op_array, opline, &zv)) {
240240
return 1;
241241
} else {
242-
zval_ptr_dtor(&zv);
242+
zval_ptr_dtor_nogc(&zv);
243243
}
244244
}
245245
return 0;
@@ -249,11 +249,11 @@ static zend_bool try_replace_op2(
249249
sccp_ctx *ctx, zend_op *opline, zend_ssa_op *ssa_op, int var, zval *value) {
250250
if (ssa_op->op2_use == var && can_replace_op2(ctx->op_array, opline, ssa_op)) {
251251
zval zv;
252-
ZVAL_DUP(&zv, value);
252+
ZVAL_COPY(&zv, value);
253253
if (zend_optimizer_update_op2_const(ctx->op_array, opline, &zv)) {
254254
return 1;
255255
} else {
256-
zval_ptr_dtor(&zv);
256+
zval_ptr_dtor_nogc(&zv);
257257
}
258258
}
259259
return 0;

0 commit comments

Comments
 (0)