summaryrefslogtreecommitdiff
path: root/includes/rts/StaticPtrTable.h
diff options
context:
space:
mode:
authorFacundo Domínguez <facundo.dominguez@tweag.io>2014-12-09 18:10:18 -0600
committerAustin Seipp <austin@well-typed.com>2014-12-09 19:59:27 -0600
commitfc45f32491313d2a44e72d8d59cdf95b1660189d (patch)
tree853de68ce9feca6a61d2b540ef13fc03162740de /includes/rts/StaticPtrTable.h
parente5974f8f53de4c97cfaad228eedfca8b31b53887 (diff)
downloadhaskell-fc45f32491313d2a44e72d8d59cdf95b1660189d.tar.gz
Implement -XStaticValues
Summary: As proposed in [1], this extension introduces a new syntactic form `static e`, where `e :: a` can be any closed expression. The static form produces a value of type `StaticPtr a`, which works as a reference that programs can "dereference" to get the value of `e` back. References are like `Ptr`s, except that they are stable across invocations of a program. The relevant wiki pages are [2, 3], which describe the motivation/ideas and implementation plan respectively. [1] Jeff Epstein, Andrew P. Black, and Simon Peyton-Jones. Towards Haskell in the cloud. SIGPLAN Not., 46(12):118–129, September 2011. ISSN 0362-1340. [2] https://ghc.haskell.org/trac/ghc/wiki/StaticPointers [3] https://ghc.haskell.org/trac/ghc/wiki/StaticPointers/ImplementationPlan Authored-by: Facundo Domínguez <facundo.dominguez@tweag.io> Authored-by: Mathieu Boespflug <m@tweag.io> Authored-by: Alexander Vershilov <alexander.vershilov@tweag.io> Test Plan: `./validate` Reviewers: hvr, simonmar, simonpj, austin Reviewed By: simonpj, austin Subscribers: qnikst, bgamari, mboes, carter, thomie, goldfire Differential Revision: https://phabricator.haskell.org/D550 GHC Trac Issues: #7015
Diffstat (limited to 'includes/rts/StaticPtrTable.h')
-rw-r--r--includes/rts/StaticPtrTable.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/includes/rts/StaticPtrTable.h b/includes/rts/StaticPtrTable.h
new file mode 100644
index 0000000000..8b56510223
--- /dev/null
+++ b/includes/rts/StaticPtrTable.h
@@ -0,0 +1,32 @@
+/* -----------------------------------------------------------------------------
+ *
+ * (c) The GHC Team, 2008-2009
+ *
+ * Initialization of the Static Pointer Table
+ *
+ * Do not #include this file directly: #include "Rts.h" instead.
+ *
+ * To understand the structure of the RTS headers, see the wiki:
+ * http://ghc.haskell.org/trac/ghc/wiki/Commentary/SourceTree/Includes
+ *
+ * -------------------------------------------------------------------------- */
+
+#ifndef RTS_STATICPTRTABLE_H
+#define RTS_STATICPTRTABLE_H
+
+/** Inserts an entry in the Static Pointer Table.
+ *
+ * The key is a fingerprint computed from the StaticName of a static pointer
+ * and the spe_closure is a pointer to the closure defining the table entry
+ * (GHC.SptEntry).
+ *
+ * A stable pointer to the closure is made to prevent it from being garbage
+ * collected while the entry exists on the table.
+ *
+ * This function is called from the code generated by
+ * compiler/deSugar/StaticPtrTable.sptInitCode
+ *
+ * */
+void hs_spt_insert (StgWord64 key[2],void* spe_closure);
+
+#endif /* RTS_STATICPTRTABLE_H */