summaryrefslogtreecommitdiff
path: root/libraries/ghc-heap
diff options
context:
space:
mode:
authorAndrew Martin <andrew.thaddeus@gmail.com>2020-10-07 15:45:30 -0400
committerBen Gamari <ben@smart-cactus.org>2020-12-14 18:48:51 -0500
commit6c2eb2232b39ff4720fda0a4a009fb6afbc9dcea (patch)
tree0a19d6cece0d63aadcfa6e014171a5baeaf4c167 /libraries/ghc-heap
parentdad87210efffce9cfc2d17dc088a71d9dea14535 (diff)
downloadhaskell-6c2eb2232b39ff4720fda0a4a009fb6afbc9dcea.tar.gz
Implement BoxedRep proposal
This implements the BoxedRep proposal, refacoring the `RuntimeRep` hierarchy from: ```haskell data RuntimeRep = LiftedPtrRep | UnliftedPtrRep | ... ``` to ```haskell data RuntimeRep = BoxedRep Levity | ... data Levity = Lifted | Unlifted ``` Closes #17526.
Diffstat (limited to 'libraries/ghc-heap')
-rw-r--r--libraries/ghc-heap/GHC/Exts/Heap.hs8
-rw-r--r--libraries/ghc-heap/tests/ClosureSizeUtils.hs2
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 2dfe788406..70ee2f0ecf 100644
--- a/libraries/ghc-heap/GHC/Exts/Heap.hs
+++ b/libraries/ghc-heap/GHC/Exts/Heap.hs
@@ -90,10 +90,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 ()