info->pinned = pinned;
info->has_references = has_references;
info->has_pinned = pinned;
- info->is_to_space = (sgen_get_current_collection_generation () == GENERATION_OLD); /*FIXME WHY??? */
+ /*
+ * Blocks that are to-space are not evacuated from. During an major collection
+ * blocks are allocated for two reasons: evacuating objects from the nursery and
+ * evacuating them from major blocks marked for evacuation. In both cases we don't
+ * want further evacuation.
+ */
+ info->is_to_space = (sgen_get_current_collection_generation () == GENERATION_OLD);
info->swept = 1;
#ifndef FIXED_HEAP
info->block = ms_get_empty_block ();
MS_CALC_MARK_BIT (word, bit, obj);
SGEN_ASSERT (9, !MS_MARK_BIT (block, word, bit), "object %p already marked", obj);
MS_PAR_SET_MARK_BIT (was_marked, block, word, bit);
+ binary_protocol_mark (obj, vt, sgen_safe_object_get_size ((MonoObject*)obj));
}
} else {
/*
#endif
sgen_los_pin_object (obj);
- /* FIXME: only enqueue if object has references */
- GRAY_OBJECT_ENQUEUE (queue, obj);
+ if (SGEN_OBJECT_HAS_REFERENCES (obj))
+ GRAY_OBJECT_ENQUEUE (queue, obj);
INC_NUM_MAJOR_OBJECTS_MARKED ();
}
}
#endif
sgen_los_pin_object (obj);
- /* FIXME: only enqueue if object has references */
- GRAY_OBJECT_ENQUEUE (queue, obj);
+ if (SGEN_OBJECT_HAS_REFERENCES (obj))
+ GRAY_OBJECT_ENQUEUE (queue, obj);
}
}
}
sweep_block (MSBlockInfo *block, gboolean during_major_collection)
{
int count;
+ void *reversed = NULL;
if (!during_major_collection)
g_assert (!sgen_concurrent_collection_in_progress ());
/* reset mark bits */
memset (block->mark_words, 0, sizeof (mword) * MS_NUM_MARK_WORDS);
- /*
- * FIXME: reverse free list so that it's in address
- * order
- */
+ /* Reverse free list so that it's in address order */
+ reversed = NULL;
+ while (block->free_list) {
+ void *next = *(void**)block->free_list;
+ *(void**)block->free_list = reversed;
+ reversed = block->free_list;
+ block->free_list = next;
+ }
+ block->free_list = reversed;
block->swept = 1;
}