summaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2017-08-24 21:55:27 -0400
committerDavid Feuer <David.Feuer@gmail.com>2017-08-24 21:55:28 -0400
commit5f3d2d3be034e04ba872f2695ab6d7b75de66663 (patch)
tree131f644eb988628aaf65ca91d7ebaf0eaacbd2c6 /libraries
parentaeb4bd958439515e02e6f8f9bb22cf84f7cd7d75 (diff)
downloadhaskell-5f3d2d3be034e04ba872f2695ab6d7b75de66663.tar.gz
CNF: Implement compaction for small pointer arrays
Test Plan: Validate Reviewers: austin, erikd, simonmar, dfeuer Reviewed By: dfeuer Subscribers: rwbarton, andrewthad, thomie, dfeuer GHC Trac Issues: #13860, #13857 Differential Revision: https://phabricator.haskell.org/D3888
Diffstat (limited to 'libraries')
-rw-r--r--libraries/ghc-compact/tests/all.T1
-rw-r--r--libraries/ghc-compact/tests/compact_small_ptr_array.hs8
2 files changed, 9 insertions, 0 deletions
diff --git a/libraries/ghc-compact/tests/all.T b/libraries/ghc-compact/tests/all.T
index 753592e733..0264bab6b2 100644
--- a/libraries/ghc-compact/tests/all.T
+++ b/libraries/ghc-compact/tests/all.T
@@ -4,6 +4,7 @@ test('compact_simple', normal, compile_and_run, [''])
test('compact_loop', normal, compile_and_run, [''])
test('compact_append', normal, compile_and_run, [''])
test('compact_autoexpand', normal, compile_and_run, [''])
+test('compact_small_array', [reqlib('primitive')], compile_and_run, [''])
test('compact_simple_array', normal, compile_and_run, [''])
test('compact_huge_array', normal, compile_and_run, [''])
test('compact_serialize', normal, compile_and_run, [''])
diff --git a/libraries/ghc-compact/tests/compact_small_ptr_array.hs b/libraries/ghc-compact/tests/compact_small_ptr_array.hs
new file mode 100644
index 0000000000..8599c71e77
--- /dev/null
+++ b/libraries/ghc-compact/tests/compact_small_ptr_array.hs
@@ -0,0 +1,8 @@
+import GHC.Compact
+import Data.Primitive.SmallArray
+
+main :: IO ()
+main = do
+ arr <- newSmallArray 5 (Just 'a')
+ arr' <- compact arr
+ print $ getCompact arr'