aboutsummaryrefslogtreecommitdiffstats
path: root/gc.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-07-20 17:39:54 +0900
committerGitHub <noreply@github.com>2022-07-20 17:39:54 +0900
commit472740de4184c214dfaaf6189fe3bb1b17a15ecc (patch)
tree75387b8bf90c1fdec4d4a60b0436ede8076e1e51 /gc.c
parente330dceb3f1c29cc5da76e69dda1082dcccb9061 (diff)
downloadruby-472740de4184c214dfaaf6189fe3bb1b17a15ecc.tar.gz
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`.
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gc.c b/gc.c
index e92a576c29..6fbcd74eb1 100644
--- a/gc.c
+++ b/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) {
VALUE val = (VALUE)ptr;
void *poisoned = asan_unpoison_object_temporary(val);
+ enum ruby_value_type type = BUILTIN_TYPE(val);
- if (RBASIC(val) == 0) free_objects++;
- if (BUILTIN_TYPE(val) == T_ZOMBIE) zombie_objects++;
+ if (type == T_NONE) free_objects++;
+ if (type == T_ZOMBIE) zombie_objects++;
if (RVALUE_PAGE_UNCOLLECTIBLE(page, val) && RVALUE_PAGE_WB_UNPROTECTED(page, val)) {
has_remembered_shady = TRUE;
}