wingo pushed a commit to branch wip-whippet
in repository guile.

commit e1ae9819cfde51db5f275d2aa678526ad31f4d77
Author: Andy Wingo <wi...@igalia.com>
AuthorDate: Fri Oct 4 13:49:45 2024 +0200

    gc_object_is_old_generation uses relaxed atomics
---
 api/gc-api.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/api/gc-api.h b/api/gc-api.h
index 3edc80862..2b3f9fcd6 100644
--- a/api/gc-api.h
+++ b/api/gc-api.h
@@ -196,8 +196,9 @@ static inline int gc_object_is_old_generation(struct 
gc_mutator *mut,
     uintptr_t base = addr & ~(alignment - 1);
     size_t granule_size = gc_allocator_small_granule_size();
     uintptr_t granule = (addr & (alignment - 1)) / granule_size;
-    uint8_t *byte = (uint8_t*)(base + granule);
-    return (*byte) & gc_old_generation_check_alloc_table_bit_pattern();
+    uint8_t *byte_loc = (uint8_t*)(base + granule);
+    uint8_t byte = atomic_load_explicit(byte_loc, memory_order_relaxed);
+    return byte & gc_old_generation_check_alloc_table_bit_pattern();
   }
   case GC_OLD_GENERATION_CHECK_SLOW:
     return gc_object_is_old_generation_slow(mut, obj);

Reply via email to