wingo pushed a commit to branch wip-whippet in repository guile. commit ff1e1b1d443173e3b5c8b1c161c85319396a7cc1 Author: Andy Wingo <wi...@igalia.com> AuthorDate: Wed Jul 10 11:47:15 2024 +0200
whippet: avoid an atomic load when visiting already-marked objects --- src/whippet.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/whippet.c b/src/whippet.c index af9b3dbd4..9674560c2 100644 --- a/src/whippet.c +++ b/src/whippet.c @@ -678,7 +678,8 @@ static inline int trace_edge(struct gc_heap *heap, struct gc_edge edge) { struct gc_ref ref = gc_edge_ref(edge); int is_new = do_trace(heap, edge, ref); - if (GC_UNLIKELY(atomic_load_explicit(&heap->check_pending_ephemerons, + if (is_new && + GC_UNLIKELY(atomic_load_explicit(&heap->check_pending_ephemerons, memory_order_relaxed))) gc_resolve_pending_ephemerons(ref, heap);