diff options
author | Ben Gamari <ben@smart-cactus.org> | 2021-01-06 11:20:44 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-01-17 05:53:02 -0500 |
commit | d159041b44049d87db7e26d09120e0b2633b3b3c (patch) | |
tree | 5e6c92f9c03b703f8b1b100ebf18562a9409b144 /rts/PrimOps.cmm | |
parent | 84dcb8440e94fab5aaba66e613de27d89264f076 (diff) | |
download | haskell-d159041b44049d87db7e26d09120e0b2633b3b3c.tar.gz |
rts: Initialize card table in newArray#
Previously we would leave the card table of new arrays uninitialized.
This wasn't a soundness issue: at worst we would end up doing
unnecessary scavenging during GC, after which the card table would be
reset. That being said, it seems worth initializing this properly to
avoid both unnecessary work and non-determinism.
Fixes #19143.
Diffstat (limited to 'rts/PrimOps.cmm')
-rw-r--r-- | rts/PrimOps.cmm | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm index c5b232f09d..77296e20ae 100644 --- a/rts/PrimOps.cmm +++ b/rts/PrimOps.cmm @@ -408,6 +408,9 @@ stg_newArrayArrayzh ( W_ n /* words */ ) StgMutArrPtrs_ptrs(arr) = n; StgMutArrPtrs_size(arr) = size; + // Initialize card table to all-clean. + setCardsValue(arr, 0, n, 0); + // Initialise all elements of the array with a pointer to the new array p = arr + SIZEOF_StgMutArrPtrs; for: |