diff options
author | nineonine <mail4chemik@gmail.com> | 2021-11-04 00:43:57 -0700 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-12-02 21:45:49 -0500 |
commit | 0e274c39bf836d5bb846f5fa08649c75f85326ac (patch) | |
tree | 4361370ce5f434c91b5e10340c6fad1d53c73855 /rts | |
parent | 99eb54bd35ae1938bf3fc0b89e527addf1a5678e (diff) | |
download | haskell-0e274c39bf836d5bb846f5fa08649c75f85326ac.tar.gz |
Require all dirty_MUT_VAR callers to do explicit stg_MUT_VAR_CLEAN_info comparison (#20088)
Diffstat (limited to 'rts')
-rw-r--r-- | rts/sm/Storage.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c index 5241494365..ede47d3eb2 100644 --- a/rts/sm/Storage.c +++ b/rts/sm/Storage.c @@ -1401,20 +1401,22 @@ allocatePinned (Capability *cap, W_ n /*words*/, W_ alignment /*bytes*/, W_ alig MUT_VAR_CLEAN object is not on the mutable list; a MUT_VAR_DIRTY is. When written to, a MUT_VAR_CLEAN turns into a MUT_VAR_DIRTY and is put on the mutable list. + Note that it is responsibility of the caller to do the + stg_MUT_VAR_CLEAN comparison. */ void dirty_MUT_VAR(StgRegTable *reg, StgMutVar *mvar, StgClosure *old) { + ASSERT(RELAXED_LOAD(&mvar->header.info) == &stg_MUT_VAR_CLEAN_info); + Capability *cap = regTableToCapability(reg); // No barrier required here as no other heap object fields are read. See // note [Heap memory barriers] in SMP.h. - if (RELAXED_LOAD(&mvar->header.info) == &stg_MUT_VAR_CLEAN_info) { - SET_INFO((StgClosure*) mvar, &stg_MUT_VAR_DIRTY_info); - recordClosureMutated(cap, (StgClosure *) mvar); - IF_NONMOVING_WRITE_BARRIER_ENABLED { - // See Note [Dirty flags in the non-moving collector] in NonMoving.c - updateRemembSetPushClosure_(reg, old); - } + SET_INFO((StgClosure*) mvar, &stg_MUT_VAR_DIRTY_info); + recordClosureMutated(cap, (StgClosure *) mvar); + IF_NONMOVING_WRITE_BARRIER_ENABLED { + // See Note [Dirty flags in the non-moving collector] in NonMoving.c + updateRemembSetPushClosure_(reg, old); } } |