diff options
author | Ben Gamari <ben@smart-cactus.org> | 2022-11-30 15:43:36 -0500 |
---|---|---|
committer | Zubin Duggal <zubin.duggal@gmail.com> | 2023-04-14 13:07:39 +0530 |
commit | 1f9376bc8d1e604ef2d1447529d87ccc7b050bb2 (patch) | |
tree | cad663d504da537198db4c333b64a0b65c5a052c | |
parent | 61e6b54d927ac169fc527fc2c94e8a4279de8866 (diff) | |
download | haskell-1f9376bc8d1e604ef2d1447529d87ccc7b050bb2.tar.gz |
nonmoving: Avoid n_caps race
(cherry picked from commit 68fa47f3f5d1c207bd9edd7206bcceb150377647)
-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 32d2481470..37a19534d2 100644 --- a/rts/sm/NonMoving.c +++ b/rts/sm/NonMoving.c @@ -844,7 +844,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; } @@ -1293,7 +1293,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; @@ -1365,7 +1365,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"); @@ -1376,7 +1376,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); |