From 9227bd5385484f4c652d209f6403e8fb78abd25f Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 11 Jul 2019 13:14:34 -0700 Subject: [PATCH] System.GC.HeapHardLimit and .HeapHardLimitPercent in runtimeconfig.json (#25574) * System.GC.HeapHardLimit and .HeapHardLimitPercent in runtimeconfig.json This adds two new configuration options, "System.GC.HeapHardLimit" and "System.GC.HeapHardLimitPercent" to runtimeconfig.json. These behave the same as COMPlus_GCHeapHardLimit and COMPlus_GCHeapHardLimitPercent. * Add cast * Dummy change to trigger tests rerun --- src/vm/eeconfig.cpp | 6 ++++++ src/vm/eeconfig.h | 4 ++++ src/vm/gcenv.ee.cpp | 12 ++++++++++++ 3 files changed, 22 insertions(+) diff --git a/src/vm/eeconfig.cpp b/src/vm/eeconfig.cpp index e3b9d8a..cdf2411 100644 --- a/src/vm/eeconfig.cpp +++ b/src/vm/eeconfig.cpp @@ -815,6 +815,12 @@ fTrackDynamicMethodDebugInfo = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_ if (!iGCgen0size) iGCgen0size = GetConfigDWORD_DontUse_(CLRConfig::UNSUPPORTED_GCgen0size, iGCgen0size); #endif //_WIN64 + const ULONGLONG ullHeapHardLimit = Configuration::GetKnobULONGLONGValue(W("System.GC.HeapHardLimit")); + iGCHeapHardLimit = FitsIn(ullHeapHardLimit) + ? static_cast(ullHeapHardLimit) + : ClrSafeInt::MaxInt(); + iGCHeapHardLimitPercent = Configuration::GetKnobDWORDValue(W("System.GC.HeapHardLimitPercent"), 0); + if (g_IGCHoardVM) iGCHoardVM = g_IGCHoardVM; else diff --git a/src/vm/eeconfig.h b/src/vm/eeconfig.h index 4d80650..928bac0 100644 --- a/src/vm/eeconfig.h +++ b/src/vm/eeconfig.h @@ -613,6 +613,8 @@ public: int GetGCHeapCount() const {LIMITED_METHOD_CONTRACT; return iGCHeapCount;} int GetGCNoAffinitize () const {LIMITED_METHOD_CONTRACT; return iGCNoAffinitize;} size_t GetGCAffinityMask() const {LIMITED_METHOD_CONTRACT; return iGCAffinityMask;} + size_t GetGCHeapHardLimit() const {LIMITED_METHOD_CONTRACT; return iGCHeapHardLimit;} + int GetGCHeapHardLimitPercent() const {LIMITED_METHOD_CONTRACT; return iGCHeapHardLimitPercent;} #ifdef GCTRIMCOMMIT @@ -918,6 +920,8 @@ private: //---------------------------------------------------------------- int iGCHeapCount; int iGCNoAffinitize; size_t iGCAffinityMask; + size_t iGCHeapHardLimit; + int iGCHeapHardLimitPercent; #ifdef GCTRIMCOMMIT diff --git a/src/vm/gcenv.ee.cpp b/src/vm/gcenv.ee.cpp index e4d3153..a0cd5a9 100644 --- a/src/vm/gcenv.ee.cpp +++ b/src/vm/gcenv.ee.cpp @@ -1097,6 +1097,18 @@ bool GCToEEInterface::GetIntConfigValue(const char* key, int64_t* value) return true; } + if (strcmp(key, "GCHeapHardLimit") == 0) + { + *value = g_pConfig->GetGCHeapHardLimit(); + return true; + } + + if (strcmp(key, "GCHeapHardLimitPercent") == 0) + { + *value = g_pConfig->GetGCHeapHardLimitPercent(); + return true; + } + if (strcmp(key, "GCLOHThreshold") == 0) { *value = g_pConfig->GetGCLOHThreshold(); -- 2.7.4