Skip to content

Commit 14979f2

Browse files
committed
* 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
1 parent 13dee24 commit 14979f2

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

ChangeLog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
Tue Dec 10 15:28:10 2013 Koichi Sasada <ko1@atdot.net>
2+
3+
* gc.c (RGENGC_CHECK_MODE): separate checkers to different modes.
4+
* 2: enable generational bits check (for debugging)
5+
* 3: enable livness check
6+
* 4: show all references
7+
18
Tue Dec 10 15:15:37 2013 Koichi Sasada <ko1@atdot.net>
29

310
* gc.c (gc_marks_check): disable GC during checking and

gc.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,9 @@ static ruby_gc_params_t gc_params = {
183183
/* RGENGC_CHECK_MODE
184184
* 0: disable all assertions
185185
* 1: enable assertions (to debug RGenGC)
186-
* 2: enable bits check (for debugging)
187-
* 3: show all references
186+
* 2: enable generational bits check (for debugging)
187+
* 3: enable livness check
188+
* 4: show all references
188189
*/
189190
#ifndef RGENGC_CHECK_MODE
190191
#define RGENGC_CHECK_MODE 0
@@ -4197,6 +4198,7 @@ reflist_dump(struct reflist *refs)
41974198
}
41984199
}
41994200

4201+
#if RGENGC_CHECK_MODE >= 3
42004202
static int
42014203
reflist_refered_from_machine_context(struct reflist *refs)
42024204
{
@@ -4207,6 +4209,7 @@ reflist_refered_from_machine_context(struct reflist *refs)
42074209
}
42084210
return 0;
42094211
}
4212+
#endif
42104213

42114214
struct allrefs {
42124215
rb_objspace_t *objspace;
@@ -4297,7 +4300,7 @@ objspace_allrefs_destruct(struct st_table *refs)
42974300
st_free_table(refs);
42984301
}
42994302

4300-
#if RGENGC_CHECK_MODE >= 3
4303+
#if RGENGC_CHECK_MODE >= 4
43014304
static int
43024305
allrefs_dump_i(st_data_t k, st_data_t v, st_data_t ptr)
43034306
{
@@ -4337,9 +4340,11 @@ gc_check_before_marks_i(st_data_t k, st_data_t v, void *ptr)
43374340
/* parent is old */
43384341
if (!MARKED_IN_BITMAP(GET_HEAP_PAGE(parent)->rememberset_bits, parent) &&
43394342
!MARKED_IN_BITMAP(GET_HEAP_PAGE(obj)->rememberset_bits, obj)) {
4340-
fprintf(stderr, "gc_marks_check_i: WB miss %p (%s) -> %p (%s)\n",
4343+
fprintf(stderr, "gc_marks_check_i: WB miss %p (%s) -> %p (%s) ",
43414344
(void *)parent, obj_type_name(parent),
43424345
(void *)obj, obj_type_name(obj));
4346+
reflist_dump(refs);
4347+
fprintf(stderr, "\n");
43434348
objspace->rgengc.error_count++;
43444349
}
43454350
}
@@ -4348,6 +4353,7 @@ gc_check_before_marks_i(st_data_t k, st_data_t v, void *ptr)
43484353
return ST_CONTINUE;
43494354
}
43504355

4356+
#if RGENGC_CHECK_MODE >= 3
43514357
static int
43524358
gc_check_after_marks_i(st_data_t k, st_data_t v, void *ptr)
43534359
{
@@ -4372,6 +4378,7 @@ gc_check_after_marks_i(st_data_t k, st_data_t v, void *ptr)
43724378
}
43734379
return ST_CONTINUE;
43744380
}
4381+
#endif
43754382

43764383
static void
43774384
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
43874394
st_foreach(objspace->rgengc.allrefs_table, checker_func, (st_data_t)objspace);
43884395

43894396
if (objspace->rgengc.error_count > 0) {
4390-
#if RGENGC_CHECK_MODE >= 3
4397+
#if RGENGC_CHECK_MODE >= 4
43914398
allrefs_dump(objspace);
43924399
#endif
43934400
rb_bug("%s: GC has problem.", checker_name);
@@ -4445,7 +4452,7 @@ gc_marks(rb_objspace_t *objspace, int full_mark)
44454452
}
44464453
#endif
44474454

4448-
#if RGENGC_CHECK_MODE >= 2
4455+
#if RGENGC_CHECK_MODE >= 3
44494456
gc_marks_check(objspace, gc_check_after_marks_i, "after_marks");
44504457
#endif
44514458

0 commit comments

Comments
 (0)