summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-16 07:33:48 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-16 07:33:48 +0000
commite8ee0a24dcd858178cf7016a9169ffe79f1c25ea (patch)
treefccd8a8b32e3479fcc2f617b51469f5a09ce9c91 /gc.c
parent15dd1f9d8bc31697933b26aabdef6472cd49469a (diff)
* gc.c (lazy_sweep): refactoring.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/gc.c b/gc.c
index 108f1f4d28..6b1c9ac6a5 100644
--- a/gc.c
+++ b/gc.c
@@ -2384,16 +2384,19 @@ after_gc_sweep(rb_objspace_t *objspace)
static int
lazy_sweep(rb_objspace_t *objspace)
{
- struct heaps_slot *next;
+ struct heaps_slot *slot, *next;
int result = FALSE;
gc_prof_sweep_timer_start(objspace);
heaps_increment(objspace);
- while (is_lazy_sweeping(objspace)) {
- next = objspace->heap.sweep_slots->next;
- slot_sweep(objspace, objspace->heap.sweep_slots);
- objspace->heap.sweep_slots = next;
+
+ slot = objspace->heap.sweep_slots;
+
+ while (slot) {
+ objspace->heap.sweep_slots = next = slot->next;
+
+ slot_sweep(objspace, slot);
if (!next) after_gc_sweep(objspace);
@@ -2401,6 +2404,8 @@ lazy_sweep(rb_objspace_t *objspace)
result = TRUE;
break;
}
+
+ slot = next;
}
gc_prof_sweep_timer_stop(objspace);