summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-05-19 13:29:42 -0400
committerBen Gamari <ben@smart-cactus.org>2019-10-21 11:43:54 -0400
commit26c3827f0b878f5bde7b5261076eb8452847fdb4 (patch)
tree45d7ab2d4c838f555fe605a8ef16aec69f703fe4 /includes
parent1037341648466158fd55bd1d50e1f81c8cfd1516 (diff)
downloadhaskell-26c3827f0b878f5bde7b5261076eb8452847fdb4.tar.gz
Nonmoving: Ensure write barrier vanishes in non-threaded RTS
Diffstat (limited to 'includes')
-rw-r--r--includes/Cmm.h12
-rw-r--r--includes/Stg.h18
-rw-r--r--includes/rts/NonMoving.h2
3 files changed, 26 insertions, 6 deletions
diff --git a/includes/Cmm.h b/includes/Cmm.h
index 42aa0bf550..546e81e8f6 100644
--- a/includes/Cmm.h
+++ b/includes/Cmm.h
@@ -950,19 +950,23 @@
return (dst);
+//
+// Nonmoving write barrier helpers
+//
+// See Note [Update remembered set] in NonMovingMark.c.
+
#if defined(THREADED_RTS)
-#define IF_WRITE_BARRIER_ENABLED \
+#define IF_NONMOVING_WRITE_BARRIER_ENABLED \
if (W_[nonmoving_write_barrier_enabled] != 0) (likely: False)
#else
// A similar measure is also taken in rts/NonMoving.h, but that isn't visible from C--
-#define IF_WRITE_BARRIER_ENABLED \
+#define IF_NONMOVING_WRITE_BARRIER_ENABLED \
if (0)
#define nonmoving_write_barrier_enabled 0
#endif
// A useful helper for pushing a pointer to the update remembered set.
-// See Note [Update remembered set] in NonMovingMark.c.
#define updateRemembSetPushPtr(p) \
- IF_WRITE_BARRIER_ENABLED { \
+ IF_NONMOVING_WRITE_BARRIER_ENABLED { \
ccall updateRemembSetPushClosure_(BaseReg "ptr", p "ptr"); \
}
diff --git a/includes/Stg.h b/includes/Stg.h
index 73de97055f..8f0abdbf6d 100644
--- a/includes/Stg.h
+++ b/includes/Stg.h
@@ -597,3 +597,21 @@ typedef union {
c; \
})
#endif
+
+/* -----------------------------------------------------------------------------
+ Nonmoving GC write barrier
+ -------------------------------------------------------------------------- */
+
+// Note that RTS code should not condition on this directly by rather
+// use the IF_NONMOVING_WRITE_BARRIER_ENABLED macro to ensure that
+// the barrier is eliminated in the non-threaded RTS.
+extern StgWord DLL_IMPORT_DATA_VAR(nonmoving_write_barrier_enabled);
+
+// A similar macro is defined in includes/Cmm.h for C-- code.
+#if defined(THREADED_RTS)
+#define IF_NONMOVING_WRITE_BARRIER_ENABLED \
+ if (RTS_UNLIKELY(nonmoving_write_barrier_enabled))
+#else
+#define IF_NONMOVING_WRITE_BARRIER_ENABLED \
+ if (0)
+#endif
diff --git a/includes/rts/NonMoving.h b/includes/rts/NonMoving.h
index 6a6d96b2c8..f64769e8a9 100644
--- a/includes/rts/NonMoving.h
+++ b/includes/rts/NonMoving.h
@@ -20,5 +20,3 @@ void updateRemembSetPushClosure_(StgRegTable *reg, StgClosure *p);
void updateRemembSetPushClosure(Capability *cap, StgClosure *p);
void updateRemembSetPushThunk_(StgRegTable *reg, StgThunk *p);
-
-extern StgWord DLL_IMPORT_DATA_VAR(nonmoving_write_barrier_enabled);