diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-16 06:00:55 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-16 06:00:55 +0000 |
commit | 3cd6fe32541d2d19a1084c2cb34de64814c14df5 (patch) | |
tree | 165fab12bd8ea885dcd0b52cc0e678ebb18d3fd8 /gc.c | |
parent | 241b1e6324112ef83bb0ddf614345ae39b0bf3c3 (diff) | |
download | ruby-3cd6fe32541d2d19a1084c2cb34de64814c14df5.tar.gz |
* gc.c (after_gc_sweep): refactoring code.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -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; |