Document SRT scavenging behavior of scavenge_block() and scavenge_one()
[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 #pragma once
16
17 #include "sm/GC.h" // for evac_fn below
18
19 #include "BeginPrivate.h"
20
21 void freeStablePtr ( StgStablePtr sp );
22
23 /* Use the "Unsafe" one after manually locking with stableLock/stableUnlock */
24 void freeStablePtrUnsafe ( StgStablePtr sp );
25
26 void initStableTables ( void );
27 void exitStableTables ( void );
28 StgWord lookupStableName ( StgPtr p );
29
30 /* Call given function on every stable ptr. markStableTables depends
31 * on the function updating its pointers in case the object is
32 * moved. */
33 /* TODO: This also remembers old stable name addresses, which isn't
34 * necessary in some contexts markStableTables is called from.
35 * Consider splitting it.
36 */
37 void markStableTables ( evac_fn evac, void *user );
38
39 void threadStableTables ( evac_fn evac, void *user );
40 void gcStableTables ( void );
41 void updateStableTables ( bool full );
42
43 void stableLock ( void );
44 void stableUnlock ( void );
45
46 #if defined(THREADED_RTS)
47 // needed by Schedule.c:forkProcess()
48 extern Mutex stable_mutex;
49 #endif
50
51 #include "EndPrivate.h"