1 /* -----------------------------------------------------------------------------
3 * (c) The GHC Team 1998-2009
5 * Operations on the mark stack
7 * Documentation on the architecture of the Garbage Collector can be
8 * found in the online commentary:
10 * http://hackage.haskell.org/trac/ghc/wiki/Commentary/Rts/Storage/GC
12 * ---------------------------------------------------------------------------*/
14 #ifndef SM_MARKSTACK_H
15 #define SM_MARKSTACk_H
17 #include "BeginPrivate.h"
20 push_mark_stack(StgPtr p)
24 *mark_sp++ = (StgWord)p;
26 if (((W_)mark_sp & BLOCK_MASK) == 0)
28 if (mark_stack_bd->u.back != NULL)
30 mark_stack_bd = mark_stack_bd->u.back;
34 bd = allocBlock_sync();
35 bd->link = mark_stack_bd;
37 mark_stack_bd->u.back = bd; // double-link the new block on
38 mark_stack_top_bd = bd;
41 mark_sp = mark_stack_bd->start;
48 if (((W_)mark_sp & BLOCK_MASK) == 0)
50 if (mark_stack_bd->link == NULL)
56 mark_stack_bd = mark_stack_bd->link;
57 mark_sp = mark_stack_bd->start + BLOCK_SIZE_W;
60 return (StgPtr)*--mark_sp;
64 mark_stack_empty(void)
66 return (((W_)mark_sp & BLOCK_MASK) == 0 && mark_stack_bd->link == NULL);
69 #include "EndPrivate.h"
71 #endif /* SM_MARKSTACK_H */