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

commit 0ffa6688aa5c19348a0a674d0d8a553b29dd9df8
Author: Andy Wingo <wi...@pobox.com>
AuthorDate: Fri May 16 22:27:20 2025 +0200

    Adapt to whippet change
---
 libguile/gc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libguile/gc.c b/libguile/gc.c
index 1270b368f..abdfffc32 100644
--- a/libguile/gc.c
+++ b/libguile/gc.c
@@ -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)

Reply via email to