Hi!

On Fri, 3 Sep 2010, Dmitry Stogov wrote:

> dmitry                                   Fri, 03 Sep 2010 09:27:47 +0000
> 
> Revision: http://svn.php.net/viewvc?view=revision&revision=303016
> 
> Log:
> Fixed GC bug

Do you perhaps have a test case or perhaps some information on what went 
wrong here? 

with kind regards,
Derick

> Changed paths:
>     U   php/php-src/branches/PHP_5_3/Zend/zend_gc.c
>     U   php/php-src/trunk/Zend/zend_gc.c
> 
> Modified: php/php-src/branches/PHP_5_3/Zend/zend_gc.c
> ===================================================================
> --- php/php-src/branches/PHP_5_3/Zend/zend_gc.c       2010-09-03 06:41:59 UTC 
> (rev 303015)
> +++ php/php-src/branches/PHP_5_3/Zend/zend_gc.c       2010-09-03 09:27:47 UTC 
> (rev 303016)
> @@ -414,19 +414,21 @@
>       gc_root_buffer *current = GC_G(roots).next;
> 
>       while (current != &GC_G(roots)) {
> -             if (current->handle && EG(objects_store).object_buckets) {
> -                     struct _store_object *obj = 
> &EG(objects_store).object_buckets[current->handle].bucket.obj;
> +             if (current->handle) {
> +                     if (EG(objects_store).object_buckets) {
> +                             struct _store_object *obj = 
> &EG(objects_store).object_buckets[current->handle].bucket.obj;
> 
> -                     if (GC_GET_COLOR(obj->buffered) == GC_PURPLE) {
> -                             zval z;
> +                             if (GC_GET_COLOR(obj->buffered) == GC_PURPLE) {
> +                                     zval z;
> 
> -                             INIT_PZVAL(&z);
> -                             Z_OBJ_HANDLE(z) = current->handle;
> -                             Z_OBJ_HT(z) = current->u.handlers;
> -                             zobj_mark_grey(obj, &z TSRMLS_CC);
> -                     } else {
> -                             GC_SET_ADDRESS(obj->buffered, NULL);
> -                             GC_REMOVE_FROM_BUFFER(current);
> +                                     INIT_PZVAL(&z);
> +                                     Z_OBJ_HANDLE(z) = current->handle;
> +                                     Z_OBJ_HT(z) = current->u.handlers;
> +                                     zobj_mark_grey(obj, &z TSRMLS_CC);
> +                             } else {
> +                                     GC_SET_ADDRESS(obj->buffered, NULL);
> +                                     GC_REMOVE_FROM_BUFFER(current);
> +                             }
>                       }
>               } else {
>                       if (GC_ZVAL_GET_COLOR(current->u.pz) == GC_PURPLE) {
> @@ -623,15 +625,17 @@
>       gc_root_buffer *current = GC_G(roots).next;
> 
>       while (current != &GC_G(roots)) {
> -             if (current->handle && EG(objects_store).object_buckets) {
> -                     struct _store_object *obj = 
> &EG(objects_store).object_buckets[current->handle].bucket.obj;
> -                     zval z;
> +             if (current->handle) {
> +                     if (EG(objects_store).object_buckets) {
> +                             struct _store_object *obj = 
> &EG(objects_store).object_buckets[current->handle].bucket.obj;
> +                             zval z;
> 
> -                     GC_SET_ADDRESS(obj->buffered, NULL);
> -                     INIT_PZVAL(&z);
> -                     Z_OBJ_HANDLE(z) = current->handle;
> -                     Z_OBJ_HT(z) = current->u.handlers;
> -                     zobj_collect_white(&z TSRMLS_CC);
> +                             GC_SET_ADDRESS(obj->buffered, NULL);
> +                             INIT_PZVAL(&z);
> +                             Z_OBJ_HANDLE(z) = current->handle;
> +                             Z_OBJ_HT(z) = current->u.handlers;
> +                             zobj_collect_white(&z TSRMLS_CC);
> +                     }
>               } else {
>                       GC_ZVAL_SET_ADDRESS(current->u.pz, NULL);
>                       zval_collect_white(current->u.pz TSRMLS_CC);
> 
> Modified: php/php-src/trunk/Zend/zend_gc.c
> ===================================================================
> --- php/php-src/trunk/Zend/zend_gc.c  2010-09-03 06:41:59 UTC (rev 303015)
> +++ php/php-src/trunk/Zend/zend_gc.c  2010-09-03 09:27:47 UTC (rev 303016)
> @@ -414,19 +414,21 @@
>       gc_root_buffer *current = GC_G(roots).next;
> 
>       while (current != &GC_G(roots)) {
> -             if (current->handle && EG(objects_store).object_buckets) {
> -                     struct _store_object *obj = 
> &EG(objects_store).object_buckets[current->handle].bucket.obj;
> +             if (current->handle) {
> +                     if (EG(objects_store).object_buckets) {
> +                             struct _store_object *obj = 
> &EG(objects_store).object_buckets[current->handle].bucket.obj;
> 
> -                     if (GC_GET_COLOR(obj->buffered) == GC_PURPLE) {
> -                             zval z;
> +                             if (GC_GET_COLOR(obj->buffered) == GC_PURPLE) {
> +                                     zval z;
> 
> -                             INIT_PZVAL(&z);
> -                             Z_OBJ_HANDLE(z) = current->handle;
> -                             Z_OBJ_HT(z) = current->u.handlers;
> -                             zobj_mark_grey(obj, &z TSRMLS_CC);
> -                     } else {
> -                             GC_SET_ADDRESS(obj->buffered, NULL);
> -                             GC_REMOVE_FROM_BUFFER(current);
> +                                     INIT_PZVAL(&z);
> +                                     Z_OBJ_HANDLE(z) = current->handle;
> +                                     Z_OBJ_HT(z) = current->u.handlers;
> +                                     zobj_mark_grey(obj, &z TSRMLS_CC);
> +                             } else {
> +                                     GC_SET_ADDRESS(obj->buffered, NULL);
> +                                     GC_REMOVE_FROM_BUFFER(current);
> +                             }
>                       }
>               } else {
>                       if (GC_ZVAL_GET_COLOR(current->u.pz) == GC_PURPLE) {
> @@ -623,15 +625,17 @@
>       gc_root_buffer *current = GC_G(roots).next;
> 
>       while (current != &GC_G(roots)) {
> -             if (current->handle && EG(objects_store).object_buckets) {
> -                     struct _store_object *obj = 
> &EG(objects_store).object_buckets[current->handle].bucket.obj;
> -                     zval z;
> +             if (current->handle) {
> +                     if (EG(objects_store).object_buckets) {
> +                             struct _store_object *obj = 
> &EG(objects_store).object_buckets[current->handle].bucket.obj;
> +                             zval z;
> 
> -                     GC_SET_ADDRESS(obj->buffered, NULL);
> -                     INIT_PZVAL(&z);
> -                     Z_OBJ_HANDLE(z) = current->handle;
> -                     Z_OBJ_HT(z) = current->u.handlers;
> -                     zobj_collect_white(&z TSRMLS_CC);
> +                             GC_SET_ADDRESS(obj->buffered, NULL);
> +                             INIT_PZVAL(&z);
> +                             Z_OBJ_HANDLE(z) = current->handle;
> +                             Z_OBJ_HT(z) = current->u.handlers;
> +                             zobj_collect_white(&z TSRMLS_CC);
> +                     }
>               } else {
>                       GC_ZVAL_SET_ADDRESS(current->u.pz, NULL);
>                       zval_collect_white(current->u.pz TSRMLS_CC);
> 
> 

-- 
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to