summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-10-22 21:41:42 +0000
committerBen Gamari <ben@smart-cactus.org>2023-04-12 07:43:44 -0400
commit22a8eacf55e51439a29393ce3e6170ac03f3abb9 (patch)
treee008664b98c0dc71a434bd603af18dddfaf80d32
parent6b443159148e38a004f575344801e560eafc0351 (diff)
downloadhaskell-22a8eacf55e51439a29393ce3e6170ac03f3abb9.tar.gz
nonmoving: Post-sweep sanity checking
(cherry picked from commit e941801a267a3b9d898b48d90737924a7b7e4da2)
-rw-r--r--rts/sm/NonMoving.c18
1 files 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)