* gc.c (lazy_sweep): refactoring.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2013-07-16 07:33:48 +00:00
parent 15dd1f9d8b
commit e8ee0a24dc
2 changed files with 14 additions and 5 deletions

View File

@ -1,3 +1,7 @@
Tue Jul 16 16:30:58 2013 Koichi Sasada <ko1@atdot.net>
* gc.c (lazy_sweep): refactoring.
Tue Jul 16 13:32:06 2013 Nobuyoshi Nakada <nobu@ruby-lang.org> Tue Jul 16 13:32:06 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* encoding.c (enc_set_index): since r41967, old terminator is dealt * encoding.c (enc_set_index): since r41967, old terminator is dealt

15
gc.c
View File

@ -2384,16 +2384,19 @@ after_gc_sweep(rb_objspace_t *objspace)
static int static int
lazy_sweep(rb_objspace_t *objspace) lazy_sweep(rb_objspace_t *objspace)
{ {
struct heaps_slot *next; struct heaps_slot *slot, *next;
int result = FALSE; int result = FALSE;
gc_prof_sweep_timer_start(objspace); gc_prof_sweep_timer_start(objspace);
heaps_increment(objspace); heaps_increment(objspace);
while (is_lazy_sweeping(objspace)) {
next = objspace->heap.sweep_slots->next; slot = objspace->heap.sweep_slots;
slot_sweep(objspace, objspace->heap.sweep_slots);
objspace->heap.sweep_slots = next; while (slot) {
objspace->heap.sweep_slots = next = slot->next;
slot_sweep(objspace, slot);
if (!next) after_gc_sweep(objspace); if (!next) after_gc_sweep(objspace);
@ -2401,6 +2404,8 @@ lazy_sweep(rb_objspace_t *objspace)
result = TRUE; result = TRUE;
break; break;
} }
slot = next;
} }
gc_prof_sweep_timer_stop(objspace); gc_prof_sweep_timer_stop(objspace);