@@ -12798,35 +12798,29 @@ void gc_heap::rearrange_heap_segments(BOOL compacting)
1279812798#endif //!USE_REGIONS
1279912799
1280012800#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)
1280312803{
12804- while (free_list ->get_num_free_regions() > target_count)
12804+ while (src ->get_num_free_regions() > target_count)
1280512805 {
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);
1281112808 }
1281212809}
1281312810
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)
1281612813{
1281712814 int64_t added_count = 0;
12818- while (free_list ->get_num_free_regions() < target_count)
12815+ while (dest ->get_num_free_regions() < target_count)
1281912816 {
12820- if (surplus_list ->get_num_free_regions() == 0)
12817+ if (src ->get_num_free_regions() == 0)
1282112818 break;
1282212819
1282312820 added_count++;
1282412821
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);
1283012824 }
1283112825 return added_count;
1283212826}
@@ -13582,7 +13576,7 @@ void gc_heap::distribute_free_regions()
1358213576 hp->free_regions[kind].get_num_free_regions(),
1358313577 heap_budget_in_region_units[kind][i]));
1358413578
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]);
1358613580 }
1358713581 }
1358813582 // 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()
1359813592 // second pass: fill all the regions having less than budget
1359913593 if (hp->free_regions[kind].get_num_free_regions() < heap_budget_in_region_units[kind][i])
1360013594 {
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]);
1360213596 dprintf (REGIONS_LOG, ("added %zd %s regions to heap %d - now has %zd, budget is %zd",
1360313597 (size_t)num_added_regions,
1360413598 free_region_kind_name[kind],
0 commit comments