From aa378a53e7c09899c619de723f35df91eda7f19f Mon Sep 17 00:00:00 2001 From: Andrew Au Date: Fri, 9 Aug 2024 06:12:19 -0700 Subject: [PATCH 01/10] Instrumentation to test commit accounting --- src/coreclr/gc/gc.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/coreclr/gc/gc.cpp b/src/coreclr/gc/gc.cpp index 4f15f554ffb41..230a914732ea9 100644 --- a/src/coreclr/gc/gc.cpp +++ b/src/coreclr/gc/gc.cpp @@ -7309,7 +7309,7 @@ bool gc_heap::virtual_commit (void* address, size_t size, int bucket, int h_numb assert(bucket != recorded_committed_free_bucket); #endif //USE_REGIONS - dprintf(3, ("commit-accounting: commit in %d [%p, %p) for heap %d", bucket, address, ((uint8_t*)address + size), h_number)); + STRESS_LOG_VA (1, ("commit-accounting: commit in %d [%p, %p) for heap %d", bucket, address, ((uint8_t*)address + size), h_number)); bool should_count = #ifdef USE_REGIONS true; @@ -7407,7 +7407,7 @@ void gc_heap::reduce_committed_bytes (void* address, size_t size, int bucket, in assert(0 <= bucket && bucket < recorded_committed_bucket_counts); assert(bucket < total_oh_count || h_number == -1); - dprintf(3, ("commit-accounting: decommit in %d [%p, %p) for heap %d", bucket, address, ((uint8_t*)address + size), h_number)); + STRESS_LOG_VA (1, ("commit-accounting: decommit in %d [%p, %p) for heap %d", bucket, address, ((uint8_t*)address + size), h_number)); #ifndef USE_REGIONS if (bucket != recorded_committed_ignored_bucket) @@ -11813,7 +11813,7 @@ void gc_heap::clear_region_info (heap_segment* region) void gc_heap::return_free_region (heap_segment* region) { gc_oh_num oh = heap_segment_oh (region); - dprintf(3, ("commit-accounting: from %d to free [%p, %p) for heap %d", oh, get_region_start (region), heap_segment_committed (region), heap_number)); + 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)); { size_t committed = heap_segment_committed (region) - get_region_start (region); if (committed > 0) @@ -11907,7 +11907,7 @@ heap_segment* gc_heap::get_free_region (int gen_number, size_t size) gen_number, true); gc_oh_num oh = gen_to_oh (gen_number); - dprintf(3, ("commit-accounting: from free to %d [%p, %p) for heap %d", oh, get_region_start (region), heap_segment_committed (region), heap_number)); + 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)); { size_t committed = heap_segment_committed (region) - get_region_start (region); if (committed > 0) @@ -24573,7 +24573,7 @@ heap_segment* gc_heap::unlink_first_rw_region (int gen_idx) dprintf (REGIONS_LOG, ("unlink_first_rw_region on heap: %d gen: %d region: %p", heap_number, gen_idx, heap_segment_mem (region))); int oh = heap_segment_oh (region); - 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)); + 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)); #ifdef _DEBUG size_t committed = heap_segment_committed (region) - get_region_start (region); if (committed > 0) @@ -24610,7 +24610,7 @@ void gc_heap::thread_rw_region_front (int gen_idx, heap_segment* region) dprintf (REGIONS_LOG, ("thread_rw_region_front on heap: %d gen: %d region: %p", heap_number, gen_idx, heap_segment_mem (region))); int oh = heap_segment_oh (region); - 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)); + 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)); #ifdef _DEBUG size_t committed = heap_segment_committed (region) - get_region_start (region); assert (heap_segment_heap (region) == nullptr); @@ -24752,7 +24752,7 @@ void gc_heap::equalize_promoted_bytes(int condemned_gen_number) assert (heap_segment_heap (start_region) == nullptr && hp != nullptr); int oh = heap_segment_oh (start_region); size_t committed = heap_segment_committed (start_region) - get_region_start (start_region); - 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)); + 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)); #ifdef _DEBUG g_heaps[hp->heap_number]->committed_by_oh_per_heap[oh] += committed; #endif //_DEBUG @@ -26070,7 +26070,7 @@ bool gc_heap::change_heap_count (int new_n_heaps) size_t committed = heap_segment_committed (region) - get_region_start (region); if (committed > 0) { - 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)); + 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)); #ifdef _DEBUG assert (hp->committed_by_oh_per_heap[oh] >= committed); hp->committed_by_oh_per_heap[oh] -= committed; @@ -47495,10 +47495,6 @@ void gc_heap::verify_committed_bytes_per_heap() void gc_heap::verify_committed_bytes() { -#ifndef USE_REGIONS - // TODO, https://github.com/dotnet/runtime/issues/102706, re-enable the testing after fixing this bug - return; -#endif //!USE_REGIONS size_t total_committed = 0; size_t committed_decommit; // unused size_t committed_free; // unused From 399b2181b879690afb8a224c59d637f54b6eff54 Mon Sep 17 00:00:00 2001 From: Andrew Au Date: Fri, 9 Aug 2024 10:00:18 -0700 Subject: [PATCH 02/10] Experiment: always run segments --- src/coreclr/gc/gcpriv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/gc/gcpriv.h b/src/coreclr/gc/gcpriv.h index 412b08050c4e4..b737dfd394950 100644 --- a/src/coreclr/gc/gcpriv.h +++ b/src/coreclr/gc/gcpriv.h @@ -145,7 +145,7 @@ inline void FATAL_GC_ERROR() // to the mmap() calls in unix/gcenv.unix.cpp More details here: // https://github.com/dotnet/runtime/issues/104211 #if defined (HOST_64BIT) && !defined (BUILD_AS_STANDALONE) && !defined(__APPLE__) && !defined(__sun) -#define USE_REGIONS +// #define USE_REGIONS #endif //HOST_64BIT && BUILD_AS_STANDALONE && !__APPLE__ //#define SPINLOCK_HISTORY From d0ec8154ee2d7423dfce735c720c804f5a5ef035 Mon Sep 17 00:00:00 2001 From: Andrew Au Date: Fri, 9 Aug 2024 15:11:19 -0700 Subject: [PATCH 03/10] Use the right bucket for committing mark array --- src/coreclr/gc/gc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/gc/gc.cpp b/src/coreclr/gc/gc.cpp index 230a914732ea9..577cef531d9ad 100644 --- a/src/coreclr/gc/gc.cpp +++ b/src/coreclr/gc/gc.cpp @@ -9594,7 +9594,7 @@ int gc_heap::grow_brick_card_tables (uint8_t* start, // in case of background gc, the mark array will be committed separately (per segment). size_t commit_size = card_table_element_layout[seg_mapping_table_element + 1]; - if (!virtual_commit (mem, commit_size, recorded_committed_bookkeeping_bucket)) + if (!virtual_commit (mem, commit_size, recorded_committed_mark_array_bucket)) { dprintf (GC_TABLE_LOG, ("Table commit failed")); set_fgm_result (fgm_commit_table, commit_size, uoh_p); From afb2b9830707044bcf514e9e4dfc161b5e9dc106 Mon Sep 17 00:00:00 2001 From: Andrew Au Date: Sat, 10 Aug 2024 07:02:16 -0700 Subject: [PATCH 04/10] Revert "Use the right bucket for committing mark array" This reverts commit d0ec8154ee2d7423dfce735c720c804f5a5ef035. --- src/coreclr/gc/gc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/gc/gc.cpp b/src/coreclr/gc/gc.cpp index 577cef531d9ad..230a914732ea9 100644 --- a/src/coreclr/gc/gc.cpp +++ b/src/coreclr/gc/gc.cpp @@ -9594,7 +9594,7 @@ int gc_heap::grow_brick_card_tables (uint8_t* start, // in case of background gc, the mark array will be committed separately (per segment). size_t commit_size = card_table_element_layout[seg_mapping_table_element + 1]; - if (!virtual_commit (mem, commit_size, recorded_committed_mark_array_bucket)) + if (!virtual_commit (mem, commit_size, recorded_committed_bookkeeping_bucket)) { dprintf (GC_TABLE_LOG, ("Table commit failed")); set_fgm_result (fgm_commit_table, commit_size, uoh_p); From db97a841baa5b2a91087256a149ccab26a94aa16 Mon Sep 17 00:00:00 2001 From: Andrew Au Date: Mon, 12 Aug 2024 13:16:11 -0700 Subject: [PATCH 05/10] Ignore Refresh test case --- src/tests/GC/API/Refresh/Refresh.cs | 42 ------------------------- src/tests/GC/API/Refresh/Refresh.csproj | 15 --------- 2 files changed, 57 deletions(-) delete mode 100644 src/tests/GC/API/Refresh/Refresh.cs delete mode 100644 src/tests/GC/API/Refresh/Refresh.csproj diff --git a/src/tests/GC/API/Refresh/Refresh.cs b/src/tests/GC/API/Refresh/Refresh.cs deleted file mode 100644 index 74190514133ab..0000000000000 --- a/src/tests/GC/API/Refresh/Refresh.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; - -namespace Refresh -{ - internal static class Program - { - private static int Main() - { - long hundred_mb = 100 * 1024 * 1024; - long two_hundred_mb = 2 * hundred_mb; - AppContext.SetData("GCHeapHardLimit", (ulong)hundred_mb); - GC.RefreshMemoryLimit(); - GCMemoryInfo gcMemoryInfo = GC.GetGCMemoryInfo(); - if (gcMemoryInfo.TotalAvailableMemoryBytes != hundred_mb) - { - Console.WriteLine("Fail"); - return 101; - } - AppContext.SetData("GCHeapHardLimit", (ulong)two_hundred_mb); - GC.RefreshMemoryLimit(); - gcMemoryInfo = GC.GetGCMemoryInfo(); - if (gcMemoryInfo.TotalAvailableMemoryBytes != two_hundred_mb) - { - Console.WriteLine("Fail"); - return 101; - } - AppContext.SetData("GCHeapHardLimit", (ulong)hundred_mb); - GC.RefreshMemoryLimit(); - gcMemoryInfo = GC.GetGCMemoryInfo(); - if (gcMemoryInfo.TotalAvailableMemoryBytes != hundred_mb) - { - Console.WriteLine("Fail"); - return 101; - } - Console.WriteLine("Pass"); - return 100; - } - } -} diff --git a/src/tests/GC/API/Refresh/Refresh.csproj b/src/tests/GC/API/Refresh/Refresh.csproj deleted file mode 100644 index cc3b9259c5b7d..0000000000000 --- a/src/tests/GC/API/Refresh/Refresh.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - Exe - true - 0 - true - true - - - PdbOnly - - - - - From bd052beee80f796b44c007e794867a7d8bc93ece Mon Sep 17 00:00:00 2001 From: Andrew Au Date: Wed, 14 Aug 2024 14:36:27 -0700 Subject: [PATCH 06/10] Revert "Move a regression test out of CI (#80399)" This reverts commit eb4d23002dba50290b37cc616ef1cf7ff914ed19. --- .../GC/Regressions/Github/Runtime_76219/Runtime_76219.csproj | 2 -- src/tests/issues.targets | 3 --- 2 files changed, 5 deletions(-) diff --git a/src/tests/GC/Regressions/Github/Runtime_76219/Runtime_76219.csproj b/src/tests/GC/Regressions/Github/Runtime_76219/Runtime_76219.csproj index aeec2e9d6b4cd..1ddf97612fbc5 100644 --- a/src/tests/GC/Regressions/Github/Runtime_76219/Runtime_76219.csproj +++ b/src/tests/GC/Regressions/Github/Runtime_76219/Runtime_76219.csproj @@ -2,8 +2,6 @@ Exe True - - 1 diff --git a/src/tests/issues.targets b/src/tests/issues.targets index a1da972936558..c61ee7e528243 100644 --- a/src/tests/issues.targets +++ b/src/tests/issues.targets @@ -66,9 +66,6 @@ CoreCLR does not implement the mono embedding API - - https://github.com/dotnet/runtime/issues/78899 - https://github.com/dotnet/runtime/issues/88586 From 8f8cc5628895373fb7288af2a77eea095982d48a Mon Sep 17 00:00:00 2001 From: Andrew Au Date: Mon, 12 Aug 2024 14:16:07 -0700 Subject: [PATCH 07/10] WIP: Commit reason tracking --- src/coreclr/gc/gc.cpp | 39 ++++++++++++++++++++------------------- src/coreclr/gc/gcpriv.h | 6 +++--- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/coreclr/gc/gc.cpp b/src/coreclr/gc/gc.cpp index 230a914732ea9..ca9b73b0b7e61 100644 --- a/src/coreclr/gc/gc.cpp +++ b/src/coreclr/gc/gc.cpp @@ -6066,6 +6066,7 @@ void gc_heap::release_segment (heap_segment* sg) FIRE_EVENT(GCFreeSegment_V1, heap_segment_mem(sg)); size_t reserved_size = (uint8_t*)heap_segment_reserved (sg) - (uint8_t*)sg; reduce_committed_bytes ( + 28973, sg, ((uint8_t*)heap_segment_committed (sg) - (uint8_t*)sg), (int) heap_segment_oh (sg) @@ -7289,7 +7290,7 @@ bool gc_heap::virtual_alloc_commit_for_heap (void* addr, size_t size, int h_numb return GCToOSInterface::VirtualCommit(addr, size); } -bool gc_heap::virtual_commit (void* address, size_t size, int bucket, int h_number, bool* hard_limit_exceeded_p) +bool gc_heap::virtual_commit (int reason, void* address, size_t size, int bucket, int h_number, bool* hard_limit_exceeded_p) { /** * Here are all the possible cases for the commits: @@ -7309,7 +7310,7 @@ bool gc_heap::virtual_commit (void* address, size_t size, int bucket, int h_numb assert(bucket != recorded_committed_free_bucket); #endif //USE_REGIONS - STRESS_LOG_VA (1, ("commit-accounting: commit in %d [%p, %p) for heap %d", bucket, address, ((uint8_t*)address + size), h_number)); + STRESS_LOG_VA (1, ("commit-accounting: commit in %d [%p, %p) for heap %d with reason %d", bucket, address, ((uint8_t*)address + size), h_number, reason)); bool should_count = #ifdef USE_REGIONS true; @@ -7402,12 +7403,12 @@ bool gc_heap::virtual_commit (void* address, size_t size, int bucket, int h_numb return commit_succeeded_p; } -void gc_heap::reduce_committed_bytes (void* address, size_t size, int bucket, int h_number, bool decommit_succeeded_p) +void gc_heap::reduce_committed_bytes (int reason, void* address, size_t size, int bucket, int h_number, bool decommit_succeeded_p) { assert(0 <= bucket && bucket < recorded_committed_bucket_counts); assert(bucket < total_oh_count || h_number == -1); - STRESS_LOG_VA (1, ("commit-accounting: decommit in %d [%p, %p) for heap %d", bucket, address, ((uint8_t*)address + size), h_number)); + STRESS_LOG_VA (1, ("commit-accounting: decommit in %d [%p, %p) for heap %d with reason", bucket, address, ((uint8_t*)address + size), h_number, reason)); #ifndef USE_REGIONS if (bucket != recorded_committed_ignored_bucket) @@ -7435,7 +7436,7 @@ void gc_heap::reduce_committed_bytes (void* address, size_t size, int bucket, in } } -bool gc_heap::virtual_decommit (void* address, size_t size, int bucket, int h_number) +bool gc_heap::virtual_decommit (int reason, void* address, size_t size, int bucket, int h_number) { /** * Here are all possible cases for the decommits: @@ -7450,7 +7451,7 @@ bool gc_heap::virtual_decommit (void* address, size_t size, int bucket, int h_nu bool decommit_succeeded_p = ((bucket != recorded_committed_bookkeeping_bucket) && use_large_pages_p) ? true : GCToOSInterface::VirtualDecommit (address, size); - reduce_committed_bytes (address, size, bucket, h_number, decommit_succeeded_p); + reduce_committed_bytes (reason, address, size, bucket, h_number, decommit_succeeded_p); return decommit_succeeded_p; } @@ -9086,7 +9087,7 @@ void gc_heap::destroy_card_table_helper (uint32_t* c_table) uint8_t* highest = card_table_highest_address (c_table); get_card_table_element_layout(lowest, highest, card_table_element_layout); size_t result = card_table_element_layout[seg_mapping_table_element + 1]; - gc_heap::reduce_committed_bytes (&card_table_refcount(c_table), result, recorded_committed_bookkeeping_bucket, -1, true); + gc_heap::reduce_committed_bytes (28972, &card_table_refcount(c_table), result, recorded_committed_bookkeeping_bucket, -1, true); // If we don't put the mark array committed in the ignored bucket, then this is where to account for the decommit of it } @@ -9346,7 +9347,7 @@ bool gc_heap::inplace_commit_card_table (uint8_t* from, uint8_t* to) bool succeed; if (commit_sizes[i] > 0) { - succeed = virtual_commit (commit_begins[i], commit_sizes[i], recorded_committed_bookkeeping_bucket); + succeed = virtual_commit (28967, commit_begins[i], commit_sizes[i], recorded_committed_bookkeeping_bucket); if (!succeed) { failed_commit = i; @@ -9368,7 +9369,7 @@ bool gc_heap::inplace_commit_card_table (uint8_t* from, uint8_t* to) bool succeed; if (commit_sizes[i] > 0) { - succeed = virtual_decommit (commit_begins[i], commit_sizes[i], recorded_committed_bookkeeping_bucket); + succeed = virtual_decommit (28968, commit_begins[i], commit_sizes[i], recorded_committed_bookkeeping_bucket); assert (succeed); } } @@ -9419,7 +9420,7 @@ uint32_t* gc_heap::make_card_table (uint8_t* start, uint8_t* end) // in case of background gc, the mark array will be committed separately (per segment). size_t commit_size = card_table_element_layout[seg_mapping_table_element + 1]; - if (!virtual_commit (mem, commit_size, recorded_committed_bookkeeping_bucket)) + if (!virtual_commit (28960, mem, commit_size, recorded_committed_bookkeeping_bucket)) { dprintf (1, ("Card table commit failed")); GCToOSInterface::VirtualRelease (mem, alloc_size); @@ -9594,7 +9595,7 @@ int gc_heap::grow_brick_card_tables (uint8_t* start, // in case of background gc, the mark array will be committed separately (per segment). size_t commit_size = card_table_element_layout[seg_mapping_table_element + 1]; - if (!virtual_commit (mem, commit_size, recorded_committed_bookkeeping_bucket)) + if (!virtual_commit (28961, mem, commit_size, recorded_committed_bookkeeping_bucket)) { dprintf (GC_TABLE_LOG, ("Table commit failed")); set_fgm_result (fgm_commit_table, commit_size, uoh_p); @@ -12274,7 +12275,7 @@ heap_segment* gc_heap::make_heap_segment (uint8_t* new_pages, size_t size, gc_he 0; #endif //MULTIPLE_HEAPS - if (!virtual_commit (new_pages, initial_commit, oh, h_number)) + if (!virtual_commit (28962, new_pages, initial_commit, oh, h_number)) { return 0; } @@ -12460,7 +12461,7 @@ size_t gc_heap::decommit_heap_segment_pages_worker (heap_segment* seg, ptrdiff_t size = heap_segment_committed (seg) - page_start; if (size > 0) { - bool decommit_succeeded_p = virtual_decommit (page_start, (size_t)size, heap_segment_oh (seg), heap_number); + bool decommit_succeeded_p = virtual_decommit (28963, page_start, (size_t)size, heap_segment_oh (seg), heap_number); if (decommit_succeeded_p) { dprintf (3, ("Decommitting heap segment [%zx, %zx[(%zd)", @@ -12501,7 +12502,7 @@ void gc_heap::decommit_heap_segment (heap_segment* seg) assert (heap_segment_committed (seg) >= page_start); size_t size = heap_segment_committed (seg) - page_start; - bool decommit_succeeded_p = virtual_decommit (page_start, size, heap_segment_oh (seg), heap_number); + bool decommit_succeeded_p = virtual_decommit (28964, page_start, size, heap_segment_oh (seg), heap_number); if (decommit_succeeded_p) { @@ -13269,7 +13270,7 @@ void gc_heap::distribute_free_regions() size_t end_space = heap_segment_committed (region) - aligned_allocated; if (end_space > 0) { - virtual_decommit (aligned_allocated, end_space, gen_to_oh (i), hn); + virtual_decommit (28969, aligned_allocated, end_space, gen_to_oh (i), hn); heap_segment_committed (region) = aligned_allocated; heap_segment_used (region) = min (heap_segment_used (region), heap_segment_committed (region)); assert (heap_segment_committed (region) > heap_segment_mem (region)); @@ -15463,7 +15464,7 @@ BOOL gc_heap::grow_heap_segment (heap_segment* seg, uint8_t* high_address, bool* "Growing heap_segment: %zx high address: %zx\n", (size_t)seg, (size_t)high_address); - bool ret = virtual_commit (heap_segment_committed (seg), c_size, heap_segment_oh (seg), heap_number, hard_limit_exceeded_p); + bool ret = virtual_commit (28965, heap_segment_committed (seg), c_size, heap_segment_oh (seg), heap_number, hard_limit_exceeded_p); if (ret) { heap_segment_committed (seg) += c_size; @@ -37731,7 +37732,7 @@ BOOL gc_heap::commit_mark_array_by_range (uint8_t* begin, uint8_t* end, uint32_t size)); #endif //SIMPLE_DPRINTF - if (virtual_commit (commit_start, size, recorded_committed_mark_array_bucket)) + if (virtual_commit (28966, commit_start, size, recorded_committed_mark_array_bucket)) { // We can only verify the mark array is cleared from begin to end, the first and the last // page aren't necessarily all cleared 'cause they could be used by other segments or @@ -37956,7 +37957,7 @@ void gc_heap::decommit_mark_array_by_seg (heap_segment* seg) if (decommit_start < decommit_end) { - if (!virtual_decommit (decommit_start, size, recorded_committed_mark_array_bucket)) + if (!virtual_decommit (28970, decommit_start, size, recorded_committed_mark_array_bucket)) { dprintf (GC_TABLE_LOG, ("decommit on %p for %zd bytes failed", decommit_start, size)); @@ -44167,7 +44168,7 @@ size_t gc_heap::decommit_region (heap_segment* region, int bucket, int h_number) uint8_t* page_start = align_lower_page (get_region_start (region)); uint8_t* decommit_end = heap_segment_committed (region); size_t decommit_size = decommit_end - page_start; - bool decommit_succeeded_p = virtual_decommit (page_start, decommit_size, bucket, h_number); + bool decommit_succeeded_p = virtual_decommit (28971, page_start, decommit_size, bucket, h_number); bool require_clearing_memory_p = !decommit_succeeded_p || use_large_pages_p; dprintf (REGIONS_LOG, ("decommitted region %p(%p-%p) (%zu bytes) - success: %d", region, diff --git a/src/coreclr/gc/gcpriv.h b/src/coreclr/gc/gcpriv.h index b737dfd394950..4b8ec91a81e9a 100644 --- a/src/coreclr/gc/gcpriv.h +++ b/src/coreclr/gc/gcpriv.h @@ -2393,9 +2393,9 @@ class gc_heap #endif //USE_REGIONS PER_HEAP_METHOD void decommit_heap_segment (heap_segment* seg); PER_HEAP_ISOLATED_METHOD bool virtual_alloc_commit_for_heap (void* addr, size_t size, int h_number); - PER_HEAP_ISOLATED_METHOD bool virtual_commit (void* address, size_t size, int bucket, int h_number=-1, bool* hard_limit_exceeded_p=NULL); - PER_HEAP_ISOLATED_METHOD bool virtual_decommit (void* address, size_t size, int bucket, int h_number=-1); - PER_HEAP_ISOLATED_METHOD void reduce_committed_bytes (void* address, size_t size, int bucket, int h_number, bool decommit_succeeded_p); + PER_HEAP_ISOLATED_METHOD bool virtual_commit (int reason, void* address, size_t size, int bucket, int h_number=-1, bool* hard_limit_exceeded_p=NULL); + PER_HEAP_ISOLATED_METHOD bool virtual_decommit (int reason, void* address, size_t size, int bucket, int h_number=-1); + PER_HEAP_ISOLATED_METHOD void reduce_committed_bytes (int reason, void* address, size_t size, int bucket, int h_number, bool decommit_succeeded_p); friend void destroy_card_table (uint32_t*); PER_HEAP_ISOLATED_METHOD void destroy_card_table_helper (uint32_t* c_table); PER_HEAP_ISOLATED_METHOD void virtual_free (void* add, size_t size, heap_segment* sg=NULL); From fab32adaeac552e919ced8708f54a612937da319 Mon Sep 17 00:00:00 2001 From: Andrew Au Date: Thu, 15 Aug 2024 20:21:51 -0700 Subject: [PATCH 08/10] Failing the test --- src/tests/readytorun/coreroot_determinism/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/readytorun/coreroot_determinism/Program.cs b/src/tests/readytorun/coreroot_determinism/Program.cs index 242f9c434d1bf..453012e6fb9ed 100644 --- a/src/tests/readytorun/coreroot_determinism/Program.cs +++ b/src/tests/readytorun/coreroot_determinism/Program.cs @@ -13,7 +13,7 @@ public class Program { public static int CompareDLLs(string folder1, string folder2) { - int result = 100; + int result = 2; string superIlcFolder1 = Directory.GetDirectories(folder1, "CPAOT*").First(); string superIlcFolder2 = Directory.GetDirectories(folder2, "CPAOT*").First(); From 12969bb4b6475d535141422787625bf1377a2878 Mon Sep 17 00:00:00 2001 From: Andrew Au Date: Fri, 16 Aug 2024 08:15:33 -0700 Subject: [PATCH 09/10] Revert "Failing the test" This reverts commit fab32adaeac552e919ced8708f54a612937da319. --- src/tests/readytorun/coreroot_determinism/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/readytorun/coreroot_determinism/Program.cs b/src/tests/readytorun/coreroot_determinism/Program.cs index 453012e6fb9ed..242f9c434d1bf 100644 --- a/src/tests/readytorun/coreroot_determinism/Program.cs +++ b/src/tests/readytorun/coreroot_determinism/Program.cs @@ -13,7 +13,7 @@ public class Program { public static int CompareDLLs(string folder1, string folder2) { - int result = 2; + int result = 100; string superIlcFolder1 = Directory.GetDirectories(folder1, "CPAOT*").First(); string superIlcFolder2 = Directory.GetDirectories(folder2, "CPAOT*").First(); From 31ae7c27ba28f6af7ae8962510e0150c4d2986b8 Mon Sep 17 00:00:00 2001 From: Andrew Au Date: Mon, 19 Aug 2024 14:28:22 -0700 Subject: [PATCH 10/10] Hacking test script --- src/tests/Common/CLRTest.Execute.Batch.targets | 13 +++++++++++++ .../Coreclr.TestWrapper/CoreclrTestWrapperLib.cs | 2 ++ .../coreroot_determinism.csproj | 2 ++ 3 files changed, 17 insertions(+) diff --git a/src/tests/Common/CLRTest.Execute.Batch.targets b/src/tests/Common/CLRTest.Execute.Batch.targets index f19c8987bbc6f..45ece77103079 100644 --- a/src/tests/Common/CLRTest.Execute.Batch.targets +++ b/src/tests/Common/CLRTest.Execute.Batch.targets @@ -146,6 +146,15 @@ if not defined CLRTestExecutionArguments (set CLRTestExecutionArguments=$(CLRTes ]]> + + true 2.0 + + true