summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAditya Mandaleeka <adityamandaleeka@users.noreply.github.com>2016-05-25 18:34:51 -0700
committerAditya Mandaleeka <adityamandaleeka@users.noreply.github.com>2016-05-25 18:34:51 -0700
commit230aa6adb070c9c5ba7ae5b7ea2f1fdc96efed7f (patch)
tree99e3e440efaca995b7c31327bda21ccdcbe0f2e1
parent049961ad651dda73a2578f37df5b1d5e88345d0a (diff)
parent18fb747a7bc519d874c85d36eccfe1aaf4f18ab6 (diff)
downloadcoreclr-230aa6adb070c9c5ba7ae5b7ea2f1fdc96efed7f.tar.gz
coreclr-230aa6adb070c9c5ba7ae5b7ea2f1fdc96efed7f.tar.bz2
coreclr-230aa6adb070c9c5ba7ae5b7ea2f1fdc96efed7f.zip
Merge pull request #5220 from adityamandaleeka/force_gc_concurrent
Check CLRConfig value explicitly to determine whether concurrent GC was forced
-rw-r--r--src/coreclr/hosts/unixcoreruncommon/coreruncommon.cpp20
-rw-r--r--src/vm/eeconfig.cpp22
2 files changed, 17 insertions, 25 deletions
diff --git a/src/coreclr/hosts/unixcoreruncommon/coreruncommon.cpp b/src/coreclr/hosts/unixcoreruncommon/coreruncommon.cpp
index fb70c69ec0..1acaf4c540 100644
--- a/src/coreclr/hosts/unixcoreruncommon/coreruncommon.cpp
+++ b/src/coreclr/hosts/unixcoreruncommon/coreruncommon.cpp
@@ -28,10 +28,6 @@
// disabled. Server GC is off by default.
static const char* serverGcVar = "CORECLR_SERVER_GC";
-// Name of the environment variable controlling concurrent GC,
-// used in the same way as serverGcVar. Concurrent GC is on by default.
-static const char* concurrentGcVar = "CORECLR_CONCURRENT_GC";
-
#if defined(__linux__)
#define symlinkEntrypointExecutable "/proc/self/exe"
#elif !defined(__APPLE__)
@@ -327,25 +323,16 @@ int ExecuteManagedAssembly(
}
else
{
- // check if we are enabling server GC or concurrent GC.
- // Server GC is off by default, while concurrent GC is on by default.
- // Actual checking of these string values is done in coreclr_initialize.
+ // Check whether we are enabling server GC (off by default)
const char* useServerGc = std::getenv(serverGcVar);
if (useServerGc == nullptr)
{
useServerGc = "0";
}
-
- const char* useConcurrentGc = std::getenv(concurrentGcVar);
- if (useConcurrentGc == nullptr)
- {
- useConcurrentGc = "1";
- }
// CoreCLR expects strings "true" and "false" instead of "1" and "0".
useServerGc = std::strcmp(useServerGc, "1") == 0 ? "true" : "false";
- useConcurrentGc = std::strcmp(useConcurrentGc, "1") == 0 ? "true" : "false";
-
+
// Allowed property names:
// APPBASE
// - The base path of the application from which the exe and other assemblies will be loaded
@@ -369,7 +356,6 @@ int ExecuteManagedAssembly(
"NATIVE_DLL_SEARCH_DIRECTORIES",
"AppDomainCompatSwitch",
"System.GC.Server",
- "System.GC.Concurrent"
};
const char *propertyValues[] = {
// TRUSTED_PLATFORM_ASSEMBLIES
@@ -384,8 +370,6 @@ int ExecuteManagedAssembly(
"UseLatestBehaviorWhenTFMNotSpecified",
// System.GC.Server
useServerGc,
- // System.GC.Concurrent
- useConcurrentGc
};
void* hostHandle;
diff --git a/src/vm/eeconfig.cpp b/src/vm/eeconfig.cpp
index ddf2048f33..27535075ea 100644
--- a/src/vm/eeconfig.cpp
+++ b/src/vm/eeconfig.cpp
@@ -794,15 +794,23 @@ HRESULT EEConfig::sync()
bool gcConcurrentWasForced = false;
#ifdef FEATURE_CORECLR
- gcConcurrentWasForced = Configuration::GetKnobBooleanValue(W("System.GC.Concurrent"), CLRConfig::UNSUPPORTED_gcConcurrent);
- if (gcConcurrentWasForced)
- iGCconcurrent = TRUE;
-#else
- int gcConcurrentConfigVal = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_gcConcurrent);
- gcConcurrentWasForced = (gcConcurrentConfigVal > 0);
+ // The CLRConfig value for UNSUPPORTED_gcConcurrent defaults to -1, and treats any
+ // positive value as 'forcing' concurrent GC to be on. Because the standard logic
+ // for mapping a DWORD CLRConfig to a boolean configuration treats -1 as true (just
+ // like any other nonzero value), we will explicitly check the DWORD later if this
+ // check returns false.
+ gcConcurrentWasForced = Configuration::GetKnobBooleanValue(W("System.GC.Concurrent"), false);
+#endif
+
+ int gcConcurrentConfigVal = 0;
+ if (!gcConcurrentWasForced)
+ {
+ gcConcurrentConfigVal = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_gcConcurrent);
+ gcConcurrentWasForced = (gcConcurrentConfigVal > 0);
+ }
+
if (gcConcurrentWasForced || (gcConcurrentConfigVal == -1 && g_IGCconcurrent))
iGCconcurrent = TRUE;
-#endif
// Disable concurrent GC during ngen for the rare case a GC gets triggered, causing problems
if (IsCompilationProcess())