diff options
author | Ben Gamari <ben@smart-cactus.org> | 2022-11-30 15:43:36 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2023-03-08 15:02:30 -0500 |
commit | 0baa8752aaefe80ca428fbfa0cbd4e620d67e1a7 (patch) | |
tree | da70cce40fbef7e07eb9679a32ffc86aaf64d438 /rts | |
parent | d4032690a8bf638f6d134cc6592d138eb018f102 (diff) | |
download | haskell-0baa8752aaefe80ca428fbfa0cbd4e620d67e1a7.tar.gz |
nonmoving: Avoid n_caps race
Diffstat (limited to 'rts')
-rw-r--r-- | rts/sm/NonMoving.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/rts/sm/NonMoving.c b/rts/sm/NonMoving.c index 4cb3eebca0..bbb499f4da 100644 --- a/rts/sm/NonMoving.c +++ b/rts/sm/NonMoving.c @@ -843,7 +843,7 @@ static void nonmovingPrepareMark(void) struct NonmovingAllocator *alloca = nonmovingHeap.allocators[alloca_idx]; // Update current segments' snapshot pointers - for (uint32_t cap_n = 0; cap_n < getNumCapabilities(); ++cap_n) { + for (uint32_t cap_n = 0; cap_n < nonmovingHeap.n_caps; ++cap_n) { struct NonmovingSegment *seg = alloca->current[cap_n]; nonmovingSegmentInfo(seg)->next_free_snap = seg->next_free; } @@ -1292,7 +1292,7 @@ void assert_in_nonmoving_heap(StgPtr p) for (int alloca_idx = 0; alloca_idx < NONMOVING_ALLOCA_CNT; ++alloca_idx) { struct NonmovingAllocator *alloca = nonmovingHeap.allocators[alloca_idx]; // Search current segments - for (uint32_t cap_idx = 0; cap_idx < getNumCapabilities(); ++cap_idx) { + for (uint32_t cap_idx = 0; cap_idx < nonmovingHeap.n_caps; ++cap_idx) { struct NonmovingSegment *seg = alloca->current[cap_idx]; if (p >= (P_)seg && p < (((P_)seg) + NONMOVING_SEGMENT_SIZE_W)) { return; @@ -1364,7 +1364,7 @@ void nonmovingPrintAllocator(struct NonmovingAllocator *alloc) debugBelch("%p ", (void*)seg); } debugBelch("\nCurrent segments:\n"); - for (uint32_t i = 0; i < getNumCapabilities(); ++i) { + for (uint32_t i = 0; i < nonmovingHeap.n_caps; ++i) { debugBelch("%p ", alloc->current[i]); } debugBelch("\n"); @@ -1375,7 +1375,7 @@ void locate_object(P_ obj) // Search allocators for (int alloca_idx = 0; alloca_idx < NONMOVING_ALLOCA_CNT; ++alloca_idx) { struct NonmovingAllocator *alloca = nonmovingHeap.allocators[alloca_idx]; - for (uint32_t cap = 0; cap < getNumCapabilities(); ++cap) { + for (uint32_t cap = 0; cap < nonmovingHeap.n_caps; ++cap) { struct NonmovingSegment *seg = alloca->current[cap]; if (obj >= (P_)seg && obj < (((P_)seg) + NONMOVING_SEGMENT_SIZE_W)) { debugBelch("%p is in current segment of capability %d of allocator %d at %p\n", obj, cap, alloca_idx, (void*)seg); |