diff options
author | Ben Gamari <ben@smart-cactus.org> | 2022-12-05 18:59:31 -0500 |
---|---|---|
committer | Zubin Duggal <zubin.duggal@gmail.com> | 2023-02-08 19:05:11 +0530 |
commit | 639329fecd5fa7c91ff6adbc4ab85f83538511f9 (patch) | |
tree | b943e3b7161e45579cec370f388c498d5ce5aa3a | |
parent | cf1921ab333234ee3049fd621aedbebc91ccfd77 (diff) | |
download | haskell-639329fecd5fa7c91ff6adbc4ab85f83538511f9.tar.gz |
nonmoving: Be more paranoid in segment tracking
Previously we left various segment link pointers dangling. None of this
wrong per se, but it did make it harder than necessary to debug.
(cherry picked from commit cc75031b4d93d4565e0428cb5910d9b9a645485b)
-rw-r--r-- | rts/sm/NonMoving.c | 3 | ||||
-rw-r--r-- | rts/sm/NonMovingMark.c | 2 | ||||
-rw-r--r-- | rts/sm/Storage.c | 1 |
3 files changed, 6 insertions, 0 deletions
diff --git a/rts/sm/NonMoving.c b/rts/sm/NonMoving.c index fdf09f3678..138c744f44 100644 --- a/rts/sm/NonMoving.c +++ b/rts/sm/NonMoving.c @@ -875,6 +875,7 @@ static void nonmovingPrepareMark(void) // Save the filled segments for later processing during the concurrent // mark phase. + ASSERT(alloca->saved_filled == NULL); alloca->saved_filled = alloca->filled; alloca->filled = NULL; @@ -950,6 +951,7 @@ void nonmovingCollect(StgWeak **dead_weaks STG_UNUSED, StgTSO **resurrected_thre ASSERT(n_nonmoving_marked_compact_blocks == 0); MarkQueue *mark_queue = stgMallocBytes(sizeof(MarkQueue), "mark queue"); + mark_queue->blocks = NULL; initMarkQueue(mark_queue); current_mark_queue = mark_queue; @@ -1118,6 +1120,7 @@ static void nonmovingMark_(MarkQueue *mark_queue, StgWeak **dead_weaks, StgTSO * seg->link = nonmovingHeap.sweep_list; nonmovingHeap.sweep_list = filled; } + nonmovingHeap.allocators[alloca_idx]->saved_filled = NULL; } // Mark Weak#s diff --git a/rts/sm/NonMovingMark.c b/rts/sm/NonMovingMark.c index 8e9a984858..5fe76f3e6f 100644 --- a/rts/sm/NonMovingMark.c +++ b/rts/sm/NonMovingMark.c @@ -277,6 +277,7 @@ static void nonmovingAddUpdRemSetBlocks_(MarkQueue *rset) bdescr *end = start; while (end->link != NULL) end = end->link; + rset->blocks = NULL; // add the blocks to the global remembered set ACQUIRE_LOCK(&upd_rem_set_lock); @@ -924,6 +925,7 @@ static MarkQueueEnt markQueuePop (MarkQueue *q) static void init_mark_queue_ (MarkQueue *queue) { bdescr *bd = allocGroup(MARK_QUEUE_BLOCKS); + ASSERT(queue->blocks == NULL); queue->blocks = bd; queue->top = (MarkQueueBlock *) bd->start; queue->top->head = 0; diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c index fb6fa6d7ed..95358a595a 100644 --- a/rts/sm/Storage.c +++ b/rts/sm/Storage.c @@ -324,6 +324,7 @@ void storageAddCapabilities (uint32_t from, uint32_t to) if (RtsFlags.GcFlags.useNonmoving) { nonmovingAddCapabilities(to); for (i = from; i < to; ++i) { + capabilities[i]->upd_rem_set.queue.blocks = NULL; nonmovingInitUpdRemSet(&capabilities[i]->upd_rem_set); } } |