Skip to content

Commit 784974e

Browse files
github-actions[bot]mangod9mrsharm
authored
[release/7.0] add ability to set GCName via runtimeconfig. (#75159)
* add ability to set GCName via runtimeconfig. * Update config name. * Added the GC Name to the gcconfig.h to show up in the GetConfigurationVariables API Co-authored-by: Manish Godse <61718172+mangod9@users.noreply.github.com> Co-authored-by: mrsharm <musharm@microsoft.com>
1 parent 8bb1983 commit 784974e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/coreclr/gc/gcconfig.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ class GCConfigStringHolder
135135
INT_CONFIG (GCHeapHardLimitPOHPercent, "GCHeapHardLimitPOHPercent", "System.GC.HeapHardLimitPOHPercent", 0, "Specifies the GC heap POH usage as a percentage of the total memory") \
136136
INT_CONFIG (GCEnabledInstructionSets, "GCEnabledInstructionSets", NULL, -1, "Specifies whether GC can use AVX2 or AVX512F - 0 for neither, 1 for AVX2, 3 for AVX512F")\
137137
INT_CONFIG (GCConserveMem, "GCConserveMemory", "System.GC.ConserveMemory", 0, "Specifies how hard GC should try to conserve memory - values 0-9") \
138-
INT_CONFIG (GCWriteBarrier, "GCWriteBarrier", NULL, 0, "Specifies whether GC should use more precise but slower write barrier")
138+
INT_CONFIG (GCWriteBarrier, "GCWriteBarrier", NULL, 0, "Specifies whether GC should use more precise but slower write barrier") \
139+
STRING_CONFIG(GCName, "GCName", "System.GC.Name", "Specifies the path of the standalone GC implementation.")
139140
// This class is responsible for retreiving configuration information
140141
// for how the GC should operate.
141142
class GCConfig

src/coreclr/vm/gcheaputilities.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
#include "common.h"
5+
#include "configuration.h"
56
#include "gcheaputilities.h"
67
#include "gcenv.ee.h"
78
#include "appdomain.hpp"
@@ -179,7 +180,7 @@ HMODULE LoadStandaloneGc(LPCWSTR libFileName)
179180
//
180181
// See Documentation/design-docs/standalone-gc-loading.md for details
181182
// on the loading protocol in use here.
182-
HRESULT LoadAndInitializeGC(LPWSTR standaloneGcLocation)
183+
HRESULT LoadAndInitializeGC(LPCWSTR standaloneGcLocation)
183184
{
184185
LIMITED_METHOD_CONTRACT;
185186

@@ -334,8 +335,7 @@ HRESULT GCHeapUtilities::LoadAndInitialize()
334335
assert(g_gc_load_status == GC_LOAD_STATUS_BEFORE_START);
335336
g_gc_load_status = GC_LOAD_STATUS_START;
336337

337-
LPWSTR standaloneGcLocation = nullptr;
338-
CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_GCName, &standaloneGcLocation);
338+
LPCWSTR standaloneGcLocation = Configuration::GetKnobStringValue(W("System.GC.Name"), CLRConfig::EXTERNAL_GCName);
339339
if (!standaloneGcLocation)
340340
{
341341
return InitializeDefaultGC();

0 commit comments

Comments
 (0)