From 28351e0ecbd00ebc411ffde85410d0322fd6fb9e Mon Sep 17 00:00:00 2001 From: Manish Godse <61718172+mangod9@users.noreply.github.com> Date: Tue, 30 Aug 2022 10:56:18 -0700 Subject: [PATCH 1/3] add ability to set GCName via runtimeconfig. --- src/coreclr/vm/gcheaputilities.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/coreclr/vm/gcheaputilities.cpp b/src/coreclr/vm/gcheaputilities.cpp index d3301df9ff51fa..434173c9c08c6c 100644 --- a/src/coreclr/vm/gcheaputilities.cpp +++ b/src/coreclr/vm/gcheaputilities.cpp @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. #include "common.h" +#include "configuration.h" #include "gcheaputilities.h" #include "gcenv.ee.h" #include "appdomain.hpp" @@ -179,7 +180,7 @@ HMODULE LoadStandaloneGc(LPCWSTR libFileName) // // See Documentation/design-docs/standalone-gc-loading.md for details // on the loading protocol in use here. -HRESULT LoadAndInitializeGC(LPWSTR standaloneGcLocation) +HRESULT LoadAndInitializeGC(LPCWSTR standaloneGcLocation) { LIMITED_METHOD_CONTRACT; @@ -334,8 +335,7 @@ HRESULT GCHeapUtilities::LoadAndInitialize() assert(g_gc_load_status == GC_LOAD_STATUS_BEFORE_START); g_gc_load_status = GC_LOAD_STATUS_START; - LPWSTR standaloneGcLocation = nullptr; - CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_GCName, &standaloneGcLocation); + LPCWSTR standaloneGcLocation = Configuration::GetKnobStringValue(W("System.GC.GCName"), CLRConfig::EXTERNAL_GCName); if (!standaloneGcLocation) { return InitializeDefaultGC(); From 3c306b72b9c410f62b5c63e82c5802bd344068c8 Mon Sep 17 00:00:00 2001 From: Manish Godse <61718172+mangod9@users.noreply.github.com> Date: Wed, 31 Aug 2022 11:55:43 -0700 Subject: [PATCH 2/3] Update config name. --- src/coreclr/vm/gcheaputilities.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/vm/gcheaputilities.cpp b/src/coreclr/vm/gcheaputilities.cpp index 434173c9c08c6c..817179eb2f017f 100644 --- a/src/coreclr/vm/gcheaputilities.cpp +++ b/src/coreclr/vm/gcheaputilities.cpp @@ -335,7 +335,7 @@ HRESULT GCHeapUtilities::LoadAndInitialize() assert(g_gc_load_status == GC_LOAD_STATUS_BEFORE_START); g_gc_load_status = GC_LOAD_STATUS_START; - LPCWSTR standaloneGcLocation = Configuration::GetKnobStringValue(W("System.GC.GCName"), CLRConfig::EXTERNAL_GCName); + LPCWSTR standaloneGcLocation = Configuration::GetKnobStringValue(W("System.GC.Name"), CLRConfig::EXTERNAL_GCName); if (!standaloneGcLocation) { return InitializeDefaultGC(); From c71779049f76bb52dd3acf0cdbb6ec86485660b1 Mon Sep 17 00:00:00 2001 From: mrsharm Date: Sat, 3 Sep 2022 21:29:25 -0700 Subject: [PATCH 3/3] Added the GC Name to the gcconfig.h to show up in the GetConfigurationVariables API --- src/coreclr/gc/gcconfig.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/coreclr/gc/gcconfig.h b/src/coreclr/gc/gcconfig.h index f1111a99eae5f6..42f90d63c7c74a 100644 --- a/src/coreclr/gc/gcconfig.h +++ b/src/coreclr/gc/gcconfig.h @@ -135,7 +135,8 @@ class GCConfigStringHolder INT_CONFIG (GCHeapHardLimitPOHPercent, "GCHeapHardLimitPOHPercent", "System.GC.HeapHardLimitPOHPercent", 0, "Specifies the GC heap POH usage as a percentage of the total memory") \ INT_CONFIG (GCEnabledInstructionSets, "GCEnabledInstructionSets", NULL, -1, "Specifies whether GC can use AVX2 or AVX512F - 0 for neither, 1 for AVX2, 3 for AVX512F")\ INT_CONFIG (GCConserveMem, "GCConserveMemory", "System.GC.ConserveMemory", 0, "Specifies how hard GC should try to conserve memory - values 0-9") \ - INT_CONFIG (GCWriteBarrier, "GCWriteBarrier", NULL, 0, "Specifies whether GC should use more precise but slower write barrier") + INT_CONFIG (GCWriteBarrier, "GCWriteBarrier", NULL, 0, "Specifies whether GC should use more precise but slower write barrier") \ + STRING_CONFIG(GCName, "GCName", "System.GC.Name", "Specifies the path of the standalone GC implementation.") // This class is responsible for retreiving configuration information // for how the GC should operate. class GCConfig