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