typedef struct _LOSSection LOSSection;
struct _LOSSection {
LOSSection *next;
- int num_free_chunks;
+ size_t num_free_chunks;
unsigned char *free_chunk_map;
};
static void
add_free_chunk (LOSFreeChunks *free_chunks, size_t size)
{
- int num_chunks = size >> LOS_CHUNK_BITS;
+ size_t num_chunks = size >> LOS_CHUNK_BITS;
free_chunks->size = size;
{
LOSFreeChunks *free_chunks = NULL;
LOSSection *section;
- int num_chunks, i, start_index;
+ size_t i, num_chunks, start_index;
+
g_assert ((size & (LOS_CHUNK_SIZE - 1)) == 0);
{
LOSSection *section;
LOSFreeChunks *free_chunks;
- int num_chunks;
+ size_t num_chunks;
size += LOS_CHUNK_SIZE - 1;
size &= ~(LOS_CHUNK_SIZE - 1);
if (num_chunks >= LOS_NUM_FAST_SIZES) {
free_chunks = get_from_size_list (&los_fast_free_lists [0], size);
} else {
- int i;
+ size_t i;
for (i = num_chunks; i < LOS_NUM_FAST_SIZES; ++i) {
free_chunks = get_from_size_list (&los_fast_free_lists [i], size);
if (free_chunks)
free_los_section_memory (LOSObject *obj, size_t size)
{
LOSSection *section = LOS_SECTION_FOR_OBJ (obj);
- int num_chunks, i, start_index;
+ size_t num_chunks, i, start_index;
size += LOS_CHUNK_SIZE - 1;
size &= ~(LOS_CHUNK_SIZE - 1);
}
}
+void
+sgen_los_count_cards (long long *num_total_cards, long long *num_marked_cards)
+{
+ LOSObject *obj;
+ long long total_cards = 0;
+ long long marked_cards = 0;
+
+ for (obj = los_object_list; obj; obj = obj->next) {
+ int i;
+ guint8 *cards = sgen_card_table_get_card_scan_address ((mword) obj->data);
+ guint8 *cards_end = sgen_card_table_get_card_scan_address ((mword) obj->data + obj->size - 1);
+ mword num_cards = (cards_end - cards) + 1;
+
+ if (!SGEN_OBJECT_HAS_REFERENCES (obj->data))
+ continue;
+
+ total_cards += num_cards;
+ for (i = 0; i < num_cards; ++i) {
+ if (cards [i])
+ ++marked_cards;
+ }
+ }
+
+ *num_total_cards = total_cards;
+ *num_marked_cards = marked_cards;
+}
+
void
sgen_los_update_cardtable_mod_union (void)
{