mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
13dee2481b
commit
14979f2161
2 changed files with 20 additions and 6 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
Tue Dec 10 15:28:10 2013 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
|
* 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@atdot.net>
|
Tue Dec 10 15:15:37 2013 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* gc.c (gc_marks_check): disable GC during checking and
|
* gc.c (gc_marks_check): disable GC during checking and
|
||||||
|
|
19
gc.c
19
gc.c
|
@ -183,8 +183,9 @@ static ruby_gc_params_t gc_params = {
|
||||||
/* RGENGC_CHECK_MODE
|
/* RGENGC_CHECK_MODE
|
||||||
* 0: disable all assertions
|
* 0: disable all assertions
|
||||||
* 1: enable assertions (to debug RGenGC)
|
* 1: enable assertions (to debug RGenGC)
|
||||||
* 2: enable bits check (for debugging)
|
* 2: enable generational bits check (for debugging)
|
||||||
* 3: show all references
|
* 3: enable livness check
|
||||||
|
* 4: show all references
|
||||||
*/
|
*/
|
||||||
#ifndef RGENGC_CHECK_MODE
|
#ifndef RGENGC_CHECK_MODE
|
||||||
#define RGENGC_CHECK_MODE 0
|
#define RGENGC_CHECK_MODE 0
|
||||||
|
@ -4197,6 +4198,7 @@ reflist_dump(struct reflist *refs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if RGENGC_CHECK_MODE >= 3
|
||||||
static int
|
static int
|
||||||
reflist_refered_from_machine_context(struct reflist *refs)
|
reflist_refered_from_machine_context(struct reflist *refs)
|
||||||
{
|
{
|
||||||
|
@ -4207,6 +4209,7 @@ reflist_refered_from_machine_context(struct reflist *refs)
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
struct allrefs {
|
struct allrefs {
|
||||||
rb_objspace_t *objspace;
|
rb_objspace_t *objspace;
|
||||||
|
@ -4297,7 +4300,7 @@ objspace_allrefs_destruct(struct st_table *refs)
|
||||||
st_free_table(refs);
|
st_free_table(refs);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if RGENGC_CHECK_MODE >= 3
|
#if RGENGC_CHECK_MODE >= 4
|
||||||
static int
|
static int
|
||||||
allrefs_dump_i(st_data_t k, st_data_t v, st_data_t ptr)
|
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_data_t v, void *ptr)
|
||||||
/* parent is old */
|
/* parent is old */
|
||||||
if (!MARKED_IN_BITMAP(GET_HEAP_PAGE(parent)->rememberset_bits, parent) &&
|
if (!MARKED_IN_BITMAP(GET_HEAP_PAGE(parent)->rememberset_bits, parent) &&
|
||||||
!MARKED_IN_BITMAP(GET_HEAP_PAGE(obj)->rememberset_bits, obj)) {
|
!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 *)parent, obj_type_name(parent),
|
||||||
(void *)obj, obj_type_name(obj));
|
(void *)obj, obj_type_name(obj));
|
||||||
|
reflist_dump(refs);
|
||||||
|
fprintf(stderr, "\n");
|
||||||
objspace->rgengc.error_count++;
|
objspace->rgengc.error_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4348,6 +4353,7 @@ gc_check_before_marks_i(st_data_t k, st_data_t v, void *ptr)
|
||||||
return ST_CONTINUE;
|
return ST_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if RGENGC_CHECK_MODE >= 3
|
||||||
static int
|
static int
|
||||||
gc_check_after_marks_i(st_data_t k, st_data_t v, void *ptr)
|
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_data_t v, void *ptr)
|
||||||
}
|
}
|
||||||
return ST_CONTINUE;
|
return ST_CONTINUE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gc_marks_check(rb_objspace_t *objspace, int (*checker_func)(ANYARGS), const char *checker_name)
|
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, int (*checker_func)(ANYARGS), const char
|
||||||
st_foreach(objspace->rgengc.allrefs_table, checker_func, (st_data_t)objspace);
|
st_foreach(objspace->rgengc.allrefs_table, checker_func, (st_data_t)objspace);
|
||||||
|
|
||||||
if (objspace->rgengc.error_count > 0) {
|
if (objspace->rgengc.error_count > 0) {
|
||||||
#if RGENGC_CHECK_MODE >= 3
|
#if RGENGC_CHECK_MODE >= 4
|
||||||
allrefs_dump(objspace);
|
allrefs_dump(objspace);
|
||||||
#endif
|
#endif
|
||||||
rb_bug("%s: GC has problem.", checker_name);
|
rb_bug("%s: GC has problem.", checker_name);
|
||||||
|
@ -4445,7 +4452,7 @@ gc_marks(rb_objspace_t *objspace, int full_mark)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if RGENGC_CHECK_MODE >= 2
|
#if RGENGC_CHECK_MODE >= 3
|
||||||
gc_marks_check(objspace, gc_check_after_marks_i, "after_marks");
|
gc_marks_check(objspace, gc_check_after_marks_i, "after_marks");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue