ruby-changes:32033
From: ko1 <ko1@a...>
Date: Tue, 10 Dec 2013 15:44:41 +0900 (JST)
Subject: [ruby-changes:32033] ko1:r44112 (trunk): * gc.c (RGENGC_CHECK_MODE): separate checkers to different modes.
ko1 2013-12-10 15:44:35 +0900 (Tue, 10 Dec 2013) New Revision: 44112 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44112 Log: * gc.c (RGENGC_CHECK_MODE): separate checkers to different modes. * 2: enable generational bits check (for debugging) * 3: enable livness check * 4: show all references Modified files: trunk/ChangeLog trunk/gc.c Index: ChangeLog =================================================================== --- ChangeLog (revision 44111) +++ ChangeLog (revision 44112) @@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Dec 10 15:28:10 2013 Koichi Sasada <ko1@a...> + + * gc.c (RGENGC_CHECK_MODE): separate checkers to different modes. + * 2: enable generational bits check (for debugging) + * 3: enable livness check + * 4: show all references + Tue Dec 10 15:15:37 2013 Koichi Sasada <ko1@a...> * gc.c (gc_marks_check): disable GC during checking and Index: gc.c =================================================================== --- gc.c (revision 44111) +++ gc.c (revision 44112) @@ -183,8 +183,9 @@ static ruby_gc_params_t gc_params = { https://github.com/ruby/ruby/blob/trunk/gc.c#L183 /* RGENGC_CHECK_MODE * 0: disable all assertions * 1: enable assertions (to debug RGenGC) - * 2: enable bits check (for debugging) - * 3: show all references + * 2: enable generational bits check (for debugging) + * 3: enable livness check + * 4: show all references */ #ifndef RGENGC_CHECK_MODE #define RGENGC_CHECK_MODE 0 @@ -4197,6 +4198,7 @@ reflist_dump(struct reflist *refs) https://github.com/ruby/ruby/blob/trunk/gc.c#L4198 } } +#if RGENGC_CHECK_MODE >= 3 static int reflist_refered_from_machine_context(struct reflist *refs) { @@ -4207,6 +4209,7 @@ reflist_refered_from_machine_context(str https://github.com/ruby/ruby/blob/trunk/gc.c#L4209 } return 0; } +#endif struct allrefs { rb_objspace_t *objspace; @@ -4297,7 +4300,7 @@ objspace_allrefs_destruct(struct st_tabl https://github.com/ruby/ruby/blob/trunk/gc.c#L4300 st_free_table(refs); } -#if RGENGC_CHECK_MODE >= 3 +#if RGENGC_CHECK_MODE >= 4 static int allrefs_dump_i(st_data_t k, st_data_t v, st_data_t ptr) { @@ -4337,9 +4340,11 @@ gc_check_before_marks_i(st_data_t k, st_ https://github.com/ruby/ruby/blob/trunk/gc.c#L4340 /* parent is old */ if (!MARKED_IN_BITMAP(GET_HEAP_PAGE(parent)->rememberset_bits, parent) && !MARKED_IN_BITMAP(GET_HEAP_PAGE(obj)->rememberset_bits, obj)) { - fprintf(stderr, "gc_marks_check_i: WB miss %p (%s) -> %p (%s)\n", + fprintf(stderr, "gc_marks_check_i: WB miss %p (%s) -> %p (%s) ", (void *)parent, obj_type_name(parent), (void *)obj, obj_type_name(obj)); + reflist_dump(refs); + fprintf(stderr, "\n"); objspace->rgengc.error_count++; } } @@ -4348,6 +4353,7 @@ gc_check_before_marks_i(st_data_t k, st_ https://github.com/ruby/ruby/blob/trunk/gc.c#L4353 return ST_CONTINUE; } +#if RGENGC_CHECK_MODE >= 3 static int gc_check_after_marks_i(st_data_t k, st_data_t v, void *ptr) { @@ -4372,6 +4378,7 @@ gc_check_after_marks_i(st_data_t k, st_d https://github.com/ruby/ruby/blob/trunk/gc.c#L4378 } return ST_CONTINUE; } +#endif static void gc_marks_check(rb_objspace_t *objspace, int (*checker_func)(ANYARGS), const char *checker_name) @@ -4387,7 +4394,7 @@ gc_marks_check(rb_objspace_t *objspace, https://github.com/ruby/ruby/blob/trunk/gc.c#L4394 st_foreach(objspace->rgengc.allrefs_table, checker_func, (st_data_t)objspace); if (objspace->rgengc.error_count > 0) { -#if RGENGC_CHECK_MODE >= 3 +#if RGENGC_CHECK_MODE >= 4 allrefs_dump(objspace); #endif rb_bug("%s: GC has problem.", checker_name); @@ -4445,7 +4452,7 @@ gc_marks(rb_objspace_t *objspace, int fu https://github.com/ruby/ruby/blob/trunk/gc.c#L4452 } #endif -#if RGENGC_CHECK_MODE >= 2 +#if RGENGC_CHECK_MODE >= 3 gc_marks_check(objspace, gc_check_after_marks_i, "after_marks"); #endif -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/