5b4019d04dc427084a8dd1743cda9c0baa03709a
[ghc-hetmet.git] / ghc / rts / StoragePriv.h
1 /* -----------------------------------------------------------------------------
2  * $Id: StoragePriv.h,v 1.10 1999/11/09 15:47:00 simonmar Exp $
3  *
4  * (c) The GHC Team, 1998-1999
5  *
6  * Internal Storage Manger Interface
7  *
8  * ---------------------------------------------------------------------------*/
9
10 #ifndef STORAGEPRIV_H
11 #define STORAGEPRIV_H
12
13 #define END_OF_STATIC_LIST stgCast(StgClosure*,1)
14
15 extern generation *generations;
16
17 extern generation *g0;
18 extern step *g0s0;
19 extern generation *oldest_gen;
20
21 extern void newCAF(StgClosure*);
22 extern StgTSO *relocate_TSO(StgTSO *src, StgTSO *dest);
23
24 extern StgWeak    *weak_ptr_list;
25 extern StgClosure *caf_list;
26
27 extern bdescr *small_alloc_list;
28 extern bdescr *large_alloc_list;
29
30 extern StgPtr alloc_Hp;
31 extern StgPtr alloc_HpLim;
32
33 extern bdescr *nursery;
34
35 extern nat nursery_blocks;
36 extern nat alloc_blocks;
37 extern nat alloc_blocks_lim;
38
39 /* Nursery manipulation */
40 extern void     allocNurseries ( void );
41 extern void     resetNurseries ( void );
42 extern bdescr * allocNursery   ( bdescr *last_bd, nat blocks );
43 extern void     resizeNursery  ( nat blocks );
44
45 /* Stats 'n' stuff */
46 extern lnat calcAllocated  ( void );
47 extern lnat calcLive       ( void );
48 extern lnat calcNeeded     ( void );
49
50 static inline void
51 dbl_link_onto(bdescr *bd, bdescr **list)
52 {
53   bd->link = *list;
54   bd->back = NULL;
55   if (*list) {
56     (*list)->back = bd; /* double-link the list */
57   }
58   *list = bd;
59 }
60
61 /* MUTABLE LISTS
62  * A mutable list is ended with END_MUT_LIST, so that we can use NULL
63  * as an indication that an object is not on a mutable list.
64  */
65 #define END_MUT_LIST ((StgMutClosure *)(void *)&END_MUT_LIST_closure)
66
67 #ifdef DEBUG
68 extern void memInventory(void);
69 extern void checkSanity(nat N);
70 #endif
71
72 #endif /* STORAGEPRIV_H */