summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghci/scripts/StaticPtr.hs
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2017-02-01 23:39:52 -0500
committerBen Gamari <ben@smart-cactus.org>2017-02-02 00:18:58 -0500
commiteedb3df0c1c28a7abc43705d614239c1c6199a1f (patch)
tree32045d426c9ecd4b07d74871d65d3e605842672d /testsuite/tests/ghci/scripts/StaticPtr.hs
parentb16239a95b730dd2d6fc0dbb18c8430669f2c187 (diff)
downloadhaskell-eedb3df0c1c28a7abc43705d614239c1c6199a1f.tar.gz
Add support for StaticPointers in GHCi
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. Test Plan: `make test TEST=StaticPtr` Reviewers: facundominguez, mboes, simonpj, simonmar, goldfire, austin, hvr, erikd Reviewed By: simonpj, simonmar Subscribers: RyanGlScott, simonpj, thomie Differential Revision: https://phabricator.haskell.org/D2504 GHC Trac Issues: #12356
Diffstat (limited to 'testsuite/tests/ghci/scripts/StaticPtr.hs')
-rw-r--r--testsuite/tests/ghci/scripts/StaticPtr.hs20
1 files changed, 20 insertions, 0 deletions
diff --git a/testsuite/tests/ghci/scripts/StaticPtr.hs b/testsuite/tests/ghci/scripts/StaticPtr.hs
new file mode 100644
index 0000000000..41bf6231cc
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/StaticPtr.hs
@@ -0,0 +1,20 @@
+{-# LANGUAGE StaticPointers #-}
+
+module StaticPtr where
+
+import GHC.StaticPtr
+
+topLevelStatic :: StaticPtr String
+topLevelStatic = static "this is a top-level"
+
+nestedStatic :: (StaticPtr String, Int)
+nestedStatic = (s, 42)
+ where
+ s = static "nested static"
+ {-# NOINLINE s #-}
+
+s1 :: StaticPtr Int
+s1 = static 3
+
+s2 :: StaticPtr String
+s2 = static "hello world"