1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

check the object is in tomb_heap.

This commit is contained in:
Koichi Sasada 2019-05-27 08:19:30 +01:00
parent 35146c4368
commit b3602f1d20

13
gc.c
View file

@ -1087,8 +1087,21 @@ check_rvalue_consistency_force(const VALUE obj, int terminate)
err++; err++;
} }
else if (!is_pointer_to_heap(objspace, (void *)obj)) { else if (!is_pointer_to_heap(objspace, (void *)obj)) {
/* check if it is in tomb_pages */
struct heap_page *page;
list_for_each(&heap_tomb->pages, page, page_node) {
if (&page->start[0] <= (RVALUE *)obj &&
(RVALUE *)obj < &page->start[page->total_slots]) {
fprintf(stderr, "check_rvalue_consistency: %p is in a tomb_heap (%p).\n",
(void *)obj, (void *)page);
err++;
goto skip;
}
}
fprintf(stderr, "check_rvalue_consistency: %p is not a Ruby object.\n", (void *)obj); fprintf(stderr, "check_rvalue_consistency: %p is not a Ruby object.\n", (void *)obj);
err++; err++;
skip:
;
} }
else { else {
const int wb_unprotected_bit = RVALUE_WB_UNPROTECTED_BITMAP(obj) != 0; const int wb_unprotected_bit = RVALUE_WB_UNPROTECTED_BITMAP(obj) != 0;