rts: Fix compaction of SmallMutArrPtrs
authorBen Gamari <bgamari.foss@gmail.com>
Sat, 19 May 2018 18:00:59 +0000 (14:00 -0400)
committerBen Gamari <ben@smart-cactus.org>
Sun, 20 May 2018 15:01:34 +0000 (11:01 -0400)
commit12deb9a97c05ad462ef04e8d2062c3d11c52c6ff
tree5b78115a49007ea49d4f36653d2c953ca3498f74
parentc4219d9f7d122a106fc8fb1e5cd9a62dadadf76c
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
libraries/ghc-compact/tests/compact_small_ptr_array.hs
libraries/ghc-compact/tests/compact_small_ptr_array.stdout [new file with mode: 0644]
rts/Compact.cmm