From adaffab3da7ad6dfa6ee486fdd308758338e6560 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Fri, 10 Nov 2023 15:07:45 +0100 Subject: [PATCH] Fix a case where we might miss some sweeping Unlike next_hole, next_hole_in_block doesn't finish_hole, so it doesn't clear metadata bits. Fix to always finish_hole when finish_sweeping_in_block. --- src/whippet.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/whippet.c b/src/whippet.c index 465f3570d..28f296764 100644 --- a/src/whippet.c +++ b/src/whippet.c @@ -2185,15 +2185,13 @@ static size_t next_hole(struct gc_mutator *mut) { } static void finish_sweeping_in_block(struct gc_mutator *mut) { - while (next_hole_in_block(mut)) - finish_hole(mut); + do { finish_hole(mut); } while (next_hole_in_block(mut)); } // Another thread is triggering GC. Before we stop, finish clearing the // dead mark bytes for the mutator's block, and release the block. static void finish_sweeping(struct gc_mutator *mut) { - while (next_hole(mut)) - finish_hole(mut); + while (next_hole(mut)) {} } static void trigger_collection(struct gc_mutator *mut,