From 22a8eacf55e51439a29393ce3e6170ac03f3abb9 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Sat, 22 Oct 2022 21:41:42 +0000 Subject: nonmoving: Post-sweep sanity checking (cherry picked from commit e941801a267a3b9d898b48d90737924a7b7e4da2) --- rts/sm/NonMoving.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/rts/sm/NonMoving.c b/rts/sm/NonMoving.c index 405d365dc6..32d2481470 100644 --- a/rts/sm/NonMoving.c +++ b/rts/sm/NonMoving.c @@ -25,9 +25,12 @@ #include "NonMovingSweep.h" #include "NonMovingCensus.h" #include "StablePtr.h" // markStablePtrTable +#include "Sanity.h" #include "Schedule.h" // markScheduler #include "Weak.h" // scheduleFinalizers +//#define NONCONCURRENT_SWEEP + struct NonmovingHeap nonmovingHeap; uint8_t nonmovingMarkEpoch = 1; @@ -289,8 +292,8 @@ Mutex concurrent_coll_finished_lock; * was (unsurprisingly) also found to result in significant amounts of * unnecessary copying. * - * Consequently, we now allow aging. Aging allows the preparatory GC leading up - * to a major collection to evacuate some objects into the young generation. + * Consequently, we now allow "aging", allows the preparatory GC leading up + * to a major collection to evacuate objects into the young generation. * However, this introduces the following tricky case that might arise after * we have finished the preparatory GC: * @@ -1192,7 +1195,7 @@ static void nonmovingMark_(MarkQueue *mark_queue, StgWeak **dead_weaks, StgTSO * #endif // Everything has been marked; allow the mutators to proceed -#if defined(THREADED_RTS) +#if defined(THREADED_RTS) && !defined(NONCONCURRENT_SWEEP) nonmoving_write_barrier_enabled = false; nonmovingFinishFlush(task); #endif @@ -1231,6 +1234,15 @@ static void nonmovingMark_(MarkQueue *mark_queue, StgWeak **dead_weaks, StgTSO * nonmovingTraceAllocatorCensus(); #endif +#if defined(THREADED_RTS) && defined(NONCONCURRENT_SWEEP) +#if defined(DEBUG) + checkNonmovingHeap(&nonmovingHeap); + checkSanity(true, true); +#endif + nonmoving_write_barrier_enabled = false; + nonmovingFinishFlush(task); +#endif + // TODO: Remainder of things done by GarbageCollect (update stats) #if defined(THREADED_RTS) -- cgit v1.2.1