diff options
author | Ben Gamari <ben@smart-cactus.org> | 2022-12-05 18:59:31 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2023-01-09 15:22:49 -0500 |
commit | a11bdf9e685996a36046690fe3a8cccd0ddb0f5b (patch) | |
tree | 3840b503f7dfc862f8eba726cc34958171c45a94 | |
parent | b2763a5124f572925b2070a07a98dade35027cb2 (diff) | |
download | haskell-a11bdf9e685996a36046690fe3a8cccd0ddb0f5b.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.
-rw-r--r-- | rts/sm/NonMoving.c | 3 | ||||
-rw-r--r-- | rts/sm/NonMovingMark.c | 2 | ||||
-rw-r--r-- | rts/sm/Storage.c | 3 |
3 files changed, 7 insertions, 1 deletions
diff --git a/rts/sm/NonMoving.c b/rts/sm/NonMoving.c index ae0318d05b..7106a00703 100644 --- a/rts/sm/NonMoving.c +++ b/rts/sm/NonMoving.c @@ -850,6 +850,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; @@ -925,6 +926,7 @@ void nonmovingCollect(StgWeak **dead_weaks, StgTSO **resurrected_threads) 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; @@ -1088,6 +1090,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 1b1e1c7b79..02cecd154f 100644 --- a/rts/sm/NonMovingMark.c +++ b/rts/sm/NonMovingMark.c @@ -271,6 +271,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); @@ -930,6 +931,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 d2926a55f8..648f8ae3d2 100644 --- a/rts/sm/Storage.c +++ b/rts/sm/Storage.c @@ -324,7 +324,8 @@ void storageAddCapabilities (uint32_t from, uint32_t to) // Initialize NonmovingAllocators and UpdRemSets if (RtsFlags.GcFlags.useNonmoving) { nonmovingAddCapabilities(to); - for (i = from; i < to; ++i) { + for (i = from; i < to; i++) { + getCapability(i)->upd_rem_set.queue.blocks = NULL; nonmovingInitUpdRemSet(&getCapability(i)->upd_rem_set); } } |