1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

gc_object_is_old_generation uses relaxed atomics

This commit is contained in:
Andy Wingo 2024-10-04 13:49:45 +02:00
parent 3c8c956f4c
commit e1ae9819cf

View file

@ -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);