com php-src: Fixed GC (Zend/tests/bug63635.phpt): Zend/zend_g c.c

From: Date: Wed, 06 Aug 2014 11:31:07 +0000
Subject: com php-src: Fixed GC (Zend/tests/bug63635.phpt): Zend/zend_g c.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-79753@lists.php.net to get a copy of this message
Commit: 414762fc12acef00733121ae515c9aba32e8bce3 Author: Dmitry Stogov <dmitry@zend.com> Wed, 6 Aug 2014 15:31:07 +0400 Parents: e677e8cc87b2a6ae63587c1a3b3e7c6820bb448f Branches: phpng Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=414762fc12acef00733121ae515c9aba32e8bce3 Log: Fixed GC (Zend/tests/bug63635.phpt) Bugs: https://bugs.php.net/63635 Changed paths: M Zend/zend_gc.c Diff: diff --git a/Zend/zend_gc.c b/Zend/zend_gc.c index eea4de8..1d1f0b3 100644 --- a/Zend/zend_gc.c +++ b/Zend/zend_gc.c @@ -472,7 +472,7 @@ static int gc_collect_white(zend_refcounted *ref TSRMLS_DC) Bucket *p; tail_call: - if (GC_INFO(ref) == GC_WHITE) { + if (GC_GET_COLOR(GC_INFO(ref)) == GC_WHITE) { ht = NULL; GC_SET_BLACK(GC_INFO(ref)); @@ -568,16 +568,23 @@ static int gc_collect_roots(TSRMLS_D) int count = 0; gc_root_buffer *current = GC_G(roots).next; + /* remove non-garbage from the list */ while (current != &GC_G(roots)) { - GC_SET_ADDRESS(GC_INFO(current->ref), 0); - if (GC_INFO(current->ref) == GC_WHITE) { - count += gc_collect_white(current->ref TSRMLS_CC); - GC_SET_ADDRESS(GC_INFO(current->ref), current - GC_G(buf)); - } else { + if (GC_GET_COLOR(GC_INFO(current->ref)) != GC_WHITE) { + GC_SET_ADDRESS(GC_INFO(current->ref), 0); GC_REMOVE_FROM_ROOTS(current); } current = current->next; } + + current = GC_G(roots).next; + while (current != &GC_G(roots)) { + if (GC_GET_COLOR(GC_INFO(current->ref)) == GC_WHITE) { + GC_REFCOUNT(current->ref)++; + count += gc_collect_white(current->ref TSRMLS_CC); + } + current = current->next; + } /* relink remaining roots into list to free */ if (GC_G(roots).next != &GC_G(roots)) { if (GC_G(to_free).next == &GC_G(to_free)) {

« previous php.cvs (#79753) next »