* gc.c (slot_sweep_body): add counters at a time.

* gc.c (gc_profile_dump_on): fix line break position.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2013-06-21 00:24:14 +00:00
parent 4b18db6a2f
commit caf923fa6a
2 changed files with 18 additions and 18 deletions

View File

@ -1,3 +1,9 @@
Fri Jun 21 09:22:16 2013 Koichi Sasada <ko1@atdot.net>
* gc.c (slot_sweep_body): add counters at a time.
* gc.c (gc_profile_dump_on): fix line break position.
Fri Jun 21 08:14:00 2013 Masaya Tarui <tarui@ruby-lang.org> Fri Jun 21 08:14:00 2013 Masaya Tarui <tarui@ruby-lang.org>
* gc.c: refactoring bitmaps. introduce bits_t type and some Consts. * gc.c: refactoring bitmaps. introduce bits_t type and some Consts.

30
gc.c
View File

@ -2209,15 +2209,7 @@ slot_sweep_body(rb_objspace_t *objspace, struct heaps_slot *sweep_slot, const in
RVALUE *final = deferred_final_list; RVALUE *final = deferred_final_list;
int deferred; int deferred;
bits_t *bits, bitset; bits_t *bits, bitset;
#if GC_PROFILE_MORE_DETAIL
gc_profile_record *record=NULL;
#endif
#if GC_PROFILE_MORE_DETAIL
if (objspace->profile.run) {
record = gc_prof_record(objspace);
}
#endif
rgengc_report(3, objspace, "slot_sweep_body: start.\n"); rgengc_report(3, objspace, "slot_sweep_body: start.\n");
p = sweep_slot->header->start; pend = p + sweep_slot->header->limit; p = sweep_slot->header->start; pend = p + sweep_slot->header->limit;
@ -2235,9 +2227,6 @@ slot_sweep_body(rb_objspace_t *objspace, struct heaps_slot *sweep_slot, const in
do { do {
if ((bitset & 1) && BUILTIN_TYPE(p) != T_ZOMBIE) { if ((bitset & 1) && BUILTIN_TYPE(p) != T_ZOMBIE) {
if (p->as.basic.flags) { if (p->as.basic.flags) {
#if GC_PROFILE_MORE_DETAIL
if(record) record->removing_objects++;
#endif
rgengc_report(3, objspace, "slot_sweep_body: free %p (%s)\n", p, obj_type_name((VALUE)p)); rgengc_report(3, objspace, "slot_sweep_body: free %p (%s)\n", p, obj_type_name((VALUE)p));
#if USE_RGENGC && RGENGC_CHECK_MODE #if USE_RGENGC && RGENGC_CHECK_MODE
if (objspace->rgengc.during_minor_gc && RVALUE_PROMOTED((VALUE)p)) rb_bug("slot_sweep_body: %p (%s) is promoted.\n", p, obj_type_name((VALUE)p)); if (objspace->rgengc.during_minor_gc && RVALUE_PROMOTED((VALUE)p)) rb_bug("slot_sweep_body: %p (%s) is promoted.\n", p, obj_type_name((VALUE)p));
@ -2263,10 +2252,6 @@ slot_sweep_body(rb_objspace_t *objspace, struct heaps_slot *sweep_slot, const in
} }
} }
else { else {
#if GC_PROFILE_MORE_DETAIL
if(record)
record->empty_objects++;
#endif
empty_num++; empty_num++;
} }
} }
@ -2275,12 +2260,22 @@ slot_sweep_body(rb_objspace_t *objspace, struct heaps_slot *sweep_slot, const in
} while (bitset); } while (bitset);
} }
} }
#if USE_RGENGC #if USE_RGENGC
gc_setup_mark_bits(sweep_slot); gc_setup_mark_bits(sweep_slot);
#else #else
gc_clear_slot_bits(sweep_slot); gc_clear_slot_bits(sweep_slot);
#endif #endif
#if GC_PROFILE_MORE_DETAIL
if (objspace->profile.run) {
gc_profile_record *record = gc_prof_record(objspace);
record->removing_objects += final_num + freed_num;
record->empty_objects += empty_num;
}
#endif
if (final_num + freed_num + empty_num == sweep_slot->header->limit && if (final_num + freed_num + empty_num == sweep_slot->header->limit &&
objspace->heap.free_num > objspace->heap.do_heap_free) { objspace->heap.free_num > objspace->heap.do_heap_free) {
RVALUE *pp; RVALUE *pp;
@ -5348,10 +5343,9 @@ gc_profile_dump_on(VALUE out, VALUE (*append)(VALUE, VALUE))
#endif #endif
" %9"PRIuSIZE" %17.12f %17.12f %17.12f %10"PRIuSIZE" %10"PRIuSIZE" %10"PRIuSIZE" %10"PRIuSIZE " %9"PRIuSIZE" %17.12f %17.12f %17.12f %10"PRIuSIZE" %10"PRIuSIZE" %10"PRIuSIZE" %10"PRIuSIZE
#if RGENGC_PROFILE #if RGENGC_PROFILE
"%10"PRIuSIZE" %10"PRIuSIZE" %10"PRIuSIZE"\n" "%10"PRIuSIZE" %10"PRIuSIZE" %10"PRIuSIZE
#endif #endif
, "\n",
i+1, i+1,
(record->flags & GPR_FLAG_MINOR) ? '-' : '+', (record->flags & GPR_FLAG_MINOR) ? '-' : '+',
(record->flags & GPR_FLAG_HAVE_FINALIZE) ? 'F' : '.', (record->flags & GPR_FLAG_HAVE_FINALIZE) ? 'F' : '.',