[project @ 2000-11-13 14:40:36 by simonmar]
[ghc-hetmet.git] / ghc / rts / StoragePriv.h
1 /* -----------------------------------------------------------------------------
2  * $Id: StoragePriv.h,v 1.12 2000/11/13 14:40:37 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 extern lnat total_allocated;
40
41 /* Nursery manipulation */
42 extern void     allocNurseries ( void );
43 extern void     resetNurseries ( void );
44 extern bdescr * allocNursery   ( bdescr *last_bd, nat blocks );
45 extern void     resizeNursery  ( nat blocks );
46
47 /* Stats 'n' stuff */
48 extern lnat calcAllocated  ( void );
49 extern lnat calcLive       ( void );
50 extern lnat calcNeeded     ( void );
51
52 static inline void
53 dbl_link_onto(bdescr *bd, bdescr **list)
54 {
55   bd->link = *list;
56   bd->back = NULL;
57   if (*list) {
58     (*list)->back = bd; /* double-link the list */
59   }
60   *list = bd;
61 }
62
63 /* MUTABLE LISTS
64  * A mutable list is ended with END_MUT_LIST, so that we can use NULL
65  * as an indication that an object is not on a mutable list.
66  */
67 #define END_MUT_LIST ((StgMutClosure *)(void *)&stg_END_MUT_LIST_closure)
68
69 #ifdef DEBUG
70 extern void memInventory(void);
71 extern void checkSanity(nat N);
72 #endif
73
74 #endif /* STORAGEPRIV_H */