57c3b0ced5c80b62422523b8ed92649c78904d78
[ghc-hetmet.git] / rts / sm / GCUtils.h
1 /* ----------------------------------------------------------------------------
2  *
3  * (c) The GHC Team 1998-2006
4  *
5  * Generational garbage collector: utilities
6  *
7  * Documentation on the architecture of the Garbage Collector can be
8  * found in the online commentary:
9  * 
10  *   http://hackage.haskell.org/trac/ghc/wiki/Commentary/Rts/Storage/GC
11  *
12  * --------------------------------------------------------------------------*/
13
14 #include "SMP.h"
15
16 #ifdef THREADED_RTS
17 extern SpinLock gc_alloc_block_sync;
18 #endif
19
20 bdescr *allocBlock_sync(void);
21
22 void    push_scan_block      (bdescr *bd, step_workspace *ws);
23 bdescr *grab_todo_block      (step_workspace *ws);
24 StgPtr  gc_alloc_todo_block  (step_workspace *ws);
25 bdescr *gc_alloc_scavd_block (step_workspace *ws);
26
27 // Returns true if a block is 3/4 full.  This predicate is used to try
28 // to re-use partial blocks wherever possible, and to reduce wastage.
29 // We might need to tweak the actual value.
30 INLINE_HEADER rtsBool
31 isPartiallyFull(bdescr *bd)
32 {
33     return (bd->free + BLOCK_SIZE_W/4 < bd->start + BLOCK_SIZE_W);
34 }
35
36
37 #if DEBUG
38 void printMutableList (generation *gen);
39 #endif