summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-11-29 23:09:48 -0500
committerZubin Duggal <zubin.duggal@gmail.com>2023-02-08 14:54:43 +0530
commit3d26addfb18c8d03de6fe273bdac361bd82c6b4c (patch)
treea063ef440146a529dd8840b950ce261e59f82af5 /rts
parent0c85bf302176def179609c0950a6ce6a496bcc1e (diff)
downloadhaskell-3d26addfb18c8d03de6fe273bdac361bd82c6b4c.tar.gz
Evac: Squash data race in eval_selector_chain
(cherry picked from commit dd784b3b01f076fa7f5715150c53ad4c183ae79d)
Diffstat (limited to 'rts')
-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 68f2627bb6..c9aee63485 100644
--- a/rts/sm/Evac.c
+++ b/rts/sm/Evac.c
@@ -1251,7 +1251,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);
@@ -1267,7 +1268,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);