[project @ 1999-11-02 15:05:38 by simonmar]
[ghc-hetmet.git] / ghc / includes / StgStorage.h
1 /* -----------------------------------------------------------------------------
2  * $Id: StgStorage.h,v 1.5 1999/11/02 15:05:53 simonmar Exp $
3  *
4  * (c) The GHC Team, 1998-1999
5  *
6  * STG Storage Manger Interface
7  *
8  * ---------------------------------------------------------------------------*/
9
10 #ifndef STGSTORAGE_H
11 #define STGSTORAGE_H
12
13 /* -----------------------------------------------------------------------------
14    Allocation area for compiled code
15
16    OpenNursery(hp,hplim)        Opens the allocation area, and sets hp
17                                 and hplim appropriately.
18
19    CloseNursery(hp)             Closes the allocation area.
20
21    PleaseStopAllocating(void)   Arranges that the next call to
22                                 ExtendNursery() will fail, triggering
23                                 a return to the scheduler.  This is
24                                 useful for asynchronous interupts etc.
25    -------------------------------------------------------------------------- */
26
27 #define OpenNursery(hp,hplim)                           \
28   (hp    = CurrentNursery->free-1,                      \
29    hplim = CurrentNursery->start + BLOCK_SIZE_W - 1)
30   
31 #define CloseNursery(hp)  (CurrentNursery->free = (P_)(hp)+1)
32
33 /* -----------------------------------------------------------------------------
34    Trigger a GC from Haskell land.
35    -------------------------------------------------------------------------- */
36
37 extern void performGC(void);
38 extern void performGCWithRoots(void (*get_roots)(void));
39
40 #endif /* STGSTORAGE_H */