1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-07 04:30:18 +02:00

Remove BDW usage from gc.c

* libguile/atomics-internal.h (scm_atomic_subtract_size): New helper.
* libguile/gc.c (scm_gc_register_allocation): Rework to use atomics.
(scm_gc_event_listener_restarting_mutators): Reset the
off_heap_allocation_countdown to the heap size after GC.
(scm_gc_disable, scm_gc_enable): Remove these.  Unclear what they mean
exactly!  Perhaps if there is a meaning we can look at it later.
(scm_i_gc):
(scm_storage_prehistory):
(scm_init_gc): Update.
This commit is contained in:
Andy Wingo 2025-05-15 15:53:34 +02:00
parent d560676572
commit f71775f396
3 changed files with 31 additions and 62 deletions

View file

@ -45,6 +45,12 @@ scm_atomic_compare_and_swap_uint32 (uint32_t *loc, uint32_t *expected,
atomic_uint_least32_t *a_loc = (atomic_uint_least32_t *) loc;
return atomic_compare_exchange_weak (a_loc, expected, desired);
}
static inline size_t
scm_atomic_subtract_size (size_t *loc, size_t arg)
{
atomic_size_t *a_loc = (atomic_size_t *) loc;
return atomic_fetch_sub (a_loc, arg);
}
static inline void
scm_atomic_set_pointer (void **loc, void *val)
{
@ -131,6 +137,17 @@ scm_atomic_compare_and_swap_uint32 (uint32_t *loc, uint32_t *expected,
return ret;
}
static inline size_t
scm_atomic_subtract_size (size_t *loc, size_t arg)
{
size_t ret;
scm_i_pthread_mutex_lock (&atomics_lock);
ret = *loc;
*loc -= arg;
scm_i_pthread_mutex_unlock (&atomics_lock);
return ret;
}
static inline void
scm_atomic_set_pointer (void **loc, void *val)
{