Skip to content

Commit fa5579f

Browse files
committed
Code review feedback
1 parent a78c1a9 commit fa5579f

1 file changed

Lines changed: 9 additions & 15 deletions

File tree

src/coreclr/src/gc/gc.cpp

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4018,13 +4018,14 @@ BOOL gc_heap::reserve_initial_memory (size_t normal_size, size_t large_size, siz
40184018
}
40194019

40204020
size_t temp_pinned_size = (separated_poh_p ? 0 : pinned_size);
4021+
size_t separate_pinned_size = memory_details.block_count * pinned_size;
40214022
size_t requestedMemory = memory_details.block_count * (normal_size + large_size + temp_pinned_size);
40224023

40234024
uint8_t* allatonce_block = (uint8_t*)virtual_alloc (requestedMemory, use_large_pages_p);
40244025
uint8_t* separated_poh_block = nullptr;
40254026
if (allatonce_block && separated_poh_p)
40264027
{
4027-
separated_poh_block = (uint8_t*)virtual_alloc ((memory_details.block_count * pinned_size), false);
4028+
separated_poh_block = (uint8_t*)virtual_alloc (separate_pinned_size, false);
40284029
if (!separated_poh_block)
40294030
{
40304031
virtual_free (allatonce_block, requestedMemory);
@@ -4036,7 +4037,7 @@ BOOL gc_heap::reserve_initial_memory (size_t normal_size, size_t large_size, siz
40364037
if (separated_poh_p)
40374038
{
40384039
g_gc_lowest_address = min (allatonce_block, separated_poh_block);
4039-
g_gc_highest_address = max (allatonce_block + requestedMemory, separated_poh_block + (memory_details.block_count * pinned_size));
4040+
g_gc_highest_address = max ((allatonce_block + requestedMemory), (separated_poh_block + separate_pinned_size));
40404041
memory_details.allocation_pattern = initial_memory_details::ALLATONCE_SEPARATED_POH;
40414042
}
40424043
else
@@ -35305,17 +35306,10 @@ HRESULT GCHeap::Initialize()
3530535306
#ifdef MULTIPLE_HEAPS
3530635307
if (nhp_from_config == 0)
3530735308
{
35308-
if (nhp > gc_heap::heap_hard_limit_oh[0] / min_segment_size_hard_limit)
35309+
for (int i = 0; i < (total_oh_count - 1); i++)
3530935310
{
35310-
nhp = (uint32_t)(gc_heap::heap_hard_limit_oh[0] / min_segment_size_hard_limit);
35311-
}
35312-
if (nhp > gc_heap::heap_hard_limit_oh[1] / min_segment_size_hard_limit)
35313-
{
35314-
nhp = (uint32_t)(gc_heap::heap_hard_limit_oh[1] / min_segment_size_hard_limit);
35315-
}
35316-
if (nhp > gc_heap::heap_hard_limit_oh[2] / min_segment_size_hard_limit)
35317-
{
35318-
nhp = (uint32_t)(gc_heap::heap_hard_limit_oh[2] / min_segment_size_hard_limit);
35311+
uint32_t nhp_oh = (uint32_t)(gc_heap::heap_hard_limit_oh[i] / min_segment_size_hard_limit);
35312+
nhp = min (nhp, nhp_oh);
3531935313
}
3532035314
if (nhp == 0)
3532135315
{
@@ -35327,9 +35321,9 @@ HRESULT GCHeap::Initialize()
3532735321
large_seg_size = gc_heap::heap_hard_limit_oh[1] / nhp;
3532835322
pin_seg_size = gc_heap::heap_hard_limit_oh[2] / nhp;
3532935323

35330-
size_t aligned_seg_size = align_on_segment_hard_limit (gc_heap::heap_hard_limit_oh[0] / nhp);
35331-
size_t aligned_large_seg_size = align_on_segment_hard_limit (gc_heap::heap_hard_limit_oh[1] / nhp);
35332-
size_t aligned_pin_seg_size = align_on_segment_hard_limit (gc_heap::heap_hard_limit_oh[2] / nhp);
35324+
size_t aligned_seg_size = align_on_segment_hard_limit (seg_size);
35325+
size_t aligned_large_seg_size = align_on_segment_hard_limit (large_seg_size);
35326+
size_t aligned_pin_seg_size = align_on_segment_hard_limit (pin_seg_size);
3533335327

3533435328
if (!gc_heap::use_large_pages_p)
3533535329
{

0 commit comments

Comments
 (0)