diff options
author | Ben Gamari <ben@smart-cactus.org> | 2022-12-05 18:59:31 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2023-03-08 15:02:31 -0500 |
commit | 0a7eb0aa0bf7e7464e68ab9b6f4176771dcc3590 (patch) | |
tree | c9169f4089a5e93a7845140471906261575587d9 /rts | |
parent | 5d3232baa78dd6f00fc040f75d8e9a8075bfbc07 (diff) | |
download | haskell-0a7eb0aa0bf7e7464e68ab9b6f4176771dcc3590.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.
Diffstat (limited to 'rts')
-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 bbb499f4da..251151f287 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 d5b78ba12d..0309d3a565 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); } } |