diff options
author | Ben Gamari <ben@well-typed.com> | 2021-09-28 20:53:26 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-10-02 05:19:51 -0400 |
commit | 4264e74d61d53e04d8109127cd52028a72a37eb2 (patch) | |
tree | ade037f036373d121740dd308069e9b030640690 /rts/sm | |
parent | 0d455a18b027261981931cec4cf18d7f900c921d (diff) | |
download | haskell-4264e74d61d53e04d8109127cd52028a72a37eb2.tar.gz |
rts: Add missing write barriers in MVar wake-up paths
Previously PerformPut failed to respect the non-moving collector's
snapshot invariant, hiding references to an MVar and its new value by
overwriting a stack frame without dirtying the stack. Fix this.
PerformTake exhibited a similar bug, failing to dirty (and therefore
mark) the blocked stack before mutating it.
Closes #20399.
Diffstat (limited to 'rts/sm')
-rw-r--r-- | rts/sm/NonMoving.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/rts/sm/NonMoving.c b/rts/sm/NonMoving.c index b92bf2276e..dd019ec18b 100644 --- a/rts/sm/NonMoving.c +++ b/rts/sm/NonMoving.c @@ -229,6 +229,10 @@ Mutex concurrent_coll_finished_lock; * - Note [StgStack dirtiness flags and concurrent marking] (TSO.h) describes * the protocol for concurrent marking of stacks. * + * - Note [Nonmoving write barrier in Perform{Take,Put}] (PrimOps.cmm) describes + * a tricky barrier necessary when resuming threads blocked on MVar + * operations. + * * - Note [Static objects under the nonmoving collector] (Storage.c) describes * treatment of static objects. * |