use synchronised version of freeChain() in scavenge_mutable_list()
[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 void    freeChain_sync(bdescr *bd);
22
23 void    push_scan_block      (bdescr *bd, step_workspace *ws);
24 bdescr *grab_todo_block      (step_workspace *ws);
25 StgPtr  gc_alloc_todo_block  (step_workspace *ws);
26 bdescr *gc_alloc_scavd_block (step_workspace *ws);
27
28 // Returns true if a block is 3/4 full.  This predicate is used to try
29 // to re-use partial blocks wherever possible, and to reduce wastage.
30 // We might need to tweak the actual value.
31 INLINE_HEADER rtsBool
32 isPartiallyFull(bdescr *bd)
33 {
34     return (bd->free + BLOCK_SIZE_W/4 < bd->start + BLOCK_SIZE_W);
35 }
36
37
38 #if DEBUG
39 void printMutableList (generation *gen);
40 #endif