From d8aa9f86151d8358190d8508b6672f5f63518059 Mon Sep 17 00:00:00 2001 From: Maoni0 Date: Mon, 16 Sep 2024 13:12:07 -0700 Subject: [PATCH] CR feedback --- src/coreclr/gc/gc.cpp | 5 +++-- src/coreclr/gc/gcpriv.h | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/coreclr/gc/gc.cpp b/src/coreclr/gc/gc.cpp index c5a5fe010f4435..95f414bf45a6d2 100644 --- a/src/coreclr/gc/gc.cpp +++ b/src/coreclr/gc/gc.cpp @@ -783,9 +783,10 @@ class t_join return join_struct.n_threads; } + // This is for instrumentation only. int get_join_lock() { - return join_struct.join_lock; + return VolatileLoadWithoutBarrier (&join_struct.join_lock); } void destroy () @@ -2425,7 +2426,7 @@ last_recorded_gc_info gc_heap::last_full_blocking_gc_info; uint64_t gc_heap::last_alloc_reset_suspended_end_time = 0; size_t gc_heap::max_peak_heap_size = 0; -size_t gc_heap::llc_size = 0; +VOLATILE(size_t) gc_heap::llc_size = 0; #ifdef BACKGROUND_GC last_recorded_gc_info gc_heap::last_bgc_info[2]; diff --git a/src/coreclr/gc/gcpriv.h b/src/coreclr/gc/gcpriv.h index 402cee7c5d21aa..711284a7d00d40 100644 --- a/src/coreclr/gc/gcpriv.h +++ b/src/coreclr/gc/gcpriv.h @@ -5193,8 +5193,6 @@ class gc_heap PER_HEAP_ISOLATED_FIELD_MAINTAINED size_t current_total_soh_stable_size; PER_HEAP_ISOLATED_FIELD_MAINTAINED uint64_t last_suspended_end_time; PER_HEAP_ISOLATED_FIELD_MAINTAINED uint64_t change_heap_count_time; - PER_HEAP_ISOLATED_FIELD_MAINTAINED uint64_t total_change_heap_count; - PER_HEAP_ISOLATED_FIELD_MAINTAINED uint64_t total_change_heap_count_time; // If the last full GC is blocking, this is that GC's index; for BGC, this is the settings.gc_index // when the BGC ended. @@ -5408,8 +5406,8 @@ class gc_heap PER_HEAP_ISOLATED_FIELD_DIAG_ONLY size_t max_peak_heap_size; // Sometimes it's difficult to figure out why we get the gen0 min/max budget. - // These fields help figure those out. - PER_HEAP_ISOLATED_FIELD_DIAG_ONLY size_t llc_size; + // These fields help figure those out. Making it volatile so it doesn't get optimized out. + PER_HEAP_ISOLATED_FIELD_DIAG_ONLY VOLATILE(size_t) llc_size; #ifdef BACKGROUND_GC PER_HEAP_ISOLATED_FIELD_DIAG_ONLY gc_history_global bgc_data_global; @@ -5442,6 +5440,8 @@ class gc_heap #ifdef DYNAMIC_HEAP_COUNT // Number of times we bailed from check_heap_count because we didn't have enough memory for the preparation PER_HEAP_ISOLATED_FIELD_DIAG_ONLY size_t hc_change_cancelled_count_prep; + PER_HEAP_ISOLATED_FIELD_DIAG_ONLY uint64_t total_change_heap_count; + PER_HEAP_ISOLATED_FIELD_DIAG_ONLY uint64_t total_change_heap_count_time; #ifdef BACKGROUND_GC // We log an entry whenever we needed to create new BGC threads.