From 5f3d2d3be034e04ba872f2695ab6d7b75de66663 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Thu, 24 Aug 2017 21:55:27 -0400 Subject: 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 --- libraries/ghc-compact/tests/all.T | 1 + libraries/ghc-compact/tests/compact_small_ptr_array.hs | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 libraries/ghc-compact/tests/compact_small_ptr_array.hs (limited to 'libraries/ghc-compact/tests') 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' -- cgit v1.2.1