1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-02 02:10:19 +02:00

Adapt to whippet change

This commit is contained in:
Andy Wingo 2025-05-16 22:27:20 +02:00
parent a344c225c4
commit 0ffa6688aa

View file

@ -65,7 +65,6 @@
struct scm_gc_event_listener {
struct gc_basic_stats stats;
uint64_t last_allocation_counter;
};
struct scm_gc_event_listener_mutator {
@ -144,14 +143,14 @@ scm_gc_event_listener_mutators_stopped (void *data)
struct scm_gc_event_listener *scm_listener = data;
gc_basic_stats_mutators_stopped (&scm_listener->stats);
scm_c_hook_run (&scm_before_gc_c_hook, NULL);
scm_listener->last_allocation_counter = gc_allocation_counter (the_gc_heap);
}
static inline void
scm_gc_event_listener_prepare_gc (void *data, enum gc_collection_kind kind)
scm_gc_event_listener_prepare_gc (void *data, enum gc_collection_kind kind,
uint64_t allocation_counter)
{
struct scm_gc_event_listener *scm_listener = data;
gc_basic_stats_prepare_gc (&scm_listener->stats, kind);
gc_basic_stats_prepare_gc (&scm_listener->stats, kind, allocation_counter);
}
static inline void
@ -358,7 +357,8 @@ SCM_DEFINE (scm_gc_stats, "gc-stats", 0, 0, 0,
uint64_t gc_time_taken = data.stats.cpu_collector_usec * scale_usecs;
size_t heap_size = data.stats.heap_size;
uint64_t total_bytes = gc_allocation_counter (the_gc_heap);
uint64_t bytes_since_gc = total_bytes - data.last_allocation_counter;
uint64_t bytes_since_gc =
total_bytes - data.stats.allocation_counter_at_last_gc;
ssize_t free_bytes = heap_size - data.stats.live_data_size;
free_bytes -= bytes_since_gc;
if (free_bytes < 0)