diff options
author | GHC GitLab CI <ghc-ci@gitlab-haskell.org> | 2020-11-26 00:11:41 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-11-29 15:33:54 -0500 |
commit | 0120829f47ed9ebd02ffd552d71e45cca3bdc9f6 (patch) | |
tree | e31cf8267cad0d426bc640de50f593c240c57ce0 /rts | |
parent | 35a5207e8277800b77af90d74cdd235d29a901e6 (diff) | |
download | haskell-0120829f47ed9ebd02ffd552d71e45cca3bdc9f6.tar.gz |
nonmoving: Add missing write barrier in shrinkSmallByteArray
Diffstat (limited to 'rts')
-rw-r--r-- | rts/PrimOps.cmm | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm index b102782148..7767ead2d8 100644 --- a/rts/PrimOps.cmm +++ b/rts/PrimOps.cmm @@ -227,6 +227,21 @@ stg_shrinkSmallMutableArrayzh ( gcptr mba, W_ new_size ) { ASSERT(new_size <= StgSmallMutArrPtrs_ptrs(mba)); + IF_NONMOVING_WRITE_BARRIER_ENABLED { + // Ensure that the elements we are about to shrink out of existence + // remain visible to the non-moving collector. + W_ p, end; + p = mba + SIZEOF_StgSmallMutArrPtrs + WDS(new_size); + end = mba + SIZEOF_StgSmallMutArrPtrs + WDS(StgSmallMutArrPtrs_ptrs(mba)); +again: + ccall updateRemembSetPushClosure_(BaseReg "ptr", + W_[p] "ptr"); + if (p < end) { + p = p + SIZEOF_W; + goto again; + } + } + OVERWRITING_CLOSURE_MUTABLE(mba, (BYTES_TO_WDS(SIZEOF_StgSmallMutArrPtrs) + new_size)); StgSmallMutArrPtrs_ptrs(mba) = new_size; |