1 /* -----------------------------------------------------------------------------
3 * (c) The GHC Team 1998-2005
5 * Compacting garbage collector
7 * ---------------------------------------------------------------------------*/
13 mark(StgPtr p, bdescr *bd)
15 nat offset_within_block = p - bd->start; // in words
16 StgPtr bitmap_word = (StgPtr)bd->u.bitmap +
17 (offset_within_block / (sizeof(W_)*BITS_PER_BYTE));
18 StgWord bit_mask = (StgWord)1 << (offset_within_block & (sizeof(W_)*BITS_PER_BYTE - 1));
19 *bitmap_word |= bit_mask;
23 unmark(StgPtr p, bdescr *bd)
25 nat offset_within_block = p - bd->start; // in words
26 StgPtr bitmap_word = (StgPtr)bd->u.bitmap +
27 (offset_within_block / (sizeof(W_)*BITS_PER_BYTE));
28 StgWord bit_mask = (StgWord)1 << (offset_within_block & (sizeof(W_)*BITS_PER_BYTE - 1));
29 *bitmap_word &= ~bit_mask;
33 is_marked(StgPtr p, bdescr *bd)
35 nat offset_within_block = p - bd->start; // in words
36 StgPtr bitmap_word = (StgPtr)bd->u.bitmap +
37 (offset_within_block / (sizeof(W_)*BITS_PER_BYTE));
38 StgWord bit_mask = (StgWord)1 << (offset_within_block & (sizeof(W_)*BITS_PER_BYTE - 1));
39 return (*bitmap_word & bit_mask);
42 void compact( void (*get_roots)(evac_fn) );
44 #endif /* GCCOMPACT_H */