Skip to content

Commit d8dbd95

Browse files
authored
Avoid accounting work on 32-bit platforms (#73491)
1 parent 63b2656 commit d8dbd95

File tree

1 file changed

+29
-22
lines changed

1 file changed

+29
-22
lines changed

src/coreclr/gc/gc.cpp

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22687,17 +22687,20 @@ heap_segment* gc_heap::unlink_first_rw_region (int gen_idx)
2268722687
assert (!heap_segment_read_only_p (region));
2268822688
dprintf (REGIONS_LOG, ("unlink_first_rw_region on heap: %d gen: %d region: %Ix", heap_number, gen_idx, heap_segment_mem (region)));
2268922689

22690-
#ifdef _DEBUG
22691-
int old_oh = heap_segment_oh (region);
22692-
int old_heap = heap_segment_heap (region)->heap_number;
22693-
dprintf(3, ("commit-accounting: from %d to temp [%Ix, %Ix) for heap %d", old_oh, get_region_start (region), heap_segment_committed (region), old_heap));
22694-
22695-
size_t committed = heap_segment_committed (region) - get_region_start (region);
22696-
check_commit_cs.Enter();
22697-
assert (g_heaps[old_heap]->committed_by_oh_per_heap[old_oh] >= committed);
22698-
g_heaps[old_heap]->committed_by_oh_per_heap[old_oh] -= committed;
22699-
check_commit_cs.Leave();
22700-
#endif // _DEBUG
22690+
#if defined(_DEBUG) && defined(HOST_64BIT)
22691+
if (heap_hard_limit_oh[soh])
22692+
{
22693+
int old_oh = heap_segment_oh (region);
22694+
int old_heap = heap_segment_heap (region)->heap_number;
22695+
dprintf(3, ("commit-accounting: from %d to temp [%Ix, %Ix) for heap %d", old_oh, get_region_start (region), heap_segment_committed (region), old_heap));
22696+
22697+
size_t committed = heap_segment_committed (region) - get_region_start (region);
22698+
check_commit_cs.Enter();
22699+
assert (g_heaps[old_heap]->committed_by_oh_per_heap[old_oh] >= committed);
22700+
g_heaps[old_heap]->committed_by_oh_per_heap[old_oh] -= committed;
22701+
check_commit_cs.Leave();
22702+
}
22703+
#endif // _DEBUG && HOST_64BIT
2270122704

2270222705
set_heap_for_contained_basic_regions (region, nullptr);
2270322706

@@ -22721,17 +22724,20 @@ void gc_heap::thread_rw_region_front (int gen_idx, heap_segment* region)
2272122724
}
2272222725
dprintf (REGIONS_LOG, ("thread_rw_region_front on heap: %d gen: %d region: %Ix", heap_number, gen_idx, heap_segment_mem (region)));
2272322726

22724-
#ifdef _DEBUG
22725-
int new_oh = gen_to_oh (gen_idx);
22726-
int new_heap = this->heap_number;
22727-
dprintf(3, ("commit-accounting: from temp to %d [%Ix, %Ix) for heap %d", new_oh, get_region_start (region), heap_segment_committed (region), new_heap));
22728-
22729-
size_t committed = heap_segment_committed (region) - get_region_start (region);
22730-
check_commit_cs.Enter();
22731-
assert (heap_segment_heap (region) == nullptr);
22732-
g_heaps[new_heap]->committed_by_oh_per_heap[new_oh] += committed;
22733-
check_commit_cs.Leave();
22734-
#endif // _DEBUG
22727+
#if defined(_DEBUG) && defined(HOST_64BIT)
22728+
if (heap_hard_limit_oh[soh])
22729+
{
22730+
int new_oh = gen_to_oh (gen_idx);
22731+
int new_heap = this->heap_number;
22732+
dprintf(3, ("commit-accounting: from temp to %d [%Ix, %Ix) for heap %d", new_oh, get_region_start (region), heap_segment_committed (region), new_heap));
22733+
22734+
size_t committed = heap_segment_committed (region) - get_region_start (region);
22735+
check_commit_cs.Enter();
22736+
assert (heap_segment_heap (region) == nullptr);
22737+
g_heaps[new_heap]->committed_by_oh_per_heap[new_oh] += committed;
22738+
check_commit_cs.Leave();
22739+
}
22740+
#endif // _DEBUG && HOST_64BIT
2273522741

2273622742
set_heap_for_contained_basic_regions (region, this);
2273722743
}
@@ -44091,6 +44097,7 @@ HRESULT GCHeap::Initialize()
4409144097
{
4409244098
gc_heap::total_physical_mem = GCToOSInterface::GetPhysicalMemoryLimit (&gc_heap::is_restricted_physical_mem);
4409344099
}
44100+
gc_heap::heap_hard_limit_oh[soh] = 0;
4409444101
#ifdef HOST_64BIT
4409544102
gc_heap::heap_hard_limit = (size_t)GCConfig::GetGCHeapHardLimit();
4409644103
gc_heap::heap_hard_limit_oh[soh] = (size_t)GCConfig::GetGCHeapHardLimitSOH();

0 commit comments

Comments
 (0)