diff options
author | GHC GitLab CI <ghc-ci@gitlab-haskell.org> | 2020-11-26 00:11:41 +0000 |
---|---|---|
committer | GHC GitLab CI <ghc-ci@gitlab-haskell.org> | 2020-12-07 15:12:51 +0000 |
commit | 813c52198a4642b9ad27786b9a01c812d9d0b5c4 (patch) | |
tree | e9ce6cc6766fd100883f34bee5eb1a411d345319 | |
parent | 38f2f62729ff7a47001bf5ef00c3b34ec5398999 (diff) | |
download | haskell-813c52198a4642b9ad27786b9a01c812d9d0b5c4.tar.gz |
nonmoving: Add missing write barrier in shrinkSmallByteArray
(cherry picked from commit 35c22991ae5c22b10ca1a81f0aa888d1939f0b3f)
-rw-r--r-- | rts/PrimOps.cmm | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm index 65bc2d01df..2b32e12d2a 100644 --- a/rts/PrimOps.cmm +++ b/rts/PrimOps.cmm @@ -233,6 +233,22 @@ stg_shrinkSmallMutableArrayzh ( gcptr mba, W_ new_size ) OVERWRITING_CLOSURE_OFS(mba, (BYTES_TO_WDS(SIZEOF_StgSmallMutArrPtrs) + new_size)); + + 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; + } + } + StgSmallMutArrPtrs_ptrs(mba) = new_size; // See the comments in overwritingClosureOfs for an explanation // of the interaction with LDV profiling. |