summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2021-07-21 13:56:32 -0400
committerPeter Zhu <peter@peterzhu.ca>2021-07-21 14:40:44 -0400
commit31144fe9876f5624e1fe7ed8f529e28fc4d65bdb (patch)
treed210af00072f085bd3805a0c122a5955fcaa6f3a /gc.c
parentf5f7010613ee404dfa670eda4fcde4ad24c39a39 (diff)
Change GC verification to walk all pages
`gc_verify_internal_consistency_` does not walk pages in the tomb heap so numbers were off. This commit changes it to walk all allocated pages.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4666
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/gc.c b/gc.c
index 9ccd26d19c..239bf95c46 100644
--- a/gc.c
+++ b/gc.c
@@ -7497,9 +7497,9 @@ check_children_i(const VALUE child, void *ptr)
}
static int
-verify_internal_consistency_i(void *page_start, void *page_end, size_t stride, void *ptr)
+verify_internal_consistency_i(void *page_start, void *page_end, size_t stride,
+ struct verify_internal_consistency_struct *data)
{
- struct verify_internal_consistency_struct *data = (struct verify_internal_consistency_struct *)ptr;
VALUE obj;
rb_objspace_t *objspace = data->objspace;
@@ -7702,8 +7702,10 @@ gc_verify_internal_consistency_(rb_objspace_t *objspace)
gc_report(5, objspace, "gc_verify_internal_consistency: start\n");
/* check relations */
-
- objspace_each_objects(objspace, verify_internal_consistency_i, &data, FALSE);
+ for (size_t i = 0; i < heap_allocated_pages; i++) {
+ struct heap_page *page = heap_pages_sorted[i];
+ verify_internal_consistency_i(page->start, page->start + page->total_slots, sizeof(RVALUE), &data);
+ }
if (data.err_count != 0) {
#if RGENGC_CHECK_MODE >= 5
@@ -7756,8 +7758,7 @@ gc_verify_internal_consistency_(rb_objspace_t *objspace)
if (heap_pages_final_slots != data.zombie_object_count ||
heap_pages_final_slots != list_count) {
- // TODO: debug it
- rb_warn("inconsistent finalizing object count:\n"
+ rb_bug("inconsistent finalizing object count:\n"
" expect %"PRIuSIZE"\n"
" but %"PRIuSIZE" zombies\n"
" heap_pages_deferred_final list has %"PRIuSIZE" items.",