Skip to content

Commit aa378a5

Browse files
committed
Instrumentation to test commit accounting
1 parent 334d57e commit aa378a5

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/coreclr/gc/gc.cpp

+8-12
Original file line numberDiff line numberDiff line change
@@ -7309,7 +7309,7 @@ bool gc_heap::virtual_commit (void* address, size_t size, int bucket, int h_numb
73097309
assert(bucket != recorded_committed_free_bucket);
73107310
#endif //USE_REGIONS
73117311

7312-
dprintf(3, ("commit-accounting: commit in %d [%p, %p) for heap %d", bucket, address, ((uint8_t*)address + size), h_number));
7312+
STRESS_LOG_VA (1, ("commit-accounting: commit in %d [%p, %p) for heap %d", bucket, address, ((uint8_t*)address + size), h_number));
73137313
bool should_count =
73147314
#ifdef USE_REGIONS
73157315
true;
@@ -7407,7 +7407,7 @@ void gc_heap::reduce_committed_bytes (void* address, size_t size, int bucket, in
74077407
assert(0 <= bucket && bucket < recorded_committed_bucket_counts);
74087408
assert(bucket < total_oh_count || h_number == -1);
74097409

7410-
dprintf(3, ("commit-accounting: decommit in %d [%p, %p) for heap %d", bucket, address, ((uint8_t*)address + size), h_number));
7410+
STRESS_LOG_VA (1, ("commit-accounting: decommit in %d [%p, %p) for heap %d", bucket, address, ((uint8_t*)address + size), h_number));
74117411

74127412
#ifndef USE_REGIONS
74137413
if (bucket != recorded_committed_ignored_bucket)
@@ -11813,7 +11813,7 @@ void gc_heap::clear_region_info (heap_segment* region)
1181311813
void gc_heap::return_free_region (heap_segment* region)
1181411814
{
1181511815
gc_oh_num oh = heap_segment_oh (region);
11816-
dprintf(3, ("commit-accounting: from %d to free [%p, %p) for heap %d", oh, get_region_start (region), heap_segment_committed (region), heap_number));
11816+
STRESS_LOG_VA (1, ("commit-accounting: from %d to free [%p, %p) for heap %d", oh, get_region_start (region), heap_segment_committed (region), heap_number));
1181711817
{
1181811818
size_t committed = heap_segment_committed (region) - get_region_start (region);
1181911819
if (committed > 0)
@@ -11907,7 +11907,7 @@ heap_segment* gc_heap::get_free_region (int gen_number, size_t size)
1190711907
gen_number, true);
1190811908

1190911909
gc_oh_num oh = gen_to_oh (gen_number);
11910-
dprintf(3, ("commit-accounting: from free to %d [%p, %p) for heap %d", oh, get_region_start (region), heap_segment_committed (region), heap_number));
11910+
STRESS_LOG_VA (1, ("commit-accounting: from free to %d [%p, %p) for heap %d", oh, get_region_start (region), heap_segment_committed (region), heap_number));
1191111911
{
1191211912
size_t committed = heap_segment_committed (region) - get_region_start (region);
1191311913
if (committed > 0)
@@ -24573,7 +24573,7 @@ heap_segment* gc_heap::unlink_first_rw_region (int gen_idx)
2457324573
dprintf (REGIONS_LOG, ("unlink_first_rw_region on heap: %d gen: %d region: %p", heap_number, gen_idx, heap_segment_mem (region)));
2457424574

2457524575
int oh = heap_segment_oh (region);
24576-
dprintf(3, ("commit-accounting: from %d to temp [%p, %p) for heap %d", oh, get_region_start (region), heap_segment_committed (region), this->heap_number));
24576+
STRESS_LOG_VA (1, ("commit-accounting: from %d to temp [%p, %p) for heap %d", oh, get_region_start (region), heap_segment_committed (region), this->heap_number));
2457724577
#ifdef _DEBUG
2457824578
size_t committed = heap_segment_committed (region) - get_region_start (region);
2457924579
if (committed > 0)
@@ -24610,7 +24610,7 @@ void gc_heap::thread_rw_region_front (int gen_idx, heap_segment* region)
2461024610
dprintf (REGIONS_LOG, ("thread_rw_region_front on heap: %d gen: %d region: %p", heap_number, gen_idx, heap_segment_mem (region)));
2461124611

2461224612
int oh = heap_segment_oh (region);
24613-
dprintf(3, ("commit-accounting: from temp to %d [%p, %p) for heap %d", oh, get_region_start (region), heap_segment_committed (region), this->heap_number));
24613+
STRESS_LOG_VA (1, ("commit-accounting: from temp to %d [%p, %p) for heap %d", oh, get_region_start (region), heap_segment_committed (region), this->heap_number));
2461424614
#ifdef _DEBUG
2461524615
size_t committed = heap_segment_committed (region) - get_region_start (region);
2461624616
assert (heap_segment_heap (region) == nullptr);
@@ -24752,7 +24752,7 @@ void gc_heap::equalize_promoted_bytes(int condemned_gen_number)
2475224752
assert (heap_segment_heap (start_region) == nullptr && hp != nullptr);
2475324753
int oh = heap_segment_oh (start_region);
2475424754
size_t committed = heap_segment_committed (start_region) - get_region_start (start_region);
24755-
dprintf(3, ("commit-accounting: from temp to %d [%p, %p) for heap %d", oh, get_region_start (start_region), heap_segment_committed (start_region), hp->heap_number));
24755+
STRESS_LOG_VA (1, ("commit-accounting: from temp to %d [%p, %p) for heap %d", oh, get_region_start (start_region), heap_segment_committed (start_region), hp->heap_number));
2475624756
#ifdef _DEBUG
2475724757
g_heaps[hp->heap_number]->committed_by_oh_per_heap[oh] += committed;
2475824758
#endif //_DEBUG
@@ -26070,7 +26070,7 @@ bool gc_heap::change_heap_count (int new_n_heaps)
2607026070
size_t committed = heap_segment_committed (region) - get_region_start (region);
2607126071
if (committed > 0)
2607226072
{
26073-
dprintf(3, ("commit-accounting: from %d to %d [%p, %p) for heap %d to heap %d", oh, oh, get_region_start (region), heap_segment_committed (region), i, dest_heap_number));
26073+
STRESS_LOG_VA (1, ("commit-accounting: from %d to %d [%p, %p) for heap %d to heap %d", oh, oh, get_region_start (region), heap_segment_committed (region), i, dest_heap_number));
2607426074
#ifdef _DEBUG
2607526075
assert (hp->committed_by_oh_per_heap[oh] >= committed);
2607626076
hp->committed_by_oh_per_heap[oh] -= committed;
@@ -47495,10 +47495,6 @@ void gc_heap::verify_committed_bytes_per_heap()
4749547495

4749647496
void gc_heap::verify_committed_bytes()
4749747497
{
47498-
#ifndef USE_REGIONS
47499-
// TODO, https://github.com/dotnet/runtime/issues/102706, re-enable the testing after fixing this bug
47500-
return;
47501-
#endif //!USE_REGIONS
4750247498
size_t total_committed = 0;
4750347499
size_t committed_decommit; // unused
4750447500
size_t committed_free; // unused

0 commit comments

Comments
 (0)