1 |
From c7b95db5ab8e56f708e96611849b7d74a36e0699 Mon Sep 17 00:00:00 2001 |
2 |
From: Dmitry Stogov <dmitry@php.net> |
3 |
Date: Fri, 3 Sep 2010 09:27:47 +0000 |
4 |
Subject: [PATCH] Fixed GC bug |
5 |
|
6 |
--- |
7 |
Zend/zend_gc.c | 42 +++++++++++++++++++++++------------------- |
8 |
1 files changed, 23 insertions(+), 19 deletions(-) |
9 |
|
10 |
diff --git a/Zend/zend_gc.c b/Zend/zend_gc.c |
11 |
index db04652..3237768 100644 |
12 |
--- a/Zend/zend_gc.c |
13 |
+++ b/Zend/zend_gc.c |
14 |
@@ -414,19 +414,21 @@ static void gc_mark_roots(TSRMLS_D) |
15 |
gc_root_buffer *current = GC_G(roots).next; |
16 |
|
17 |
while (current != &GC_G(roots)) { |
18 |
- if (current->handle && EG(objects_store).object_buckets) { |
19 |
- struct _store_object *obj = &EG(objects_store).object_buckets[current->handle].bucket.obj; |
20 |
+ if (current->handle) { |
21 |
+ if (EG(objects_store).object_buckets) { |
22 |
+ struct _store_object *obj = &EG(objects_store).object_buckets[current->handle].bucket.obj; |
23 |
|
24 |
- if (GC_GET_COLOR(obj->buffered) == GC_PURPLE) { |
25 |
- zval z; |
26 |
+ if (GC_GET_COLOR(obj->buffered) == GC_PURPLE) { |
27 |
+ zval z; |
28 |
|
29 |
- INIT_PZVAL(&z); |
30 |
- Z_OBJ_HANDLE(z) = current->handle; |
31 |
- Z_OBJ_HT(z) = current->u.handlers; |
32 |
- zobj_mark_grey(obj, &z TSRMLS_CC); |
33 |
- } else { |
34 |
- GC_SET_ADDRESS(obj->buffered, NULL); |
35 |
- GC_REMOVE_FROM_BUFFER(current); |
36 |
+ INIT_PZVAL(&z); |
37 |
+ Z_OBJ_HANDLE(z) = current->handle; |
38 |
+ Z_OBJ_HT(z) = current->u.handlers; |
39 |
+ zobj_mark_grey(obj, &z TSRMLS_CC); |
40 |
+ } else { |
41 |
+ GC_SET_ADDRESS(obj->buffered, NULL); |
42 |
+ GC_REMOVE_FROM_BUFFER(current); |
43 |
+ } |
44 |
} |
45 |
} else { |
46 |
if (GC_ZVAL_GET_COLOR(current->u.pz) == GC_PURPLE) { |
47 |
@@ -623,15 +625,17 @@ static void gc_collect_roots(TSRMLS_D) |
48 |
gc_root_buffer *current = GC_G(roots).next; |
49 |
|
50 |
while (current != &GC_G(roots)) { |
51 |
- if (current->handle && EG(objects_store).object_buckets) { |
52 |
- struct _store_object *obj = &EG(objects_store).object_buckets[current->handle].bucket.obj; |
53 |
- zval z; |
54 |
+ if (current->handle) { |
55 |
+ if (EG(objects_store).object_buckets) { |
56 |
+ struct _store_object *obj = &EG(objects_store).object_buckets[current->handle].bucket.obj; |
57 |
+ zval z; |
58 |
|
59 |
- GC_SET_ADDRESS(obj->buffered, NULL); |
60 |
- INIT_PZVAL(&z); |
61 |
- Z_OBJ_HANDLE(z) = current->handle; |
62 |
- Z_OBJ_HT(z) = current->u.handlers; |
63 |
- zobj_collect_white(&z TSRMLS_CC); |
64 |
+ GC_SET_ADDRESS(obj->buffered, NULL); |
65 |
+ INIT_PZVAL(&z); |
66 |
+ Z_OBJ_HANDLE(z) = current->handle; |
67 |
+ Z_OBJ_HT(z) = current->u.handlers; |
68 |
+ zobj_collect_white(&z TSRMLS_CC); |
69 |
+ } |
70 |
} else { |
71 |
GC_ZVAL_SET_ADDRESS(current->u.pz, NULL); |
72 |
zval_collect_white(current->u.pz TSRMLS_CC); |
73 |
-- |
74 |
1.7.8 |
75 |
|