[commit: ghc] master: StgCmmPrim: Add missing write barrier. (2cb8cc2)
git at git.haskell.org
git at git.haskell.org
Wed Oct 19 13:33:07 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/2cb8cc26df6af431d30b6964710ea2d859ca2bcd/ghc
>---------------------------------------------------------------
commit 2cb8cc26df6af431d30b6964710ea2d859ca2bcd
Author: Peter Trommler <ptrommler at acm.org>
Date: Wed Oct 19 09:02:54 2016 -0400
StgCmmPrim: Add missing write barrier.
On architectures with weak memory consistency a write barrier
is needed before the write to the pointer array.
Fixes #12469
Test Plan: rebuilt Stackage nightly twice on powerpc64le
Reviewers: hvr, rrnewton, erikd, austin, simonmar, bgamari
Reviewed By: erikd, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2525
GHC Trac Issues: #12469
>---------------------------------------------------------------
2cb8cc26df6af431d30b6964710ea2d859ca2bcd
compiler/codeGen/StgCmmPrim.hs | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/compiler/codeGen/StgCmmPrim.hs b/compiler/codeGen/StgCmmPrim.hs
index 2169465..34c2d06 100644
--- a/compiler/codeGen/StgCmmPrim.hs
+++ b/compiler/codeGen/StgCmmPrim.hs
@@ -1350,6 +1350,10 @@ doWritePtrArrayOp :: CmmExpr
doWritePtrArrayOp addr idx val
= do dflags <- getDynFlags
let ty = cmmExprType dflags val
+ -- This write barrier is to ensure that the heap writes to the object
+ -- referred to by val have happened before we write val into the array.
+ -- See #12469 for details.
+ emitPrimCall [] MO_WriteBarrier []
mkBasicIndexedWrite (arrPtrsHdrSize dflags) Nothing addr ty idx val
emit (setInfo addr (CmmLit (CmmLabel mkMAP_DIRTY_infoLabel)))
-- the write barrier. We must write a byte into the mark table:
More information about the ghc-commits
mailing list