#ifdef USE_REGIONS
region_allocator global_region_allocator;
uint8_t*(*initial_regions)[total_generation_count][2] = nullptr;
+size_t gc_heap::region_count = 0;
#endif //USE_REGIONS
#ifdef BACKGROUND_GC
return (basic_region_index - ((size_t)g_gc_lowest_address >> gc_heap::min_segment_size_shr));
}
-inline
-size_t get_total_region_count()
-{
- return (get_basic_region_index_for_address (g_gc_highest_address) + 1);
-}
-
// Go from a random address to its region info. The random address could be
// in one of the basic regions of a larger region so we need to check for that.
inline
#ifdef USE_REGIONS
// first set the pieces for all regions to empty
- size_t region_count = get_total_region_count();
assert (g_mark_list_piece_size >= region_count);
for (size_t region_index = 0; region_index < region_count; region_index++)
{
}
dprintf (3, ("h%d getting surv", heap_number));
- size_t region_count = get_total_region_count();
size_t promoted = 0;
for (size_t i = 0; i < region_count; i++)
{
#ifdef USE_REGIONS
special_sweep_p = false;
+ region_count = global_region_allocator.get_used_region_count();
grow_mark_list_piece();
#endif //USE_REGIONS
#endif //MULTIPLE_HEAPS
survived_per_region = (size_t*)&g_mark_list_piece[heap_number * 2 * g_mark_list_piece_size];
old_card_survived_per_region = (size_t*)&survived_per_region[g_mark_list_piece_size];
- size_t region_info_to_clear = get_total_region_count() * sizeof (size_t);
+ size_t region_info_to_clear = region_count * sizeof (size_t);
memset (survived_per_region, 0, region_info_to_clear);
memset (old_card_survived_per_region, 0, region_info_to_clear);
}
void gc_heap::grow_mark_list_piece()
{
- size_t region_count = get_total_region_count();
if (g_mark_list_piece_size < region_count)
{
delete[] g_mark_list_piece;
{
if (!survived_per_region) return;
- size_t region_info_to_copy = get_total_region_count() * sizeof (size_t);
+ size_t region_info_to_copy = region_count * sizeof (size_t);
memcpy (old_card_survived_per_region, survived_per_region, region_info_to_copy);
#ifdef _DEBUG
- size_t region_count = get_total_region_count();
for (size_t region_index = 0; region_index < region_count; region_index++)
{
if (survived_per_region[region_index] != 0)
{
if (!survived_per_region) return;
- size_t region_count = get_total_region_count();
for (size_t region_index = 0; region_index < region_count; region_index++)
{
old_card_survived_per_region[region_index] = survived_per_region[region_index] -
size_t* survived_per_region;
PER_HEAP
size_t* old_card_survived_per_region;
+ PER_HEAP_ISOLATED
+ size_t region_count;
#endif //USE_REGIONS
#define max_oom_history_count 4
size_t get_free() { return (total_free_units * region_alignment) ; }
size_t get_region_alignment () { return region_alignment; }
size_t get_large_region_alignment () { return large_region_alignment; }
+ size_t get_used_region_count()
+ {
+ // currently we don't allocate anything from the right -
+ // once we do, we need a more sophisticated way to iterate
+ // through the used regions
+ assert (region_map_right_start == region_map_right_end);
+ return (region_map_left_end - region_map_left_start);
+ }
};
#endif //USE_REGIONS