mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Refactor zval cleanup into single function
Also use zval_ptr_dtor_nogc() everywhere in Zend in favor of zval_dtor()
This commit is contained in:
parent
59f35c0ca9
commit
bac6fdb0c5
21 changed files with 484 additions and 534 deletions
|
@ -463,7 +463,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_str_weak(zval *arg, zend_string **dest
|
|||
|
||||
Z_ADDREF_P(z);
|
||||
if (Z_TYPE_P(z) != IS_OBJECT) {
|
||||
zval_dtor(arg);
|
||||
zval_ptr_dtor_nogc(arg);
|
||||
ZVAL_NULL(arg);
|
||||
if (!zend_make_printable_zval(z, arg)) {
|
||||
ZVAL_COPY_VALUE(arg, z);
|
||||
|
@ -3386,7 +3386,7 @@ ZEND_API zend_bool zend_make_callable(zval *callable, zend_string **callable_nam
|
|||
|
||||
if (zend_is_callable_ex(callable, NULL, IS_CALLABLE_STRICT, callable_name, &fcc, NULL)) {
|
||||
if (Z_TYPE_P(callable) == IS_STRING && fcc.calling_scope) {
|
||||
zval_dtor(callable);
|
||||
zval_ptr_dtor_nogc(callable);
|
||||
array_init(callable);
|
||||
add_next_index_str(callable, zend_string_copy(fcc.calling_scope->name));
|
||||
add_next_index_str(callable, zend_string_copy(fcc.function_handler->common.function_name));
|
||||
|
@ -3951,7 +3951,7 @@ ZEND_API int zend_update_static_property(zend_class_entry *scope, const char *na
|
|||
} else {
|
||||
if (property != value) {
|
||||
if (Z_ISREF_P(property)) {
|
||||
zval_dtor(property);
|
||||
zval_ptr_dtor_nogc(property);
|
||||
ZVAL_COPY_VALUE(property, value);
|
||||
if (Z_REFCOUNTED_P(value) && Z_REFCOUNT_P(value) > 0) {
|
||||
zval_opt_copy_ctor(property);
|
||||
|
|
|
@ -185,7 +185,7 @@ static int zend_ast_add_array_element(zval *result, zval *offset, zval *expr)
|
|||
break;
|
||||
case IS_STRING:
|
||||
zend_symtable_update(Z_ARRVAL_P(result), Z_STR_P(offset), expr);
|
||||
zval_dtor(offset);
|
||||
zval_ptr_dtor_nogc(offset);
|
||||
break;
|
||||
case IS_NULL:
|
||||
zend_symtable_update(Z_ARRVAL_P(result), ZSTR_EMPTY_ALLOC(), expr);
|
||||
|
@ -219,13 +219,13 @@ ZEND_API int zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *sc
|
|||
if (UNEXPECTED(zend_ast_evaluate(&op1, ast->child[0], scope) != SUCCESS)) {
|
||||
ret = FAILURE;
|
||||
} else if (UNEXPECTED(zend_ast_evaluate(&op2, ast->child[1], scope) != SUCCESS)) {
|
||||
zval_dtor(&op1);
|
||||
zval_ptr_dtor_nogc(&op1);
|
||||
ret = FAILURE;
|
||||
} else {
|
||||
binary_op_type op = get_binary_op(ast->attr);
|
||||
ret = op(result, &op1, &op2);
|
||||
zval_dtor(&op1);
|
||||
zval_dtor(&op2);
|
||||
zval_ptr_dtor_nogc(&op1);
|
||||
zval_ptr_dtor_nogc(&op2);
|
||||
}
|
||||
break;
|
||||
case ZEND_AST_GREATER:
|
||||
|
@ -233,15 +233,15 @@ ZEND_API int zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *sc
|
|||
if (UNEXPECTED(zend_ast_evaluate(&op1, ast->child[0], scope) != SUCCESS)) {
|
||||
ret = FAILURE;
|
||||
} else if (UNEXPECTED(zend_ast_evaluate(&op2, ast->child[1], scope) != SUCCESS)) {
|
||||
zval_dtor(&op1);
|
||||
zval_ptr_dtor_nogc(&op1);
|
||||
ret = FAILURE;
|
||||
} else {
|
||||
/* op1 > op2 is the same as op2 < op1 */
|
||||
binary_op_type op = ast->kind == ZEND_AST_GREATER
|
||||
? is_smaller_function : is_smaller_or_equal_function;
|
||||
ret = op(result, &op2, &op1);
|
||||
zval_dtor(&op1);
|
||||
zval_dtor(&op2);
|
||||
zval_ptr_dtor_nogc(&op1);
|
||||
zval_ptr_dtor_nogc(&op2);
|
||||
}
|
||||
break;
|
||||
case ZEND_AST_UNARY_OP:
|
||||
|
@ -250,7 +250,7 @@ ZEND_API int zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *sc
|
|||
} else {
|
||||
unary_op_type op = get_unary_op(ast->attr);
|
||||
ret = op(result, &op1);
|
||||
zval_dtor(&op1);
|
||||
zval_ptr_dtor_nogc(&op1);
|
||||
}
|
||||
break;
|
||||
case ZEND_AST_ZVAL:
|
||||
|
@ -283,16 +283,16 @@ ZEND_API int zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *sc
|
|||
}
|
||||
if (zend_is_true(&op1)) {
|
||||
if (UNEXPECTED(zend_ast_evaluate(&op2, ast->child[1], scope) != SUCCESS)) {
|
||||
zval_dtor(&op1);
|
||||
zval_ptr_dtor_nogc(&op1);
|
||||
ret = FAILURE;
|
||||
break;
|
||||
}
|
||||
ZVAL_BOOL(result, zend_is_true(&op2));
|
||||
zval_dtor(&op2);
|
||||
zval_ptr_dtor_nogc(&op2);
|
||||
} else {
|
||||
ZVAL_FALSE(result);
|
||||
}
|
||||
zval_dtor(&op1);
|
||||
zval_ptr_dtor_nogc(&op1);
|
||||
break;
|
||||
case ZEND_AST_OR:
|
||||
if (UNEXPECTED(zend_ast_evaluate(&op1, ast->child[0], scope) != SUCCESS)) {
|
||||
|
@ -303,14 +303,14 @@ ZEND_API int zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *sc
|
|||
ZVAL_TRUE(result);
|
||||
} else {
|
||||
if (UNEXPECTED(zend_ast_evaluate(&op2, ast->child[1], scope) != SUCCESS)) {
|
||||
zval_dtor(&op1);
|
||||
zval_ptr_dtor_nogc(&op1);
|
||||
ret = FAILURE;
|
||||
break;
|
||||
}
|
||||
ZVAL_BOOL(result, zend_is_true(&op2));
|
||||
zval_dtor(&op2);
|
||||
zval_ptr_dtor_nogc(&op2);
|
||||
}
|
||||
zval_dtor(&op1);
|
||||
zval_ptr_dtor_nogc(&op1);
|
||||
break;
|
||||
case ZEND_AST_CONDITIONAL:
|
||||
if (UNEXPECTED(zend_ast_evaluate(&op1, ast->child[0], scope) != SUCCESS)) {
|
||||
|
@ -322,19 +322,19 @@ ZEND_API int zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *sc
|
|||
*result = op1;
|
||||
} else {
|
||||
if (UNEXPECTED(zend_ast_evaluate(result, ast->child[1], scope) != SUCCESS)) {
|
||||
zval_dtor(&op1);
|
||||
zval_ptr_dtor_nogc(&op1);
|
||||
ret = FAILURE;
|
||||
break;
|
||||
}
|
||||
zval_dtor(&op1);
|
||||
zval_ptr_dtor_nogc(&op1);
|
||||
}
|
||||
} else {
|
||||
if (UNEXPECTED(zend_ast_evaluate(result, ast->child[2], scope) != SUCCESS)) {
|
||||
zval_dtor(&op1);
|
||||
zval_ptr_dtor_nogc(&op1);
|
||||
ret = FAILURE;
|
||||
break;
|
||||
}
|
||||
zval_dtor(&op1);
|
||||
zval_ptr_dtor_nogc(&op1);
|
||||
}
|
||||
break;
|
||||
case ZEND_AST_COALESCE:
|
||||
|
@ -346,11 +346,11 @@ ZEND_API int zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *sc
|
|||
*result = op1;
|
||||
} else {
|
||||
if (UNEXPECTED(zend_ast_evaluate(result, ast->child[1], scope) != SUCCESS)) {
|
||||
zval_dtor(&op1);
|
||||
zval_ptr_dtor_nogc(&op1);
|
||||
ret = FAILURE;
|
||||
break;
|
||||
}
|
||||
zval_dtor(&op1);
|
||||
zval_ptr_dtor_nogc(&op1);
|
||||
}
|
||||
break;
|
||||
case ZEND_AST_UNARY_PLUS:
|
||||
|
@ -359,7 +359,7 @@ ZEND_API int zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *sc
|
|||
} else {
|
||||
ZVAL_LONG(&op1, 0);
|
||||
ret = add_function(result, &op1, &op2);
|
||||
zval_dtor(&op2);
|
||||
zval_ptr_dtor_nogc(&op2);
|
||||
}
|
||||
break;
|
||||
case ZEND_AST_UNARY_MINUS:
|
||||
|
@ -368,7 +368,7 @@ ZEND_API int zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *sc
|
|||
} else {
|
||||
ZVAL_LONG(&op1, 0);
|
||||
ret = sub_function(result, &op1, &op2);
|
||||
zval_dtor(&op2);
|
||||
zval_ptr_dtor_nogc(&op2);
|
||||
}
|
||||
break;
|
||||
case ZEND_AST_ARRAY:
|
||||
|
@ -380,21 +380,21 @@ ZEND_API int zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *sc
|
|||
zend_ast *elem = list->child[i];
|
||||
if (elem->child[1]) {
|
||||
if (UNEXPECTED(zend_ast_evaluate(&op1, elem->child[1], scope) != SUCCESS)) {
|
||||
zval_dtor(result);
|
||||
zval_ptr_dtor_nogc(result);
|
||||
return FAILURE;
|
||||
}
|
||||
} else {
|
||||
ZVAL_UNDEF(&op1);
|
||||
}
|
||||
if (UNEXPECTED(zend_ast_evaluate(&op2, elem->child[0], scope) != SUCCESS)) {
|
||||
zval_dtor(&op1);
|
||||
zval_dtor(result);
|
||||
zval_ptr_dtor_nogc(&op1);
|
||||
zval_ptr_dtor_nogc(result);
|
||||
return FAILURE;
|
||||
}
|
||||
if (UNEXPECTED(zend_ast_add_array_element(result, &op1, &op2) != SUCCESS)) {
|
||||
zval_dtor(&op1);
|
||||
zval_dtor(&op2);
|
||||
zval_dtor(result);
|
||||
zval_ptr_dtor_nogc(&op1);
|
||||
zval_ptr_dtor_nogc(&op2);
|
||||
zval_ptr_dtor_nogc(result);
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -408,7 +408,7 @@ ZEND_API int zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *sc
|
|||
if (UNEXPECTED(zend_ast_evaluate(&op1, ast->child[0], scope) != SUCCESS)) {
|
||||
ret = FAILURE;
|
||||
} else if (UNEXPECTED(zend_ast_evaluate(&op2, ast->child[1], scope) != SUCCESS)) {
|
||||
zval_dtor(&op1);
|
||||
zval_ptr_dtor_nogc(&op1);
|
||||
ret = FAILURE;
|
||||
} else {
|
||||
zval tmp;
|
||||
|
@ -425,8 +425,8 @@ ZEND_API int zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *sc
|
|||
ZVAL_DUP(result, &tmp);
|
||||
}
|
||||
zval_ptr_dtor(&tmp);
|
||||
zval_dtor(&op1);
|
||||
zval_dtor(&op2);
|
||||
zval_ptr_dtor_nogc(&op1);
|
||||
zval_ptr_dtor_nogc(&op2);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -427,7 +427,7 @@ static int lookup_cv(zend_op_array *op_array, zend_string* name) /* {{{ */{
|
|||
|
||||
void zend_del_literal(zend_op_array *op_array, int n) /* {{{ */
|
||||
{
|
||||
zval_dtor(CT_CONSTANT_EX(op_array, n));
|
||||
zval_ptr_dtor_nogc(CT_CONSTANT_EX(op_array, n));
|
||||
if (n + 1 == op_array->last_literal) {
|
||||
op_array->last_literal--;
|
||||
} else {
|
||||
|
@ -3276,7 +3276,7 @@ int zend_compile_func_strlen(znode *result, zend_ast_list *args) /* {{{ */
|
|||
if (arg_node.op_type == IS_CONST && Z_TYPE(arg_node.u.constant) == IS_STRING) {
|
||||
result->op_type = IS_CONST;
|
||||
ZVAL_LONG(&result->u.constant, Z_STRLEN(arg_node.u.constant));
|
||||
zval_dtor(&arg_node.u.constant);
|
||||
zval_ptr_dtor_nogc(&arg_node.u.constant);
|
||||
} else {
|
||||
zend_emit_op_tmp(result, ZEND_STRLEN, &arg_node, NULL);
|
||||
}
|
||||
|
@ -4147,7 +4147,7 @@ void zend_resolve_goto_label(zend_op_array *op_array, zend_op *opline) /* {{{ */
|
|||
zend_error_noreturn(E_COMPILE_ERROR, "'goto' to undefined label '%s'", Z_STRVAL_P(label));
|
||||
}
|
||||
|
||||
zval_dtor(label);
|
||||
zval_ptr_dtor_nogc(label);
|
||||
ZVAL_NULL(label);
|
||||
|
||||
current = opline->extended_value;
|
||||
|
@ -4535,7 +4535,7 @@ void zend_compile_switch(zend_ast *ast) /* {{{ */
|
|||
SET_NODE(opline->op1, &expr_node);
|
||||
SET_UNUSED(opline->op2);
|
||||
} else if (expr_node.op_type == IS_CONST) {
|
||||
zval_dtor(&expr_node.u.constant);
|
||||
zval_ptr_dtor_nogc(&expr_node.u.constant);
|
||||
}
|
||||
|
||||
efree(jmpnz_opnums);
|
||||
|
@ -4779,7 +4779,7 @@ void zend_compile_declare(zend_ast *ast) /* {{{ */
|
|||
zval value_zv;
|
||||
zend_const_expr_to_zval(&value_zv, value_ast);
|
||||
FC(declarables).ticks = zval_get_long(&value_zv);
|
||||
zval_dtor(&value_zv);
|
||||
zval_ptr_dtor_nogc(&value_zv);
|
||||
} else if (zend_string_equals_literal_ci(name, "encoding")) {
|
||||
|
||||
if (FAILURE == zend_declare_is_first_statement(ast)) {
|
||||
|
|
|
@ -516,7 +516,7 @@ ZEND_API int zend_register_constant(zend_constant *c)
|
|||
zend_error(E_NOTICE,"Constant %s already defined", ZSTR_VAL(name));
|
||||
zend_string_release(c->name);
|
||||
if (!(c->flags & CONST_PERSISTENT)) {
|
||||
zval_dtor(&c->value);
|
||||
zval_ptr_dtor_nogc(&c->value);
|
||||
}
|
||||
ret = FAILURE;
|
||||
}
|
||||
|
|
|
@ -2091,7 +2091,7 @@ static zend_always_inline void i_free_compiled_variables(zend_execute_data *exec
|
|||
if (!Z_DELREF_P(cv)) {
|
||||
zend_refcounted *r = Z_COUNTED_P(cv);
|
||||
ZVAL_NULL(cv);
|
||||
zval_dtor_func_for_ptr(r);
|
||||
zval_dtor_func(r);
|
||||
} else {
|
||||
GC_ZVAL_CHECK_POSSIBLE_ROOT(cv);
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval
|
|||
Z_ADDREF_P(variable_ptr);
|
||||
}
|
||||
}
|
||||
zval_dtor_func_for_ptr(garbage);
|
||||
zval_dtor_func(garbage);
|
||||
return variable_ptr;
|
||||
} else { /* we need to split */
|
||||
/* optimized version of GC_ZVAL_CHECK_POSSIBLE_ROOT(variable_ptr) */
|
||||
|
@ -220,7 +220,7 @@ static zend_always_inline void zend_vm_stack_free_extra_args_ex(uint32_t call_in
|
|||
if (!Z_DELREF_P(p)) {
|
||||
zend_refcounted *r = Z_COUNTED_P(p);
|
||||
ZVAL_NULL(p);
|
||||
zval_dtor_func_for_ptr(r);
|
||||
zval_dtor_func(r);
|
||||
} else {
|
||||
GC_ZVAL_CHECK_POSSIBLE_ROOT(p);
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ static zend_always_inline void zend_vm_stack_free_args(zend_execute_data *call)
|
|||
if (!Z_DELREF_P(p)) {
|
||||
zend_refcounted *r = Z_COUNTED_P(p);
|
||||
ZVAL_NULL(p);
|
||||
zval_dtor_func_for_ptr(r);
|
||||
zval_dtor_func(r);
|
||||
}
|
||||
}
|
||||
} while (p != end);
|
||||
|
|
|
@ -1017,7 +1017,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k
|
|||
zend_exception_restore();
|
||||
|
||||
zval_ptr_dtor(&args[0]);
|
||||
zval_dtor(&fcall_info.function_name);
|
||||
zval_ptr_dtor_nogc(&fcall_info.function_name);
|
||||
|
||||
zend_hash_del(EG(in_autoload), lc_name);
|
||||
|
||||
|
@ -1127,7 +1127,7 @@ ZEND_API int zend_eval_stringl(char *str, size_t str_len, zval *retval_ptr, char
|
|||
} else {
|
||||
retval = FAILURE;
|
||||
}
|
||||
zval_dtor(&pv);
|
||||
zval_ptr_dtor_nogc(&pv);
|
||||
return retval;
|
||||
}
|
||||
/* }}} */
|
||||
|
|
|
@ -243,7 +243,7 @@ ZEND_API void ZEND_FASTCALL gc_possible_root(zend_refcounted *ref)
|
|||
gc_collect_cycles();
|
||||
GC_REFCOUNT(ref)--;
|
||||
if (UNEXPECTED(GC_REFCOUNT(ref)) == 0) {
|
||||
zval_dtor_func_for_ptr(ref);
|
||||
zval_dtor_func(ref);
|
||||
return;
|
||||
}
|
||||
if (UNEXPECTED(GC_INFO(ref))) {
|
||||
|
|
|
@ -660,7 +660,7 @@ static void do_inherit_property(zend_property_info *parent_info, zend_string *ke
|
|||
int parent_num = OBJ_PROP_TO_NUM(parent_info->offset);
|
||||
int child_num = OBJ_PROP_TO_NUM(child_info->offset);
|
||||
|
||||
/* Don't keep default properties in GC (thry may be freed by opcache) */
|
||||
/* Don't keep default properties in GC (they may be freed by opcache) */
|
||||
zval_ptr_dtor_nogc(&(ce->default_properties_table[parent_num]));
|
||||
ce->default_properties_table[parent_num] = ce->default_properties_table[child_num];
|
||||
ZVAL_UNDEF(&ce->default_properties_table[child_num]);
|
||||
|
|
|
@ -313,7 +313,7 @@ statement:
|
|||
if (Z_TYPE($2) == IS_STRING) {
|
||||
zend_string_release(Z_STR($2));
|
||||
} else {
|
||||
zval_dtor(&$2);
|
||||
zval_ptr_dtor_nogc(&$2);
|
||||
}
|
||||
zval_ptr_dtor(&$5);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -667,7 +667,7 @@ zend_op_array *compile_filename(int type, zval *filename)
|
|||
zend_destroy_file_handle(&file_handle);
|
||||
|
||||
if (filename==&tmp) {
|
||||
zval_dtor(&tmp);
|
||||
zval_ptr_dtor_nogc(&tmp);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
@ -761,7 +761,7 @@ zend_op_array *compile_string(zval *source_string, char *filename)
|
|||
}
|
||||
|
||||
zend_restore_lexical_state(&original_lex_state);
|
||||
zval_dtor(&tmp);
|
||||
zval_ptr_dtor_nogc(&tmp);
|
||||
|
||||
return op_array;
|
||||
}
|
||||
|
@ -812,7 +812,7 @@ int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_
|
|||
SCNG(script_filtered) = NULL;
|
||||
}
|
||||
zend_restore_lexical_state(&original_lex_state);
|
||||
zval_dtor(str);
|
||||
zval_ptr_dtor_nogc(str);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Generated by re2c 0.15.3 */
|
||||
/* Generated by re2c 0.14.3 */
|
||||
#line 3 "Zend/zend_language_scanner_defs.h"
|
||||
|
||||
enum YYCONDTYPE {
|
||||
|
|
|
@ -1680,7 +1680,7 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty
|
|||
ce = Z_OBJCE_P(readobj);
|
||||
zend_error(E_NOTICE, "Object of class %s could not be converted to int", ZSTR_VAL(ce->name));
|
||||
if (readobj == writeobj) {
|
||||
zval_dtor(readobj);
|
||||
zval_ptr_dtor_nogc(readobj);
|
||||
}
|
||||
ZVAL_LONG(writeobj, 1);
|
||||
return SUCCESS;
|
||||
|
@ -1688,7 +1688,7 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty
|
|||
ce = Z_OBJCE_P(readobj);
|
||||
zend_error(E_NOTICE, "Object of class %s could not be converted to float", ZSTR_VAL(ce->name));
|
||||
if (readobj == writeobj) {
|
||||
zval_dtor(readobj);
|
||||
zval_ptr_dtor_nogc(readobj);
|
||||
}
|
||||
ZVAL_DOUBLE(writeobj, 1);
|
||||
return SUCCESS;
|
||||
|
|
|
@ -332,7 +332,7 @@ try_again:
|
|||
zval dst;
|
||||
|
||||
convert_object_to_type(op, &dst, IS_LONG, convert_to_long);
|
||||
zval_dtor(op);
|
||||
zval_ptr_dtor_nogc(op);
|
||||
|
||||
if (Z_TYPE(dst) == IS_LONG) {
|
||||
ZVAL_COPY_VALUE(op, &dst);
|
||||
|
@ -392,7 +392,7 @@ try_again:
|
|||
zval dst;
|
||||
|
||||
convert_object_to_type(op, &dst, IS_DOUBLE, convert_to_double);
|
||||
zval_dtor(op);
|
||||
zval_ptr_dtor_nogc(op);
|
||||
|
||||
if (Z_TYPE(dst) == IS_DOUBLE) {
|
||||
ZVAL_COPY_VALUE(op, &dst);
|
||||
|
@ -417,7 +417,7 @@ ZEND_API void ZEND_FASTCALL convert_to_null(zval *op) /* {{{ */
|
|||
|
||||
ZVAL_COPY_VALUE(&org, op);
|
||||
if (Z_OBJ_HT_P(op)->cast_object(&org, op, IS_NULL) == SUCCESS) {
|
||||
zval_dtor(&org);
|
||||
zval_ptr_dtor_nogc(&org);
|
||||
return;
|
||||
}
|
||||
ZVAL_COPY_VALUE(op, &org);
|
||||
|
@ -477,7 +477,7 @@ try_again:
|
|||
zval dst;
|
||||
|
||||
convert_object_to_type(op, &dst, _IS_BOOL, convert_to_boolean);
|
||||
zval_dtor(op);
|
||||
zval_ptr_dtor_nogc(op);
|
||||
|
||||
if (Z_TYPE(dst) == IS_FALSE || Z_TYPE(dst) == IS_TRUE) {
|
||||
ZVAL_COPY_VALUE(op, &dst);
|
||||
|
@ -556,7 +556,7 @@ try_again:
|
|||
zval dst;
|
||||
|
||||
convert_object_to_type(op, &dst, IS_STRING, convert_to_string);
|
||||
zval_dtor(op);
|
||||
zval_ptr_dtor_nogc(op);
|
||||
|
||||
if (Z_TYPE(dst) == IS_STRING) {
|
||||
ZVAL_COPY_VALUE(op, &dst);
|
||||
|
@ -613,11 +613,11 @@ try_again:
|
|||
} else {
|
||||
arr = zend_array_dup(obj_ht);
|
||||
}
|
||||
zval_dtor(op);
|
||||
zval_ptr_dtor_nogc(op);
|
||||
ZVAL_ARR(op, arr);
|
||||
} else {
|
||||
arr = zend_array_dup(obj_ht);
|
||||
zval_dtor(op);
|
||||
zval_ptr_dtor_nogc(op);
|
||||
ZVAL_ARR(op, arr);
|
||||
}
|
||||
return;
|
||||
|
@ -627,13 +627,13 @@ try_again:
|
|||
convert_object_to_type(op, &dst, IS_ARRAY, convert_to_array);
|
||||
|
||||
if (Z_TYPE(dst) == IS_ARRAY) {
|
||||
zval_dtor(op);
|
||||
zval_ptr_dtor_nogc(op);
|
||||
ZVAL_COPY_VALUE(op, &dst);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
zval_dtor(op);
|
||||
zval_ptr_dtor_nogc(op);
|
||||
array_init(op);
|
||||
}
|
||||
break;
|
||||
|
@ -1224,7 +1224,7 @@ ZEND_API int ZEND_FASTCALL mod_function(zval *result, zval *op1, zval *op2) /* {
|
|||
convert_op1_op2_long(op1, op1_lval, op2, op2_lval, ZEND_MOD, mod_function);
|
||||
|
||||
if (op1 == result) {
|
||||
zval_dtor(result);
|
||||
zval_ptr_dtor_nogc(result);
|
||||
}
|
||||
|
||||
if (op2_lval == 0) {
|
||||
|
@ -1425,7 +1425,7 @@ ZEND_API int ZEND_FASTCALL bitwise_or_function(zval *result, zval *op1, zval *op
|
|||
}
|
||||
|
||||
if (op1 == result) {
|
||||
zval_dtor(result);
|
||||
zval_ptr_dtor_nogc(result);
|
||||
}
|
||||
ZVAL_LONG(result, op1_lval | op2_lval);
|
||||
return SUCCESS;
|
||||
|
@ -1492,7 +1492,7 @@ ZEND_API int ZEND_FASTCALL bitwise_and_function(zval *result, zval *op1, zval *o
|
|||
}
|
||||
|
||||
if (op1 == result) {
|
||||
zval_dtor(result);
|
||||
zval_ptr_dtor_nogc(result);
|
||||
}
|
||||
ZVAL_LONG(result, op1_lval & op2_lval);
|
||||
return SUCCESS;
|
||||
|
@ -1559,7 +1559,7 @@ ZEND_API int ZEND_FASTCALL bitwise_xor_function(zval *result, zval *op1, zval *o
|
|||
}
|
||||
|
||||
if (op1 == result) {
|
||||
zval_dtor(result);
|
||||
zval_ptr_dtor_nogc(result);
|
||||
}
|
||||
ZVAL_LONG(result, op1_lval ^ op2_lval);
|
||||
return SUCCESS;
|
||||
|
@ -1573,7 +1573,7 @@ ZEND_API int ZEND_FASTCALL shift_left_function(zval *result, zval *op1, zval *op
|
|||
convert_op1_op2_long(op1, op1_lval, op2, op2_lval, ZEND_SL, shift_left_function);
|
||||
|
||||
if (op1 == result) {
|
||||
zval_dtor(result);
|
||||
zval_ptr_dtor_nogc(result);
|
||||
}
|
||||
|
||||
/* prevent wrapping quirkiness on some processors where << 64 + x == << x */
|
||||
|
@ -1604,7 +1604,7 @@ ZEND_API int ZEND_FASTCALL shift_right_function(zval *result, zval *op1, zval *o
|
|||
convert_op1_op2_long(op1, op1_lval, op2, op2_lval, ZEND_SR, shift_right_function);
|
||||
|
||||
if (op1 == result) {
|
||||
zval_dtor(result);
|
||||
zval_ptr_dtor_nogc(result);
|
||||
}
|
||||
|
||||
/* prevent wrapping quirkiness on some processors where >> 64 + x == >> x */
|
||||
|
@ -1646,7 +1646,7 @@ ZEND_API int ZEND_FASTCALL concat_function(zval *result, zval *op1, zval *op2) /
|
|||
* we have to free it.
|
||||
*/
|
||||
if (result == op1) {
|
||||
zval_dtor(op1);
|
||||
zval_ptr_dtor_nogc(op1);
|
||||
if (UNEXPECTED(op1 == op2)) {
|
||||
op2 = &op1_copy;
|
||||
}
|
||||
|
@ -1699,10 +1699,10 @@ ZEND_API int ZEND_FASTCALL concat_function(zval *result, zval *op1, zval *op2) /
|
|||
}
|
||||
|
||||
if (UNEXPECTED(use_copy1)) {
|
||||
zval_dtor(op1);
|
||||
zval_ptr_dtor_nogc(op1);
|
||||
}
|
||||
if (UNEXPECTED(use_copy2)) {
|
||||
zval_dtor(op2);
|
||||
zval_ptr_dtor_nogc(op2);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
@ -1797,7 +1797,7 @@ static inline void zend_free_obj_get_result(zval *op) /* {{{ */
|
|||
{
|
||||
if (Z_REFCOUNTED_P(op)) {
|
||||
if (Z_REFCOUNT_P(op) == 0) {
|
||||
zval_dtor(op);
|
||||
zval_ptr_dtor_nogc(op);
|
||||
} else {
|
||||
zval_ptr_dtor(op);
|
||||
}
|
||||
|
|
|
@ -30,10 +30,6 @@
|
|||
|
||||
ZEND_API void ZEND_FASTCALL _zval_dtor_func(zend_refcounted *p ZEND_FILE_LINE_DC)
|
||||
{
|
||||
if (--GC_REFCOUNT(p)) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (GC_TYPE(p)) {
|
||||
case IS_STRING:
|
||||
case IS_CONSTANT: {
|
||||
|
@ -79,61 +75,13 @@ ZEND_API void ZEND_FASTCALL _zval_dtor_func(zend_refcounted *p ZEND_FILE_LINE_DC
|
|||
}
|
||||
}
|
||||
|
||||
ZEND_API void ZEND_FASTCALL _zval_dtor_func_for_ptr(zend_refcounted *p ZEND_FILE_LINE_DC)
|
||||
ZEND_API void _zval_internal_dtor(zval *zval_ptr ZEND_FILE_LINE_DC)
|
||||
{
|
||||
switch (GC_TYPE(p)) {
|
||||
case IS_STRING:
|
||||
case IS_CONSTANT: {
|
||||
zend_string *str = (zend_string*)p;
|
||||
CHECK_ZVAL_STRING_REL(str);
|
||||
zend_string_free(str);
|
||||
break;
|
||||
}
|
||||
case IS_ARRAY: {
|
||||
zend_array *arr = (zend_array*)p;
|
||||
|
||||
zend_array_destroy(arr);
|
||||
break;
|
||||
}
|
||||
case IS_CONSTANT_AST: {
|
||||
zend_ast_ref *ast = (zend_ast_ref*)p;
|
||||
|
||||
zend_ast_destroy_and_free(ast->ast);
|
||||
efree_size(ast, sizeof(zend_ast_ref));
|
||||
break;
|
||||
}
|
||||
case IS_OBJECT: {
|
||||
zend_object *obj = (zend_object*)p;
|
||||
|
||||
zend_objects_store_del(obj);
|
||||
break;
|
||||
}
|
||||
case IS_RESOURCE: {
|
||||
zend_resource *res = (zend_resource*)p;
|
||||
|
||||
/* destroy resource */
|
||||
zend_list_free(res);
|
||||
break;
|
||||
}
|
||||
case IS_REFERENCE: {
|
||||
zend_reference *ref = (zend_reference*)p;
|
||||
|
||||
i_zval_ptr_dtor(&ref->val ZEND_FILE_LINE_RELAY_CC);
|
||||
efree_size(ref, sizeof(zend_reference));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC)
|
||||
{
|
||||
switch (Z_TYPE_P(zvalue)) {
|
||||
switch (Z_TYPE_P(zval_ptr)) {
|
||||
case IS_STRING:
|
||||
case IS_CONSTANT:
|
||||
CHECK_ZVAL_STRING_REL(Z_STR_P(zvalue));
|
||||
zend_string_release(Z_STR_P(zvalue));
|
||||
CHECK_ZVAL_STRING_REL(Z_STR_P(zval_ptr));
|
||||
zend_string_release(Z_STR_P(zval_ptr));
|
||||
break;
|
||||
case IS_ARRAY:
|
||||
case IS_CONSTANT_AST:
|
||||
|
@ -142,7 +90,7 @@ ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC)
|
|||
zend_error_noreturn(E_CORE_ERROR, "Internal zval's can't be arrays, objects or resources");
|
||||
break;
|
||||
case IS_REFERENCE: {
|
||||
zend_reference *ref = (zend_reference*)Z_REF_P(zvalue);
|
||||
zend_reference *ref = (zend_reference*)Z_REF_P(zval_ptr);
|
||||
|
||||
zval_internal_ptr_dtor(&ref->val);
|
||||
free(ref);
|
||||
|
@ -158,13 +106,13 @@ ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC)
|
|||
}
|
||||
}
|
||||
|
||||
ZEND_API void _zval_internal_dtor_for_ptr(zval *zvalue ZEND_FILE_LINE_DC)
|
||||
ZEND_API void _zval_internal_dtor_for_ptr(zval *zval_ptr ZEND_FILE_LINE_DC)
|
||||
{
|
||||
switch (Z_TYPE_P(zvalue)) {
|
||||
switch (Z_TYPE_P(zval_ptr)) {
|
||||
case IS_STRING:
|
||||
case IS_CONSTANT:
|
||||
CHECK_ZVAL_STRING_REL(Z_STR_P(zvalue));
|
||||
zend_string_free(Z_STR_P(zvalue));
|
||||
CHECK_ZVAL_STRING_REL(Z_STR_P(zval_ptr));
|
||||
zend_string_free(Z_STR_P(zval_ptr));
|
||||
break;
|
||||
case IS_ARRAY:
|
||||
case IS_CONSTANT_AST:
|
||||
|
@ -173,7 +121,7 @@ ZEND_API void _zval_internal_dtor_for_ptr(zval *zvalue ZEND_FILE_LINE_DC)
|
|||
zend_error_noreturn(E_CORE_ERROR, "Internal zval's can't be arrays, objects or resources");
|
||||
break;
|
||||
case IS_REFERENCE: {
|
||||
zend_reference *ref = (zend_reference*)Z_REF_P(zvalue);
|
||||
zend_reference *ref = (zend_reference*)Z_REF_P(zval_ptr);
|
||||
|
||||
zval_internal_ptr_dtor(&ref->val);
|
||||
free(ref);
|
||||
|
@ -215,17 +163,17 @@ ZEND_API void zval_add_ref_unref(zval *p)
|
|||
}
|
||||
}
|
||||
|
||||
ZEND_API void ZEND_FASTCALL _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC)
|
||||
ZEND_API void ZEND_FASTCALL _zval_copy_ctor_func(zval *zval_ptr ZEND_FILE_LINE_DC)
|
||||
{
|
||||
if (EXPECTED(Z_TYPE_P(zvalue) == IS_ARRAY)) {
|
||||
ZVAL_ARR(zvalue, zend_array_dup(Z_ARRVAL_P(zvalue)));
|
||||
} else if (EXPECTED(Z_TYPE_P(zvalue) == IS_STRING) ||
|
||||
EXPECTED(Z_TYPE_P(zvalue) == IS_CONSTANT)) {
|
||||
CHECK_ZVAL_STRING_REL(Z_STR_P(zvalue));
|
||||
Z_STR_P(zvalue) = zend_string_dup(Z_STR_P(zvalue), 0);
|
||||
} else if (EXPECTED(Z_TYPE_P(zvalue) == IS_CONSTANT_AST)) {
|
||||
zend_ast *copy = zend_ast_copy(Z_ASTVAL_P(zvalue));
|
||||
ZVAL_NEW_AST(zvalue, copy);
|
||||
if (EXPECTED(Z_TYPE_P(zval_ptr) == IS_ARRAY)) {
|
||||
ZVAL_ARR(zval_ptr, zend_array_dup(Z_ARRVAL_P(zval_ptr)));
|
||||
} else if (EXPECTED(Z_TYPE_P(zval_ptr) == IS_STRING) ||
|
||||
EXPECTED(Z_TYPE_P(zval_ptr) == IS_CONSTANT)) {
|
||||
CHECK_ZVAL_STRING_REL(Z_STR_P(zval_ptr));
|
||||
Z_STR_P(zval_ptr) = zend_string_dup(Z_STR_P(zval_ptr), 0);
|
||||
} else if (EXPECTED(Z_TYPE_P(zval_ptr) == IS_CONSTANT_AST)) {
|
||||
zend_ast *copy = zend_ast_copy(Z_ASTVAL_P(zval_ptr));
|
||||
ZVAL_NEW_AST(zval_ptr, copy);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -236,16 +184,16 @@ ZEND_API size_t zend_print_variable(zval *var)
|
|||
}
|
||||
|
||||
|
||||
ZEND_API void _zval_dtor_wrapper(zval *zvalue)
|
||||
ZEND_API void _zval_dtor_wrapper(zval *zval_ptr)
|
||||
{
|
||||
zval_dtor(zvalue);
|
||||
zval_dtor(zval_ptr);
|
||||
}
|
||||
|
||||
|
||||
#if ZEND_DEBUG
|
||||
ZEND_API void _zval_internal_dtor_wrapper(zval *zvalue)
|
||||
ZEND_API void _zval_internal_dtor_wrapper(zval *zval_ptr)
|
||||
{
|
||||
zval_internal_dtor(zvalue);
|
||||
zval_internal_dtor(zval_ptr);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -29,25 +29,15 @@
|
|||
BEGIN_EXTERN_C()
|
||||
|
||||
ZEND_API void ZEND_FASTCALL _zval_dtor_func(zend_refcounted *p ZEND_FILE_LINE_DC);
|
||||
ZEND_API void ZEND_FASTCALL _zval_dtor_func_for_ptr(zend_refcounted *p ZEND_FILE_LINE_DC);
|
||||
ZEND_API void ZEND_FASTCALL _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC);
|
||||
ZEND_API void ZEND_FASTCALL _zval_copy_ctor_func(zval *zval_ptr ZEND_FILE_LINE_DC);
|
||||
|
||||
#define zval_dtor_func(zv) _zval_dtor_func(zv ZEND_FILE_LINE_CC)
|
||||
#define zval_dtor_func_for_ptr(zv) _zval_dtor_func_for_ptr(zv ZEND_FILE_LINE_CC)
|
||||
#define zval_copy_ctor_func(zv) _zval_copy_ctor_func(zv ZEND_FILE_LINE_CC)
|
||||
|
||||
static zend_always_inline void _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC)
|
||||
{
|
||||
if (!Z_REFCOUNTED_P(zvalue)) {
|
||||
return;
|
||||
}
|
||||
_zval_dtor_func(Z_COUNTED_P(zvalue) ZEND_FILE_LINE_RELAY_CC);
|
||||
}
|
||||
#define zval_dtor_func(zval_ptr) _zval_dtor_func(zval_ptr ZEND_FILE_LINE_CC)
|
||||
#define zval_copy_ctor_func(zval_ptr) _zval_copy_ctor_func(zval_ptr ZEND_FILE_LINE_CC)
|
||||
|
||||
static zend_always_inline void _zval_ptr_dtor_nogc(zval *zval_ptr ZEND_FILE_LINE_DC)
|
||||
{
|
||||
if (Z_REFCOUNTED_P(zval_ptr) && !Z_DELREF_P(zval_ptr)) {
|
||||
_zval_dtor_func_for_ptr(Z_COUNTED_P(zval_ptr) ZEND_FILE_LINE_RELAY_CC);
|
||||
_zval_dtor_func(Z_COUNTED_P(zval_ptr) ZEND_FILE_LINE_RELAY_CC);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,78 +45,80 @@ static zend_always_inline void i_zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC)
|
|||
{
|
||||
if (Z_REFCOUNTED_P(zval_ptr)) {
|
||||
if (!Z_DELREF_P(zval_ptr)) {
|
||||
_zval_dtor_func_for_ptr(Z_COUNTED_P(zval_ptr) ZEND_FILE_LINE_RELAY_CC);
|
||||
_zval_dtor_func(Z_COUNTED_P(zval_ptr) ZEND_FILE_LINE_RELAY_CC);
|
||||
} else {
|
||||
GC_ZVAL_CHECK_POSSIBLE_ROOT(zval_ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static zend_always_inline void _zval_copy_ctor(zval *zvalue ZEND_FILE_LINE_DC)
|
||||
static zend_always_inline void _zval_copy_ctor(zval *zval_ptr ZEND_FILE_LINE_DC)
|
||||
{
|
||||
if (Z_REFCOUNTED_P(zvalue) || Z_IMMUTABLE_P(zvalue)) {
|
||||
if (Z_COPYABLE_P(zvalue) || Z_IMMUTABLE_P(zvalue)) {
|
||||
_zval_copy_ctor_func(zvalue ZEND_FILE_LINE_RELAY_CC);
|
||||
if (Z_REFCOUNTED_P(zval_ptr) || Z_IMMUTABLE_P(zval_ptr)) {
|
||||
if (Z_COPYABLE_P(zval_ptr) || Z_IMMUTABLE_P(zval_ptr)) {
|
||||
_zval_copy_ctor_func(zval_ptr ZEND_FILE_LINE_RELAY_CC);
|
||||
} else {
|
||||
Z_ADDREF_P(zvalue);
|
||||
Z_ADDREF_P(zval_ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static zend_always_inline void _zval_opt_copy_ctor(zval *zvalue ZEND_FILE_LINE_DC)
|
||||
static zend_always_inline void _zval_opt_copy_ctor(zval *zval_ptr ZEND_FILE_LINE_DC)
|
||||
{
|
||||
if (Z_OPT_REFCOUNTED_P(zvalue) || Z_OPT_IMMUTABLE_P(zvalue)) {
|
||||
if (Z_OPT_COPYABLE_P(zvalue) || Z_OPT_IMMUTABLE_P(zvalue)) {
|
||||
_zval_copy_ctor_func(zvalue ZEND_FILE_LINE_RELAY_CC);
|
||||
if (Z_OPT_REFCOUNTED_P(zval_ptr) || Z_OPT_IMMUTABLE_P(zval_ptr)) {
|
||||
if (Z_OPT_COPYABLE_P(zval_ptr) || Z_OPT_IMMUTABLE_P(zval_ptr)) {
|
||||
_zval_copy_ctor_func(zval_ptr ZEND_FILE_LINE_RELAY_CC);
|
||||
} else {
|
||||
Z_ADDREF_P(zvalue);
|
||||
Z_ADDREF_P(zval_ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static zend_always_inline void _zval_copy_ctor_no_imm(zval *zvalue ZEND_FILE_LINE_DC)
|
||||
static zend_always_inline void _zval_copy_ctor_no_imm(zval *zval_ptr ZEND_FILE_LINE_DC)
|
||||
{
|
||||
if (Z_REFCOUNTED_P(zvalue)) {
|
||||
if (Z_COPYABLE_P(zvalue)) {
|
||||
_zval_copy_ctor_func(zvalue ZEND_FILE_LINE_RELAY_CC);
|
||||
if (Z_REFCOUNTED_P(zval_ptr)) {
|
||||
if (Z_COPYABLE_P(zval_ptr)) {
|
||||
_zval_copy_ctor_func(zval_ptr ZEND_FILE_LINE_RELAY_CC);
|
||||
} else {
|
||||
Z_ADDREF_P(zvalue);
|
||||
Z_ADDREF_P(zval_ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static zend_always_inline void _zval_opt_copy_ctor_no_imm(zval *zvalue ZEND_FILE_LINE_DC)
|
||||
static zend_always_inline void _zval_opt_copy_ctor_no_imm(zval *zval_ptr ZEND_FILE_LINE_DC)
|
||||
{
|
||||
if (Z_OPT_REFCOUNTED_P(zvalue)) {
|
||||
if (Z_OPT_COPYABLE_P(zvalue)) {
|
||||
_zval_copy_ctor_func(zvalue ZEND_FILE_LINE_RELAY_CC);
|
||||
if (Z_OPT_REFCOUNTED_P(zval_ptr)) {
|
||||
if (Z_OPT_COPYABLE_P(zval_ptr)) {
|
||||
_zval_copy_ctor_func(zval_ptr ZEND_FILE_LINE_RELAY_CC);
|
||||
} else {
|
||||
Z_ADDREF_P(zvalue);
|
||||
Z_ADDREF_P(zval_ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_API size_t zend_print_variable(zval *var);
|
||||
ZEND_API void _zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC);
|
||||
ZEND_API void _zval_internal_dtor_for_ptr(zval *zvalue ZEND_FILE_LINE_DC);
|
||||
ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC);
|
||||
ZEND_API void _zval_internal_ptr_dtor(zval *zvalue ZEND_FILE_LINE_DC);
|
||||
ZEND_API void _zval_dtor_wrapper(zval *zvalue);
|
||||
#define zval_copy_ctor(zvalue) _zval_copy_ctor((zvalue) ZEND_FILE_LINE_CC)
|
||||
#define zval_opt_copy_ctor(zvalue) _zval_opt_copy_ctor((zvalue) ZEND_FILE_LINE_CC)
|
||||
#define zval_copy_ctor_no_imm(zvalue) _zval_copy_ctor_no_imm((zvalue) ZEND_FILE_LINE_CC)
|
||||
#define zval_opt_copy_ctor_no_imm(zvalue) _zval_opt_copy_ctor_no_imm((zvalue) ZEND_FILE_LINE_CC)
|
||||
#define zval_dtor(zvalue) _zval_dtor((zvalue) ZEND_FILE_LINE_CC)
|
||||
#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
|
||||
ZEND_API void _zval_internal_dtor_for_ptr(zval *zval_ptr ZEND_FILE_LINE_DC);
|
||||
ZEND_API void _zval_internal_dtor(zval *zval_ptr ZEND_FILE_LINE_DC);
|
||||
ZEND_API void _zval_internal_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC);
|
||||
ZEND_API void _zval_dtor_wrapper(zval *zval_ptr);
|
||||
#define zval_copy_ctor(zval_ptr) _zval_copy_ctor((zval_ptr) ZEND_FILE_LINE_CC)
|
||||
#define zval_opt_copy_ctor(zval_ptr) _zval_opt_copy_ctor((zval_ptr) ZEND_FILE_LINE_CC)
|
||||
#define zval_copy_ctor_no_imm(zval_ptr) _zval_copy_ctor_no_imm((zval_ptr) ZEND_FILE_LINE_CC)
|
||||
#define zval_opt_copy_ctor_no_imm(zval_ptr) _zval_opt_copy_ctor_no_imm((zval_ptr) ZEND_FILE_LINE_CC)
|
||||
#define zval_ptr_dtor_nogc(zval_ptr) _zval_ptr_dtor_nogc((zval_ptr) ZEND_FILE_LINE_CC)
|
||||
#define zval_internal_dtor(zvalue) _zval_internal_dtor((zvalue) ZEND_FILE_LINE_CC)
|
||||
#define zval_internal_ptr_dtor(zvalue) _zval_internal_ptr_dtor((zvalue) ZEND_FILE_LINE_CC)
|
||||
#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
|
||||
#define zval_internal_dtor(zval_ptr) _zval_internal_dtor((zval_ptr) ZEND_FILE_LINE_CC)
|
||||
#define zval_internal_ptr_dtor(zval_ptr) _zval_internal_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
|
||||
#define zval_dtor_wrapper _zval_dtor_wrapper
|
||||
|
||||
/* deprecated in favor of zval_ptr_dtor_nogc(); kept for avoiding too many changes */
|
||||
#define zval_dtor(zval_ptr) zval_ptr_dtor_nogc(zval_ptr)
|
||||
|
||||
#if ZEND_DEBUG
|
||||
ZEND_API void _zval_ptr_dtor_wrapper(zval *zval_ptr);
|
||||
ZEND_API void _zval_internal_dtor_wrapper(zval *zvalue);
|
||||
ZEND_API void _zval_internal_ptr_dtor_wrapper(zval *zvalue);
|
||||
ZEND_API void _zval_internal_dtor_wrapper(zval *zval_ptr);
|
||||
ZEND_API void _zval_internal_ptr_dtor_wrapper(zval *zval_ptr);
|
||||
#define zval_ptr_dtor_wrapper _zval_ptr_dtor_wrapper
|
||||
#define zval_internal_dtor_wrapper _zval_internal_dtor_wrapper
|
||||
#define zval_internal_ptr_dtor_wrapper _zval_internal_ptr_dtor_wrapper
|
||||
|
|
|
@ -3906,7 +3906,7 @@ ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY)
|
|||
if (OP1_TYPE & (IS_VAR|IS_TMP_VAR)) {
|
||||
if (Z_REFCOUNTED_P(free_op1) && !Z_DELREF_P(free_op1)) {
|
||||
SAVE_OPLINE();
|
||||
zval_dtor_func_for_ptr(Z_COUNTED_P(free_op1));
|
||||
zval_dtor_func(Z_COUNTED_P(free_op1));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -4457,7 +4457,7 @@ ZEND_VM_C_LABEL(send_again):
|
|||
ZEND_VM_C_GOTO(unpack_iter_dtor);
|
||||
}
|
||||
|
||||
zval_dtor(&key);
|
||||
zval_ptr_dtor_nogc(&key);
|
||||
}
|
||||
|
||||
if (ARG_MUST_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
|
||||
|
@ -5396,7 +5396,7 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMPVAR|CV, UNUSED, VAR_FETCH|ISSET)
|
|||
|
||||
if (!--GC_REFCOUNT(garbage)) {
|
||||
ZVAL_UNDEF(var);
|
||||
zval_dtor_func_for_ptr(garbage);
|
||||
zval_dtor_func(garbage);
|
||||
} else {
|
||||
zval *z = var;
|
||||
ZVAL_DEREF(z);
|
||||
|
@ -7624,7 +7624,7 @@ ZEND_VM_C_LABEL(check_indirect):
|
|||
}
|
||||
if (refcnt == 0) {
|
||||
SAVE_OPLINE();
|
||||
zval_dtor_func_for_ptr(Z_COUNTED_P(variable_ptr));
|
||||
zval_dtor_func(Z_COUNTED_P(variable_ptr));
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
ZVAL_NULL(variable_ptr);
|
||||
HANDLE_EXCEPTION();
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -479,7 +479,7 @@ $op2_free_op = array(
|
|||
);
|
||||
|
||||
$op1_free_op_if_var = array(
|
||||
"ANY" => "if (opline->op1_type == IS_VAR) {zval_ptr_dtor_nogc(free_op1);}",
|
||||
"ANY" => "if (opline->op1_type == IS_VAR) { zval_ptr_dtor_nogc(free_op1); }",
|
||||
"TMP" => "",
|
||||
"VAR" => "zval_ptr_dtor_nogc(free_op1)",
|
||||
"CONST" => "",
|
||||
|
@ -490,7 +490,7 @@ $op1_free_op_if_var = array(
|
|||
);
|
||||
|
||||
$op2_free_op_if_var = array(
|
||||
"ANY" => "if (opline->op2_type == IS_VAR) {zval_ptr_dtor_nogc(free_op2);}",
|
||||
"ANY" => "if (opline->op2_type == IS_VAR) { zval_ptr_dtor_nogc(free_op2); }",
|
||||
"TMP" => "",
|
||||
"VAR" => "zval_ptr_dtor_nogc(free_op2)",
|
||||
"CONST" => "",
|
||||
|
@ -501,9 +501,9 @@ $op2_free_op_if_var = array(
|
|||
);
|
||||
|
||||
$op1_free_op_var_ptr = array(
|
||||
"ANY" => "if (free_op1) {zval_ptr_dtor_nogc(free_op1);}",
|
||||
"ANY" => "if (free_op1) { zval_ptr_dtor_nogc(free_op1); }",
|
||||
"TMP" => "",
|
||||
"VAR" => "if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}",
|
||||
"VAR" => "if (UNEXPECTED(free_op1)) { zval_ptr_dtor_nogc(free_op1); }",
|
||||
"CONST" => "",
|
||||
"UNUSED" => "",
|
||||
"CV" => "",
|
||||
|
@ -512,9 +512,9 @@ $op1_free_op_var_ptr = array(
|
|||
);
|
||||
|
||||
$op2_free_op_var_ptr = array(
|
||||
"ANY" => "if (free_op2) {zval_ptr_dtor_nogc(free_op2);}",
|
||||
"ANY" => "if (free_op2) { zval_ptr_dtor_nogc(free_op2); }",
|
||||
"TMP" => "",
|
||||
"VAR" => "if (UNEXPECTED(free_op2)) {zval_ptr_dtor_nogc(free_op2);}",
|
||||
"VAR" => "if (UNEXPECTED(free_op2)) { zval_ptr_dtor_nogc(free_op2); }",
|
||||
"CONST" => "",
|
||||
"UNUSED" => "",
|
||||
"CV" => "",
|
||||
|
|
|
@ -385,7 +385,7 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
|
|||
} else {
|
||||
zend_refcounted *garbage = Z_COUNTED_P(return_value);
|
||||
ZVAL_COPY(return_value, tmp);
|
||||
_zval_dtor_func(garbage ZEND_FILE_LINE_CC);
|
||||
zval_dtor_func(garbage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue