1 /* -----------------------------------------------------------------------------
3 * (c) The GHC Team 1998-1999
5 * Compacting garbage collector
7 * ---------------------------------------------------------------------------*/
10 mark(StgPtr p, bdescr *bd)
12 nat offset_within_block = p - bd->start; // in words
13 StgPtr bitmap_word = (StgPtr)bd->u.bitmap +
14 (offset_within_block / (sizeof(W_)*BITS_PER_BYTE));
15 nat bit_mask = 1 << (offset_within_block & (sizeof(W_)*BITS_PER_BYTE - 1));
16 *bitmap_word |= bit_mask;
20 unmark(StgPtr p, bdescr *bd)
22 nat offset_within_block = p - bd->start; // in words
23 StgPtr bitmap_word = (StgPtr)bd->u.bitmap +
24 (offset_within_block / (sizeof(W_)*BITS_PER_BYTE));
25 nat bit_mask = 1 << (offset_within_block & (sizeof(W_)*BITS_PER_BYTE - 1));
26 *bitmap_word &= ~bit_mask;
30 is_marked(StgPtr p, bdescr *bd)
32 nat offset_within_block = p - bd->start; // in words
33 StgPtr bitmap_word = (StgPtr)bd->u.bitmap +
34 (offset_within_block / (sizeof(W_)*BITS_PER_BYTE));
35 nat bit_mask = 1 << (offset_within_block & (sizeof(W_)*BITS_PER_BYTE - 1));
36 return (*bitmap_word & bit_mask);
39 void compact( void (*get_roots)(evac_fn) );