Fold integer-simple.git into ghc.git (re #8545)
[ghc.git] / includes / rts / Stable.h
1 /* -----------------------------------------------------------------------------
2 *
3 * (c) The GHC Team, 1998-2009
4 *
5 * Stable Pointers
6 *
7 * Do not #include this file directly: #include "Rts.h" instead.
8 *
9 * To understand the structure of the RTS headers, see the wiki:
10 * http://ghc.haskell.org/trac/ghc/wiki/Commentary/SourceTree/Includes
11 *
12 * ---------------------------------------------------------------------------*/
13
14 #ifndef RTS_STABLE_H
15 #define RTS_STABLE_H
16
17 EXTERN_INLINE StgPtr deRefStablePtr (StgStablePtr stable_ptr);
18 StgStablePtr getStablePtr (StgPtr p);
19
20 /* -----------------------------------------------------------------------------
21 PRIVATE from here.
22 -------------------------------------------------------------------------- */
23
24 typedef struct {
25 StgPtr addr; /* Haskell object, free list, or NULL */
26 StgPtr old; /* old Haskell object, used during GC */
27 StgClosure *sn_obj; /* the StableName object (or NULL) */
28 } snEntry;
29
30 typedef struct {
31 StgPtr addr;
32 } spEntry;
33
34 extern DLL_IMPORT_RTS snEntry *stable_name_table;
35 extern DLL_IMPORT_RTS spEntry *stable_ptr_table;
36
37 EXTERN_INLINE
38 StgPtr deRefStablePtr(StgStablePtr sp)
39 {
40 return stable_ptr_table[(StgWord)sp].addr;
41 }
42
43 #endif /* RTS_STABLE_H */