summaryrefslogtreecommitdiff
path: root/rts/sm
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-11-10 13:18:04 -0500
committerMatthew Pickering <matthewtpickering@gmail.com>2023-01-06 15:21:48 +0000
commitd276bb54642c3fe29caa59e7ee01199427d020fc (patch)
treecf19ebbe71cf393f1b5916eb27050c129c8ebfd2 /rts/sm
parenta169f7a8fa86b6c87fbf430f4efbab6c83a1e068 (diff)
downloadhaskell-d276bb54642c3fe29caa59e7ee01199427d020fc.tar.gz
nonmoving: Use atomic when looking at bd->gen
Since it may have been mutated by a moving GC. (cherry picked from commit 602455c9ae6e5a2746f43b1811bb3c54efb0a6f5)
Diffstat (limited to 'rts/sm')
-rw-r--r--rts/sm/NonMovingMark.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/rts/sm/NonMovingMark.c b/rts/sm/NonMovingMark.c
index a42c3c46ce..98aef4ce47 100644
--- a/rts/sm/NonMovingMark.c
+++ b/rts/sm/NonMovingMark.c
@@ -1281,7 +1281,10 @@ mark_closure (MarkQueue *queue, const StgClosure *p0, StgClosure **origin)
bd = Bdescr((StgPtr) p);
- if (bd->gen != oldest_gen) {
+ // This must be a relaxed load since the object may be a large object,
+ // in which case evacuation by the moving collector will result in
+ // mutation.
+ if (RELAXED_LOAD(&bd->gen) != oldest_gen) {
// Here we have an object living outside of the non-moving heap. While
// we likely evacuated nearly everything to the nonmoving heap during
// preparation there are nevertheless a few ways in which we might trace