mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fix free objects count condition
Free objects have `T_NONE` as the builtin type. A pointer to a valid array element will never be `NULL`.
This commit is contained in:
parent
e330dceb3f
commit
472740de41
Notes:
git
2022-07-20 17:40:25 +09:00
Merged: https://github.com/ruby/ruby/pull/6153 Merged-By: nobu <nobu@ruby-lang.org>
1 changed files with 3 additions and 2 deletions
5
gc.c
5
gc.c
|
@ -7866,9 +7866,10 @@ gc_verify_heap_page(rb_objspace_t *objspace, struct heap_page *page, VALUE obj)
|
||||||
for (uintptr_t ptr = start; ptr < end; ptr += slot_size) {
|
for (uintptr_t ptr = start; ptr < end; ptr += slot_size) {
|
||||||
VALUE val = (VALUE)ptr;
|
VALUE val = (VALUE)ptr;
|
||||||
void *poisoned = asan_unpoison_object_temporary(val);
|
void *poisoned = asan_unpoison_object_temporary(val);
|
||||||
|
enum ruby_value_type type = BUILTIN_TYPE(val);
|
||||||
|
|
||||||
if (RBASIC(val) == 0) free_objects++;
|
if (type == T_NONE) free_objects++;
|
||||||
if (BUILTIN_TYPE(val) == T_ZOMBIE) zombie_objects++;
|
if (type == T_ZOMBIE) zombie_objects++;
|
||||||
if (RVALUE_PAGE_UNCOLLECTIBLE(page, val) && RVALUE_PAGE_WB_UNPROTECTED(page, val)) {
|
if (RVALUE_PAGE_UNCOLLECTIBLE(page, val) && RVALUE_PAGE_WB_UNPROTECTED(page, val)) {
|
||||||
has_remembered_shady = TRUE;
|
has_remembered_shady = TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue