summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-11-15 15:49:02 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-12-16 16:12:45 -0500
commitad0e260af691ad47d73b22e698f6a4c08a6e9434 (patch)
treed983a0b92b3991132167ffcff97f40e86e4fb530
parenteb1a013648f6c4ff7704a99a7c654f7dec787b63 (diff)
downloadhaskell-ad0e260af691ad47d73b22e698f6a4c08a6e9434.tar.gz
rts: Use ordered accesses instead of explicit barriers
-rw-r--r--rts/PrimOps.cmm8
-rw-r--r--rts/include/Cmm.h6
2 files changed, 6 insertions, 8 deletions
diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm
index 94e2eb28f5..0868fdaa9e 100644
--- a/rts/PrimOps.cmm
+++ b/rts/PrimOps.cmm
@@ -1728,7 +1728,7 @@ stg_takeMVarzh ( P_ mvar /* :: MVar a */ )
// Write barrier before we make the new MVAR_TSO_QUEUE
// visible to other cores.
// See Note [Heap memory barriers]
- prim_write_barrier;
+ RELEASE_FENCE;
if (StgMVar_head(mvar) == stg_END_TSO_QUEUE_closure) {
StgMVar_head(mvar) = q;
@@ -1895,7 +1895,7 @@ stg_putMVarzh ( P_ mvar, /* :: MVar a */
SET_HDR(q, stg_MVAR_TSO_QUEUE_info, CCS_SYSTEM);
// See Note [Heap memory barriers]
- prim_write_barrier;
+ RELEASE_FENCE;
if (StgMVar_head(mvar) == stg_END_TSO_QUEUE_closure) {
StgMVar_head(mvar) = q;
@@ -2104,7 +2104,7 @@ stg_readMVarzh ( P_ mvar, /* :: MVar a */ )
SET_HDR(q, stg_MVAR_TSO_QUEUE_info, CCS_SYSTEM);
// See Note [Heap memory barriers]
- prim_write_barrier;
+ RELEASE_FENCE;
StgTSO__link(CurrentTSO) = q;
StgTSO_block_info(CurrentTSO) = mvar;
@@ -2237,7 +2237,7 @@ stg_readIOPortzh ( P_ ioport /* :: IOPort a */ )
SET_HDR(q, stg_MVAR_TSO_QUEUE_info, CCS_SYSTEM);
// See Note [Heap memory barriers]
- prim_write_barrier;
+ RELEASE_FENCE;
StgMVar_head(ioport) = q;
StgTSO__link(CurrentTSO) = q;
diff --git a/rts/include/Cmm.h b/rts/include/Cmm.h
index fb267a5581..9d2ebda52f 100644
--- a/rts/include/Cmm.h
+++ b/rts/include/Cmm.h
@@ -278,8 +278,7 @@
// "used".
#define LOAD_INFO_ACQUIRE(ret,x) \
- info = %INFO_PTR(UNTAG(x)); \
- prim_read_barrier;
+ info = %acquire StgHeader_info(UNTAG(x));
#define UNTAG_IF_PROF(x) UNTAG(x)
@@ -289,8 +288,7 @@
if (GETTAG(x) != 0) { \
ret(x); \
} \
- info = %INFO_PTR(x); \
- prim_read_barrier;
+ info = %acquire StgHeader_info(x);
#define UNTAG_IF_PROF(x) (x) /* already untagged */