diff options
author | nari <nari@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-02-21 09:35:07 +0000 |
---|---|---|
committer | nari <nari@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-02-21 09:35:07 +0000 |
commit | 0d44bf83dac7d4abd939273aeccd9182a2b353b8 (patch) | |
tree | 6426200311e0f1154b3e672326794ff92032e8fd /gc.c | |
parent | 2e733be0b2a4f590532a78e4b4539ff539f69d0e (diff) | |
download | ruby-0d44bf83dac7d4abd939273aeccd9182a2b353b8.tar.gz |
* gc.c : remove gc_clear_mark_on_sweep_slots() and use
rest_sweep() instead of it, because some dead objects might be
marked in next the mark phase by false pointers.
[ruby-core:42672]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 26 |
1 files changed, 5 insertions, 21 deletions
@@ -495,14 +495,13 @@ rb_gc_set_params(void) #if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE static void gc_sweep(rb_objspace_t *); static void slot_sweep(rb_objspace_t *, struct heaps_slot *); -static void gc_clear_mark_on_sweep_slots(rb_objspace_t *); +static void rest_sweep(rb_objspace_t *); static void aligned_free(void *); void rb_objspace_free(rb_objspace_t *objspace) { - gc_clear_mark_on_sweep_slots(objspace); - gc_sweep(objspace); + rest_sweep(objspace); if (objspace->profile.record) { free(objspace->profile.record); objspace->profile.record = 0; @@ -2620,21 +2619,6 @@ mark_current_machine_context(rb_objspace_t *objspace, rb_thread_t *th) } static void -gc_clear_mark_on_sweep_slots(rb_objspace_t *objspace) -{ - struct heaps_slot *scan; - - if (objspace->heap.sweep_slots) { - while (heaps_increment(objspace)); - while (objspace->heap.sweep_slots) { - scan = objspace->heap.sweep_slots; - gc_clear_slot_bits(scan); - objspace->heap.sweep_slots = objspace->heap.sweep_slots->next; - } - } -} - -static void gc_marks(rb_objspace_t *objspace) { struct gc_list *list; @@ -2645,8 +2629,6 @@ gc_marks(rb_objspace_t *objspace) objspace->count++; - gc_clear_mark_on_sweep_slots(objspace); - SET_STACK_END; init_mark_stack(objspace); @@ -2703,6 +2685,8 @@ garbage_collect(rb_objspace_t *objspace) GC_PROF_TIMER_START; + rest_sweep(objspace); + during_gc++; gc_marks(objspace); @@ -3212,7 +3196,7 @@ rb_objspace_call_finalizer(rb_objspace_t *objspace) size_t i; /* run finalizers */ - gc_clear_mark_on_sweep_slots(objspace); + rest_sweep(objspace); if (ATOMIC_EXCHANGE(finalizing, 1)) return; |