cpp: Use #pragma once instead of #ifndef guards
[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 #pragma once
15
16 EXTERN_INLINE StgPtr deRefStablePtr (StgStablePtr stable_ptr);
17 StgStablePtr getStablePtr (StgPtr p);
18
19 /* -----------------------------------------------------------------------------
20 PRIVATE from here.
21 -------------------------------------------------------------------------- */
22
23 typedef struct {
24 StgPtr addr; /* Haskell object, free list, or NULL */
25 StgPtr old; /* old Haskell object, used during GC */
26 StgClosure *sn_obj; /* the StableName object (or NULL) */
27 } snEntry;
28
29 typedef struct {
30 StgPtr addr;
31 } spEntry;
32
33 extern DLL_IMPORT_RTS snEntry *stable_name_table;
34 extern DLL_IMPORT_RTS spEntry *stable_ptr_table;
35
36 EXTERN_INLINE
37 StgPtr deRefStablePtr(StgStablePtr sp)
38 {
39 return stable_ptr_table[(StgWord)sp].addr;
40 }