2009-05-02 05:04:19 -04:00
|
|
|
/* card marking write barrier. a card is a byte storing a mark flag,
|
|
|
|
and the offset (in cells) of the first object in the card.
|
|
|
|
|
|
|
|
the mark flag is set by the write barrier when an object in the
|
|
|
|
card has a slot written to.
|
|
|
|
|
|
|
|
the offset of the first object is set by the allocator. */
|
|
|
|
|
2013-05-11 22:32:23 -04:00
|
|
|
namespace factor {
|
2009-05-04 02:46:13 -04:00
|
|
|
|
2009-05-08 16:05:55 -04:00
|
|
|
/* if card_points_to_nursery is set, card_points_to_aging must also be set. */
|
|
|
|
static const cell card_points_to_nursery = 0x80;
|
|
|
|
static const cell card_points_to_aging = 0x40;
|
2013-05-11 22:32:23 -04:00
|
|
|
static const cell card_mark_mask =
|
|
|
|
(card_points_to_nursery | card_points_to_aging);
|
2013-05-13 00:28:25 -04:00
|
|
|
typedef uint8_t card;
|
2009-05-02 05:04:19 -04:00
|
|
|
|
2009-05-08 16:05:55 -04:00
|
|
|
static const cell card_bits = 8;
|
2013-05-11 22:32:23 -04:00
|
|
|
static const cell card_size = (1 << card_bits);
|
|
|
|
static const cell addr_card_mask = (card_size - 1);
|
2009-05-02 05:04:19 -04:00
|
|
|
|
2013-05-13 00:28:25 -04:00
|
|
|
typedef uint8_t card_deck;
|
2009-05-02 05:04:19 -04:00
|
|
|
|
2009-05-08 16:05:55 -04:00
|
|
|
static const cell deck_bits = (card_bits + 10);
|
2013-05-11 22:32:23 -04:00
|
|
|
static const cell deck_size = (1 << deck_bits);
|
|
|
|
static const cell addr_deck_mask = (deck_size - 1);
|
2009-05-04 05:50:24 -04:00
|
|
|
|
2013-05-11 22:32:23 -04:00
|
|
|
inline cell addr_to_card(cell a) { return a >> card_bits; }
|
2009-10-13 22:16:04 -04:00
|
|
|
|
2013-05-11 22:32:23 -04:00
|
|
|
inline cell addr_to_deck(cell a) { return a >> deck_bits; }
|
2009-05-04 02:46:13 -04:00
|
|
|
}
|