Add warning comment about Mach-O section name hack.
[ghc.git] / rts / Stable.h
1 /* -----------------------------------------------------------------------------
2 *
3 * (c) The GHC Team, 1998-2004
4 *
5 * Stable Pointers: A stable pointer is represented as an index into
6 * the stable pointer table.
7 *
8 * StgStablePtr used to be a synonym for StgWord, but stable pointers
9 * are guaranteed to be void* on the C-side, so we have to do some
10 * occasional casting. Size is not a matter, because StgWord is always
11 * the same size as a void*.
12 *
13 * ---------------------------------------------------------------------------*/
14
15 #ifndef STABLE_H
16 #define STABLE_H
17
18 #include "sm/GC.h" // for evac_fn below
19
20 #include "BeginPrivate.h"
21
22 void freeStablePtr ( StgStablePtr sp );
23
24 /* Use the "Unsafe" one after manually locking with stableLock/stableUnlock */
25 void freeStablePtrUnsafe ( StgStablePtr sp );
26
27 void initStableTables ( void );
28 void exitStableTables ( void );
29 StgWord lookupStableName ( StgPtr p );
30
31 /* Call given function on every stable ptr. markStableTables depends
32 * on the function updating its pointers in case the object is
33 * moved. */
34 /* TODO: This also remembers old stable name addresses, which isn't
35 * necessary in some contexts markStableTables is called from.
36 * Consider splitting it.
37 */
38 void markStableTables ( evac_fn evac, void *user );
39
40 void threadStableTables ( evac_fn evac, void *user );
41 void gcStableTables ( void );
42 void updateStableTables ( rtsBool full );
43
44 void stableLock ( void );
45 void stableUnlock ( void );
46
47 #ifdef THREADED_RTS
48 // needed by Schedule.c:forkProcess()
49 extern Mutex stable_mutex;
50 #endif
51
52 #include "EndPrivate.h"
53
54 #endif /* STABLE_H */