diff options
author | Ben Gamari <ben@smart-cactus.org> | 2021-02-02 10:06:11 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2021-03-07 17:01:40 -0500 |
commit | 3e082f8ff5ea2f42c5e6430094683b26b5818fb8 (patch) | |
tree | 4c85427ff40740b654cf1911a20a3a478a9fb754 /libraries/ghc-heap | |
parent | cf65cf16c89414273c4f6b2d090d4b2fffb90759 (diff) | |
download | haskell-3e082f8ff5ea2f42c5e6430094683b26b5818fb8.tar.gz |
Implement BoxedRep proposalwip/boxed-rep
This implements the BoxedRep proposal, refactoring the `RuntimeRep`
hierarchy from:
```haskell
data RuntimeRep = LiftedPtrRep | UnliftedPtrRep | ...
```
to
```haskell
data RuntimeRep = BoxedRep Levity | ...
data Levity = Lifted | Unlifted
```
Updates binary, haddock submodules.
Closes #17526.
Metric Increase:
T12545
Diffstat (limited to 'libraries/ghc-heap')
-rw-r--r-- | libraries/ghc-heap/GHC/Exts/Heap.hs | 8 | ||||
-rw-r--r-- | libraries/ghc-heap/tests/ClosureSizeUtils.hs | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/libraries/ghc-heap/GHC/Exts/Heap.hs b/libraries/ghc-heap/GHC/Exts/Heap.hs index 10a9ea8be9..1e429ca054 100644 --- a/libraries/ghc-heap/GHC/Exts/Heap.hs +++ b/libraries/ghc-heap/GHC/Exts/Heap.hs @@ -91,10 +91,18 @@ class HasHeapRep (a :: TYPE rep) where -> IO Closure -- ^ Heap representation of the closure. +#if __GLASGOW_HASKELL__ >= 901 +instance HasHeapRep (a :: TYPE ('BoxedRep 'Lifted)) where +#else instance HasHeapRep (a :: TYPE 'LiftedRep) where +#endif getClosureData = getClosureDataFromHeapObject +#if __GLASGOW_HASKELL__ >= 901 +instance HasHeapRep (a :: TYPE ('BoxedRep 'Unlifted)) where +#else instance HasHeapRep (a :: TYPE 'UnliftedRep) where +#endif getClosureData x = getClosureDataFromHeapObject (unsafeCoerce# x) instance Int# ~ a => HasHeapRep (a :: TYPE 'IntRep) where diff --git a/libraries/ghc-heap/tests/ClosureSizeUtils.hs b/libraries/ghc-heap/tests/ClosureSizeUtils.hs index 5fafa4f7a5..3b1578451a 100644 --- a/libraries/ghc-heap/tests/ClosureSizeUtils.hs +++ b/libraries/ghc-heap/tests/ClosureSizeUtils.hs @@ -30,7 +30,7 @@ assertSize x = assertSizeBox (asBox x) (typeRep @a) assertSizeUnlifted - :: forall (a :: TYPE 'UnliftedRep). (HasCallStack, Typeable a) + :: forall (a :: TYPE ('BoxedRep 'Unlifted)). (HasCallStack, Typeable a) => a -- ^ closure -> Int -- ^ expected size in words -> IO () |