From 82d06c5adeaa54e451e9f873d63b27e3e47f91db Mon Sep 17 00:00:00 2001 From: ko1 Date: Wed, 16 Oct 2013 20:41:49 +0000 Subject: * 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 --- gc.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) (limited to 'gc.c') 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; } -- cgit v1.2.3