summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-11-10 13:18:04 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-12-23 19:09:30 -0500
commit602455c9ae6e5a2746f43b1811bb3c54efb0a6f5 (patch)
treeb73d9ef83c46bfc69c494a33f6fc75d765db6f77
parent11241efa3422fae97aed0abb1857baab2f9018fb (diff)
downloadhaskell-602455c9ae6e5a2746f43b1811bb3c54efb0a6f5.tar.gz
nonmoving: Use atomic when looking at bd->gen
Since it may have been mutated by a moving GC.
-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