From 3cd6fe32541d2d19a1084c2cb34de64814c14df5 Mon Sep 17 00:00:00 2001 From: ko1 Date: Tue, 16 Jul 2013 06:00:55 +0000 Subject: * gc.c (after_gc_sweep): refactoring code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- gc.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'gc.c') diff --git a/gc.c b/gc.c index 108f1f4d28..e5ffaccfec 100644 --- a/gc.c +++ b/gc.c @@ -2384,18 +2384,20 @@ after_gc_sweep(rb_objspace_t *objspace) static int lazy_sweep(rb_objspace_t *objspace) { - struct heaps_slot *next; + struct heaps_slot *slot; 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; - if (!next) after_gc_sweep(objspace); + while (slot) { + slot_sweep(objspace, slot); + + if ((objspace->heap.sweep_slots = slot = slot->next) == NULL) { + after_gc_sweep(objspace); + } if (has_free_object) { result = TRUE; -- cgit v1.2.3