summaryrefslogtreecommitdiff
path: root/includes/rts/Stable.h
diff options
context:
space:
mode:
Diffstat (limited to 'includes/rts/Stable.h')
-rw-r--r--includes/rts/Stable.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/includes/rts/Stable.h b/includes/rts/Stable.h
new file mode 100644
index 0000000000..95a3f96156
--- /dev/null
+++ b/includes/rts/Stable.h
@@ -0,0 +1,35 @@
+/* -----------------------------------------------------------------------------
+ *
+ * (c) The GHC Team, 1998-2004
+ *
+ * Stable Pointers
+ *
+ * ---------------------------------------------------------------------------*/
+
+#ifndef RTS_STABLE_H
+#define RTS_STABLE_H
+
+EXTERN_INLINE StgPtr deRefStablePtr (StgStablePtr stable_ptr);
+StgStablePtr getStablePtr (StgPtr p);
+
+/* -----------------------------------------------------------------------------
+ PRIVATE from here.
+ -------------------------------------------------------------------------- */
+
+typedef struct {
+ StgPtr addr; /* Haskell object, free list, or NULL */
+ StgPtr old; /* old Haskell object, used during GC */
+ StgWord ref; /* used for reference counting */
+ StgClosure *sn_obj; /* the StableName object (or NULL) */
+} snEntry;
+
+extern DLL_IMPORT_RTS snEntry *stable_ptr_table;
+
+EXTERN_INLINE
+StgPtr deRefStablePtr(StgStablePtr sp)
+{
+ ASSERT(stable_ptr_table[(StgWord)sp].ref > 0);
+ return stable_ptr_table[(StgWord)sp].addr;
+}
+
+#endif /* RTS_STABLE_H */