diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/Cmm.h | 12 | ||||
-rw-r--r-- | includes/Stg.h | 18 | ||||
-rw-r--r-- | includes/rts/NonMoving.h | 2 |
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); |