summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-11-29 23:09:48 -0500
committerBen Gamari <ben@smart-cactus.org>2023-04-12 07:43:22 -0400
commit8a373f232e79152896660c9d4bec2a4d1770865c (patch)
tree382f0066f8b1f2a1d061fab8c25c83537be60ca2
parent66d301136710229d11e32fbff9a1ff5ec47554c0 (diff)
downloadhaskell-8a373f232e79152896660c9d4bec2a4d1770865c.tar.gz
Evac: Squash data race in eval_selector_chain
(cherry picked from commit 9ce9fba46bf3fe1af4ce39dba4276bb241f3ea29)
-rw-r--r--rts/sm/Evac.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/rts/sm/Evac.c b/rts/sm/Evac.c
index e427386f5c..ed75b608a1 100644
--- a/rts/sm/Evac.c
+++ b/rts/sm/Evac.c
@@ -1249,7 +1249,8 @@ selector_chain:
// save any space in any case, and updating with an indirection is
// trickier in a non-collected gen: we would have to update the
// mutable list.
- if (RELAXED_LOAD(&bd->flags) & (BF_EVACUATED | BF_NONMOVING)) {
+ uint16_t flags = RELAXED_LOAD(&bd->flags);
+ if (flags & (BF_EVACUATED | BF_NONMOVING)) {
unchain_thunk_selectors(prev_thunk_selector, (StgClosure *)p);
*q = (StgClosure *)p;
// shortcut, behave as for: if (evac) evacuate(q);
@@ -1265,7 +1266,7 @@ selector_chain:
// (scavenge_mark_stack doesn't deal with IND). BEWARE! This
// bit is very tricky to get right. If you make changes
// around here, test by compiling stage 3 with +RTS -c -RTS.
- if (bd->flags & BF_MARKED) {
+ if (flags & BF_MARKED) {
// must call evacuate() to mark this closure if evac==true
*q = (StgClosure *)p;
if (evac) evacuate(q);