File tree Expand file tree Collapse file tree
Open diff view settings
Expand file tree Collapse file tree
Open diff view settings
Original file line number Diff line number Diff line change @@ -382,16 +382,11 @@ static void zend_ast_destroy_ex(zend_ast *ast, zend_bool free) {
382382
383383 switch (ast -> kind ) {
384384 case ZEND_AST_ZVAL :
385- {
386385 /* Destroy value without using GC: When opcache moves arrays into SHM it will
387386 * free the zend_array structure, so references to it from outside the op array
388387 * become invalid. GC would cause such a reference in the root buffer. */
389- zval * zv = zend_ast_get_zval (ast );
390- if (Z_REFCOUNTED_P (zv ) && !Z_DELREF_P (zv )) {
391- _zval_dtor_func_for_ptr (Z_COUNTED_P (zv ) ZEND_FILE_LINE_CC );
392- }
388+ zval_ptr_dtor_nogc (zend_ast_get_zval (ast ));
393389 break ;
394- }
395390 case ZEND_AST_FUNC_DECL :
396391 case ZEND_AST_CLOSURE :
397392 case ZEND_AST_METHOD :
Original file line number Diff line number Diff line change @@ -600,10 +600,7 @@ void zend_do_free(znode *op1 TSRMLS_DC) /* {{{ */
600600 /* Destroy value without using GC: When opcache moves arrays into SHM it will
601601 * free the zend_array structure, so references to it from outside the op array
602602 * become invalid. GC would cause such a reference in the root buffer. */
603- zval * zv = & op1 -> u .constant ;
604- if (Z_REFCOUNTED_P (zv ) && !Z_DELREF_P (zv )) {
605- _zval_dtor_func_for_ptr (Z_COUNTED_P (zv ) ZEND_FILE_LINE_CC );
606- }
603+ zval_ptr_dtor_nogc (& op1 -> u .constant );
607604 }
608605}
609606/* }}} */
Original file line number Diff line number Diff line change @@ -83,7 +83,6 @@ static const zend_internal_function zend_pass_function = {
8383
8484#undef zval_ptr_dtor
8585#define zval_ptr_dtor (zv ) i_zval_ptr_dtor(zv ZEND_FILE_LINE_CC TSRMLS_CC)
86- #define zval_ptr_dtor_nogc (zv ) i_zval_ptr_dtor_nogc(zv ZEND_FILE_LINE_CC TSRMLS_CC)
8786
8887#define PZVAL_LOCK (z ) if (Z_REFCOUNTED_P(z)) Z_ADDREF_P((z))
8988#define SELECTIVE_PZVAL_LOCK (pzv , opline ) if (RETURN_VALUE_USED(opline)) { PZVAL_LOCK(pzv); }
Original file line number Diff line number Diff line change @@ -63,16 +63,6 @@ static zend_always_inline void i_zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC
6363 }
6464}
6565
66- static zend_always_inline void i_zval_ptr_dtor_nogc (zval * zval_ptr ZEND_FILE_LINE_DC TSRMLS_DC )
67- {
68- if (Z_REFCOUNTED_P (zval_ptr )) {
69- if (!Z_DELREF_P (zval_ptr )) {
70- ZEND_ASSERT (zval_ptr != & EG (uninitialized_zval ));
71- _zval_dtor_func_for_ptr (Z_COUNTED_P (zval_ptr ) ZEND_FILE_LINE_CC );
72- }
73- }
74- }
75-
7666static zend_always_inline int i_zend_is_true (zval * op TSRMLS_DC )
7767{
7868 int result ;
@@ -237,7 +227,7 @@ static zend_always_inline void zend_vm_stack_free_extra_args(zend_execute_data *
237227 zval * p = end + (call -> num_args - first_extra_arg );
238228 do {
239229 p -- ;
240- i_zval_ptr_dtor_nogc ( p ZEND_FILE_LINE_CC TSRMLS_CC );
230+ zval_ptr_dtor_nogc ( p );
241231 } while (p != end );
242232 }
243233}
@@ -252,7 +242,7 @@ static zend_always_inline void zend_vm_stack_free_args(zend_execute_data *call T
252242
253243 do {
254244 p -- ;
255- i_zval_ptr_dtor_nogc ( p ZEND_FILE_LINE_CC TSRMLS_CC );
245+ zval_ptr_dtor_nogc ( p );
256246 } while (p != end );
257247 }
258248}
Original file line number Diff line number Diff line change @@ -343,7 +343,7 @@ ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC)
343343 if (literal ) {
344344 end = literal + op_array -> last_literal ;
345345 while (literal < end ) {
346- zval_dtor (literal );
346+ zval_ptr_dtor_nogc (literal );
347347 literal ++ ;
348348 }
349349 efree (op_array -> literals );
Original file line number Diff line number Diff line change @@ -36,6 +36,13 @@ static zend_always_inline void _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC)
3636 _zval_dtor_func (Z_COUNTED_P (zvalue ) ZEND_FILE_LINE_RELAY_CC );
3737}
3838
39+ static zend_always_inline void _zval_ptr_dtor_nogc (zval * zval_ptr ZEND_FILE_LINE_DC )
40+ {
41+ if (Z_REFCOUNTED_P (zval_ptr ) && !Z_DELREF_P (zval_ptr )) {
42+ _zval_dtor_func_for_ptr (Z_COUNTED_P (zval_ptr ) ZEND_FILE_LINE_CC );
43+ }
44+ }
45+
3946ZEND_API void _zval_copy_ctor_func (zval * zvalue ZEND_FILE_LINE_DC );
4047
4148#define zval_copy_ctor_func (zv ) _zval_copy_ctor_func(zv ZEND_FILE_LINE_CC)
@@ -98,6 +105,7 @@ ZEND_API void _zval_dtor_wrapper(zval *zvalue);
98105#define zval_opt_copy_ctor_no_imm (zvalue ) _zval_opt_copy_ctor_no_imm((zvalue) ZEND_FILE_LINE_CC)
99106#define zval_dtor (zvalue ) _zval_dtor((zvalue) ZEND_FILE_LINE_CC)
100107#define zval_ptr_dtor (zval_ptr ) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
108+ #define zval_ptr_dtor_nogc (zval_ptr ) _zval_ptr_dtor_nogc((zval_ptr) ZEND_FILE_LINE_CC)
101109#define zval_internal_dtor (zvalue ) _zval_internal_dtor((zvalue) ZEND_FILE_LINE_CC)
102110#define zval_internal_ptr_dtor (zvalue ) _zval_internal_ptr_dtor((zvalue) ZEND_FILE_LINE_CC)
103111#define zval_dtor_wrapper _zval_dtor_wrapper
You can’t perform that action at this time.
0 commit comments