diff options
-rw-r--r-- | Zend/zend_execute.c | 2 | ||||
-rw-r--r-- | Zend/zend_execute.h | 6 | ||||
-rw-r--r-- | Zend/zend_gc.c | 2 | ||||
-rw-r--r-- | Zend/zend_variables.c | 52 | ||||
-rw-r--r-- | Zend/zend_variables.h | 16 | ||||
-rw-r--r-- | Zend/zend_vm_def.h | 6 | ||||
-rw-r--r-- | Zend/zend_vm_execute.h | 16 | ||||
-rw-r--r-- | ext/soap/php_packet_soap.c | 2 |
8 files changed, 20 insertions, 82 deletions
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 53f2362e19..bd5ccf6c37 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -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); } diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index 36a44f6395..24071719a2 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -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); diff --git a/Zend/zend_gc.c b/Zend/zend_gc.c index 821ac4d9dc..87f4fb87d6 100644 --- a/Zend/zend_gc.c +++ b/Zend/zend_gc.c @@ -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))) { diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c index 01b68c25a4..dc75353e62 100644 --- a/Zend/zend_variables.c +++ b/Zend/zend_variables.c @@ -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,54 +75,6 @@ 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) -{ - 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)) { diff --git a/Zend/zend_variables.h b/Zend/zend_variables.h index 6958d6139f..0afe68760d 100644 --- a/Zend/zend_variables.h +++ b/Zend/zend_variables.h @@ -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); #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); -} - 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,7 +45,7 @@ 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); } @@ -116,7 +106,7 @@ ZEND_API void _zval_dtor_wrapper(zval *zvalue); #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_dtor(zvalue) zval_ptr_dtor_nogc(zvalue) #define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((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) diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 6694a183c5..36a041915d 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -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 { @@ -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(); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 0911a61806..f9b8f6b7f1 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -2813,7 +2813,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_SPEC_CONST_HANDLER(ZEND if (IS_CONST & (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 { @@ -7521,7 +7521,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_UNUSED_HA if (!--GC_REFCOUNT(garbage)) { ZVAL_UNDEF(var); - zval_dtor_func_for_ptr(garbage); + zval_dtor_func(garbage); } else { zval *z = var; ZVAL_DEREF(z); @@ -11917,7 +11917,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_SPEC_TMP_HANDLER(ZEND_O if (IS_TMP_VAR & (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 { @@ -15193,7 +15193,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_SPEC_VAR_HANDLER(ZEND_O if (IS_VAR & (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 { @@ -34839,7 +34839,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_SPEC_CV_HANDLER(ZEND_OP if (IS_CV & (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 { @@ -40109,7 +40109,7 @@ 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(); @@ -42314,7 +42314,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_UNUSED_HANDL if (!--GC_REFCOUNT(garbage)) { ZVAL_UNDEF(var); - zval_dtor_func_for_ptr(garbage); + zval_dtor_func(garbage); } else { zval *z = var; ZVAL_DEREF(z); @@ -52442,7 +52442,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMPVAR_UNUSED_H if (!--GC_REFCOUNT(garbage)) { ZVAL_UNDEF(var); - zval_dtor_func_for_ptr(garbage); + zval_dtor_func(garbage); } else { zval *z = var; ZVAL_DEREF(z); diff --git a/ext/soap/php_packet_soap.c b/ext/soap/php_packet_soap.c index c835c84dff..81a8d18b29 100644 --- a/ext/soap/php_packet_soap.c +++ b/ext/soap/php_packet_soap.c @@ -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); } } } |