[project @ 1999-02-05 16:02:18 by simonm]
[ghc-hetmet.git] / ghc / includes / StgStorage.h
1 /* -----------------------------------------------------------------------------
2  * $Id: StgStorage.h,v 1.3 1999/02/05 16:02:29 simonm 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 #include "Block.h"
14
15 extern bdescr *current_nursery;
16
17 /* -----------------------------------------------------------------------------
18    Allocation area for compiled code
19
20    OpenNursery(hp,hplim)        Opens the allocation area, and sets hp
21                                 and hplim appropriately.
22
23    CloseNursery(hp)             Closes the allocation area.
24
25    PleaseStopAllocating(void)   Arranges that the next call to
26                                 ExtendNursery() will fail, triggering
27                                 a return to the scheduler.  This is
28                                 useful for asynchronous interupts etc.
29    -------------------------------------------------------------------------- */
30
31 #define OpenNursery(hp,hplim)                           \
32   (hp    = current_nursery->free-1,                     \
33    hplim = current_nursery->start + BLOCK_SIZE_W - 1)
34   
35 #define CloseNursery(hp)  (current_nursery->free = (P_)(hp)+1)
36
37 /* -----------------------------------------------------------------------------
38    Trigger a GC from Haskell land.
39    -------------------------------------------------------------------------- */
40
41 extern void performGC(void);
42 extern void performGCWithRoots(void (*get_roots)(void));
43
44 #endif /* STGSTORAGE_H */