summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2020-09-28 09:43:19 -0700
committerAaron Patterson <tenderlove@ruby-lang.org>2020-09-28 09:45:04 -0700
commitd598654c742eddc4284814021a8d4b1d6e48b604 (patch)
tree73654b4c781a9c131b126137ac2b077943213970 /gc.c
parent664eeda66e1f64d09e0d321e681f2c21916f9c13 (diff)
Fix ASAN and don't check SPECIAL_CONST_P
Heap allocated objects are never special constants. Since we're walking the heap, we know none of these objects can be special. Also, adding the object to the freelist will poison the object, so we can't check that the type is T_NONE after poison.
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c45
1 files changed, 21 insertions, 24 deletions
diff --git a/gc.c b/gc.c
index 075019a315..93652ffd4c 100644
--- a/gc.c
+++ b/gc.c
@@ -8727,33 +8727,30 @@ gc_ref_update(void *vstart, void *vend, size_t stride, void * data)
/* For each object on the page */
for (; v != (VALUE)vend; v += stride) {
- if (!SPECIAL_CONST_P(v)) {
- void *poisoned = asan_poisoned_object_p(v);
- asan_unpoison_object(v, false);
+ void *poisoned = asan_poisoned_object_p(v);
+ asan_unpoison_object(v, false);
- switch (BUILTIN_TYPE(v)) {
- case T_NONE:
- heap_page_add_freeobj(objspace, page, v);
- free_slots++;
- break;
- case T_MOVED:
- break;
- case T_ZOMBIE:
- break;
- default:
- if (RVALUE_WB_UNPROTECTED(v)) {
- page->flags.has_uncollectible_shady_objects = TRUE;
- }
- if (RVALUE_PAGE_MARKING(page, v)) {
- page->flags.has_remembered_objects = TRUE;
- }
- gc_update_object_references(objspace, v);
+ switch (BUILTIN_TYPE(v)) {
+ case T_NONE:
+ heap_page_add_freeobj(objspace, page, v);
+ free_slots++;
+ break;
+ case T_MOVED:
+ break;
+ case T_ZOMBIE:
+ break;
+ default:
+ if (RVALUE_WB_UNPROTECTED(v)) {
+ page->flags.has_uncollectible_shady_objects = TRUE;
}
-
- if (poisoned) {
- GC_ASSERT(BUILTIN_TYPE(v) == T_NONE);
- asan_poison_object(v);
+ if (RVALUE_PAGE_MARKING(page, v)) {
+ page->flags.has_remembered_objects = TRUE;
}
+ gc_update_object_references(objspace, v);
+ }
+
+ if (poisoned) {
+ asan_poison_object(v);
}
}