Skip to content

Commit

Permalink
Remove unnecessary property setting in corerun. (#49950)
Browse files Browse the repository at this point in the history
* Remove unnecessary property setting in corerun.

* Remove unused get_envvar_as_boolean()
  • Loading branch information
AaronRobinsonMSFT authored Mar 21, 2021
1 parent d64c11e commit 389674d
Showing 1 changed file with 1 addition and 30 deletions.
31 changes: 1 addition & 30 deletions src/coreclr/hosts/corerun/corerun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,6 @@ namespace envvar

// Variable used to preload a mock hostpolicy for testing.
const char_t* mockHostPolicy = W("MOCK_HOSTPOLICY");

// Name of the environment variable controlling server GC.
// If set to 1, server GC is enabled on startup. If 0, server GC is
// disabled. Server GC is off by default.
const char_t* serverGc = W("COMPlus_gcServer");

// Environment variable for setting whether or not to use Concurrent GC.
// On by default.
const char_t* concurrentGc = W("COMPlus_gcConcurrent");
}

static void wait_for_debugger()
Expand Down Expand Up @@ -155,18 +146,6 @@ static bool try_get_export(pal::mod_t mod, const char* symbol, void** fptr)
return false;
}

static const char* get_envvar_as_boolean(const char_t* var, bool def = false)
{
string_t val = pal::getenv(var);
if (val.empty())
val = def ? W("1") : W("0");

// CoreCLR expects strings "true" and "false" instead of "1" and "0".
return (val.compare(W("1")) == 0 || val.compare(W("true")) == 0 || val.compare(W("TRUE")) == 0)
? "true"
: "false";
}

class logger_t final
{
const char* _exePath;
Expand All @@ -190,7 +169,7 @@ class logger_t final
, _argv{ argv }
{ }

void dump_details(FILE* fd = stderr)
void dump_details(FILE* fd = stdout)
{
// Using std::fprintf since values have been converted to UTF-8.
std::fprintf(fd, "Exe path: %s\n", _exePath);
Expand Down Expand Up @@ -308,8 +287,6 @@ static int run(const configuration& config)
pal::string_utf8_t app_path_utf8 = pal::convert_to_utf8(std::move(app_path));
pal::string_utf8_t app_path_ni_utf8 = pal::convert_to_utf8(std::move(app_path_ni));
pal::string_utf8_t native_search_dirs_utf8 = pal::convert_to_utf8(native_search_dirs.str());
const char* enable_server_gc = get_envvar_as_boolean(envvar::serverGc);
const char* enable_concurrent_gc = get_envvar_as_boolean(envvar::concurrentGc, true /* default */);

// Allowed property names:
//
Expand All @@ -330,8 +307,6 @@ static int run(const configuration& config)
"APP_PATHS",
"APP_NI_PATHS",
"NATIVE_DLL_SEARCH_DIRECTORIES",
"System.GC.Server",
"System.GC.Concurrent",
};

const char* propertyValues[] =
Expand All @@ -344,10 +319,6 @@ static int run(const configuration& config)
app_path_ni_utf8.c_str(),
// NATIVE_DLL_SEARCH_DIRECTORIES
native_search_dirs_utf8.c_str(),
// System.GC.Server
enable_server_gc,
// System.GC.Concurrent
enable_concurrent_gc,
};

int propertyCount = (int)(sizeof(propertyKeys) / sizeof(propertyKeys[0]));
Expand Down

0 comments on commit 389674d

Please sign in to comment.