diff options
author | Ben Gamari <bgamari.foss@gmail.com> | 2018-05-19 14:00:59 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-05-20 11:01:34 -0400 |
commit | 12deb9a97c05ad462ef04e8d2062c3d11c52c6ff (patch) | |
tree | 5b78115a49007ea49d4f36653d2c953ca3498f74 /libraries/ghc-compact | |
parent | c4219d9f7d122a106fc8fb1e5cd9a62dadadf76c (diff) | |
download | haskell-12deb9a97c05ad462ef04e8d2062c3d11c52c6ff.tar.gz |
rts: Fix compaction of SmallMutArrPtrs
This was blatantly wrong due to copy-paste blindness:
* labels were shadowed, which GHC doesn't warn about(!), resulting in
plainly wrong behavior
* the sharing check was omitted
* the wrong closure layout was being used
Moreover, the test wasn't being run due to its primitive dependency, so
I didn't even notice. Sillyness.
Test Plan: install `primitive`, `make test TEST=compact_small_array`
Reviewers: simonmar, erikd
Reviewed By: simonmar
Subscribers: rwbarton, thomie, carter
GHC Trac Issues: #13857.
Differential Revision: https://phabricator.haskell.org/D4702
Diffstat (limited to 'libraries/ghc-compact')
-rw-r--r-- | libraries/ghc-compact/tests/compact_small_ptr_array.hs | 2 | ||||
-rw-r--r-- | libraries/ghc-compact/tests/compact_small_ptr_array.stdout | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/libraries/ghc-compact/tests/compact_small_ptr_array.hs b/libraries/ghc-compact/tests/compact_small_ptr_array.hs index 8599c71e77..77c9fa85e7 100644 --- a/libraries/ghc-compact/tests/compact_small_ptr_array.hs +++ b/libraries/ghc-compact/tests/compact_small_ptr_array.hs @@ -3,6 +3,6 @@ import Data.Primitive.SmallArray main :: IO () main = do - arr <- newSmallArray 5 (Just 'a') + arr <- newSmallArray 5 (Just 'a') >>= unsafeFreezeSmallArray arr' <- compact arr print $ getCompact arr' diff --git a/libraries/ghc-compact/tests/compact_small_ptr_array.stdout b/libraries/ghc-compact/tests/compact_small_ptr_array.stdout new file mode 100644 index 0000000000..24b514ef1b --- /dev/null +++ b/libraries/ghc-compact/tests/compact_small_ptr_array.stdout @@ -0,0 +1 @@ +fromListN 5 [Just 'a',Just 'a',Just 'a',Just 'a',Just 'a'] |