@@ -12798,35 +12798,29 @@ void gc_heap::rearrange_heap_segments(BOOL compacting)
12798
12798
#endif //!USE_REGIONS
12799
12799
12800
12800
#if defined(USE_REGIONS)
12801
- // trim down the list of free regions pointed at by free_list down to target_count, moving the extra ones to surplus_list
12802
- static void remove_surplus_regions (region_free_list* free_list , region_free_list* surplus_list , size_t target_count)
12801
+ // trim down the list of regions pointed at by src down to target_count, moving the extra ones to dest
12802
+ static void trim_region_list (region_free_list* dest , region_free_list* src , size_t target_count)
12803
12803
{
12804
- while (free_list ->get_num_free_regions() > target_count)
12804
+ while (src ->get_num_free_regions() > target_count)
12805
12805
{
12806
- // remove one region from the heap's free list
12807
- heap_segment* region = free_list->unlink_region_front();
12808
-
12809
- // and put it on the surplus list
12810
- surplus_list->add_region_front (region);
12806
+ heap_segment* region = src->unlink_region_front();
12807
+ dest->add_region_front (region);
12811
12808
}
12812
12809
}
12813
12810
12814
- // add regions from surplus_list to free_list , trying to reach target_count
12815
- static int64_t add_regions (region_free_list* free_list , region_free_list* surplus_list , size_t target_count)
12811
+ // add regions from src to dest , trying to grow the size of dest to target_count
12812
+ static int64_t grow_region_list (region_free_list* dest , region_free_list* src , size_t target_count)
12816
12813
{
12817
12814
int64_t added_count = 0;
12818
- while (free_list ->get_num_free_regions() < target_count)
12815
+ while (dest ->get_num_free_regions() < target_count)
12819
12816
{
12820
- if (surplus_list ->get_num_free_regions() == 0)
12817
+ if (src ->get_num_free_regions() == 0)
12821
12818
break;
12822
12819
12823
12820
added_count++;
12824
12821
12825
- // remove one region from the surplus list
12826
- heap_segment* region = surplus_list->unlink_region_front();
12827
-
12828
- // and put it on the heap's free list
12829
- free_list->add_region_front (region);
12822
+ heap_segment* region = src->unlink_region_front();
12823
+ dest->add_region_front (region);
12830
12824
}
12831
12825
return added_count;
12832
12826
}
@@ -13582,7 +13576,7 @@ void gc_heap::distribute_free_regions()
13582
13576
hp->free_regions[kind].get_num_free_regions(),
13583
13577
heap_budget_in_region_units[kind][i]));
13584
13578
13585
- remove_surplus_regions (&hp->free_regions [kind], &surplus_regions [kind], heap_budget_in_region_units[kind][i]);
13579
+ trim_region_list (&surplus_regions [kind], &hp->free_regions [kind], heap_budget_in_region_units[kind][i]);
13586
13580
}
13587
13581
}
13588
13582
// finally go through all the heaps and distribute any surplus regions to heaps having too few free regions
@@ -13598,7 +13592,7 @@ void gc_heap::distribute_free_regions()
13598
13592
// second pass: fill all the regions having less than budget
13599
13593
if (hp->free_regions[kind].get_num_free_regions() < heap_budget_in_region_units[kind][i])
13600
13594
{
13601
- int64_t num_added_regions = add_regions (&hp->free_regions[kind], &surplus_regions[kind], heap_budget_in_region_units[kind][i]);
13595
+ int64_t num_added_regions = grow_region_list (&hp->free_regions[kind], &surplus_regions[kind], heap_budget_in_region_units[kind][i]);
13602
13596
dprintf (REGIONS_LOG, ("added %zd %s regions to heap %d - now has %zd, budget is %zd",
13603
13597
(size_t)num_added_regions,
13604
13598
free_region_kind_name[kind],
0 commit comments