summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-16 20:41:49 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-16 20:41:49 +0000
commit82d06c5adeaa54e451e9f873d63b27e3e47f91db (patch)
tree9ab483c2ad8c186caa2b1ac35686788ef55fc4a5 /gc.c
parentf9718bf703a9cffdc47b6fb69f77ffcb0a838655 (diff)
* gc.c (objspace_each_objects): do not skip empty RVALUEs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43313 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/gc.c b/gc.c
index 6830e78ab6..4289b8af6e 100644
--- a/gc.c
+++ b/gc.c
@@ -1411,16 +1411,12 @@ objspace_each_objects(VALUE arg)
RVALUE *pstart, *pend;
rb_objspace_t *objspace = &rb_objspace;
struct each_obj_args *args = (struct each_obj_args *)arg;
- volatile VALUE v;
i = 0;
while (i < heap_used) {
- while (0 < i && last_body < objspace->heap.sorted[i-1]->body)
- i--;
- while (i < heap_used && objspace->heap.sorted[i]->body <= last_body)
- i++;
- if (heap_used <= i)
- break;
+ while (0 < i && last_body < objspace->heap.sorted[i-1]->body) i--;
+ while (i < heap_used && objspace->heap.sorted[i]->body <= last_body) i++;
+ if (heap_used <= i) break;
slot = objspace->heap.sorted[i];
last_body = slot->body;
@@ -1428,19 +1424,10 @@ objspace_each_objects(VALUE arg)
pstart = slot->start;
pend = pstart + slot->limit;
- for (; pstart != pend; pstart++) {
- if (pstart->as.basic.flags) {
- v = (VALUE)pstart; /* acquire to save this object */
- break;
- }
- }
- if (pstart != pend) {
- if ((*args->callback)(pstart, pend, sizeof(RVALUE), args->data)) {
- break;
- }
+ if ((*args->callback)(pstart, pend, sizeof(RVALUE), args->data)) {
+ break;
}
}
- RB_GC_GUARD(v);
return Qnil;
}