@@ -953,20 +953,28 @@ static void gc_remove_nested_data_from_buffer(zend_refcounted *ref, gc_root_buff
953
953
zval * zv ;
954
954
955
955
tail_call :
956
- if (root ||
957
- (GC_ADDRESS (GC_INFO (ref )) != 0 &&
958
- GC_REF_GET_COLOR (ref ) == GC_BLACK )) {
959
- GC_TRACE_REF (ref , "removing from buffer" );
956
+ do {
960
957
if (root ) {
958
+ GC_TRACE_REF (ref , "removing from buffer" );
961
959
if (EXPECTED (GC_ADDRESS (GC_INFO (root -> ref )) < GC_ROOT_BUFFER_MAX_ENTRIES )) {
962
960
gc_remove_from_roots (root );
963
961
} else {
964
962
gc_remove_from_additional_roots (root );
965
963
}
966
964
GC_INFO (ref ) = 0 ;
967
965
root = NULL ;
968
- } else {
966
+ } else if (GC_ADDRESS (GC_INFO (ref )) != 0
967
+ && GC_REF_GET_COLOR (ref ) == GC_BLACK ) {
968
+ GC_TRACE_REF (ref , "removing from buffer" );
969
969
GC_REMOVE_FROM_BUFFER (ref );
970
+ } else if (GC_TYPE (ref ) == IS_REFERENCE ) {
971
+ if (Z_REFCOUNTED (((zend_reference * )ref )-> val )) {
972
+ ref = Z_COUNTED (((zend_reference * )ref )-> val );
973
+ goto tail_call ;
974
+ }
975
+ return ;
976
+ } else {
977
+ return ;
970
978
}
971
979
972
980
if (GC_TYPE (ref ) == IS_OBJECT ) {
@@ -1004,12 +1012,6 @@ static void gc_remove_nested_data_from_buffer(zend_refcounted *ref, gc_root_buff
1004
1012
}
1005
1013
} else if (GC_TYPE (ref ) == IS_ARRAY ) {
1006
1014
ht = (zend_array * )ref ;
1007
- } else if (GC_TYPE (ref ) == IS_REFERENCE ) {
1008
- if (Z_REFCOUNTED (((zend_reference * )ref )-> val )) {
1009
- ref = Z_COUNTED (((zend_reference * )ref )-> val );
1010
- goto tail_call ;
1011
- }
1012
- return ;
1013
1015
} else {
1014
1016
return ;
1015
1017
}
@@ -1045,7 +1047,7 @@ static void gc_remove_nested_data_from_buffer(zend_refcounted *ref, gc_root_buff
1045
1047
}
1046
1048
ref = Z_COUNTED_P (zv );
1047
1049
goto tail_call ;
1048
- }
1050
+ } while ( 0 );
1049
1051
}
1050
1052
1051
1053
ZEND_API int zend_gc_collect_cycles (void )
0 commit comments