1 /* -----------------------------------------------------------------------------
3 * (c) The GHC Team 1998-2005
5 * Compacting garbage collector
7 * ---------------------------------------------------------------------------*/
13 mark_stack_empty(void)
15 return mark_sp == mark_stack;
21 return mark_sp >= mark_splim;
25 reset_mark_stack(void)
31 push_mark_stack(StgPtr p)
43 mark(StgPtr p, bdescr *bd)
45 nat offset_within_block = p - bd->start; // in words
46 StgPtr bitmap_word = (StgPtr)bd->u.bitmap +
47 (offset_within_block / (sizeof(W_)*BITS_PER_BYTE));
48 StgWord bit_mask = (StgWord)1 << (offset_within_block & (sizeof(W_)*BITS_PER_BYTE - 1));
49 *bitmap_word |= bit_mask;
53 unmark(StgPtr p, bdescr *bd)
55 nat offset_within_block = p - bd->start; // in words
56 StgPtr bitmap_word = (StgPtr)bd->u.bitmap +
57 (offset_within_block / (sizeof(W_)*BITS_PER_BYTE));
58 StgWord bit_mask = (StgWord)1 << (offset_within_block & (sizeof(W_)*BITS_PER_BYTE - 1));
59 *bitmap_word &= ~bit_mask;
63 is_marked(StgPtr p, bdescr *bd)
65 nat offset_within_block = p - bd->start; // in words
66 StgPtr bitmap_word = (StgPtr)bd->u.bitmap +
67 (offset_within_block / (sizeof(W_)*BITS_PER_BYTE));
68 StgWord bit_mask = (StgWord)1 << (offset_within_block & (sizeof(W_)*BITS_PER_BYTE - 1));
69 return (*bitmap_word & bit_mask);
74 #endif /* GCCOMPACT_H */