ruby-changes:29495
From: ko1 <ko1@a...>
Date: Sat, 22 Jun 2013 04:42:14 +0900 (JST)
Subject: [ruby-changes:29495] ko1:r41547 (trunk): * gc.c (slot_sweep_body): rename to slot_sweep().
ko1 2013-06-22 04:42:04 +0900 (Sat, 22 Jun 2013) New Revision: 41547 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41547 Log: * gc.c (slot_sweep_body): rename to slot_sweep(). No need to separate major/minor GC. * gc.c (gc_setup_mark_bits): remove gc_clear_mark_bits() and unify to this function. Modified files: trunk/ChangeLog trunk/gc.c Index: ChangeLog =================================================================== --- ChangeLog (revision 41546) +++ ChangeLog (revision 41547) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sat Jun 22 04:37:08 2013 Koichi Sasada <ko1@a...> + + * gc.c (slot_sweep_body): rename to slot_sweep(). + No need to separate major/minor GC. + + * gc.c (gc_setup_mark_bits): remove gc_clear_mark_bits() and unify to + this function. + Sat Jun 22 04:20:21 2013 Koichi Sasada <ko1@a...> * gc.c (check_bitmap_consistency): add to check flag and bitmap consistency. Index: gc.c =================================================================== --- gc.c (revision 41546) +++ gc.c (revision 41547) @@ -2157,19 +2157,17 @@ lazy_sweep_enable(void) https://github.com/ruby/ruby/blob/trunk/gc.c#L2157 return Qnil; } -#if !USE_RGENGC -static void -gc_clear_slot_bits(struct heaps_slot *slot) -{ - memset(&slot->mark_bits[0], 0, HEAP_BITMAP_SIZE); -} -#else static void gc_setup_mark_bits(struct heaps_slot *slot) { +#if USE_RGENGC + /* copy oldgen bitmap to mark bitmap */ memcpy(&slot->mark_bits[0], &slot->oldgen_bits[0], HEAP_BITMAP_SIZE); -} +#else + /* clear mark bitmap */ + memset(&slot->mark_bits[0], 0, HEAP_BITMAP_SIZE); #endif +} static size_t objspace_live_num(rb_objspace_t *objspace) @@ -2178,7 +2176,7 @@ objspace_live_num(rb_objspace_t *objspac https://github.com/ruby/ruby/blob/trunk/gc.c#L2176 } static inline void -slot_sweep_body(rb_objspace_t *objspace, struct heaps_slot *sweep_slot, const int during_minor_gc) +slot_sweep(rb_objspace_t *objspace, struct heaps_slot *sweep_slot) { int i; size_t empty_num = 0, freed_num = 0, final_num = 0; @@ -2187,7 +2185,7 @@ slot_sweep_body(rb_objspace_t *objspace, https://github.com/ruby/ruby/blob/trunk/gc.c#L2185 int deferred; bits_t *bits, bitset; - rgengc_report(3, objspace, "slot_sweep_body: start.\n"); + rgengc_report(1, objspace, "slot_sweep: start.\n"); p = sweep_slot->header->start; pend = p + sweep_slot->header->limit; offset = p - NUM_IN_SLOT(p); @@ -2204,10 +2202,10 @@ slot_sweep_body(rb_objspace_t *objspace, https://github.com/ruby/ruby/blob/trunk/gc.c#L2202 do { if ((bitset & 1) && BUILTIN_TYPE(p) != T_ZOMBIE) { if (p->as.basic.flags) { - rgengc_report(3, objspace, "slot_sweep_body: free %p (%s)\n", p, obj_type_name((VALUE)p)); + rgengc_report(3, objspace, "slot_sweep: free %p (%s)\n", p, obj_type_name((VALUE)p)); #if USE_RGENGC && RGENGC_CHECK_MODE - if (objspace->rgengc.during_minor_gc && RVALUE_PROMOTED(p)) rb_bug("slot_sweep_body: %p (%s) is promoted.\n", p, obj_type_name((VALUE)p)); - if (rgengc_remembered(objspace, (VALUE)p)) rb_bug("slot_sweep_body: %p (%s) is remembered.\n", p, obj_type_name((VALUE)p)); + if (objspace->rgengc.during_minor_gc && RVALUE_PROMOTED(p)) rb_bug("slot_sweep: %p (%s) is promoted.\n", p, obj_type_name((VALUE)p)); + if (rgengc_remembered(objspace, (VALUE)p)) rb_bug("slot_sweep: %p (%s) is remembered.\n", p, obj_type_name((VALUE)p)); #endif if ((deferred = obj_free(objspace, (VALUE)p)) || (FL_TEST(p, FL_FINALIZE))) { if (!deferred) { @@ -2224,7 +2222,7 @@ slot_sweep_body(rb_objspace_t *objspace, https://github.com/ruby/ruby/blob/trunk/gc.c#L2222 p->as.free.flags = 0; p->as.free.next = sweep_slot->freelist; sweep_slot->freelist = p; - rgengc_report(3, objspace, "slot_sweep_body: %p (%s) is added to freelist\n", p, obj_type_name((VALUE)p)); + rgengc_report(3, objspace, "slot_sweep: %p (%s) is added to freelist\n", p, obj_type_name((VALUE)p)); freed_num++; } } @@ -2238,11 +2236,7 @@ slot_sweep_body(rb_objspace_t *objspace, https://github.com/ruby/ruby/blob/trunk/gc.c#L2236 } } -#if USE_RGENGC gc_setup_mark_bits(sweep_slot); -#else - gc_clear_slot_bits(sweep_slot); -#endif #if GC_PROFILE_MORE_DETAIL if (objspace->profile.run) { @@ -2252,7 +2246,6 @@ slot_sweep_body(rb_objspace_t *objspace, https://github.com/ruby/ruby/blob/trunk/gc.c#L2246 } #endif - if (final_num + freed_num + empty_num == sweep_slot->header->limit && objspace->heap.free_num > objspace->heap.do_heap_free) { RVALUE *pp; @@ -2283,40 +2276,7 @@ slot_sweep_body(rb_objspace_t *objspace, https://github.com/ruby/ruby/blob/trunk/gc.c#L2276 } } - rgengc_report(3, objspace, "slot_sweep_body: end.\n"); -} - -#if USE_RGENGC -static void -slot_sweep_minor(rb_objspace_t *objspace, struct heaps_slot *sweep_slot) -{ - slot_sweep_body(objspace, sweep_slot, TRUE); -} - -static void -slot_sweep_major(rb_objspace_t *objspace, struct heaps_slot *sweep_slot) -{ - slot_sweep_body(objspace, sweep_slot, FALSE); -} -#endif - -static void -slot_sweep(rb_objspace_t *objspace, struct heaps_slot *sweep_slot) -{ - rgengc_report(1, objspace, "slot_sweep: start\n"); - { -#if USE_RGENGC - if (objspace->rgengc.during_minor_gc) { - slot_sweep_minor(objspace, sweep_slot); - } - else { - slot_sweep_major(objspace, sweep_slot); - } -#else - slot_sweep_body(objspace, sweep_slot, FALSE); -#endif - } - rgengc_report(1, objspace, "slot_sweep: end\n"); + rgengc_report(1, objspace, "slot_sweep: end.\n"); } static int -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/