jumptable_type == IS_LONG ? ZEND_SWITCH_LONG : ZEND_SWITCH_STRING,
&expr_node, &jumptable_op);
if (opline->op1_type == IS_CONST) {
- zval_copy_ctor(CT_CONSTANT(opline->op1));
+ Z_TRY_ADDREF_P(CT_CONSTANT(opline->op1));
}
opnum_switch = opline - CG(active_op_array)->opcodes;
}
&expr_node, &cond_node);
SET_NODE(opline->result, &case_node);
if (opline->op1_type == IS_CONST) {
- zval_copy_ctor(CT_CONSTANT(opline->op1));
+ Z_TRY_ADDREF_P(CT_CONSTANT(opline->op1));
}
jmpnz_opnums[i] = zend_emit_cond_jump(ZEND_JMPNZ, &case_node, 0);
if (c->flags & CONST_PERSISTENT) {
ZVAL_COPY_VALUE(result, &c->value);
if (copy) {
- zval_copy_ctor(result);
+ Z_TRY_ADDREF_P(result);
}
} else {
retval = 0;
MAKE_NOP(src);
} else {
zval c;
- ZVAL_DUP(&c, &ZEND_OP1_LITERAL(src));
+ ZVAL_COPY(&c, &ZEND_OP1_LITERAL(src));
if (zend_optimizer_update_op1_const(op_array, opline, &c)) {
zend_optimizer_remove_live_range(op_array, op1.var);
VAR_SOURCE(op1) = NULL;
znode_op op2 = opline->op2;
zval c;
- ZVAL_DUP(&c, &ZEND_OP1_LITERAL(src));
+ ZVAL_COPY(&c, &ZEND_OP1_LITERAL(src));
if (zend_optimizer_update_op2_const(op_array, opline, &c)) {
zend_optimizer_remove_live_range(op_array, op2.var);
VAR_SOURCE(op2) = NULL;
*last_op = *target;
if (last_op->op1_type == IS_CONST) {
zval zv;
- ZVAL_DUP(&zv, &ZEND_OP1_LITERAL(last_op));
+ ZVAL_COPY(&zv, &ZEND_OP1_LITERAL(last_op));
last_op->op1.constant = zend_optimizer_add_literal(op_array, &zv);
}
DEL_SOURCE(block, block->successors[0]);
*last_op = *target;
if (last_op->op1_type == IS_CONST) {
zval zv;
- ZVAL_DUP(&zv, &ZEND_OP1_LITERAL(last_op));
+ ZVAL_COPY(&zv, &ZEND_OP1_LITERAL(last_op));
last_op->op1.constant = zend_optimizer_add_literal(op_array, &zv);
}
DEL_SOURCE(block, block->successors[0]);
if (RETURN_VALUE_USED(opline)) {
zval zv;
- ZVAL_DUP(&zv, RT_CONSTANT(ret_opline, ret_opline->op1));
+ ZVAL_COPY(&zv, RT_CONSTANT(ret_opline, ret_opline->op1));
opline->opcode = ZEND_QM_ASSIGN;
opline->op1_type = IS_CONST;
opline->op1.constant = zend_optimizer_add_literal(op_array, &zv);
static inline int ct_eval_add_array_elem(zval *result, zval *value, zval *key) {
if (!key) {
+ SEPARATE_ARRAY(result);
if ((value = zend_hash_next_index_insert(Z_ARR_P(result), value))) {
Z_TRY_ADDREF_P(value);
return SUCCESS;
switch (Z_TYPE_P(key)) {
case IS_NULL:
+ SEPARATE_ARRAY(result);
value = zend_hash_update(Z_ARR_P(result), ZSTR_EMPTY_ALLOC(), value);
break;
case IS_FALSE:
+ SEPARATE_ARRAY(result);
value = zend_hash_index_update(Z_ARR_P(result), 0, value);
break;
case IS_TRUE:
+ SEPARATE_ARRAY(result);
value = zend_hash_index_update(Z_ARR_P(result), 1, value);
break;
case IS_LONG:
+ SEPARATE_ARRAY(result);
value = zend_hash_index_update(Z_ARR_P(result), Z_LVAL_P(key), value);
break;
case IS_DOUBLE:
+ SEPARATE_ARRAY(result);
value = zend_hash_index_update(
Z_ARR_P(result), zend_dval_to_lval(Z_DVAL_P(key)), value);
break;
case IS_STRING:
+ SEPARATE_ARRAY(result);
value = zend_symtable_update(Z_ARR_P(result), Z_STR_P(key), value);
break;
default:
if (IS_PARTIAL_ARRAY(op1)) {
dup_partial_array(&zv, op1);
} else {
- ZVAL_DUP(&zv, op1);
+ ZVAL_COPY(&zv, op1);
}
if (!op2 && IS_PARTIAL_ARRAY(&zv)) {
if (IS_PARTIAL_ARRAY(op1)) {
dup_partial_array(&zv, op1);
} else {
- ZVAL_DUP(&zv, op1);
+ ZVAL_COPY(&zv, op1);
}
}
ctx->constants = zend_arena_alloc(&ctx->arena, sizeof(HashTable));
zend_hash_init(ctx->constants, 16, NULL, zend_optimizer_zval_dtor_wrapper, 0);
}
- ZVAL_DUP(&val, value);
+ ZVAL_COPY(&val, value);
zend_hash_add(ctx->constants, Z_STR_P(name), &val);
}
zval *val;
if ((val = zend_hash_find(constants, Z_STR_P(name))) != NULL) {
- ZVAL_DUP(value, val);
+ ZVAL_COPY(value, val);
return 1;
}
return 0;
m->op1_type == type &&
m->op1.var == var) {
zval v;
- ZVAL_DUP(&v, val);
+ ZVAL_COPY(&v, val);
if (Z_TYPE(v) == IS_STRING) {
zend_string_hash_val(Z_STR(v));
}
if (m->opcode == ZEND_CASE) {
m->opcode = ZEND_IS_EQUAL;
}
- ZVAL_DUP(&v, val);
+ ZVAL_COPY(&v, val);
if (Z_TYPE(v) == IS_STRING) {
zend_string_hash_val(Z_STR(v));
}