summaryrefslogtreecommitdiff
path: root/rts/sm/Storage.c
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 /rts/sm/Storage.c
parent1037341648466158fd55bd1d50e1f81c8cfd1516 (diff)
downloadhaskell-26c3827f0b878f5bde7b5261076eb8452847fdb4.tar.gz
Nonmoving: Ensure write barrier vanishes in non-threaded RTS
Diffstat (limited to 'rts/sm/Storage.c')
-rw-r--r--rts/sm/Storage.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c
index 7ed4896301..44163a353f 100644
--- a/rts/sm/Storage.c
+++ b/rts/sm/Storage.c
@@ -430,7 +430,7 @@ lockCAF (StgRegTable *reg, StgIndStatic *caf)
// reference should be in SRTs
ASSERT(orig_info_tbl->layout.payload.ptrs == 0);
// Becuase the payload is empty we just push the SRT
- if (RTS_UNLIKELY(nonmoving_write_barrier_enabled)) {
+ IF_NONMOVING_WRITE_BARRIER_ENABLED {
StgThunkInfoTable *thunk_info = itbl_to_thunk_itbl(orig_info_tbl);
if (thunk_info->i.srt) {
updateRemembSetPushClosure(cap, GET_SRT(thunk_info));
@@ -1144,7 +1144,7 @@ dirty_MUT_VAR(StgRegTable *reg, StgMutVar *mvar, StgClosure *old)
if (mvar->header.info == &stg_MUT_VAR_CLEAN_info) {
mvar->header.info = &stg_MUT_VAR_DIRTY_info;
recordClosureMutated(cap, (StgClosure *) mvar);
- if (RTS_UNLIKELY(nonmoving_write_barrier_enabled != 0)) {
+ IF_NONMOVING_WRITE_BARRIER_ENABLED {
updateRemembSetPushClosure_(reg, old);
}
}
@@ -1166,7 +1166,7 @@ dirty_TVAR(Capability *cap, StgTVar *p,
if (p->header.info == &stg_TVAR_CLEAN_info) {
p->header.info = &stg_TVAR_DIRTY_info;
recordClosureMutated(cap,(StgClosure*)p);
- if (RTS_UNLIKELY(nonmoving_write_barrier_enabled != 0)) {
+ IF_NONMOVING_WRITE_BARRIER_ENABLED {
updateRemembSetPushClosure(cap, old);
}
}
@@ -1183,8 +1183,9 @@ setTSOLink (Capability *cap, StgTSO *tso, StgTSO *target)
if (tso->dirty == 0) {
tso->dirty = 1;
recordClosureMutated(cap,(StgClosure*)tso);
- if (RTS_UNLIKELY(nonmoving_write_barrier_enabled))
+ IF_NONMOVING_WRITE_BARRIER_ENABLED {
updateRemembSetPushClosure(cap, (StgClosure *) tso->_link);
+ }
}
tso->_link = target;
}
@@ -1195,8 +1196,9 @@ setTSOPrev (Capability *cap, StgTSO *tso, StgTSO *target)
if (tso->dirty == 0) {
tso->dirty = 1;
recordClosureMutated(cap,(StgClosure*)tso);
- if (RTS_UNLIKELY(nonmoving_write_barrier_enabled))
+ IF_NONMOVING_WRITE_BARRIER_ENABLED {
updateRemembSetPushClosure(cap, (StgClosure *) tso->block_info.prev);
+ }
}
tso->block_info.prev = target;
}
@@ -1209,8 +1211,9 @@ dirty_TSO (Capability *cap, StgTSO *tso)
recordClosureMutated(cap,(StgClosure*)tso);
}
- if (RTS_UNLIKELY(nonmoving_write_barrier_enabled))
+ IF_NONMOVING_WRITE_BARRIER_ENABLED {
updateRemembSetPushTSO(cap, tso);
+ }
}
void
@@ -1218,8 +1221,9 @@ dirty_STACK (Capability *cap, StgStack *stack)
{
// First push to upd_rem_set before we set stack->dirty since we
// the nonmoving collector may already be marking the stack.
- if (RTS_UNLIKELY(nonmoving_write_barrier_enabled))
+ IF_NONMOVING_WRITE_BARRIER_ENABLED {
updateRemembSetPushStack(cap, stack);
+ }
if (! (stack->dirty & STACK_DIRTY)) {
stack->dirty = STACK_DIRTY;
@@ -1243,7 +1247,7 @@ void
update_MVAR(StgRegTable *reg, StgClosure *p, StgClosure *old_val)
{
Capability *cap = regTableToCapability(reg);
- if (RTS_UNLIKELY(nonmoving_write_barrier_enabled)) {
+ IF_NONMOVING_WRITE_BARRIER_ENABLED {
StgMVar *mvar = (StgMVar *) p;
updateRemembSetPushClosure(cap, old_val);
updateRemembSetPushClosure(cap, (StgClosure *) mvar->head);