summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghci/scripts/StaticPtr.script
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2016-08-31 19:39:54 -0400
committerBen Gamari <ben@smart-cactus.org>2017-01-08 22:19:45 -0500
commit98ed207472febdc3b2a144267f8af9b29b44934c (patch)
treef6f2dea660fb6f391d3a7e89edddb8e0daf55227 /testsuite/tests/ghci/scripts/StaticPtr.script
parent326931db9cdc26f2d47657c1f084b9903fd46246 (diff)
downloadhaskell-wip/ghci-staticptrs.tar.gz
Add support for StaticPointers in GHCiwip/ghci-staticptrs
Here we add support to GHCi for StaticPointers. This process begins by adding remote GHCi messages for adding entries to the static pointer table. We then collect binders needing SPT entries after linking and send the interpreter a message adding entries with the appropriate fingerprints.
Diffstat (limited to 'testsuite/tests/ghci/scripts/StaticPtr.script')
-rw-r--r--testsuite/tests/ghci/scripts/StaticPtr.script23
1 files changed, 23 insertions, 0 deletions
diff --git a/testsuite/tests/ghci/scripts/StaticPtr.script b/testsuite/tests/ghci/scripts/StaticPtr.script
new file mode 100644
index 0000000000..6070c15943
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/StaticPtr.script
@@ -0,0 +1,23 @@
+:set -XStaticPointers
+:load StaticPtr.hs
+import GHC.StaticPtr
+import Prelude
+
+:{
+let checkKey :: Show a => StaticPtr a -> IO ()
+ checkKey x = do
+ allKeys <- staticPtrKeys
+ putStrLn $
+ show (deRefStaticPtr x)
+ ++ " " ++
+ (if staticKey x `elem` allKeys
+ then "good"
+ else "bad")
+:}
+
+checkKey s1
+checkKey s2
+
+-- :m + StaticPtr
+--checkKey topLevelStatic
+--checkKey (fst nestedStatic)