diff options
| author | Ben Gamari <ben@smart-cactus.org> | 2022-12-05 18:59:31 -0500 |
|---|---|---|
| committer | Ben Gamari <ben@smart-cactus.org> | 2023-04-12 07:43:46 -0400 |
| commit | 357903c492410cac32b7834b714735f6cdff927e (patch) | |
| tree | 650e7bae837f318ded2c9734f412a87385ce27ba | |
| parent | d4e08f0e93c2eddfc2cbabc2e6c2a7132386802a (diff) | |
| download | haskell-357903c492410cac32b7834b714735f6cdff927e.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 ca3bc40255ffadfd0df31ec3a6ec5df7ca7f663e)
| -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 37a19534d2..f05c106612 100644 --- a/rts/sm/NonMoving.c +++ b/rts/sm/NonMoving.c @@ -851,6 +851,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; @@ -926,6 +927,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; @@ -1089,6 +1091,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 fca82f511d..94581d4049 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 1b5601da2c..b043de976e 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); } } |
