@@ -1444,7 +1444,9 @@ static void gc_scan_roots(gc_stack *stack)
14441444 * make sure to reload pointers. */
14451445 idx = GC_FIRST_ROOT ;
14461446 end = GC_G (first_unused );
1447+
14471448 while (idx != end ) {
1449+ repeat :
14481450 current = GC_IDX2PTR (idx );
14491451 if (GC_IS_ROOT (current -> ref )) {
14501452 if (GC_REF_CHECK_COLOR (current -> ref , GC_GREY )) {
@@ -1456,15 +1458,9 @@ static void gc_scan_roots(gc_stack *stack)
14561458 }
14571459
14581460 /* Scan extra roots added during gc_scan */
1459- while (idx != GC_G (first_unused )) {
1460- current = GC_IDX2PTR (idx );
1461- if (GC_IS_ROOT (current -> ref )) {
1462- if (GC_REF_CHECK_COLOR (current -> ref , GC_GREY )) {
1463- GC_REF_SET_COLOR (current -> ref , GC_WHITE );
1464- gc_scan (current -> ref , stack );
1465- }
1466- }
1467- idx ++ ;
1461+ if (idx != GC_G (first_unused )) {
1462+ end = GC_G (first_unused );
1463+ goto repeat ;
14681464 }
14691465}
14701466
@@ -1535,7 +1531,7 @@ static int gc_collect_white(zend_refcounted *ref, uint32_t *flags, gc_stack *sta
15351531 for (; n != 0 ; n -- ) {
15361532 ZEND_ASSERT (Z_TYPE_P (zv ) == IS_PTR );
15371533 zval * entry = (zval * ) Z_PTR_P (zv );
1538- if (Z_COLLECTABLE_P (entry ) && GC_FROM_WEAKMAP_KEY (entry ) && GC_COLLECTABLE (Z_COUNTED_P (entry )) && GC_FROM_WEAKMAP_KEY ( entry ) ) {
1534+ if (Z_COLLECTABLE_P (entry ) && GC_FROM_WEAKMAP_KEY (entry ) && GC_COLLECTABLE (Z_COUNTED_P (entry ))) {
15391535 GC_UNSET_FROM_WEAKMAP_KEY (entry );
15401536 GC_UNSET_FROM_WEAKMAP (entry );
15411537 ref = Z_COUNTED_P (entry );
0 commit comments