Created
August 9, 2019 14:26
-
-
Save dstogov/92ea9476b8a4ddb60054de6e48fe68f0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Zend/zend_gc.c b/Zend/zend_gc.c | |
index 97a7edaac2..4dd0ed14c7 100644 | |
--- a/Zend/zend_gc.c | |
+++ b/Zend/zend_gc.c | |
@@ -1344,16 +1344,24 @@ static void gc_remove_nested_data_from_buffer(zend_refcounted *ref, gc_root_buff | |
zval *zv; | |
tail_call: | |
- if (root || | |
- (GC_REF_ADDRESS(ref) != 0 && | |
- GC_REF_CHECK_COLOR(ref, GC_BLACK))) { | |
- GC_TRACE_REF(ref, "removing from buffer"); | |
+ do { | |
if (root) { | |
+ GC_TRACE_REF(ref, "removing from buffer"); | |
gc_remove_from_roots(root); | |
GC_REF_SET_INFO(ref, 0); | |
root = NULL; | |
- } else { | |
+ } else if (GC_REF_ADDRESS(ref) != 0 | |
+ && GC_REF_CHECK_COLOR(ref, GC_BLACK)) { | |
+ GC_TRACE_REF(ref, "removing from buffer"); | |
GC_REMOVE_FROM_BUFFER(ref); | |
+ } else if (GC_TYPE(ref) == IS_REFERENCE) { | |
+ if (Z_REFCOUNTED(((zend_reference*)ref)->val)) { | |
+ ref = Z_COUNTED(((zend_reference*)ref)->val); | |
+ goto tail_call; | |
+ } | |
+ return; | |
+ } else { | |
+ return; | |
} | |
if (GC_TYPE(ref) == IS_OBJECT) { | |
@@ -1389,12 +1397,6 @@ tail_call: | |
} | |
} else if (GC_TYPE(ref) == IS_ARRAY) { | |
ht = (zend_array*)ref; | |
- } else if (GC_TYPE(ref) == IS_REFERENCE) { | |
- if (Z_REFCOUNTED(((zend_reference*)ref)->val)) { | |
- ref = Z_COUNTED(((zend_reference*)ref)->val); | |
- goto tail_call; | |
- } | |
- return; | |
} else { | |
return; | |
} | |
@@ -1430,7 +1432,7 @@ tail_call: | |
} | |
ref = Z_COUNTED_P(zv); | |
goto tail_call; | |
- } | |
+ } while (0); | |
} | |
ZEND_API int zend_gc_collect_cycles(void) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment