From c65320833210f3df7412e2fcd11d6751fa374adc Mon Sep 17 00:00:00 2001 From: Jakob Botsch Nielsen Date: Thu, 14 Nov 2024 14:00:16 +0100 Subject: [PATCH] JIT: Switch config values to UTF8 (#109418) - Switch JitConfig strings from UTF16 to UTF8 - Switch relevant JIT-EE and host methods to UTF8 - Remove `getJitTimeLogFilename` JIT-EE call, which seemingly existed to avoid having a config parser in the JIT in release builds, but that ship has sailed --- src/coreclr/inc/clrconfigvalues.h | 2 - src/coreclr/inc/corinfo.h | 3 - src/coreclr/inc/corjithost.h | 8 +- src/coreclr/inc/icorjitinfoimpl_generated.h | 2 - src/coreclr/inc/jiteeversionguid.h | 10 +- src/coreclr/jit/ICorJitInfo_names_generated.h | 1 - .../jit/ICorJitInfo_wrapper_generated.hpp | 8 - src/coreclr/jit/bitset.cpp | 2 +- src/coreclr/jit/codegencommon.cpp | 10 +- src/coreclr/jit/codegenlinear.cpp | 12 +- src/coreclr/jit/compiler.cpp | 99 ++- src/coreclr/jit/compiler.h | 19 +- src/coreclr/jit/disasm.cpp | 8 +- src/coreclr/jit/ee_il_dll.cpp | 6 +- src/coreclr/jit/fgdiagnostic.cpp | 32 +- src/coreclr/jit/gcencode.cpp | 4 +- src/coreclr/jit/importervectorization.cpp | 4 +- src/coreclr/jit/inline.cpp | 6 +- src/coreclr/jit/inlinepolicy.cpp | 6 +- src/coreclr/jit/jitconfig.cpp | 50 +- src/coreclr/jit/jitconfig.h | 12 +- src/coreclr/jit/jitconfigvalues.h | 797 +++++++++--------- src/coreclr/jit/lsra.cpp | 12 +- src/coreclr/jit/utils.cpp | 194 +++-- src/coreclr/jit/utils.h | 20 +- .../tools/Common/JitInterface/CorInfoImpl.cs | 9 +- .../JitInterface/CorInfoImpl_generated.cs | 132 ++- .../Common/JitInterface/JitConfigProvider.cs | 23 +- .../ThunkGenerator/ThunkInput.txt | 1 - .../tools/aot/jitinterface/jithost.cpp | 24 +- .../aot/jitinterface/jitinterface_generated.h | 9 - .../superpmi-shared/icorjithostimpl.h | 6 +- .../tools/superpmi/superpmi-shared/lwmlist.h | 1 - .../superpmi-shared/methodcontext.cpp | 64 +- .../superpmi/superpmi-shared/methodcontext.h | 14 +- .../superpmi-shim-collector/icorjitinfo.cpp | 9 - .../superpmi-shim-collector/jithost.cpp | 130 +-- .../icorjitinfo_generated.cpp | 6 - .../superpmi-shim-counter/jithost.cpp | 6 +- .../icorjitinfo_generated.cpp | 5 - .../superpmi/superpmi-shim-simple/jithost.cpp | 6 +- .../tools/superpmi/superpmi/commandline.cpp | 18 +- .../tools/superpmi/superpmi/commandline.h | 2 +- .../tools/superpmi/superpmi/icorjitinfo.cpp | 18 - .../tools/superpmi/superpmi/jithost.cpp | 74 +- src/coreclr/tools/superpmi/superpmi/jithost.h | 2 +- .../tools/superpmi/superpmi/jitinstance.cpp | 18 +- .../tools/superpmi/superpmi/jitinstance.h | 6 +- .../superpmi/superpmi/parallelsuperpmi.cpp | 6 +- .../superpmi/superpmi/streamingsuperpmi.cpp | 8 +- src/coreclr/vm/jithost.cpp | 47 +- src/coreclr/vm/jithost.h | 6 +- src/coreclr/vm/jitinterface.cpp | 21 +- 53 files changed, 995 insertions(+), 1003 deletions(-) diff --git a/src/coreclr/inc/clrconfigvalues.h b/src/coreclr/inc/clrconfigvalues.h index 3097ff9f9c891..7e5cdd02c2028 100644 --- a/src/coreclr/inc/clrconfigvalues.h +++ b/src/coreclr/inc/clrconfigvalues.h @@ -329,8 +329,6 @@ RETAIL_CONFIG_DWORD_INFO(EXTERNAL_JitHostMaxSlabCache, W("JitHostMaxSlabCache"), RETAIL_CONFIG_DWORD_INFO(EXTERNAL_JitOptimizeType, W("JitOptimizeType"), 0 /* OPT_DEFAULT */, "") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_JitPrintInlinedMethods, W("JitPrintInlinedMethods"), 0, "") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_JitTelemetry, W("JitTelemetry"), 1, "If non-zero, gather JIT telemetry data") -RETAIL_CONFIG_STRING_INFO(INTERNAL_JitTimeLogFile, W("JitTimeLogFile"), "If set, gather JIT throughput data and write to this file.") -RETAIL_CONFIG_STRING_INFO(INTERNAL_JitTimeLogCsv, W("JitTimeLogCsv"), "If set, gather JIT throughput data and write to a CSV file. This mode must be used in internal retail builds.") RETAIL_CONFIG_STRING_INFO(INTERNAL_JitFuncInfoLogFile, W("JitFuncInfoLogFile"), "If set, gather JIT function info and write to this file.") CONFIG_DWORD_INFO(INTERNAL_JitVerificationDisable, W("JitVerificationDisable"), 0, "") RETAIL_CONFIG_DWORD_INFO(INTERNAL_JitLockWrite, W("JitLockWrite"), 0, "Force all volatile writes to be 'locked'") diff --git a/src/coreclr/inc/corinfo.h b/src/coreclr/inc/corinfo.h index 93778cc092591..aabc86d3cd65a 100644 --- a/src/coreclr/inc/corinfo.h +++ b/src/coreclr/inc/corinfo.h @@ -2962,9 +2962,6 @@ class ICorStaticInfo CORINFO_EE_INFO *pEEInfoOut ) = 0; - // Returns name of the JIT timer log - virtual const char16_t *getJitTimeLogFilename() = 0; - /*********************************************************************************/ // // Diagnostic methods diff --git a/src/coreclr/inc/corjithost.h b/src/coreclr/inc/corjithost.h index e70558f9e8e26..1adb047b6348e 100644 --- a/src/coreclr/inc/corjithost.h +++ b/src/coreclr/inc/corjithost.h @@ -22,13 +22,13 @@ class ICorJitHost // Return an integer config value for the given key, if any exists. virtual int getIntConfigValue( - const WCHAR* name, + const char* name, int defaultValue ) = 0; // Return a string config value for the given key, if any exists. - virtual const WCHAR* getStringConfigValue( - const WCHAR* name + virtual const char* getStringConfigValue( + const char* name ) = 0; // Free a string ConfigValue returned by the runtime. @@ -36,7 +36,7 @@ class ICorJitHost // to return the string values to the runtime for deletion. // This avoids leaking the memory in the JIT. virtual void freeStringConfigValue( - const WCHAR* value + const char* value ) = 0; // Allocate memory slab of the given size in bytes. The host is expected to pool diff --git a/src/coreclr/inc/icorjitinfoimpl_generated.h b/src/coreclr/inc/icorjitinfoimpl_generated.h index 1744b5dcf2038..08b1004d4642d 100644 --- a/src/coreclr/inc/icorjitinfoimpl_generated.h +++ b/src/coreclr/inc/icorjitinfoimpl_generated.h @@ -498,8 +498,6 @@ bool runWithSPMIErrorTrap( void getEEInfo( CORINFO_EE_INFO* pEEInfoOut) override; -const char16_t* getJitTimeLogFilename() override; - mdMethodDef getMethodDefFromMethod( CORINFO_METHOD_HANDLE hMethod) override; diff --git a/src/coreclr/inc/jiteeversionguid.h b/src/coreclr/inc/jiteeversionguid.h index 07e246cd3fa13..9592494c457c8 100644 --- a/src/coreclr/inc/jiteeversionguid.h +++ b/src/coreclr/inc/jiteeversionguid.h @@ -43,11 +43,11 @@ typedef const GUID *LPCGUID; #define GUID_DEFINED #endif // !GUID_DEFINED -constexpr GUID JITEEVersionIdentifier = { /* 04021b93-e969-41ed-96cd-4c583673b9ab */ - 0x04021b93, - 0xe969, - 0x41ed, - {0x96, 0xcd, 0x4c, 0x58, 0x36, 0x73, 0xb9, 0xab} +constexpr GUID JITEEVersionIdentifier = { /* 6f498741-c4a2-4863-9dd7-06ad7d788443 */ + 0x6f498741, + 0xc4a2, + 0x4863, + {0x9d, 0xd7, 0x06, 0xad, 0x7d, 0x78, 0x84, 0x43} }; ////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/coreclr/jit/ICorJitInfo_names_generated.h b/src/coreclr/jit/ICorJitInfo_names_generated.h index b903dcb19709f..94e244c0749bf 100644 --- a/src/coreclr/jit/ICorJitInfo_names_generated.h +++ b/src/coreclr/jit/ICorJitInfo_names_generated.h @@ -124,7 +124,6 @@ DEF_CLR_API(getHFAType) DEF_CLR_API(runWithErrorTrap) DEF_CLR_API(runWithSPMIErrorTrap) DEF_CLR_API(getEEInfo) -DEF_CLR_API(getJitTimeLogFilename) DEF_CLR_API(getMethodDefFromMethod) DEF_CLR_API(printMethodName) DEF_CLR_API(getMethodNameFromMetadata) diff --git a/src/coreclr/jit/ICorJitInfo_wrapper_generated.hpp b/src/coreclr/jit/ICorJitInfo_wrapper_generated.hpp index 70f4ec545e8d7..9c7e6c1099826 100644 --- a/src/coreclr/jit/ICorJitInfo_wrapper_generated.hpp +++ b/src/coreclr/jit/ICorJitInfo_wrapper_generated.hpp @@ -1181,14 +1181,6 @@ void WrapICorJitInfo::getEEInfo( API_LEAVE(getEEInfo); } -const char16_t* WrapICorJitInfo::getJitTimeLogFilename() -{ - API_ENTER(getJitTimeLogFilename); - const char16_t* temp = wrapHnd->getJitTimeLogFilename(); - API_LEAVE(getJitTimeLogFilename); - return temp; -} - mdMethodDef WrapICorJitInfo::getMethodDefFromMethod( CORINFO_METHOD_HANDLE hMethod) { diff --git a/src/coreclr/jit/bitset.cpp b/src/coreclr/jit/bitset.cpp index 31d1a9229e5b9..3bb356a61c8ce 100644 --- a/src/coreclr/jit/bitset.cpp +++ b/src/coreclr/jit/bitset.cpp @@ -139,7 +139,7 @@ void BitSetSupport::BitSetOpCounter::RecordOp(BitSetSupport::Operation op) { if (OpOutputFile == nullptr) { - OpOutputFile = fopen(m_fileName, "a"); + OpOutputFile = fopen_utf8(m_fileName, "a"); } fprintf(OpOutputFile, "@ %d total ops.\n", TotalOps); diff --git a/src/coreclr/jit/codegencommon.cpp b/src/coreclr/jit/codegencommon.cpp index aec95740e8b55..59a5cca378891 100644 --- a/src/coreclr/jit/codegencommon.cpp +++ b/src/coreclr/jit/codegencommon.cpp @@ -2259,14 +2259,12 @@ void CodeGen::genEmitUnwindDebugGCandEH() BYTE* dumpAddr = (BYTE*)codePtrRW; size_t dumpSize = finalHotCodeSize; - const WCHAR* rawHexCodeFilePath = JitConfig.JitRawHexCodeFile(); + const char* rawHexCodeFilePath = JitConfig.JitRawHexCodeFile(); if (rawHexCodeFilePath) { - FILE* hexDmpf; - errno_t ec = _wfopen_s(&hexDmpf, rawHexCodeFilePath, W("at")); // NOTE: file append mode - if (ec == 0) + FILE* hexDmpf = fopen_utf8(rawHexCodeFilePath, "at"); // NOTE: file append mode + if (hexDmpf != nullptr) { - assert(hexDmpf); hexDump(hexDmpf, dumpAddr, dumpSize); fclose(hexDmpf); } @@ -6823,7 +6821,7 @@ void CodeGen::genReportRichDebugInfoToFile() static CritSecObject s_critSect; CritSecHolder holder(s_critSect); - FILE* file = _wfopen(JitConfig.WriteRichDebugInfoFile(), W("a")); + FILE* file = fopen(JitConfig.WriteRichDebugInfoFile(), "a"); if (file == nullptr) { return; diff --git a/src/coreclr/jit/codegenlinear.cpp b/src/coreclr/jit/codegenlinear.cpp index f68cd082c4718..d227352089703 100644 --- a/src/coreclr/jit/codegenlinear.cpp +++ b/src/coreclr/jit/codegenlinear.cpp @@ -2678,7 +2678,7 @@ void CodeGen::genEmitterUnitTests() return; } - const WCHAR* unitTestSection = JitConfig.JitEmitUnitTestsSections(); + const char* unitTestSection = JitConfig.JitEmitUnitTestsSections(); if (unitTestSection == nullptr) { @@ -2695,24 +2695,24 @@ void CodeGen::genEmitterUnitTests() // Add NOPs at the start and end for easier script parsing. instGen(INS_nop); - bool unitTestSectionAll = (u16_strstr(unitTestSection, W("all")) != nullptr); + bool unitTestSectionAll = (strstr(unitTestSection, "all") != nullptr); #if defined(TARGET_AMD64) - if (unitTestSectionAll || (u16_strstr(unitTestSection, W("sse2")) != nullptr)) + if (unitTestSectionAll || (strstr(unitTestSection, "sse2") != nullptr)) { genAmd64EmitterUnitTestsSse2(); } #elif defined(TARGET_ARM64) - if (unitTestSectionAll || (u16_strstr(unitTestSection, W("general")) != nullptr)) + if (unitTestSectionAll || (strstr(unitTestSection, "general") != nullptr)) { genArm64EmitterUnitTestsGeneral(); } - if (unitTestSectionAll || (u16_strstr(unitTestSection, W("advsimd")) != nullptr)) + if (unitTestSectionAll || (strstr(unitTestSection, "advsimd") != nullptr)) { genArm64EmitterUnitTestsAdvSimd(); } - if (unitTestSectionAll || (u16_strstr(unitTestSection, W("sve")) != nullptr)) + if (unitTestSectionAll || (strstr(unitTestSection, "sve") != nullptr)) { genArm64EmitterUnitTestsSve(); } diff --git a/src/coreclr/jit/compiler.cpp b/src/coreclr/jit/compiler.cpp index 231ec70c821cf..b8a2da8b0c2e8 100644 --- a/src/coreclr/jit/compiler.cpp +++ b/src/coreclr/jit/compiler.cpp @@ -353,7 +353,7 @@ Compiler::Compiler(ArenaAllocator* arena, info.compClassName = eeGetClassName(info.compClassHnd); info.compFullName = eeGetMethodFullName(methodHnd); - info.compMethodSuperPMIIndex = g_jitHost->getIntConfigValue(W("SuperPMIMethodContextNumber"), -1); + info.compMethodSuperPMIIndex = g_jitHost->getIntConfigValue("SuperPMIMethodContextNumber", -1); if (!compIsForInlining()) { @@ -1409,14 +1409,13 @@ void DisplayNowayAssertMap() { FILE* fout; - LPCWSTR strJitMeasureNowayAssertFile = JitConfig.JitMeasureNowayAssertFile(); + const char* strJitMeasureNowayAssertFile = JitConfig.JitMeasureNowayAssertFile(); if (strJitMeasureNowayAssertFile != nullptr) { - fout = _wfopen(strJitMeasureNowayAssertFile, W("a")); + fout = fopen_utf8(strJitMeasureNowayAssertFile, "a"); if (fout == nullptr) { - fprintf(jitstdout(), "Failed to open JitMeasureNowayAssertFile \"%ws\"\n", - strJitMeasureNowayAssertFile); + fprintf(jitstdout(), "Failed to open JitMeasureNowayAssertFile \"%s\"\n", strJitMeasureNowayAssertFile); return; } } @@ -1554,7 +1553,7 @@ void Compiler::compShutdown() // Finish reading and/or writing inline xml if (JitConfig.JitInlineDumpXmlFile() != nullptr) { - FILE* file = _wfopen(JitConfig.JitInlineDumpXmlFile(), W("a")); + FILE* file = fopen_utf8(JitConfig.JitInlineDumpXmlFile(), "a"); if (file != nullptr) { InlineStrategy::FinalizeXml(file); @@ -1581,7 +1580,7 @@ void Compiler::compShutdown() #ifdef FEATURE_JIT_METHOD_PERF if (compJitTimeLogFilename != nullptr) { - FILE* jitTimeLogFile = _wfopen(compJitTimeLogFilename, W("a")); + FILE* jitTimeLogFile = fopen_utf8(compJitTimeLogFilename, "a"); if (jitTimeLogFile != nullptr) { CompTimeSummaryInfo::s_compTimeSummary.Print(jitTimeLogFile); @@ -2569,7 +2568,7 @@ void Compiler::compInitOptions(JitFlags* jitFlags) // First, initialize the AltJitExcludeAssemblies list, but only do it once. if (!s_pAltJitExcludeAssembliesListInitialized) { - const WCHAR* wszAltJitExcludeAssemblyList = JitConfig.AltJitExcludeAssemblies(); + const char* wszAltJitExcludeAssemblyList = JitConfig.AltJitExcludeAssemblies(); if (wszAltJitExcludeAssemblyList != nullptr) { // NOTE: The Assembly name list is allocated in the process heap, not in the no-release heap, which is @@ -2599,7 +2598,7 @@ void Compiler::compInitOptions(JitFlags* jitFlags) // Setup assembly name list for disassembly and dump, if not already set up. if (!s_pJitDisasmIncludeAssembliesListInitialized) { - const WCHAR* assemblyNameList = JitConfig.JitDisasmAssemblies(); + const char* assemblyNameList = JitConfig.JitDisasmAssemblies(); if (assemblyNameList != nullptr) { s_pJitDisasmIncludeAssembliesList = new (HostAllocator::getHostAllocator()) @@ -3000,7 +2999,7 @@ void Compiler::compInitOptions(JitFlags* jitFlags) // Read function list, if not already read, and there exists such a list. if (!s_pJitFunctionFileInitialized) { - const WCHAR* functionFileName = JitConfig.JitFunctionFile(); + const char* functionFileName = JitConfig.JitFunctionFile(); if (functionFileName != nullptr) { s_pJitMethodSet = @@ -3172,10 +3171,10 @@ void Compiler::compInitOptions(JitFlags* jitFlags) #endif // PROFILING_SUPPORTED #if FEATURE_TAILCALL_OPT - const WCHAR* strTailCallOpt = JitConfig.TailCallOpt(); + const char* strTailCallOpt = JitConfig.TailCallOpt(); if (strTailCallOpt != nullptr) { - opts.compTailCallOpt = (UINT)_wtoi(strTailCallOpt) != 0; + opts.compTailCallOpt = (UINT)atoi(strTailCallOpt) != 0; } if (JitConfig.TailCallLoopOpt() == 0) @@ -3453,13 +3452,6 @@ bool Compiler::compJitHaltMethod() * It should reflect the usefulness:overhead ratio. */ -const LPCWSTR Compiler::s_compStressModeNamesW[STRESS_COUNT + 1] = { -#define STRESS_MODE(mode) W("STRESS_") W(#mode), - - STRESS_MODES -#undef STRESS_MODE -}; - const char* Compiler::s_compStressModeNames[STRESS_COUNT + 1] = { #define STRESS_MODE(mode) "STRESS_" #mode, @@ -3569,26 +3561,26 @@ bool Compiler::compStressCompileHelper(compStressArea stressArea, unsigned weigh } // Does user explicitly prevent using this STRESS_MODE through the command line? - const WCHAR* strStressModeNamesNot = JitConfig.JitStressModeNamesNot(); + const char* strStressModeNamesNot = JitConfig.JitStressModeNamesNot(); if ((strStressModeNamesNot != nullptr) && - (u16_strstr(strStressModeNamesNot, s_compStressModeNamesW[stressArea]) != nullptr)) + (strstr(strStressModeNamesNot, s_compStressModeNames[stressArea]) != nullptr)) { return false; } // Does user allow using this STRESS_MODE through the command line? - const WCHAR* strStressModeNamesAllow = JitConfig.JitStressModeNamesAllow(); + const char* strStressModeNamesAllow = JitConfig.JitStressModeNamesAllow(); if ((strStressModeNamesAllow != nullptr) && - (u16_strstr(strStressModeNamesAllow, s_compStressModeNamesW[stressArea]) == nullptr)) + (strstr(strStressModeNamesAllow, s_compStressModeNames[stressArea]) == nullptr)) { return false; } // Does user explicitly set this STRESS_MODE through the command line? - const WCHAR* strStressModeNames = JitConfig.JitStressModeNames(); + const char* strStressModeNames = JitConfig.JitStressModeNames(); if (strStressModeNames != nullptr) { - if (u16_strstr(strStressModeNames, s_compStressModeNamesW[stressArea]) != nullptr) + if (strstr(strStressModeNames, s_compStressModeNames[stressArea]) != nullptr) { return true; } @@ -5968,11 +5960,7 @@ int Compiler::compCompile(CORINFO_MODULE_HANDLE classPtr, if (!checkedForJitTimeLog) { - // Call into VM to get the config strings. FEATURE_JIT_METHOD_PERF is enabled for - // retail builds. Do not call the regular Config helper here as it would pull - // in a copy of the config parser into the clrjit.dll. - InterlockedCompareExchangeT(&Compiler::compJitTimeLogFilename, - (LPCWSTR)info.compCompHnd->getJitTimeLogFilename(), NULL); + InterlockedCompareExchangeT(&Compiler::compJitTimeLogFilename, JitConfig.JitTimeLogFile(), NULL); // At a process or module boundary clear the file and start afresh. JitTimer::PrintCsvHeader(); @@ -5991,16 +5979,16 @@ int Compiler::compCompile(CORINFO_MODULE_HANDLE classPtr, #endif #if FUNC_INFO_LOGGING - LPCWSTR tmpJitFuncInfoFilename = JitConfig.JitFuncInfoFile(); + const char* tmpJitFuncInfoFilename = JitConfig.JitFuncInfoFile(); if (tmpJitFuncInfoFilename != nullptr) { - LPCWSTR oldFuncInfoFileName = + const char* oldFuncInfoFileName = InterlockedCompareExchangeT(&compJitFuncInfoFilename, tmpJitFuncInfoFilename, NULL); if (oldFuncInfoFileName == nullptr) { assert(compJitFuncInfoFile == nullptr); - compJitFuncInfoFile = _wfopen(compJitFuncInfoFilename, W("a")); + compJitFuncInfoFile = fopen_utf8(compJitFuncInfoFilename, "a"); if (compJitFuncInfoFile == nullptr) { #if defined(DEBUG) && !defined(HOST_UNIX) // no 'perror' in the PAL @@ -6505,7 +6493,7 @@ void Compiler::compCompileFinish() if (JitConfig.JitInlineDumpXmlFile() != nullptr) { - FILE* file = _wfopen(JitConfig.JitInlineDumpXmlFile(), W("a")); + FILE* file = fopen_utf8(JitConfig.JitInlineDumpXmlFile(), "a"); if (file != nullptr) { m_inlineStrategy->DumpXml(file); @@ -8645,7 +8633,7 @@ void CompTimeSummaryInfo::AddInfo(CompTimeInfo& info, bool includePhases) } // Static -LPCWSTR Compiler::compJitTimeLogFilename = nullptr; +const char* Compiler::compJitTimeLogFilename = nullptr; void CompTimeSummaryInfo::Print(FILE* f) { @@ -9055,15 +9043,15 @@ CritSecObject JitTimer::s_csvLock; // when the process exits. This should be accessed under the s_csvLock. FILE* JitTimer::s_csvFile = nullptr; -LPCWSTR Compiler::JitTimeLogCsv() +const char* Compiler::JitTimeLogCsv() { - LPCWSTR jitTimeLogCsv = JitConfig.JitTimeLogCsv(); + const char* jitTimeLogCsv = JitConfig.JitTimeLogCsv(); return jitTimeLogCsv; } void JitTimer::PrintCsvHeader() { - LPCWSTR jitTimeLogCsv = Compiler::JitTimeLogCsv(); + const char* jitTimeLogCsv = Compiler::JitTimeLogCsv(); if (jitTimeLogCsv == nullptr) { return; @@ -9073,7 +9061,7 @@ void JitTimer::PrintCsvHeader() if (s_csvFile == nullptr) { - s_csvFile = _wfopen(jitTimeLogCsv, W("a")); + s_csvFile = fopen_utf8(jitTimeLogCsv, "a"); } if (s_csvFile != nullptr) { @@ -9120,7 +9108,7 @@ void JitTimer::PrintCsvHeader() void JitTimer::PrintCsvMethodStats(Compiler* comp) { - LPCWSTR jitTimeLogCsv = Compiler::JitTimeLogCsv(); + const char* jitTimeLogCsv = Compiler::JitTimeLogCsv(); if (jitTimeLogCsv == nullptr) { return; @@ -9142,7 +9130,7 @@ void JitTimer::PrintCsvMethodStats(Compiler* comp) // // Query the jit host directly here instead of going via the // config cache, since value will change for each method. - int index = g_jitHost->getIntConfigValue(W("SuperPMIMethodContextNumber"), -1); + int index = g_jitHost->getIntConfigValue("SuperPMIMethodContextNumber", -1); CritSecHolder csvLock(s_csvLock); @@ -9332,7 +9320,7 @@ void Compiler::RecordStateAtEndOfCompilation() #if FUNC_INFO_LOGGING // static -LPCWSTR Compiler::compJitFuncInfoFilename = nullptr; +const char* Compiler::compJitFuncInfoFilename = nullptr; // static FILE* Compiler::compJitFuncInfoFile = nullptr; @@ -10734,6 +10722,33 @@ const char* Compiler::printfAlloc(const char* format, ...) return resultStr; } +//------------------------------------------------------------------------ +// convertUtf16ToUtf8ForPrinting: +// Convert a string from UTF16 to UTF8 to be printed to output. +// +// Arguments: +// utf16String - The string +// +// Returns: +// Converted string, or a marker string if conversion failed. +// +const char* Compiler::convertUtf16ToUtf8ForPrinting(const WCHAR* utf16String) +{ + const char* utf8Str = ""; + int utf8Len = WideCharToMultiByte(CP_UTF8, 0, utf16String, -1, nullptr, 0, nullptr, nullptr); + if (utf8Len == 0) + { + char* allocated = new (this, CMK_DebugOnly) char[utf8Len]; + + if (WideCharToMultiByte(CP_UTF8, 0, (WCHAR*)utf16String, -1, allocated, utf8Len, nullptr, nullptr) != 0) + { + utf8Str = allocated; + } + } + + return utf8Str; +} + #endif // defined(DEBUG) #if TRACK_ENREG_STATS diff --git a/src/coreclr/jit/compiler.h b/src/coreclr/jit/compiler.h index 36b0137e724e2..6ecf4be7551a2 100644 --- a/src/coreclr/jit/compiler.h +++ b/src/coreclr/jit/compiler.h @@ -10543,6 +10543,8 @@ class Compiler const char* printfAlloc(const char* format, ...); + const char* convertUtf16ToUtf8ForPrinting(const WCHAR* utf16String); + #endif // DEBUG // clang-format off @@ -10622,9 +10624,8 @@ class Compiler // clang-format on #ifdef DEBUG - static const LPCWSTR s_compStressModeNamesW[STRESS_COUNT + 1]; - static const char* s_compStressModeNames[STRESS_COUNT + 1]; - BYTE compActiveStressModes[STRESS_COUNT]; + static const char* s_compStressModeNames[STRESS_COUNT + 1]; + BYTE compActiveStressModes[STRESS_COUNT]; #endif // DEBUG #define MAX_STRESS_WEIGHT 100 @@ -11434,8 +11435,8 @@ class Compiler JitTimer* pCompJitTimer = nullptr; // Timer data structure (by phases) for current compilation. static CompTimeSummaryInfo s_compJitTimerSummary; // Summary of the Timer information for the whole run. - static LPCWSTR JitTimeLogCsv(); // Retrieve the file name for CSV from ConfigDWORD. - static LPCWSTR compJitTimeLogFilename; // If a log file for JIT time is desired, filename to write it to. + static const char* JitTimeLogCsv(); // Retrieve the file name for CSV from ConfigDWORD. + static const char* compJitTimeLogFilename; // If a log file for JIT time is desired, filename to write it to. #endif void BeginPhase(Phases phase); // Indicate the start of the given phase. void EndPhase(Phases phase); // Indicate the end of the given phase. @@ -11470,10 +11471,10 @@ class Compiler public: #if FUNC_INFO_LOGGING - static LPCWSTR compJitFuncInfoFilename; // If a log file for per-function information is required, this is the - // filename to write it to. - static FILE* compJitFuncInfoFile; // And this is the actual FILE* to write to. -#endif // FUNC_INFO_LOGGING + static const char* compJitFuncInfoFilename; // If a log file for per-function information is required, this is the + // filename to write it to. + static FILE* compJitFuncInfoFile; // And this is the actual FILE* to write to. +#endif // FUNC_INFO_LOGGING #if MEASURE_NOWAY void RecordNowayAssert(const char* filename, unsigned line, const char* condStr); diff --git a/src/coreclr/jit/disasm.cpp b/src/coreclr/jit/disasm.cpp index bff93c85150a6..945254147652a 100644 --- a/src/coreclr/jit/disasm.cpp +++ b/src/coreclr/jit/disasm.cpp @@ -1489,14 +1489,10 @@ void DisAssembler::disAsmCode(BYTE* hotCodePtr, #endif // !DEBUG #ifdef DEBUG - const WCHAR* fileName = JitConfig.JitLateDisasmTo(); + const char* fileName = JitConfig.JitLateDisasmTo(); if (fileName != nullptr) { - errno_t ec = _wfopen_s(&disAsmFile, fileName, W("a+")); - if (ec != 0) - { - disAsmFile = nullptr; - } + disAsmFile = fopen_utf8(fileName, "a+"); } #else // !DEBUG // NOTE: non-DEBUG builds always use jitstdout currently! diff --git a/src/coreclr/jit/ee_il_dll.cpp b/src/coreclr/jit/ee_il_dll.cpp index 2f86c8b527453..ff190a64c75d9 100644 --- a/src/coreclr/jit/ee_il_dll.cpp +++ b/src/coreclr/jit/ee_il_dll.cpp @@ -78,11 +78,11 @@ static FILE* volatile s_jitstdout; static FILE* jitstdoutInit() { - const WCHAR* jitStdOutFile = JitConfig.JitStdOutFile(); - FILE* file = nullptr; + const char* jitStdOutFile = JitConfig.JitStdOutFile(); + FILE* file = nullptr; if (jitStdOutFile != nullptr) { - file = _wfopen(jitStdOutFile, W("a")); + file = fopen_utf8(jitStdOutFile, "a"); assert(file != nullptr); } diff --git a/src/coreclr/jit/fgdiagnostic.cpp b/src/coreclr/jit/fgdiagnostic.cpp index 16560d52c09bc..1d600864c2000 100644 --- a/src/coreclr/jit/fgdiagnostic.cpp +++ b/src/coreclr/jit/fgdiagnostic.cpp @@ -365,24 +365,6 @@ void Compiler::fgDumpTree(FILE* fgxFile, GenTree* const tree) } } -#ifdef DEBUG -namespace -{ -const char* ConvertToUtf8(LPCWSTR wideString, CompAllocator& allocator) -{ - int utf8Len = WideCharToMultiByte(CP_UTF8, 0, wideString, -1, nullptr, 0, nullptr, nullptr); - if (utf8Len == 0) - return nullptr; - - char* alloc = (char*)allocator.allocate(utf8Len); - if (0 == WideCharToMultiByte(CP_UTF8, 0, wideString, -1, alloc, utf8Len, nullptr, nullptr)) - return nullptr; - - return alloc; -} -} // namespace -#endif - //------------------------------------------------------------------------ // fgOpenFlowGraphFile: Open a file to dump either the xml or dot format flow graph // @@ -429,10 +411,10 @@ FILE* Compiler::fgOpenFlowGraphFile(bool* wbDontClose, Phases phase, PhasePositi dumpFunction = JitConfig.JitDumpFg().contains(info.compMethodHnd, info.compClassHnd, &info.compMethodInfo->args); CompAllocator allocator = getAllocatorDebugOnly(); - filename = ConvertToUtf8(JitConfig.JitDumpFgFile(), allocator); - pathname = ConvertToUtf8(JitConfig.JitDumpFgDir(), allocator); - prePhasePattern = ConvertToUtf8(JitConfig.JitDumpFgPrePhase(), allocator); - postPhasePattern = ConvertToUtf8(JitConfig.JitDumpFgPhase(), allocator); + filename = JitConfig.JitDumpFgFile(); + pathname = JitConfig.JitDumpFgDir(); + prePhasePattern = JitConfig.JitDumpFgPrePhase(); + postPhasePattern = JitConfig.JitDumpFgPhase(); #endif // DEBUG if (!dumpFunction) @@ -582,7 +564,7 @@ FILE* Compiler::fgOpenFlowGraphFile(bool* wbDontClose, Phases phase, PhasePositi sprintf_s((char*)filename, charCount, FILENAME_PATTERN, escapedString, phasePositionString, phaseName, tierName, type); } - fgxFile = fopen(filename, "wx"); // Open the file for writing only only if it doesn't already exist + fgxFile = fopen_utf8(filename, "wx"); // Open the file for writing only only if it doesn't already exist if (fgxFile == nullptr) { // This filename already exists, so create a different one by appending ~2, ~3, etc... @@ -598,7 +580,7 @@ FILE* Compiler::fgOpenFlowGraphFile(bool* wbDontClose, Phases phase, PhasePositi sprintf_s((char*)filename, charCount, FILENAME_PATTERN_WITH_NUMBER, escapedString, phasePositionString, phaseName, tierName, i, type); } - fgxFile = fopen(filename, "wx"); // Open the file for writing only only if it doesn't already exist + fgxFile = fopen_utf8(filename, "wx"); // Open the file for writing only only if it doesn't already exist if (fgxFile != nullptr) { break; @@ -639,7 +621,7 @@ FILE* Compiler::fgOpenFlowGraphFile(bool* wbDontClose, Phases phase, PhasePositi { sprintf_s((char*)filename, charCount, "%s.%s", origFilename, type); } - fgxFile = fopen(filename, "a+"); + fgxFile = fopen_utf8(filename, "a+"); *wbDontClose = false; } diff --git a/src/coreclr/jit/gcencode.cpp b/src/coreclr/jit/gcencode.cpp index ae05bf797f86a..15f30f0f138ee 100644 --- a/src/coreclr/jit/gcencode.cpp +++ b/src/coreclr/jit/gcencode.cpp @@ -397,7 +397,7 @@ static void regenLog(unsigned codeDelta, if (logFile == NULL) { - logFile = fopen("regen.txt", "a"); + logFile = fopen_utf8("regen.txt", "a"); InitializeCriticalSection(&logFileLock); } @@ -424,7 +424,7 @@ static void regenLog(unsigned encoding, InfoHdr* header, InfoHdr* state) { if (logFile == NULL) { - logFile = fopen("regen.txt", "a"); + logFile = fopen_utf8("regen.txt", "a"); InitializeCriticalSection(&logFileLock); } diff --git a/src/coreclr/jit/importervectorization.cpp b/src/coreclr/jit/importervectorization.cpp index b7c9aff67a5d9..c0a138fb4a00d 100644 --- a/src/coreclr/jit/importervectorization.cpp +++ b/src/coreclr/jit/importervectorization.cpp @@ -648,7 +648,9 @@ GenTree* Compiler::impUtf16SpanComparison(StringComparisonKind kind, CORINFO_SIG JITDUMP("UTF16 data is too long to unroll - bail out.\n"); return nullptr; } - JITDUMP("Trying to unroll MemoryExtensions.Equals|SequenceEqual|StartsWith(op1, \"%ws\")...\n", str) + + JITDUMP("Trying to unroll MemoryExtensions.Equals|SequenceEqual|StartsWith(op1, \"%s\")...\n", + convertUtf16ToUtf8ForPrinting((WCHAR*)str)); } unsigned spanLclNum; diff --git a/src/coreclr/jit/inline.cpp b/src/coreclr/jit/inline.cpp index bcbf92fe8e736..aba964f2ce613 100644 --- a/src/coreclr/jit/inline.cpp +++ b/src/coreclr/jit/inline.cpp @@ -1765,7 +1765,7 @@ bool InlineStrategy::IsInliningDisabled() #if defined(DEBUG) static ConfigMethodRange range; - const WCHAR* noInlineRange = JitConfig.JitNoInlineRange(); + const char* noInlineRange = JitConfig.JitNoInlineRange(); if (noInlineRange == nullptr) { @@ -1776,9 +1776,9 @@ bool InlineStrategy::IsInliningDisabled() // number of spaces in our config string to see if there are // more. Number of ranges we need is 2x that value. unsigned entryCount = 1; - for (const WCHAR* p = noInlineRange; *p != 0; p++) + for (const char* p = noInlineRange; *p != 0; p++) { - if (*p == L' ') + if (*p == ' ') { entryCount++; } diff --git a/src/coreclr/jit/inlinepolicy.cpp b/src/coreclr/jit/inlinepolicy.cpp index 0c6ac9241fca6..d7b7bf6e1a024 100644 --- a/src/coreclr/jit/inlinepolicy.cpp +++ b/src/coreclr/jit/inlinepolicy.cpp @@ -3330,14 +3330,14 @@ ReplayPolicy::ReplayPolicy(Compiler* compiler, bool isPrejitRoot) if (!s_WroteReplayBanner) { // Nope, open it up. - const WCHAR* replayFileName = JitConfig.JitInlineReplayFile(); - s_ReplayFile = _wfopen(replayFileName, W("r")); + const char* replayFileName = JitConfig.JitInlineReplayFile(); + s_ReplayFile = fopen_utf8(replayFileName, "r"); // Display banner to stderr, unless we're dumping inline Xml, // in which case the policy name is captured in the Xml. if (JitConfig.JitInlineDumpXml() == 0) { - fprintf(stderr, "*** %s inlines from %ws\n", s_ReplayFile == nullptr ? "Unable to replay" : "Replaying", + fprintf(stderr, "*** %s inlines from %s\n", s_ReplayFile == nullptr ? "Unable to replay" : "Replaying", replayFileName); } diff --git a/src/coreclr/jit/jitconfig.cpp b/src/coreclr/jit/jitconfig.cpp index 27738f7c10b67..e64c861058cd5 100644 --- a/src/coreclr/jit/jitconfig.cpp +++ b/src/coreclr/jit/jitconfig.cpp @@ -10,30 +10,25 @@ JitConfigValues JitConfig; -void JitConfigValues::MethodSet::initialize(const WCHAR* list, ICorJitHost* host) +//---------------------------------------------------------------------- +// initialize: Initialize the method set by parsing the string +// +// Arguments: +// listFromConfig - A string containing the list. The string must have come from the host's config, +// and this class takes ownership of the string. +// host - Pointer to host interface +// +void JitConfigValues::MethodSet::initialize(const char* listFromConfig, ICorJitHost* host) { - assert(m_list == nullptr); + assert(m_listFromConfig == nullptr); assert(m_names == nullptr); - // Convert the input list to UTF-8 - int utf8ListLen = WideCharToMultiByte(CP_UTF8, 0, list, -1, nullptr, 0, nullptr, nullptr); - if (utf8ListLen == 0) + if (listFromConfig == nullptr) { return; } - else - { - // char* m_list; - // - m_list = static_cast(host->allocateMemory(utf8ListLen)); - if (WideCharToMultiByte(CP_UTF8, 0, list, -1, static_cast(m_list), utf8ListLen, nullptr, nullptr) == 0) - { - // Failed to convert the list. Free the memory and ignore the list. - host->freeMemory(static_cast(m_list)); - m_list = nullptr; - return; - } - } + + m_listFromConfig = listFromConfig; auto commitPattern = [this, host](const char* start, const char* end) { if (end <= start) @@ -68,7 +63,7 @@ void JitConfigValues::MethodSet::initialize(const WCHAR* list, ICorJitHost* host m_names = name; }; - const char* curPatternStart = m_list; + const char* curPatternStart = m_listFromConfig; const char* curChar; for (curChar = curPatternStart; *curChar != '\0'; curChar++) { @@ -82,6 +77,12 @@ void JitConfigValues::MethodSet::initialize(const WCHAR* list, ICorJitHost* host commitPattern(curPatternStart, curChar); } +//---------------------------------------------------------------------- +// destroy: Destroy the method set. +// +// Arguments: +// host - Pointer to host interface +// void JitConfigValues::MethodSet::destroy(ICorJitHost* host) { // Free method names, free the list string, and reset our state @@ -90,10 +91,10 @@ void JitConfigValues::MethodSet::destroy(ICorJitHost* host) next = name->m_next; host->freeMemory(static_cast(name)); } - if (m_list != nullptr) + if (m_listFromConfig != nullptr) { - host->freeMemory(static_cast(m_list)); - m_list = nullptr; + host->freeStringConfigValue(m_listFromConfig); + m_listFromConfig = nullptr; } m_names = nullptr; } @@ -194,9 +195,8 @@ void JitConfigValues::initialize(ICorJitHost* host) #define RELEASE_CONFIG_INTEGER(name, key, defaultValue) m_##name = host->getIntConfigValue(key, defaultValue); #define RELEASE_CONFIG_STRING(name, key) m_##name = host->getStringConfigValue(key); #define RELEASE_CONFIG_METHODSET(name, key) \ - const WCHAR* name##value = host->getStringConfigValue(key); \ - m_##name.initialize(name##value, host); \ - host->freeStringConfigValue(name##value); + const char* name##value = host->getStringConfigValue(key); \ + m_##name.initialize(name##value, host); #include "jitconfigvalues.h" diff --git a/src/coreclr/jit/jitconfig.h b/src/coreclr/jit/jitconfig.h index 32c84f47e073b..0f4e12b87184f 100644 --- a/src/coreclr/jit/jitconfig.h +++ b/src/coreclr/jit/jitconfig.h @@ -28,7 +28,7 @@ class JitConfigValues bool m_containsSignature; }; - char* m_list; + const char* m_listFromConfig; MethodName* m_names; MethodSet(const MethodSet& other) = delete; @@ -39,12 +39,12 @@ class JitConfigValues { } - inline const char* list() const + const char* list() const { - return const_cast(m_list); + return m_listFromConfig; } - void initialize(const WCHAR* list, ICorJitHost* host); + void initialize(const char* listFromConfig, ICorJitHost* host); void destroy(ICorJitHost* host); inline bool isEmpty() const @@ -57,7 +57,7 @@ class JitConfigValues private: #define RELEASE_CONFIG_INTEGER(name, key, defaultValue) int m_##name; -#define RELEASE_CONFIG_STRING(name, key) const WCHAR* m_##name; +#define RELEASE_CONFIG_STRING(name, key) const char* m_##name; #define RELEASE_CONFIG_METHODSET(name, key) MethodSet m_##name; #include "jitconfigvalues.h" @@ -69,7 +69,7 @@ class JitConfigValues return m_##name; \ } #define RELEASE_CONFIG_STRING(name, key) \ - inline const WCHAR* name() const \ + inline const char* name() const \ { \ return m_##name; \ } diff --git a/src/coreclr/jit/jitconfigvalues.h b/src/coreclr/jit/jitconfigvalues.h index 23158d49342de..a04f8b7f689c5 100644 --- a/src/coreclr/jit/jitconfigvalues.h +++ b/src/coreclr/jit/jitconfigvalues.h @@ -30,135 +30,135 @@ #endif // Max number of functions to use altjit for (decimal) -CONFIG_INTEGER(AltJitLimit, W("AltJitLimit"), 0) +CONFIG_INTEGER(AltJitLimit, "AltJitLimit", 0) // If AltJit hits an assert, fall back to the fallback JIT. Useful in conjunction with DOTNET_ContinueOnAssert=1 -CONFIG_INTEGER(AltJitSkipOnAssert, W("AltJitSkipOnAssert"), 0) +CONFIG_INTEGER(AltJitSkipOnAssert, "AltJitSkipOnAssert", 0) // Breaks when using internal logging on a particular token value. -CONFIG_INTEGER(BreakOnDumpToken, W("BreakOnDumpToken"), 0xffffffff) +CONFIG_INTEGER(BreakOnDumpToken, "BreakOnDumpToken", 0xffffffff) // Halts the jit on verification failure -CONFIG_INTEGER(DebugBreakOnVerificationFailure, W("DebugBreakOnVerificationFailure"), 0) +CONFIG_INTEGER(DebugBreakOnVerificationFailure, "DebugBreakOnVerificationFailure", 0) -CONFIG_INTEGER(DisplayLoopHoistStats, W("JitLoopHoistStats"), 0) // Display JIT loop hoisting statistics +CONFIG_INTEGER(DisplayLoopHoistStats, "JitLoopHoistStats", 0) // Display JIT loop hoisting statistics // Display JIT Linear Scan Register Allocator statistics // If set to "1", display the stats in textual format. // If set to "2", display the stats in csv format. // If set to "3", display the stats in summarize format. // Recommended to use with JitStdOutFile flag. -CONFIG_INTEGER(DisplayLsraStats, W("JitLsraStats"), 0) - -CONFIG_STRING(JitLsraOrdering, W("JitLsraOrdering")) // LSRA heuristics ordering -CONFIG_INTEGER(EnablePCRelAddr, W("JitEnablePCRelAddr"), 1) // Whether absolute addr be encoded as PC-rel offset by - // RyuJIT where possible -CONFIG_INTEGER(JitAssertOnMaxRAPasses, W("JitAssertOnMaxRAPasses"), 0) -CONFIG_INTEGER(JitBreakEmitOutputInstr, W("JitBreakEmitOutputInstr"), -1) -CONFIG_INTEGER(JitBreakMorphTree, W("JitBreakMorphTree"), 0xffffffff) -CONFIG_INTEGER(JitBreakOnBadCode, W("JitBreakOnBadCode"), 0) -CONFIG_INTEGER(JitBreakOnMinOpts, W("JITBreakOnMinOpts"), 0) // Halt if jit switches to MinOpts -CONFIG_INTEGER(JitCloneLoops, W("JitCloneLoops"), 1) // If 0, don't clone. Otherwise clone loops for optimizations. -CONFIG_INTEGER(JitCloneLoopsWithGdvTests, W("JitCloneLoopsWithGdvTests"), 1) // If 0, don't clone loops based on - // invariant type/method address tests -RELEASE_CONFIG_INTEGER(JitCloneLoopsSizeLimit, W("JitCloneLoopsSizeLimit"), 400) // limit cloning to loops with less - // than this many tree nodes -CONFIG_INTEGER(JitDebugLogLoopCloning, W("JitDebugLogLoopCloning"), 0) // In debug builds log places where loop cloning - // optimizations are performed on the fast path. -CONFIG_INTEGER(JitDefaultFill, W("JitDefaultFill"), 0xdd) // In debug builds, initialize the memory allocated by the nra - // with this byte. +CONFIG_INTEGER(DisplayLsraStats, "JitLsraStats", 0) + +CONFIG_STRING(JitLsraOrdering, "JitLsraOrdering") // LSRA heuristics ordering +CONFIG_INTEGER(EnablePCRelAddr, "JitEnablePCRelAddr", 1) // Whether absolute addr be encoded as PC-rel offset by + // RyuJIT where possible +CONFIG_INTEGER(JitAssertOnMaxRAPasses, "JitAssertOnMaxRAPasses", 0) +CONFIG_INTEGER(JitBreakEmitOutputInstr, "JitBreakEmitOutputInstr", -1) +CONFIG_INTEGER(JitBreakMorphTree, "JitBreakMorphTree", 0xffffffff) +CONFIG_INTEGER(JitBreakOnBadCode, "JitBreakOnBadCode", 0) +CONFIG_INTEGER(JitBreakOnMinOpts, "JITBreakOnMinOpts", 0) // Halt if jit switches to MinOpts +CONFIG_INTEGER(JitCloneLoops, "JitCloneLoops", 1) // If 0, don't clone. Otherwise clone loops for optimizations. +CONFIG_INTEGER(JitCloneLoopsWithGdvTests, "JitCloneLoopsWithGdvTests", 1) // If 0, don't clone loops based on + // invariant type/method address tests +RELEASE_CONFIG_INTEGER(JitCloneLoopsSizeLimit, "JitCloneLoopsSizeLimit", 400) // limit cloning to loops with less + // than this many tree nodes +CONFIG_INTEGER(JitDebugLogLoopCloning, "JitDebugLogLoopCloning", 0) // In debug builds log places where loop cloning + // optimizations are performed on the fast path. +CONFIG_INTEGER(JitDefaultFill, "JitDefaultFill", 0xdd) // In debug builds, initialize the memory allocated by the nra + // with this byte. // Minimum weight needed for the first block of a loop to make it a candidate for alignment. -CONFIG_INTEGER(JitAlignLoopMinBlockWeight, W("JitAlignLoopMinBlockWeight"), DEFAULT_ALIGN_LOOP_MIN_BLOCK_WEIGHT) +CONFIG_INTEGER(JitAlignLoopMinBlockWeight, "JitAlignLoopMinBlockWeight", DEFAULT_ALIGN_LOOP_MIN_BLOCK_WEIGHT) // For non-adaptive alignment, minimum loop size (in bytes) for which alignment will be done. // Defaults to 3 blocks of 32 bytes chunks = 96 bytes. -CONFIG_INTEGER(JitAlignLoopMaxCodeSize, W("JitAlignLoopMaxCodeSize"), DEFAULT_MAX_LOOPSIZE_FOR_ALIGN) +CONFIG_INTEGER(JitAlignLoopMaxCodeSize, "JitAlignLoopMaxCodeSize", DEFAULT_MAX_LOOPSIZE_FOR_ALIGN) // For non-adaptive alignment, address boundary (power of 2) at which loop alignment should be done. By default, 32B. -CONFIG_INTEGER(JitAlignLoopBoundary, W("JitAlignLoopBoundary"), DEFAULT_ALIGN_LOOP_BOUNDARY) +CONFIG_INTEGER(JitAlignLoopBoundary, "JitAlignLoopBoundary", DEFAULT_ALIGN_LOOP_BOUNDARY) // If set, for non-adaptive alignment, ensure loop jmps are not on or cross alignment boundary. -CONFIG_INTEGER(JitAlignLoopForJcc, W("JitAlignLoopForJcc"), 0) +CONFIG_INTEGER(JitAlignLoopForJcc, "JitAlignLoopForJcc", 0) // If set, perform adaptive loop alignment that limits number of padding based on loop size. -CONFIG_INTEGER(JitAlignLoopAdaptive, W("JitAlignLoopAdaptive"), 1) +CONFIG_INTEGER(JitAlignLoopAdaptive, "JitAlignLoopAdaptive", 1) // If set, try to hide align instruction (if any) behind an unconditional jump instruction (if any) // that is present before the loop start. -CONFIG_INTEGER(JitHideAlignBehindJmp, W("JitHideAlignBehindJmp"), 1) +CONFIG_INTEGER(JitHideAlignBehindJmp, "JitHideAlignBehindJmp", 1) // Track stores to locals done through return buffers. -CONFIG_INTEGER(JitOptimizeStructHiddenBuffer, W("JitOptimizeStructHiddenBuffer"), 1) +CONFIG_INTEGER(JitOptimizeStructHiddenBuffer, "JitOptimizeStructHiddenBuffer", 1) CONFIG_INTEGER(JitUnrollLoopMaxIterationCount, - W("JitUnrollLoopMaxIterationCount"), + "JitUnrollLoopMaxIterationCount", DEFAULT_UNROLL_LOOP_MAX_ITERATION_COUNT) -CONFIG_INTEGER(JitDirectAlloc, W("JitDirectAlloc"), 0) -CONFIG_INTEGER(JitDoubleAlign, W("JitDoubleAlign"), 1) -CONFIG_INTEGER(JitEmitPrintRefRegs, W("JitEmitPrintRefRegs"), 0) -CONFIG_INTEGER(JitEnableDevirtualization, W("JitEnableDevirtualization"), 1) // Enable devirtualization in importer -CONFIG_INTEGER(JitEnableLateDevirtualization, W("JitEnableLateDevirtualization"), 1) // Enable devirtualization after - // inlining -CONFIG_INTEGER(JitExpensiveDebugCheckLevel, W("JitExpensiveDebugCheckLevel"), 0) // Level indicates how much checking - // beyond the default to do in debug - // builds (currently 1-2) -CONFIG_INTEGER(JitForceFallback, W("JitForceFallback"), 0) // Set to non-zero to test NOWAY assert by forcing a retry -CONFIG_INTEGER(JitFullyInt, W("JitFullyInt"), 0) // Forces Fully interruptible code -CONFIG_INTEGER(JitFunctionTrace, W("JitFunctionTrace"), 0) // If non-zero, print JIT start/end logging -CONFIG_INTEGER(JitGCChecks, W("JitGCChecks"), 0) -CONFIG_INTEGER(JitGCInfoLogging, W("JitGCInfoLogging"), 0) // If true, prints GCInfo-related output to standard output. -CONFIG_INTEGER(JitHashBreak, W("JitHashBreak"), -1) // Same as JitBreak, but for a method hash -CONFIG_INTEGER(JitHashHalt, W("JitHashHalt"), -1) // Same as JitHalt, but for a method hash -CONFIG_INTEGER(JitInlineAdditionalMultiplier, W("JitInlineAdditionalMultiplier"), 0) -CONFIG_INTEGER(JitInlinePrintStats, W("JitInlinePrintStats"), 0) -CONFIG_INTEGER(JitInlineSize, W("JITInlineSize"), DEFAULT_MAX_INLINE_SIZE) -CONFIG_INTEGER(JitInlineDepth, W("JITInlineDepth"), DEFAULT_MAX_INLINE_DEPTH) -CONFIG_INTEGER(JitForceInlineDepth, W("JITForceInlineDepth"), DEFAULT_MAX_FORCE_INLINE_DEPTH) -CONFIG_INTEGER(JitLongAddress, W("JitLongAddress"), 0) // Force using the large pseudo instruction form for long address -CONFIG_INTEGER(JitMaxUncheckedOffset, W("JitMaxUncheckedOffset"), 8) +CONFIG_INTEGER(JitDirectAlloc, "JitDirectAlloc", 0) +CONFIG_INTEGER(JitDoubleAlign, "JitDoubleAlign", 1) +CONFIG_INTEGER(JitEmitPrintRefRegs, "JitEmitPrintRefRegs", 0) +CONFIG_INTEGER(JitEnableDevirtualization, "JitEnableDevirtualization", 1) // Enable devirtualization in importer +CONFIG_INTEGER(JitEnableLateDevirtualization, "JitEnableLateDevirtualization", 1) // Enable devirtualization after + // inlining +CONFIG_INTEGER(JitExpensiveDebugCheckLevel, "JitExpensiveDebugCheckLevel", 0) // Level indicates how much checking + // beyond the default to do in debug + // builds (currently 1-2) +CONFIG_INTEGER(JitForceFallback, "JitForceFallback", 0) // Set to non-zero to test NOWAY assert by forcing a retry +CONFIG_INTEGER(JitFullyInt, "JitFullyInt", 0) // Forces Fully interruptible code +CONFIG_INTEGER(JitFunctionTrace, "JitFunctionTrace", 0) // If non-zero, print JIT start/end logging +CONFIG_INTEGER(JitGCChecks, "JitGCChecks", 0) +CONFIG_INTEGER(JitGCInfoLogging, "JitGCInfoLogging", 0) // If true, prints GCInfo-related output to standard output. +CONFIG_INTEGER(JitHashBreak, "JitHashBreak", -1) // Same as JitBreak, but for a method hash +CONFIG_INTEGER(JitHashHalt, "JitHashHalt", -1) // Same as JitHalt, but for a method hash +CONFIG_INTEGER(JitInlineAdditionalMultiplier, "JitInlineAdditionalMultiplier", 0) +CONFIG_INTEGER(JitInlinePrintStats, "JitInlinePrintStats", 0) +CONFIG_INTEGER(JitInlineSize, "JITInlineSize", DEFAULT_MAX_INLINE_SIZE) +CONFIG_INTEGER(JitInlineDepth, "JITInlineDepth", DEFAULT_MAX_INLINE_DEPTH) +CONFIG_INTEGER(JitForceInlineDepth, "JITForceInlineDepth", DEFAULT_MAX_FORCE_INLINE_DEPTH) +CONFIG_INTEGER(JitLongAddress, "JitLongAddress", 0) // Force using the large pseudo instruction form for long address +CONFIG_INTEGER(JitMaxUncheckedOffset, "JitMaxUncheckedOffset", 8) // // MinOpts // -CONFIG_INTEGER(JitMinOpts, W("JITMinOpts"), 0) // Forces MinOpts -CONFIG_METHODSET(JitMinOptsName, W("JITMinOptsName")) // Forces MinOpts for a named function +CONFIG_INTEGER(JitMinOpts, "JITMinOpts", 0) // Forces MinOpts +CONFIG_METHODSET(JitMinOptsName, "JITMinOptsName") // Forces MinOpts for a named function // Internal jit control of MinOpts -CONFIG_INTEGER(JitMinOptsBbCount, W("JITMinOptsBbCount"), DEFAULT_MIN_OPTS_BB_COUNT) -CONFIG_INTEGER(JitMinOptsCodeSize, W("JITMinOptsCodeSize"), DEFAULT_MIN_OPTS_CODE_SIZE) -CONFIG_INTEGER(JitMinOptsInstrCount, W("JITMinOptsInstrCount"), DEFAULT_MIN_OPTS_INSTR_COUNT) -CONFIG_INTEGER(JitMinOptsLvNumCount, W("JITMinOptsLvNumcount"), DEFAULT_MIN_OPTS_LV_NUM_COUNT) -CONFIG_INTEGER(JitMinOptsLvRefCount, W("JITMinOptsLvRefcount"), DEFAULT_MIN_OPTS_LV_REF_COUNT) - -CONFIG_INTEGER(JitNoCSE, W("JitNoCSE"), 0) -CONFIG_INTEGER(JitNoCSE2, W("JitNoCSE2"), 0) -CONFIG_INTEGER(JitNoForceFallback, W("JitNoForceFallback"), 0) // Set to non-zero to prevent NOWAY assert testing. - // Overrides DOTNET_JitForceFallback and JIT stress - // flags. -CONFIG_INTEGER(JitNoForwardSub, W("JitNoForwardSub"), 0) // Disables forward sub -CONFIG_INTEGER(JitNoHoist, W("JitNoHoist"), 0) -CONFIG_INTEGER(JitNoMemoryBarriers, W("JitNoMemoryBarriers"), 0) // If 1, don't generate memory barriers -CONFIG_INTEGER(JitNoStructPromotion, W("JitNoStructPromotion"), 0) // Disables struct promotion 1 - for all, 2 - for - // params. -CONFIG_INTEGER(JitNoUnroll, W("JitNoUnroll"), 0) -CONFIG_INTEGER(JitOrder, W("JitOrder"), 0) -CONFIG_INTEGER(JitQueryCurrentStaticFieldClass, W("JitQueryCurrentStaticFieldClass"), 1) -CONFIG_INTEGER(JitReportFastTailCallDecisions, W("JitReportFastTailCallDecisions"), 0) -CONFIG_INTEGER(JitPInvokeCheckEnabled, W("JITPInvokeCheckEnabled"), 0) -CONFIG_INTEGER(JitPInvokeEnabled, W("JITPInvokeEnabled"), 1) - -CONFIG_INTEGER(JitHoistLimit, W("JitHoistLimit"), -1) // Specifies the maximum number of hoist candidates to hoist +CONFIG_INTEGER(JitMinOptsBbCount, "JITMinOptsBbCount", DEFAULT_MIN_OPTS_BB_COUNT) +CONFIG_INTEGER(JitMinOptsCodeSize, "JITMinOptsCodeSize", DEFAULT_MIN_OPTS_CODE_SIZE) +CONFIG_INTEGER(JitMinOptsInstrCount, "JITMinOptsInstrCount", DEFAULT_MIN_OPTS_INSTR_COUNT) +CONFIG_INTEGER(JitMinOptsLvNumCount, "JITMinOptsLvNumcount", DEFAULT_MIN_OPTS_LV_NUM_COUNT) +CONFIG_INTEGER(JitMinOptsLvRefCount, "JITMinOptsLvRefcount", DEFAULT_MIN_OPTS_LV_REF_COUNT) + +CONFIG_INTEGER(JitNoCSE, "JitNoCSE", 0) +CONFIG_INTEGER(JitNoCSE2, "JitNoCSE2", 0) +CONFIG_INTEGER(JitNoForceFallback, "JitNoForceFallback", 0) // Set to non-zero to prevent NOWAY assert testing. + // Overrides DOTNET_JitForceFallback and JIT stress + // flags. +CONFIG_INTEGER(JitNoForwardSub, "JitNoForwardSub", 0) // Disables forward sub +CONFIG_INTEGER(JitNoHoist, "JitNoHoist", 0) +CONFIG_INTEGER(JitNoMemoryBarriers, "JitNoMemoryBarriers", 0) // If 1, don't generate memory barriers +CONFIG_INTEGER(JitNoStructPromotion, "JitNoStructPromotion", 0) // Disables struct promotion 1 - for all, 2 - for + // params. +CONFIG_INTEGER(JitNoUnroll, "JitNoUnroll", 0) +CONFIG_INTEGER(JitOrder, "JitOrder", 0) +CONFIG_INTEGER(JitQueryCurrentStaticFieldClass, "JitQueryCurrentStaticFieldClass", 1) +CONFIG_INTEGER(JitReportFastTailCallDecisions, "JitReportFastTailCallDecisions", 0) +CONFIG_INTEGER(JitPInvokeCheckEnabled, "JITPInvokeCheckEnabled", 0) +CONFIG_INTEGER(JitPInvokeEnabled, "JITPInvokeEnabled", 1) + +CONFIG_INTEGER(JitHoistLimit, "JitHoistLimit", -1) // Specifies the maximum number of hoist candidates to hoist // Controls verbosity for JitPrintInlinedMethods. Ignored for JitDump where it's always set. -CONFIG_INTEGER(JitPrintInlinedMethodsVerbose, W("JitPrintInlinedMethodsVerboseLevel"), 0) +CONFIG_INTEGER(JitPrintInlinedMethodsVerbose, "JitPrintInlinedMethodsVerboseLevel", 0) // Prints a tree of inlinees for a specific method (use '*' for all methods) -CONFIG_METHODSET(JitPrintInlinedMethods, W("JitPrintInlinedMethods")) +CONFIG_METHODSET(JitPrintInlinedMethods, "JitPrintInlinedMethods") -CONFIG_METHODSET(JitPrintDevirtualizedMethods, W("JitPrintDevirtualizedMethods")) +CONFIG_METHODSET(JitPrintDevirtualizedMethods, "JitPrintDevirtualizedMethods") // -1: just do internal checks (CHECK_HASLIKELIHOOD | CHECK_LIKELIHOODSUM | RAISE_ASSERT) // Else bitflag: // - 0x1: check edges have likelihoods @@ -166,213 +166,213 @@ CONFIG_METHODSET(JitPrintDevirtualizedMethods, W("JitPrintDevirtualizedMethods") // - 0x4: fully check likelihoods // - 0x8: assert on check failure // - 0x10: check block profile weights -CONFIG_INTEGER(JitProfileChecks, W("JitProfileChecks"), -1) +CONFIG_INTEGER(JitProfileChecks, "JitProfileChecks", -1) -CONFIG_INTEGER(JitRequired, W("JITRequired"), -1) -CONFIG_INTEGER(JitStackAllocToLocalSize, W("JitStackAllocToLocalSize"), DEFAULT_MAX_LOCALLOC_TO_LOCAL_SIZE) -CONFIG_INTEGER(JitSkipArrayBoundCheck, W("JitSkipArrayBoundCheck"), 0) -CONFIG_INTEGER(JitSlowDebugChecksEnabled, W("JitSlowDebugChecksEnabled"), 1) // Turn on slow debug checks +CONFIG_INTEGER(JitRequired, "JITRequired", -1) +CONFIG_INTEGER(JitStackAllocToLocalSize, "JitStackAllocToLocalSize", DEFAULT_MAX_LOCALLOC_TO_LOCAL_SIZE) +CONFIG_INTEGER(JitSkipArrayBoundCheck, "JitSkipArrayBoundCheck", 0) +CONFIG_INTEGER(JitSlowDebugChecksEnabled, "JitSlowDebugChecksEnabled", 1) // Turn on slow debug checks // On ARM, use this as the maximum function/funclet size for creating function fragments (and creating // multiple RUNTIME_FUNCTION entries) -CONFIG_INTEGER(JitSplitFunctionSize, W("JitSplitFunctionSize"), 0) +CONFIG_INTEGER(JitSplitFunctionSize, "JitSplitFunctionSize", 0) // Perturb order of processing of blocks in SSA; 0 = no stress; 1 = use method hash; * = supplied value as random hash -CONFIG_INTEGER(JitSsaStress, W("JitSsaStress"), 0) +CONFIG_INTEGER(JitSsaStress, "JitSsaStress", 0) -CONFIG_INTEGER(JitStackChecks, W("JitStackChecks"), 0) +CONFIG_INTEGER(JitStackChecks, "JitStackChecks", 0) // Internal Jit stress mode: 0 = no stress, 2 = all stress, other = vary stress based on a hash of the method and // this value. -CONFIG_INTEGER(JitStress, W("JitStress"), 0) +CONFIG_INTEGER(JitStress, "JitStress", 0) -CONFIG_INTEGER(JitStressBBProf, W("JitStressBBProf"), 0) // Internal Jit stress mode -CONFIG_INTEGER(JitStressProcedureSplitting, W("JitStressProcedureSplitting"), 0) // Always split after the first basic - // block. -CONFIG_INTEGER(JitStressRegs, W("JitStressRegs"), 0) -CONFIG_STRING(JitStressRegsRange, W("JitStressRegsRange")) // Only apply JitStressRegs to methods in this hash range +CONFIG_INTEGER(JitStressBBProf, "JitStressBBProf", 0) // Internal Jit stress mode +CONFIG_INTEGER(JitStressProcedureSplitting, "JitStressProcedureSplitting", 0) // Always split after the first basic + // block. +CONFIG_INTEGER(JitStressRegs, "JitStressRegs", 0) +CONFIG_STRING(JitStressRegsRange, "JitStressRegsRange") // Only apply JitStressRegs to methods in this hash range // If non-negative value N, only stress split the first N trees. -CONFIG_INTEGER(JitStressSplitTreeLimit, W("JitStressSplitTreeLimit"), -1) +CONFIG_INTEGER(JitStressSplitTreeLimit, "JitStressSplitTreeLimit", -1) // If non-zero, assert if # of VNF_MapSelect applications considered reaches this. -CONFIG_INTEGER(JitVNMapSelLimit, W("JitVNMapSelLimit"), 0) +CONFIG_INTEGER(JitVNMapSelLimit, "JitVNMapSelLimit", 0) // If non-zero, and the compilation succeeds for an AltJit, then use the code. If zero, then we always throw away the // generated code and fall back to the default compiler. -CONFIG_INTEGER(RunAltJitCode, W("RunAltJitCode"), 1) +CONFIG_INTEGER(RunAltJitCode, "RunAltJitCode", 1) -CONFIG_INTEGER(RunComponentUnitTests, W("JitComponentUnitTests"), 0) // Run JIT component unit tests -CONFIG_INTEGER(ShouldInjectFault, W("InjectFault"), 0) -CONFIG_INTEGER(TailcallStress, W("TailcallStress"), 0) +CONFIG_INTEGER(RunComponentUnitTests, "JitComponentUnitTests", 0) // Run JIT component unit tests +CONFIG_INTEGER(ShouldInjectFault, "InjectFault", 0) +CONFIG_INTEGER(TailcallStress, "TailcallStress", 0) -CONFIG_METHODSET(JitBreak, W("JitBreak")) // Stops in the importer when compiling a specified method -CONFIG_METHODSET(JitDebugBreak, W("JitDebugBreak")) +CONFIG_METHODSET(JitBreak, "JitBreak") // Stops in the importer when compiling a specified method +CONFIG_METHODSET(JitDebugBreak, "JitDebugBreak") // // JitDump // -CONFIG_METHODSET(JitDump, W("JitDump")) // Dumps trees for specified method -CONFIG_INTEGER(JitHashDump, W("JitHashDump"), -1) // Same as JitDump, but for a method hash -CONFIG_INTEGER(JitDumpTier0, W("JitDumpTier0"), 1) // Dump tier0 jit compilations -CONFIG_INTEGER(JitDumpOSR, W("JitDumpOSR"), 1) // Dump OSR jit compilations -CONFIG_INTEGER(JitDumpAtOSROffset, W("JitDumpAtOSROffset"), -1) // Dump only OSR jit compilations with this offset -CONFIG_INTEGER(JitDumpInlinePhases, W("JitDumpInlinePhases"), 1) // Dump inline compiler phases -CONFIG_INTEGER(JitDumpASCII, W("JitDumpASCII"), 1) // Uses only ASCII characters in tree dumps -CONFIG_INTEGER(JitDumpTerseLsra, W("JitDumpTerseLsra"), 1) // Produce terse dump output for LSRA -CONFIG_INTEGER(JitDumpToDebugger, W("JitDumpToDebugger"), 0) // Output JitDump output to the debugger -CONFIG_INTEGER(JitDumpVerboseSsa, W("JitDumpVerboseSsa"), 0) // Produce especially verbose dump output for SSA -CONFIG_INTEGER(JitDumpVerboseTrees, W("JitDumpVerboseTrees"), 0) // Enable more verbose tree dumps -CONFIG_INTEGER(JitDumpTreeIDs, W("JitDumpTreeIDs"), 1) // Print tree IDs in dumps -CONFIG_INTEGER(JitDumpBeforeAfterMorph, W("JitDumpBeforeAfterMorph"), 0) // If 1, display each tree before/after - // morphing +CONFIG_METHODSET(JitDump, "JitDump") // Dumps trees for specified method +CONFIG_INTEGER(JitHashDump, "JitHashDump", -1) // Same as JitDump, but for a method hash +CONFIG_INTEGER(JitDumpTier0, "JitDumpTier0", 1) // Dump tier0 jit compilations +CONFIG_INTEGER(JitDumpOSR, "JitDumpOSR", 1) // Dump OSR jit compilations +CONFIG_INTEGER(JitDumpAtOSROffset, "JitDumpAtOSROffset", -1) // Dump only OSR jit compilations with this offset +CONFIG_INTEGER(JitDumpInlinePhases, "JitDumpInlinePhases", 1) // Dump inline compiler phases +CONFIG_INTEGER(JitDumpASCII, "JitDumpASCII", 1) // Uses only ASCII characters in tree dumps +CONFIG_INTEGER(JitDumpTerseLsra, "JitDumpTerseLsra", 1) // Produce terse dump output for LSRA +CONFIG_INTEGER(JitDumpToDebugger, "JitDumpToDebugger", 0) // Output JitDump output to the debugger +CONFIG_INTEGER(JitDumpVerboseSsa, "JitDumpVerboseSsa", 0) // Produce especially verbose dump output for SSA +CONFIG_INTEGER(JitDumpVerboseTrees, "JitDumpVerboseTrees", 0) // Enable more verbose tree dumps +CONFIG_INTEGER(JitDumpTreeIDs, "JitDumpTreeIDs", 1) // Print tree IDs in dumps +CONFIG_INTEGER(JitDumpBeforeAfterMorph, "JitDumpBeforeAfterMorph", 0) // If 1, display each tree before/after + // morphing // When dumping blocks, display "*" instead of block number for lexical "next" blocks, to reduce clutter. -CONFIG_INTEGER(JitDumpTerseNextBlock, W("JitDumpTerseNextBlock"), 0) - -CONFIG_METHODSET(JitEHDump, W("JitEHDump")) // Dump the EH table for the method, as reported to the VM - -CONFIG_METHODSET(JitExclude, W("JitExclude")) -CONFIG_INTEGER(JitFakeProcedureSplitting, W("JitFakeProcedureSplitting"), 0) // Do code splitting independent of VM. -CONFIG_METHODSET(JitForceProcedureSplitting, W("JitForceProcedureSplitting")) -CONFIG_METHODSET(JitGCDump, W("JitGCDump")) -CONFIG_METHODSET(JitDebugDump, W("JitDebugDump")) -CONFIG_METHODSET(JitHalt, W("JitHalt")) // Emits break instruction into jitted code -CONFIG_METHODSET(JitInclude, W("JitInclude")) -CONFIG_METHODSET(JitLateDisasm, W("JitLateDisasm")) // Generate late disassembly for the specified methods. -CONFIG_STRING(JitLateDisasmTo, W("JitLateDisasmTo")) // If set, sends late disassembly output to this file instead of - // stdout/JitStdOutFile. -CONFIG_METHODSET(JitNoProcedureSplitting, W("JitNoProcedureSplitting")) // Disallow procedure splitting for specified - // methods -CONFIG_METHODSET(JitNoProcedureSplittingEH, W("JitNoProcedureSplittingEH")) // Disallow procedure splitting for - // specified methods if they contain - // exception handling -CONFIG_METHODSET(JitStressOnly, W("JitStressOnly")) // Internal Jit stress mode: stress only the specified method(s) -CONFIG_METHODSET(JitUnwindDump, W("JitUnwindDump")) // Dump the unwind codes for the method +CONFIG_INTEGER(JitDumpTerseNextBlock, "JitDumpTerseNextBlock", 0) + +CONFIG_METHODSET(JitEHDump, "JitEHDump") // Dump the EH table for the method, as reported to the VM + +CONFIG_METHODSET(JitExclude, "JitExclude") +CONFIG_INTEGER(JitFakeProcedureSplitting, "JitFakeProcedureSplitting", 0) // Do code splitting independent of VM. +CONFIG_METHODSET(JitForceProcedureSplitting, "JitForceProcedureSplitting") +CONFIG_METHODSET(JitGCDump, "JitGCDump") +CONFIG_METHODSET(JitDebugDump, "JitDebugDump") +CONFIG_METHODSET(JitHalt, "JitHalt") // Emits break instruction into jitted code +CONFIG_METHODSET(JitInclude, "JitInclude") +CONFIG_METHODSET(JitLateDisasm, "JitLateDisasm") // Generate late disassembly for the specified methods. +CONFIG_STRING(JitLateDisasmTo, "JitLateDisasmTo") // If set, sends late disassembly output to this file instead of + // stdout/JitStdOutFile. +CONFIG_METHODSET(JitNoProcedureSplitting, "JitNoProcedureSplitting") // Disallow procedure splitting for specified + // methods +CONFIG_METHODSET(JitNoProcedureSplittingEH, "JitNoProcedureSplittingEH") // Disallow procedure splitting for + // specified methods if they contain + // exception handling +CONFIG_METHODSET(JitStressOnly, "JitStressOnly") // Internal Jit stress mode: stress only the specified method(s) +CONFIG_METHODSET(JitUnwindDump, "JitUnwindDump") // Dump the unwind codes for the method // // JitDumpFg - dump flowgraph // -CONFIG_METHODSET(JitDumpFg, W("JitDumpFg")) // Dumps Xml/Dot Flowgraph for specified method -CONFIG_STRING(JitDumpFgDir, W("JitDumpFgDir")) // Directory for Xml/Dot flowgraph dump(s) -CONFIG_STRING(JitDumpFgFile, W("JitDumpFgFile")) // Filename for Xml/Dot flowgraph dump(s) (default: "default") -CONFIG_STRING(JitDumpFgPhase, W("JitDumpFgPhase")) // Phase-based Xml/Dot flowgraph support. Set to the short name of a - // phase to see the flowgraph after that phase. Leave unset to dump - // after COLD-BLK (determine first cold block) or set to * for all - // phases -CONFIG_STRING(JitDumpFgPrePhase, W("JitDumpFgPrePhase")) // Same as JitDumpFgPhase, but specifies to dump pre-phase, not - // post-phase. -CONFIG_INTEGER(JitDumpFgDot, W("JitDumpFgDot"), 1) // 0 == dump XML format; non-zero == dump DOT format -CONFIG_INTEGER(JitDumpFgEH, W("JitDumpFgEH"), 0) // 0 == no EH regions; non-zero == include EH regions -CONFIG_INTEGER(JitDumpFgLoops, W("JitDumpFgLoops"), 0) // 0 == no loop regions; non-zero == include loop regions - -CONFIG_INTEGER(JitDumpFgConstrained, W("JitDumpFgConstrained"), 1) // 0 == don't constrain to mostly linear layout; - // non-zero == force mostly lexical block - // linear layout -CONFIG_INTEGER(JitDumpFgBlockID, W("JitDumpFgBlockID"), 0) // 0 == display block with bbNum; 1 == display with both - // bbNum and bbID -CONFIG_INTEGER(JitDumpFgBlockFlags, W("JitDumpFgBlockFlags"), 0) // 0 == don't display block flags; 1 == display flags -CONFIG_INTEGER(JitDumpFgLoopFlags, W("JitDumpFgLoopFlags"), 0) // 0 == don't display loop flags; 1 == display flags -CONFIG_INTEGER(JitDumpFgBlockOrder, W("JitDumpFgBlockOrder"), 0) // 0 == bbNext order; 1 == bbNum order; 2 == bbID - // order -CONFIG_INTEGER(JitDumpFgMemorySsa, W("JitDumpFgMemorySsa"), 0) // non-zero: show memory phis + SSA/VNs - -CONFIG_STRING(JitRange, W("JitRange")) +CONFIG_METHODSET(JitDumpFg, "JitDumpFg") // Dumps Xml/Dot Flowgraph for specified method +CONFIG_STRING(JitDumpFgDir, "JitDumpFgDir") // Directory for Xml/Dot flowgraph dump(s) +CONFIG_STRING(JitDumpFgFile, "JitDumpFgFile") // Filename for Xml/Dot flowgraph dump(s) (default: "default") +CONFIG_STRING(JitDumpFgPhase, "JitDumpFgPhase") // Phase-based Xml/Dot flowgraph support. Set to the short name of a + // phase to see the flowgraph after that phase. Leave unset to dump + // after COLD-BLK (determine first cold block) or set to * for all + // phases +CONFIG_STRING(JitDumpFgPrePhase, "JitDumpFgPrePhase") // Same as JitDumpFgPhase, but specifies to dump pre-phase, not + // post-phase. +CONFIG_INTEGER(JitDumpFgDot, "JitDumpFgDot", 1) // 0 == dump XML format; non-zero == dump DOT format +CONFIG_INTEGER(JitDumpFgEH, "JitDumpFgEH", 0) // 0 == no EH regions; non-zero == include EH regions +CONFIG_INTEGER(JitDumpFgLoops, "JitDumpFgLoops", 0) // 0 == no loop regions; non-zero == include loop regions + +CONFIG_INTEGER(JitDumpFgConstrained, "JitDumpFgConstrained", 1) // 0 == don't constrain to mostly linear layout; + // non-zero == force mostly lexical block + // linear layout +CONFIG_INTEGER(JitDumpFgBlockID, "JitDumpFgBlockID", 0) // 0 == display block with bbNum; 1 == display with both + // bbNum and bbID +CONFIG_INTEGER(JitDumpFgBlockFlags, "JitDumpFgBlockFlags", 0) // 0 == don't display block flags; 1 == display flags +CONFIG_INTEGER(JitDumpFgLoopFlags, "JitDumpFgLoopFlags", 0) // 0 == don't display loop flags; 1 == display flags +CONFIG_INTEGER(JitDumpFgBlockOrder, "JitDumpFgBlockOrder", 0) // 0 == bbNext order; 1 == bbNum order; 2 == bbID + // order +CONFIG_INTEGER(JitDumpFgMemorySsa, "JitDumpFgMemorySsa", 0) // non-zero: show memory phis + SSA/VNs + +CONFIG_STRING(JitRange, "JitRange") // Internal Jit stress mode: stress using the given set of stress mode names, e.g. STRESS_REGS, STRESS_TAILCALL. // Unless JitStressModeNamesOnly is non-zero, other stress modes from a JitStress setting may also be invoked. -CONFIG_STRING(JitStressModeNames, W("JitStressModeNames")) +CONFIG_STRING(JitStressModeNames, "JitStressModeNames") // Internal Jit stress: if nonzero, only enable stress modes listed in JitStressModeNames. -CONFIG_INTEGER(JitStressModeNamesOnly, W("JitStressModeNamesOnly"), 0) +CONFIG_INTEGER(JitStressModeNamesOnly, "JitStressModeNamesOnly", 0) // Internal Jit stress mode: only allow stress using the given set of stress mode names, e.g. STRESS_REGS, // STRESS_TAILCALL. Note that JitStress must be enabled first, and then only the mentioned stress modes are allowed // to be used, at the same percentage weighting as with JitStress -- the stress modes mentioned are NOT // unconditionally true for a call to `compStressCompile`. This is basically the opposite of JitStressModeNamesNot. -CONFIG_STRING(JitStressModeNamesAllow, W("JitStressModeNamesAllow")) +CONFIG_STRING(JitStressModeNamesAllow, "JitStressModeNamesAllow") // Internal Jit stress mode: do NOT stress using the given set of stress mode names, e.g. STRESS_REGS, STRESS_TAILCALL -CONFIG_STRING(JitStressModeNamesNot, W("JitStressModeNamesNot")) +CONFIG_STRING(JitStressModeNamesNot, "JitStressModeNamesNot") -CONFIG_STRING(JitStressRange, W("JitStressRange")) // Internal Jit stress mode -CONFIG_METHODSET(JitEmitUnitTests, W("JitEmitUnitTests")) // Generate emitter unit tests in the specified functions -CONFIG_STRING(JitEmitUnitTestsSections, W("JitEmitUnitTestsSections")) // Generate this set of unit tests +CONFIG_STRING(JitStressRange, "JitStressRange") // Internal Jit stress mode +CONFIG_METHODSET(JitEmitUnitTests, "JitEmitUnitTests") // Generate emitter unit tests in the specified functions +CONFIG_STRING(JitEmitUnitTestsSections, "JitEmitUnitTestsSections") // Generate this set of unit tests /// /// JIT Hardware Intrinsics /// -CONFIG_INTEGER(EnableIncompleteISAClass, W("EnableIncompleteISAClass"), 0) // Enable testing not-yet-implemented +CONFIG_INTEGER(EnableIncompleteISAClass, "EnableIncompleteISAClass", 0) // Enable testing not-yet-implemented // // JitDisasm // -RELEASE_CONFIG_METHODSET(JitDisasm, W("JitDisasm")) // Print codegen for given methods -RELEASE_CONFIG_INTEGER(JitDisasmTesting, W("JitDisasmTesting"), 0) // Display BEGIN METHOD/END METHOD anchors for disasm - // testing -RELEASE_CONFIG_INTEGER(JitDisasmDiffable, W("JitDisasmDiffable"), 0) // Make the disassembly diff-able -RELEASE_CONFIG_INTEGER(JitDisasmSummary, W("JitDisasmSummary"), 0) // Prints all jitted methods to the console +RELEASE_CONFIG_METHODSET(JitDisasm, "JitDisasm") // Print codegen for given methods +RELEASE_CONFIG_INTEGER(JitDisasmTesting, "JitDisasmTesting", 0) // Display BEGIN METHOD/END METHOD anchors for disasm + // testing +RELEASE_CONFIG_INTEGER(JitDisasmDiffable, "JitDisasmDiffable", 0) // Make the disassembly diff-able +RELEASE_CONFIG_INTEGER(JitDisasmSummary, "JitDisasmSummary", 0) // Prints all jitted methods to the console // Hides disassembly for unoptimized codegen -RELEASE_CONFIG_INTEGER(JitDisasmOnlyOptimized, W("JitDisasmOnlyOptimized"), 0) +RELEASE_CONFIG_INTEGER(JitDisasmOnlyOptimized, "JitDisasmOnlyOptimized", 0) // Print the alignment boundaries. -RELEASE_CONFIG_INTEGER(JitDisasmWithAlignmentBoundaries, W("JitDisasmWithAlignmentBoundaries"), 0) +RELEASE_CONFIG_INTEGER(JitDisasmWithAlignmentBoundaries, "JitDisasmWithAlignmentBoundaries", 0) // Print the instruction code bytes -RELEASE_CONFIG_INTEGER(JitDisasmWithCodeBytes, W("JitDisasmWithCodeBytes"), 0) +RELEASE_CONFIG_INTEGER(JitDisasmWithCodeBytes, "JitDisasmWithCodeBytes", 0) // Only show JitDisasm and related info for methods from this semicolon-delimited list of assemblies. -CONFIG_STRING(JitDisasmAssemblies, W("JitDisasmAssemblies")) +CONFIG_STRING(JitDisasmAssemblies, "JitDisasmAssemblies") // Dump interleaved GC Info for any method disassembled. -CONFIG_INTEGER(JitDisasmWithGC, W("JitDisasmWithGC"), 0) +CONFIG_INTEGER(JitDisasmWithGC, "JitDisasmWithGC", 0) // Dump interleaved debug info for any method disassembled. -CONFIG_INTEGER(JitDisasmWithDebugInfo, W("JitDisasmWithDebugInfo"), 0) +CONFIG_INTEGER(JitDisasmWithDebugInfo, "JitDisasmWithDebugInfo", 0) // Display native code when any register spilling occurs -CONFIG_INTEGER(JitDisasmSpilled, W("JitDisasmSpilled"), 0) +CONFIG_INTEGER(JitDisasmSpilled, "JitDisasmSpilled", 0) // Print the process address next to each instruction of the disassembly -CONFIG_INTEGER(JitDasmWithAddress, W("JitDasmWithAddress"), 0) +CONFIG_INTEGER(JitDasmWithAddress, "JitDasmWithAddress", 0) -RELEASE_CONFIG_STRING(JitStdOutFile, W("JitStdOutFile")) // If set, sends JIT's stdout output to this file. +RELEASE_CONFIG_STRING(JitStdOutFile, "JitStdOutFile") // If set, sends JIT's stdout output to this file. -RELEASE_CONFIG_INTEGER(RichDebugInfo, W("RichDebugInfo"), 0) // If 1, keep rich debug info and report it back to the EE +RELEASE_CONFIG_INTEGER(RichDebugInfo, "RichDebugInfo", 0) // If 1, keep rich debug info and report it back to the EE -CONFIG_STRING(WriteRichDebugInfoFile, W("WriteRichDebugInfoFile")) // Write rich debug info in JSON format to this file +CONFIG_STRING(WriteRichDebugInfoFile, "WriteRichDebugInfoFile") // Write rich debug info in JSON format to this file #if FEATURE_LOOP_ALIGN -RELEASE_CONFIG_INTEGER(JitAlignLoops, W("JitAlignLoops"), 1) // If set, align inner loops +RELEASE_CONFIG_INTEGER(JitAlignLoops, "JitAlignLoops", 1) // If set, align inner loops #else -RELEASE_CONFIG_INTEGER(JitAlignLoops, W("JitAlignLoops"), 0) +RELEASE_CONFIG_INTEGER(JitAlignLoops, "JitAlignLoops", 0) #endif // AltJitAssertOnNYI should be 0 on targets where JIT is under development or bring up stage, so as to facilitate // fallback to main JIT on hitting a NYI. -RELEASE_CONFIG_INTEGER(AltJitAssertOnNYI, W("AltJitAssertOnNYI"), 1) // Controls the AltJit behavior of NYI stuff +RELEASE_CONFIG_INTEGER(AltJitAssertOnNYI, "AltJitAssertOnNYI", 1) // Controls the AltJit behavior of NYI stuff // Enable the register allocator to support EH-write thru: partial enregistration of vars exposed on EH boundaries -RELEASE_CONFIG_INTEGER(EnableEHWriteThru, W("EnableEHWriteThru"), 1) +RELEASE_CONFIG_INTEGER(EnableEHWriteThru, "EnableEHWriteThru", 1) // Enable the enregistration of locals that are defined or used in a multireg context. -RELEASE_CONFIG_INTEGER(EnableMultiRegLocals, W("EnableMultiRegLocals"), 1) +RELEASE_CONFIG_INTEGER(EnableMultiRegLocals, "EnableMultiRegLocals", 1) // Disables inlining of all methods -RELEASE_CONFIG_INTEGER(JitNoInline, W("JitNoInline"), 0) +RELEASE_CONFIG_INTEGER(JitNoInline, "JitNoInline", 0) // clang-format off #if defined(TARGET_AMD64) || defined(TARGET_X86) // Enable EVEX encoding for SIMD instructions when AVX-512VL is available. -CONFIG_INTEGER(JitStressEvexEncoding, W("JitStressEvexEncoding"), 0) +CONFIG_INTEGER(JitStressEvexEncoding, "JitStressEvexEncoding", 0) #endif -RELEASE_CONFIG_INTEGER(PreferredVectorBitWidth, W("PreferredVectorBitWidth"), 0) // The preferred decimal width, in bits, to use for any implicit vectorization emitted. A value less than 128 is treated as the system default. +RELEASE_CONFIG_INTEGER(PreferredVectorBitWidth, "PreferredVectorBitWidth", 0) // The preferred decimal width, in bits, to use for any implicit vectorization emitted. A value less than 128 is treated as the system default. // // Hardware Intrinsic ISAs; keep in sync with clrconfigvalues.h @@ -380,55 +380,55 @@ RELEASE_CONFIG_INTEGER(PreferredVectorBitWidth, W("PreferredVectorBitWidth") #if defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV64) //TODO: should implement LoongArch64's features. //TODO-RISCV64-CQ: should implement RISCV64's features. -RELEASE_CONFIG_INTEGER(EnableHWIntrinsic, W("EnableHWIntrinsic"), 0) // Allows Base+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableHWIntrinsic, "EnableHWIntrinsic", 0) // Allows Base+ hardware intrinsics to be disabled #else -RELEASE_CONFIG_INTEGER(EnableHWIntrinsic, W("EnableHWIntrinsic"), 1) // Allows Base+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableHWIntrinsic, "EnableHWIntrinsic", 1) // Allows Base+ hardware intrinsics to be disabled #endif // defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV64) #if defined(TARGET_AMD64) || defined(TARGET_X86) -RELEASE_CONFIG_INTEGER(EnableAES, W("EnableAES"), 1) // Allows AES+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableAVX, W("EnableAVX"), 1) // Allows AVX+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableAVX2, W("EnableAVX2"), 1) // Allows AVX2+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableAVX512BW, W("EnableAVX512BW"), 1) // Allows AVX512BW+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableAVX512BW_VL, W("EnableAVX512BW_VL"), 1) // Allows AVX512BW+ AVX512VL+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableAVX512CD, W("EnableAVX512CD"), 1) // Allows AVX512CD+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableAVX512CD_VL, W("EnableAVX512CD_VL"), 1) // Allows AVX512CD+ AVX512VL+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableAVX512DQ, W("EnableAVX512DQ"), 1) // Allows AVX512DQ+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableAVX512DQ_VL, W("EnableAVX512DQ_VL"), 1) // Allows AVX512DQ+ AVX512VL+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableAVX512F, W("EnableAVX512F"), 1) // Allows AVX512F+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableAVX512F_VL, W("EnableAVX512F_VL"), 1) // Allows AVX512F+ AVX512VL+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableAVX512VBMI, W("EnableAVX512VBMI"), 1) // Allows AVX512VBMI+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableAVX512VBMI_VL, W("EnableAVX512VBMI_VL"), 1) // Allows AVX512VBMI_VL+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableAVX10v1, W("EnableAVX10v1"), 1) // Allows AVX10v1+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableAVXVNNI, W("EnableAVXVNNI"), 1) // Allows AVXVNNI+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableBMI1, W("EnableBMI1"), 1) // Allows BMI1+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableBMI2, W("EnableBMI2"), 1) // Allows BMI2+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableFMA, W("EnableFMA"), 1) // Allows FMA+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableLZCNT, W("EnableLZCNT"), 1) // Allows LZCNT+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnablePCLMULQDQ, W("EnablePCLMULQDQ"), 1) // Allows PCLMULQDQ+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnablePOPCNT, W("EnablePOPCNT"), 1) // Allows POPCNT+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableSSE, W("EnableSSE"), 1) // Allows SSE+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableSSE2, W("EnableSSE2"), 1) // Allows SSE2+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableSSE3, W("EnableSSE3"), 1) // Allows SSE3+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableSSE3_4, W("EnableSSE3_4"), 1) // Allows SSE3+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableSSE41, W("EnableSSE41"), 1) // Allows SSE4.1+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableSSE42, W("EnableSSE42"), 1) // Allows SSE4.2+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableSSSE3, W("EnableSSSE3"), 1) // Allows SSSE3+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableAES, "EnableAES", 1) // Allows AES+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableAVX, "EnableAVX", 1) // Allows AVX+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableAVX2, "EnableAVX2", 1) // Allows AVX2+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableAVX512BW, "EnableAVX512BW", 1) // Allows AVX512BW+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableAVX512BW_VL, "EnableAVX512BW_VL", 1) // Allows AVX512BW+ AVX512VL+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableAVX512CD, "EnableAVX512CD", 1) // Allows AVX512CD+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableAVX512CD_VL, "EnableAVX512CD_VL", 1) // Allows AVX512CD+ AVX512VL+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableAVX512DQ, "EnableAVX512DQ", 1) // Allows AVX512DQ+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableAVX512DQ_VL, "EnableAVX512DQ_VL", 1) // Allows AVX512DQ+ AVX512VL+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableAVX512F, "EnableAVX512F", 1) // Allows AVX512F+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableAVX512F_VL, "EnableAVX512F_VL", 1) // Allows AVX512F+ AVX512VL+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableAVX512VBMI, "EnableAVX512VBMI", 1) // Allows AVX512VBMI+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableAVX512VBMI_VL, "EnableAVX512VBMI_VL", 1) // Allows AVX512VBMI_VL+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableAVX10v1, "EnableAVX10v1", 1) // Allows AVX10v1+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableAVXVNNI, "EnableAVXVNNI", 1) // Allows AVXVNNI+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableBMI1, "EnableBMI1", 1) // Allows BMI1+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableBMI2, "EnableBMI2", 1) // Allows BMI2+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableFMA, "EnableFMA", 1) // Allows FMA+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableLZCNT, "EnableLZCNT", 1) // Allows LZCNT+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnablePCLMULQDQ, "EnablePCLMULQDQ", 1) // Allows PCLMULQDQ+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnablePOPCNT, "EnablePOPCNT", 1) // Allows POPCNT+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableSSE, "EnableSSE", 1) // Allows SSE+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableSSE2, "EnableSSE2", 1) // Allows SSE2+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableSSE3, "EnableSSE3", 1) // Allows SSE3+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableSSE3_4, "EnableSSE3_4", 1) // Allows SSE3+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableSSE41, "EnableSSE41", 1) // Allows SSE4.1+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableSSE42, "EnableSSE42", 1) // Allows SSE4.2+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableSSSE3, "EnableSSSE3", 1) // Allows SSSE3+ hardware intrinsics to be disabled #elif defined(TARGET_ARM64) -RELEASE_CONFIG_INTEGER(EnableArm64AdvSimd, W("EnableArm64AdvSimd"), 1) // Allows Arm64 AdvSimd+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableArm64Aes, W("EnableArm64Aes"), 1) // Allows Arm64 Aes+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableArm64Atomics, W("EnableArm64Atomics"), 1) // Allows Arm64 Atomics+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableArm64Crc32, W("EnableArm64Crc32"), 1) // Allows Arm64 Crc32+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableArm64Dczva, W("EnableArm64Dczva"), 1) // Allows Arm64 Dczva+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableArm64Dp, W("EnableArm64Dp"), 1) // Allows Arm64 Dp+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableArm64Rdm, W("EnableArm64Rdm"), 1) // Allows Arm64 Rdm+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableArm64Sha1, W("EnableArm64Sha1"), 1) // Allows Arm64 Sha1+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableArm64Sha256, W("EnableArm64Sha256"), 1) // Allows Arm64 Sha256+ hardware intrinsics to be disabled -RELEASE_CONFIG_INTEGER(EnableArm64Sve, W("EnableArm64Sve"), 1) // Allows Arm64 Sve+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableArm64AdvSimd, "EnableArm64AdvSimd", 1) // Allows Arm64 AdvSimd+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableArm64Aes, "EnableArm64Aes", 1) // Allows Arm64 Aes+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableArm64Atomics, "EnableArm64Atomics", 1) // Allows Arm64 Atomics+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableArm64Crc32, "EnableArm64Crc32", 1) // Allows Arm64 Crc32+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableArm64Dczva, "EnableArm64Dczva", 1) // Allows Arm64 Dczva+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableArm64Dp, "EnableArm64Dp", 1) // Allows Arm64 Dp+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableArm64Rdm, "EnableArm64Rdm", 1) // Allows Arm64 Rdm+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableArm64Sha1, "EnableArm64Sha1", 1) // Allows Arm64 Sha1+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableArm64Sha256, "EnableArm64Sha256", 1) // Allows Arm64 Sha256+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableArm64Sve, "EnableArm64Sve", 1) // Allows Arm64 Sve+ hardware intrinsics to be disabled #endif -RELEASE_CONFIG_INTEGER(EnableEmbeddedBroadcast, W("EnableEmbeddedBroadcast"), 1) // Allows embedded broadcasts to be disabled -RELEASE_CONFIG_INTEGER(EnableEmbeddedMasking, W("EnableEmbeddedMasking"), 1) // Allows embedded masking to be disabled +RELEASE_CONFIG_INTEGER(EnableEmbeddedBroadcast, "EnableEmbeddedBroadcast", 1) // Allows embedded broadcasts to be disabled +RELEASE_CONFIG_INTEGER(EnableEmbeddedMasking, "EnableEmbeddedMasking", 1) // Allows embedded masking to be disabled // clang-format on @@ -437,7 +437,7 @@ RELEASE_CONFIG_INTEGER(EnableEmbeddedMasking, W("EnableEmbeddedMasking"), // If 1, then disable ValueNumbering of SIMD nodes // If 2, then disable ValueNumbering of HW Intrinsic nodes // If 3, disable both SIMD and HW Intrinsic nodes -RELEASE_CONFIG_INTEGER(JitDisableSimdVN, W("JitDisableSimdVN"), 0) +RELEASE_CONFIG_INTEGER(JitDisableSimdVN, "JitDisableSimdVN", 0) #endif // Default 0, enable the CSE of Constants, including nearby offsets. (only for ARM/ARM64) @@ -451,20 +451,20 @@ RELEASE_CONFIG_INTEGER(JitDisableSimdVN, W("JitDisableSimdVN"), 0) #define CONST_CSE_ENABLE_ARM_NO_SHARING 2 #define CONST_CSE_ENABLE_ALL 3 #define CONST_CSE_ENABLE_ALL_NO_SHARING 4 -RELEASE_CONFIG_INTEGER(JitConstCSE, W("JitConstCSE"), CONST_CSE_ENABLE_ARM) +RELEASE_CONFIG_INTEGER(JitConstCSE, "JitConstCSE", CONST_CSE_ENABLE_ARM) // If nonzero, use the greedy RL policy. // -RELEASE_CONFIG_INTEGER(JitRLCSEGreedy, W("JitRLCSEGreedy"), 0) +RELEASE_CONFIG_INTEGER(JitRLCSEGreedy, "JitRLCSEGreedy", 0) // If nonzero, dump out details of parameterized policy evaluation and gradient updates. -RELEASE_CONFIG_INTEGER(JitRLCSEVerbose, W("JitRLCSEVerbose"), 0) +RELEASE_CONFIG_INTEGER(JitRLCSEVerbose, "JitRLCSEVerbose", 0) // Allow fine-grained controls of CSEs done in a particular method // // Specify method that will respond to the CSEMask. // -1 means feature disabled and all methods run CSE normally. -CONFIG_INTEGER(JitCSEHash, W("JitCSEHash"), -1) +CONFIG_INTEGER(JitCSEHash, "JitCSEHash", -1) // Bitmask of allowed CSEs in methods specified by JitCSEHash. // These bits control the "cse attempts" made by normal jitting, @@ -479,20 +479,20 @@ CONFIG_INTEGER(JitCSEHash, W("JitCSEHash"), -1) // F: do only the first four CSEs // ...etc... // FFFFFFFF : do all the CSEs normally done -CONFIG_INTEGER(JitCSEMask, W("JitCSEMask"), 0) +CONFIG_INTEGER(JitCSEMask, "JitCSEMask", 0) // Enable metric output in jit disasm and elsewhere -CONFIG_INTEGER(JitMetrics, W("JitMetrics"), 0) +CONFIG_INTEGER(JitMetrics, "JitMetrics", 0) // When nonzero, choose CSE candidates randomly, with hash salt specified by the (decimal) value of the config. -CONFIG_INTEGER(JitRandomCSE, W("JitRandomCSE"), 0) +CONFIG_INTEGER(JitRandomCSE, "JitRandomCSE", 0) // When set, specifies the exact CSEs to perform as a sequence of CSE candidate numbers. -CONFIG_STRING(JitReplayCSE, W("JitReplayCSE")) +CONFIG_STRING(JitReplayCSE, "JitReplayCSE") // When set, specify the sequence of rewards from the CSE replay. // There should be one reward per step in the sequence. -CONFIG_STRING(JitReplayCSEReward, W("JitReplayCSEReward")) +CONFIG_STRING(JitReplayCSEReward, "JitReplayCSEReward") // When set, specifies the initial parameter string for // the reinforcement-learning based CSE heuristic. @@ -500,27 +500,27 @@ CONFIG_STRING(JitReplayCSEReward, W("JitReplayCSEReward")) // Note you can also set JitReplayCSE and JitReplayCSEPerfScore // along with this, in which case we are asking for a policy // evaluation/update based on the provided sequence. -CONFIG_STRING(JitRLCSE, W("JitRLCSE")) +CONFIG_STRING(JitRLCSE, "JitRLCSE") // When set, specify the alpha value (step size) to use in learning. -CONFIG_STRING(JitRLCSEAlpha, W("JitRLCSEAlpha")) +CONFIG_STRING(JitRLCSEAlpha, "JitRLCSEAlpha") // If nonzero, dump candidate feature values -CONFIG_INTEGER(JitRLCSECandidateFeatures, W("JitRLCSECandidateFeatures"), 0) +CONFIG_INTEGER(JitRLCSECandidateFeatures, "JitRLCSECandidateFeatures", 0) // Enable CSE_HeuristicRLHook -CONFIG_INTEGER(JitRLHook, W("JitRLHook"), 0) // If 1, emit RL callbacks +CONFIG_INTEGER(JitRLHook, "JitRLHook", 0) // If 1, emit RL callbacks // If 1, emit feature column names -CONFIG_INTEGER(JitRLHookEmitFeatureNames, W("JitRLHookEmitFeatureNames"), 0) +CONFIG_INTEGER(JitRLHookEmitFeatureNames, "JitRLHookEmitFeatureNames", 0) // A list of CSEs to choose, in the order they should be applied. -CONFIG_STRING(JitRLHookCSEDecisions, W("JitRLHookCSEDecisions")) +CONFIG_STRING(JitRLHookCSEDecisions, "JitRLHookCSEDecisions") #if !defined(DEBUG) && !defined(_DEBUG) -RELEASE_CONFIG_INTEGER(JitEnableNoWayAssert, W("JitEnableNoWayAssert"), 0) +RELEASE_CONFIG_INTEGER(JitEnableNoWayAssert, "JitEnableNoWayAssert", 0) #else // defined(DEBUG) || defined(_DEBUG) -RELEASE_CONFIG_INTEGER(JitEnableNoWayAssert, W("JitEnableNoWayAssert"), 1) +RELEASE_CONFIG_INTEGER(JitEnableNoWayAssert, "JitEnableNoWayAssert", 1) #endif // !defined(DEBUG) && !defined(_DEBUG) // The following should be wrapped inside "#if MEASURE_MEM_ALLOC / #endif", but @@ -530,109 +530,112 @@ RELEASE_CONFIG_INTEGER(JitEnableNoWayAssert, W("JitEnableNoWayAssert"), 1) // (normally MEASURE_MEM_ALLOC is off for release builds but if it's toggled on // for release in "jit.h" the flag would be missing for some includers). // TODO-Cleanup: need to make 'MEASURE_MEM_ALLOC' well-defined here at all times. -RELEASE_CONFIG_INTEGER(DisplayMemStats, W("JitMemStats"), 0) // Display JIT memory usage statistics +RELEASE_CONFIG_INTEGER(DisplayMemStats, "JitMemStats", 0) // Display JIT memory usage statistics -CONFIG_INTEGER(JitEnregStats, W("JitEnregStats"), 0) // Display JIT enregistration statistics +CONFIG_INTEGER(JitEnregStats, "JitEnregStats", 0) // Display JIT enregistration statistics -RELEASE_CONFIG_INTEGER(JitAggressiveInlining, W("JitAggressiveInlining"), 0) // Aggressive inlining of all methods -RELEASE_CONFIG_INTEGER(JitELTHookEnabled, W("JitELTHookEnabled"), 0) // If 1, emit Enter/Leave/TailCall callbacks -RELEASE_CONFIG_INTEGER(JitInlineSIMDMultiplier, W("JitInlineSIMDMultiplier"), 3) +RELEASE_CONFIG_INTEGER(JitAggressiveInlining, "JitAggressiveInlining", 0) // Aggressive inlining of all methods +RELEASE_CONFIG_INTEGER(JitELTHookEnabled, "JitELTHookEnabled", 0) // If 1, emit Enter/Leave/TailCall callbacks +RELEASE_CONFIG_INTEGER(JitInlineSIMDMultiplier, "JitInlineSIMDMultiplier", 3) // Ex lclMAX_TRACKED constant. -RELEASE_CONFIG_INTEGER(JitMaxLocalsToTrack, W("JitMaxLocalsToTrack"), 0x400) +RELEASE_CONFIG_INTEGER(JitMaxLocalsToTrack, "JitMaxLocalsToTrack", 0x400) #if defined(FEATURE_ENABLE_NO_RANGE_CHECKS) -RELEASE_CONFIG_INTEGER(JitNoRngChks, W("JitNoRngChks"), 0) // If 1, don't generate range checks +RELEASE_CONFIG_INTEGER(JitNoRngChks, "JitNoRngChks", 0) // If 1, don't generate range checks #endif -OPT_CONFIG_INTEGER(JitDoAssertionProp, W("JitDoAssertionProp"), 1) // Perform assertion propagation optimization -OPT_CONFIG_INTEGER(JitDoCopyProp, W("JitDoCopyProp"), 1) // Perform copy propagation on variables that appear redundant -OPT_CONFIG_INTEGER(JitDoOptimizeIVs, W("JitDoOptimizeIVs"), 1) // Perform optimization of induction variables -OPT_CONFIG_INTEGER(JitDoEarlyProp, W("JitDoEarlyProp"), 1) // Perform Early Value Propagation -OPT_CONFIG_INTEGER(JitDoLoopHoisting, W("JitDoLoopHoisting"), 1) // Perform loop hoisting on loop invariant values -OPT_CONFIG_INTEGER(JitDoLoopInversion, W("JitDoLoopInversion"), 1) // Perform loop inversion on "for/while" loops -OPT_CONFIG_INTEGER(JitDoRangeAnalysis, W("JitDoRangeAnalysis"), 1) // Perform range check analysis -OPT_CONFIG_INTEGER(JitDoVNBasedDeadStoreRemoval, W("JitDoVNBasedDeadStoreRemoval"), 1) // Perform VN-based dead store - // removal -OPT_CONFIG_INTEGER(JitDoRedundantBranchOpts, W("JitDoRedundantBranchOpts"), 1) // Perform redundant branch optimizations -OPT_CONFIG_STRING(JitEnableRboRange, W("JitEnableRboRange")) -OPT_CONFIG_STRING(JitEnableHeadTailMergeRange, W("JitEnableHeadTailMergeRange")) -OPT_CONFIG_STRING(JitEnableVNBasedDeadStoreRemovalRange, W("JitEnableVNBasedDeadStoreRemovalRange")) -OPT_CONFIG_STRING(JitEnableEarlyLivenessRange, W("JitEnableEarlyLivenessRange")) +OPT_CONFIG_INTEGER(JitDoAssertionProp, "JitDoAssertionProp", 1) // Perform assertion propagation optimization +OPT_CONFIG_INTEGER(JitDoCopyProp, "JitDoCopyProp", 1) // Perform copy propagation on variables that appear redundant +OPT_CONFIG_INTEGER(JitDoOptimizeIVs, "JitDoOptimizeIVs", 1) // Perform optimization of induction variables +OPT_CONFIG_INTEGER(JitDoEarlyProp, "JitDoEarlyProp", 1) // Perform Early Value Propagation +OPT_CONFIG_INTEGER(JitDoLoopHoisting, "JitDoLoopHoisting", 1) // Perform loop hoisting on loop invariant values +OPT_CONFIG_INTEGER(JitDoLoopInversion, "JitDoLoopInversion", 1) // Perform loop inversion on "for/while" loops +OPT_CONFIG_INTEGER(JitDoRangeAnalysis, "JitDoRangeAnalysis", 1) // Perform range check analysis +OPT_CONFIG_INTEGER(JitDoVNBasedDeadStoreRemoval, "JitDoVNBasedDeadStoreRemoval", 1) // Perform VN-based dead store + // removal +OPT_CONFIG_INTEGER(JitDoRedundantBranchOpts, "JitDoRedundantBranchOpts", 1) // Perform redundant branch optimizations +OPT_CONFIG_STRING(JitEnableRboRange, "JitEnableRboRange") +OPT_CONFIG_STRING(JitEnableHeadTailMergeRange, "JitEnableHeadTailMergeRange") +OPT_CONFIG_STRING(JitEnableVNBasedDeadStoreRemovalRange, "JitEnableVNBasedDeadStoreRemovalRange") +OPT_CONFIG_STRING(JitEnableEarlyLivenessRange, "JitEnableEarlyLivenessRange") OPT_CONFIG_STRING(JitOnlyOptimizeRange, - W("JitOnlyOptimizeRange")) // If set, all methods that do _not_ match are forced into MinOpts -OPT_CONFIG_STRING(JitEnablePhysicalPromotionRange, W("JitEnablePhysicalPromotionRange")) -OPT_CONFIG_STRING(JitEnableCrossBlockLocalAssertionPropRange, W("JitEnableCrossBlockLocalAssertionPropRange")) -OPT_CONFIG_STRING(JitEnableInductionVariableOptsRange, W("JitEnableInductionVariableOptsRange")) -OPT_CONFIG_STRING(JitEnableLocalAddrPropagationRange, W("JitEnableLocalAddrPropagationRange")) + "JitOnlyOptimizeRange") // If set, all methods that do _not_ match are forced into MinOpts +OPT_CONFIG_STRING(JitEnablePhysicalPromotionRange, "JitEnablePhysicalPromotionRange") +OPT_CONFIG_STRING(JitEnableCrossBlockLocalAssertionPropRange, "JitEnableCrossBlockLocalAssertionPropRange") +OPT_CONFIG_STRING(JitEnableInductionVariableOptsRange, "JitEnableInductionVariableOptsRange") +OPT_CONFIG_STRING(JitEnableLocalAddrPropagationRange, "JitEnableLocalAddrPropagationRange") -OPT_CONFIG_INTEGER(JitDoSsa, W("JitDoSsa"), 1) // Perform Static Single Assignment (SSA) numbering on the variables -OPT_CONFIG_INTEGER(JitDoValueNumber, W("JitDoValueNumber"), 1) // Perform value numbering on method expressions +OPT_CONFIG_INTEGER(JitDoSsa, "JitDoSsa", 1) // Perform Static Single Assignment (SSA) numbering on the variables +OPT_CONFIG_INTEGER(JitDoValueNumber, "JitDoValueNumber", 1) // Perform value numbering on method expressions -OPT_CONFIG_STRING(JitOptRepeatRange, W("JitOptRepeatRange")) // Enable JitOptRepeat based on method hash range +OPT_CONFIG_STRING(JitOptRepeatRange, "JitOptRepeatRange") // Enable JitOptRepeat based on method hash range -OPT_CONFIG_INTEGER(JitDoIfConversion, W("JitDoIfConversion"), 1) // Perform If conversion +OPT_CONFIG_INTEGER(JitDoIfConversion, "JitDoIfConversion", 1) // Perform If conversion -RELEASE_CONFIG_INTEGER(JitEnableOptRepeat, W("JitEnableOptRepeat"), 1) // If zero, do not allow JitOptRepeat -RELEASE_CONFIG_METHODSET(JitOptRepeat, W("JitOptRepeat")) // Runs optimizer multiple times on specified methods -RELEASE_CONFIG_INTEGER(JitOptRepeatCount, W("JitOptRepeatCount"), 2) // Number of times to repeat opts when repeating +RELEASE_CONFIG_INTEGER(JitEnableOptRepeat, "JitEnableOptRepeat", 1) // If zero, do not allow JitOptRepeat +RELEASE_CONFIG_METHODSET(JitOptRepeat, "JitOptRepeat") // Runs optimizer multiple times on specified methods +RELEASE_CONFIG_INTEGER(JitOptRepeatCount, "JitOptRepeatCount", 2) // Number of times to repeat opts when repeating // Max # of MapSelect's considered for a particular top-level invocation. -RELEASE_CONFIG_INTEGER(JitVNMapSelBudget, W("JitVNMapSelBudget"), DEFAULT_MAP_SELECT_BUDGET) +RELEASE_CONFIG_INTEGER(JitVNMapSelBudget, "JitVNMapSelBudget", DEFAULT_MAP_SELECT_BUDGET) -RELEASE_CONFIG_INTEGER(TailCallLoopOpt, W("TailCallLoopOpt"), 1) // Convert recursive tail calls to loops -RELEASE_CONFIG_METHODSET(AltJit, W("AltJit")) // Enables AltJit and selectively limits it to the specified methods. -RELEASE_CONFIG_METHODSET(AltJitNgen, W("AltJitNgen")) // Enables AltJit for NGEN and selectively limits it - // to the specified methods. +RELEASE_CONFIG_INTEGER(TailCallLoopOpt, "TailCallLoopOpt", 1) // Convert recursive tail calls to loops +RELEASE_CONFIG_METHODSET(AltJit, "AltJit") // Enables AltJit and selectively limits it to the specified methods. +RELEASE_CONFIG_METHODSET(AltJitNgen, "AltJitNgen") // Enables AltJit for NGEN and selectively limits it + // to the specified methods. // Do not use AltJit on this semicolon-delimited list of assemblies. -RELEASE_CONFIG_STRING(AltJitExcludeAssemblies, W("AltJitExcludeAssemblies")) +RELEASE_CONFIG_STRING(AltJitExcludeAssemblies, "AltJitExcludeAssemblies") // If set, measure the IR size after some phases and report it in the time log. -RELEASE_CONFIG_INTEGER(JitMeasureIR, W("JitMeasureIR"), 0) +RELEASE_CONFIG_INTEGER(JitMeasureIR, "JitMeasureIR", 0) // If set, gather JIT function info and write to this file. -RELEASE_CONFIG_STRING(JitFuncInfoFile, W("JitFuncInfoLogFile")) +RELEASE_CONFIG_STRING(JitFuncInfoFile, "JitFuncInfoLogFile") // If set, gather JIT throughput data and write to a CSV file. This mode must be used in internal retail builds. -RELEASE_CONFIG_STRING(JitTimeLogCsv, W("JitTimeLogCsv")) +RELEASE_CONFIG_STRING(JitTimeLogCsv, "JitTimeLogCsv") -RELEASE_CONFIG_STRING(TailCallOpt, W("TailCallOpt")) +// If set, gather JIT throughput data and write to this file. +RELEASE_CONFIG_STRING(JitTimeLogFile, "JitTimeLogFile") + +RELEASE_CONFIG_STRING(TailCallOpt, "TailCallOpt") // If set, allow fast tail calls; otherwise allow only helper-based calls for explicit tail calls. -RELEASE_CONFIG_INTEGER(FastTailCalls, W("FastTailCalls"), 1) +RELEASE_CONFIG_INTEGER(FastTailCalls, "FastTailCalls", 1) // Set to 1 to measure noway_assert usage. Only valid if MEASURE_NOWAY is defined. -RELEASE_CONFIG_INTEGER(JitMeasureNowayAssert, W("JitMeasureNowayAssert"), 0) +RELEASE_CONFIG_INTEGER(JitMeasureNowayAssert, "JitMeasureNowayAssert", 0) // Set to file to write noway_assert usage to a file (if not set: stdout). Only valid if MEASURE_NOWAY is defined. -RELEASE_CONFIG_STRING(JitMeasureNowayAssertFile, W("JitMeasureNowayAssertFile")) - -CONFIG_INTEGER(EnableExtraSuperPmiQueries, W("EnableExtraSuperPmiQueries"), 0) // Make extra queries to somewhat - // future-proof SuperPmi method contexts. - -CONFIG_INTEGER(JitInlineDumpData, W("JitInlineDumpData"), 0) -CONFIG_INTEGER(JitInlineDumpXml, W("JitInlineDumpXml"), 0) // 1 = full xml (+ failures in DEBUG) - // 2 = only methods with inlines (+ failures in DEBUG) - // 3 = only methods with inlines, no failures -CONFIG_STRING(JitInlineDumpXmlFile, W("JitInlineDumpXmlFile")) -CONFIG_INTEGER(JitInlinePolicyDumpXml, W("JitInlinePolicyDumpXml"), 0) -CONFIG_INTEGER(JitInlineLimit, W("JitInlineLimit"), -1) -CONFIG_INTEGER(JitInlinePolicyDiscretionary, W("JitInlinePolicyDiscretionary"), 0) -CONFIG_INTEGER(JitInlinePolicyFull, W("JitInlinePolicyFull"), 0) -CONFIG_INTEGER(JitInlinePolicySize, W("JitInlinePolicySize"), 0) -CONFIG_INTEGER(JitInlinePolicyRandom, W("JitInlinePolicyRandom"), 0) // nonzero enables; value is the external random - // seed -CONFIG_INTEGER(JitInlinePolicyReplay, W("JitInlinePolicyReplay"), 0) -CONFIG_STRING(JitNoInlineRange, W("JitNoInlineRange")) -CONFIG_STRING(JitInlineReplayFile, W("JitInlineReplayFile")) +RELEASE_CONFIG_STRING(JitMeasureNowayAssertFile, "JitMeasureNowayAssertFile") + +CONFIG_INTEGER(EnableExtraSuperPmiQueries, "EnableExtraSuperPmiQueries", 0) // Make extra queries to somewhat + // future-proof SuperPmi method contexts. + +CONFIG_INTEGER(JitInlineDumpData, "JitInlineDumpData", 0) +CONFIG_INTEGER(JitInlineDumpXml, "JitInlineDumpXml", 0) // 1 = full xml (+ failures in DEBUG) + // 2 = only methods with inlines (+ failures in DEBUG) + // 3 = only methods with inlines, no failures +CONFIG_STRING(JitInlineDumpXmlFile, "JitInlineDumpXmlFile") +CONFIG_INTEGER(JitInlinePolicyDumpXml, "JitInlinePolicyDumpXml", 0) +CONFIG_INTEGER(JitInlineLimit, "JitInlineLimit", -1) +CONFIG_INTEGER(JitInlinePolicyDiscretionary, "JitInlinePolicyDiscretionary", 0) +CONFIG_INTEGER(JitInlinePolicyFull, "JitInlinePolicyFull", 0) +CONFIG_INTEGER(JitInlinePolicySize, "JitInlinePolicySize", 0) +CONFIG_INTEGER(JitInlinePolicyRandom, "JitInlinePolicyRandom", 0) // nonzero enables; value is the external random + // seed +CONFIG_INTEGER(JitInlinePolicyReplay, "JitInlinePolicyReplay", 0) +CONFIG_STRING(JitNoInlineRange, "JitNoInlineRange") +CONFIG_STRING(JitInlineReplayFile, "JitInlineReplayFile") // Extended version of DefaultPolicy that includes a more precise IL scan, // relies on PGO if it exists and generally is more aggressive. -RELEASE_CONFIG_INTEGER(JitExtDefaultPolicy, W("JitExtDefaultPolicy"), 1) -RELEASE_CONFIG_INTEGER(JitExtDefaultPolicyMaxIL, W("JitExtDefaultPolicyMaxIL"), 0x80) -RELEASE_CONFIG_INTEGER(JitExtDefaultPolicyMaxILProf, W("JitExtDefaultPolicyMaxILProf"), 0x400) -RELEASE_CONFIG_INTEGER(JitExtDefaultPolicyMaxBB, W("JitExtDefaultPolicyMaxBB"), 7) +RELEASE_CONFIG_INTEGER(JitExtDefaultPolicy, "JitExtDefaultPolicy", 1) +RELEASE_CONFIG_INTEGER(JitExtDefaultPolicyMaxIL, "JitExtDefaultPolicyMaxIL", 0x80) +RELEASE_CONFIG_INTEGER(JitExtDefaultPolicyMaxILProf, "JitExtDefaultPolicyMaxILProf", 0x400) +RELEASE_CONFIG_INTEGER(JitExtDefaultPolicyMaxBB, "JitExtDefaultPolicyMaxBB", 7) // Inliner uses the following formula for PGO-driven decisions: // @@ -642,146 +645,146 @@ RELEASE_CONFIG_INTEGER(JitExtDefaultPolicyMaxBB, W("JitExtDefaultPolicyMaxBB"), // If a profile data can be trusted for 100% we can safely just give up on inlining anything inside cold blocks // (except the cases where inlining in cold blocks improves type info/escape analysis for the whole caller). // For now, it's only applied for dynamic PGO. -RELEASE_CONFIG_INTEGER(JitExtDefaultPolicyProfTrust, W("JitExtDefaultPolicyProfTrust"), 0x7) -RELEASE_CONFIG_INTEGER(JitExtDefaultPolicyProfScale, W("JitExtDefaultPolicyProfScale"), 0x2A) +RELEASE_CONFIG_INTEGER(JitExtDefaultPolicyProfTrust, "JitExtDefaultPolicyProfTrust", 0x7) +RELEASE_CONFIG_INTEGER(JitExtDefaultPolicyProfScale, "JitExtDefaultPolicyProfScale", 0x2A) -RELEASE_CONFIG_INTEGER(JitInlinePolicyModel, W("JitInlinePolicyModel"), 0) -RELEASE_CONFIG_INTEGER(JitInlinePolicyProfile, W("JitInlinePolicyProfile"), 0) -RELEASE_CONFIG_INTEGER(JitInlinePolicyProfileThreshold, W("JitInlinePolicyProfileThreshold"), 40) -CONFIG_STRING(JitObjectStackAllocationRange, W("JitObjectStackAllocationRange")) -RELEASE_CONFIG_INTEGER(JitObjectStackAllocation, W("JitObjectStackAllocation"), 1) -RELEASE_CONFIG_INTEGER(JitObjectStackAllocationRefClass, W("JitObjectStackAllocationRefClass"), 1) -RELEASE_CONFIG_INTEGER(JitObjectStackAllocationBoxedValueClass, W("JitObjectStackAllocationBoxedValueClass"), 1) +RELEASE_CONFIG_INTEGER(JitInlinePolicyModel, "JitInlinePolicyModel", 0) +RELEASE_CONFIG_INTEGER(JitInlinePolicyProfile, "JitInlinePolicyProfile", 0) +RELEASE_CONFIG_INTEGER(JitInlinePolicyProfileThreshold, "JitInlinePolicyProfileThreshold", 40) +CONFIG_STRING(JitObjectStackAllocationRange, "JitObjectStackAllocationRange") +RELEASE_CONFIG_INTEGER(JitObjectStackAllocation, "JitObjectStackAllocation", 1) +RELEASE_CONFIG_INTEGER(JitObjectStackAllocationRefClass, "JitObjectStackAllocationRefClass", 1) +RELEASE_CONFIG_INTEGER(JitObjectStackAllocationBoxedValueClass, "JitObjectStackAllocationBoxedValueClass", 1) -RELEASE_CONFIG_INTEGER(JitEECallTimingInfo, W("JitEECallTimingInfo"), 0) +RELEASE_CONFIG_INTEGER(JitEECallTimingInfo, "JitEECallTimingInfo", 0) -CONFIG_INTEGER(JitEnableFinallyCloning, W("JitEnableFinallyCloning"), 1) -CONFIG_INTEGER(JitEnableRemoveEmptyTry, W("JitEnableRemoveEmptyTry"), 1) +CONFIG_INTEGER(JitEnableFinallyCloning, "JitEnableFinallyCloning", 1) +CONFIG_INTEGER(JitEnableRemoveEmptyTry, "JitEnableRemoveEmptyTry", 1) // Overall master enable for Guarded Devirtualization. -RELEASE_CONFIG_INTEGER(JitEnableGuardedDevirtualization, W("JitEnableGuardedDevirtualization"), 1) +RELEASE_CONFIG_INTEGER(JitEnableGuardedDevirtualization, "JitEnableGuardedDevirtualization", 1) #define MAX_GDV_TYPE_CHECKS 5 // Number of types to probe for polymorphic virtual call-sites to devirtualize them, // Max number is MAX_GDV_TYPE_CHECKS defined above ^. -1 means it's up to JIT to decide -RELEASE_CONFIG_INTEGER(JitGuardedDevirtualizationMaxTypeChecks, W("JitGuardedDevirtualizationMaxTypeChecks"), -1) +RELEASE_CONFIG_INTEGER(JitGuardedDevirtualizationMaxTypeChecks, "JitGuardedDevirtualizationMaxTypeChecks", -1) // Various policies for GuardedDevirtualization (0x4B == 75) -RELEASE_CONFIG_INTEGER(JitGuardedDevirtualizationChainLikelihood, W("JitGuardedDevirtualizationChainLikelihood"), 0x4B) -RELEASE_CONFIG_INTEGER(JitGuardedDevirtualizationChainStatements, W("JitGuardedDevirtualizationChainStatements"), 1) -CONFIG_STRING(JitGuardedDevirtualizationRange, W("JitGuardedDevirtualizationRange")) -CONFIG_INTEGER(JitRandomGuardedDevirtualization, W("JitRandomGuardedDevirtualization"), 0) +RELEASE_CONFIG_INTEGER(JitGuardedDevirtualizationChainLikelihood, "JitGuardedDevirtualizationChainLikelihood", 0x4B) +RELEASE_CONFIG_INTEGER(JitGuardedDevirtualizationChainStatements, "JitGuardedDevirtualizationChainStatements", 1) +CONFIG_STRING(JitGuardedDevirtualizationRange, "JitGuardedDevirtualizationRange") +CONFIG_INTEGER(JitRandomGuardedDevirtualization, "JitRandomGuardedDevirtualization", 0) // Enable insertion of patchpoints into Tier0 methods, switching to optimized where needed. #if defined(TARGET_AMD64) || defined(TARGET_ARM64) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV64) -RELEASE_CONFIG_INTEGER(TC_OnStackReplacement, W("TC_OnStackReplacement"), 1) +RELEASE_CONFIG_INTEGER(TC_OnStackReplacement, "TC_OnStackReplacement", 1) #else -RELEASE_CONFIG_INTEGER(TC_OnStackReplacement, W("TC_OnStackReplacement"), 0) +RELEASE_CONFIG_INTEGER(TC_OnStackReplacement, "TC_OnStackReplacement", 0) #endif // defined(TARGET_AMD64) || defined(TARGET_ARM64) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV64) // Initial patchpoint counter value used by jitted code -RELEASE_CONFIG_INTEGER(TC_OnStackReplacement_InitialCounter, W("TC_OnStackReplacement_InitialCounter"), 1000) +RELEASE_CONFIG_INTEGER(TC_OnStackReplacement_InitialCounter, "TC_OnStackReplacement_InitialCounter", 1000) // Enable partial compilation for Tier0 methods -RELEASE_CONFIG_INTEGER(TC_PartialCompilation, W("TC_PartialCompilation"), 0) +RELEASE_CONFIG_INTEGER(TC_PartialCompilation, "TC_PartialCompilation", 0) // If partial compilation is enabled, use random heuristic for patchpoint placement -CONFIG_INTEGER(JitRandomPartialCompilation, W("JitRandomPartialCompilation"), 0) +CONFIG_INTEGER(JitRandomPartialCompilation, "JitRandomPartialCompilation", 0) // Patchpoint strategy: // 0 - backedge sources // 1 - backedge targets // 2 - adaptive (default) -RELEASE_CONFIG_INTEGER(TC_PatchpointStrategy, W("TC_PatchpointStrategy"), 2) +RELEASE_CONFIG_INTEGER(TC_PatchpointStrategy, "TC_PatchpointStrategy", 2) // Randomly sprinkle patchpoints. Value is the likelihood any given stack-empty point becomes a patchpoint. -CONFIG_INTEGER(JitRandomOnStackReplacement, W("JitRandomOnStackReplacement"), 0) +CONFIG_INTEGER(JitRandomOnStackReplacement, "JitRandomOnStackReplacement", 0) // Place patchpoint at the specified IL offset, if possible. Overrides random placement. -CONFIG_INTEGER(JitOffsetOnStackReplacement, W("JitOffsetOnStackReplacement"), -1) +CONFIG_INTEGER(JitOffsetOnStackReplacement, "JitOffsetOnStackReplacement", -1) // EnableOsrRange allows you to limit the set of methods that will rely on OSR to escape // from Tier0 code. Methods outside the range that would normally be jitted at Tier0 // and have patchpoints will instead be switched to optimized. -CONFIG_STRING(JitEnableOsrRange, W("JitEnableOsrRange")) +CONFIG_STRING(JitEnableOsrRange, "JitEnableOsrRange") // EnablePatchpointRange allows you to limit the set of Tier0 methods that // will have patchpoints, and hence control which methods will create OSR methods. // Unlike EnableOsrRange, it will not alter the optimization setting for methods // outside the enabled range. -CONFIG_STRING(JitEnablePatchpointRange, W("JitEnablePatchpointRange")) +CONFIG_STRING(JitEnablePatchpointRange, "JitEnablePatchpointRange") // Profile instrumentation options -RELEASE_CONFIG_INTEGER(JitInterlockedProfiling, W("JitInterlockedProfiling"), 0) -RELEASE_CONFIG_INTEGER(JitScalableProfiling, W("JitScalableProfiling"), 1) -RELEASE_CONFIG_INTEGER(JitCounterPadding, W("JitCounterPadding"), 0) // number of unused extra slots per counter -RELEASE_CONFIG_INTEGER(JitMinimalJitProfiling, W("JitMinimalJitProfiling"), 1) -RELEASE_CONFIG_INTEGER(JitMinimalPrejitProfiling, W("JitMinimalPrejitProfiling"), 0) - -RELEASE_CONFIG_INTEGER(JitProfileValues, W("JitProfileValues"), 1) // Value profiling, e.g. Buffer.Memmove's size -RELEASE_CONFIG_INTEGER(JitProfileCasts, W("JitProfileCasts"), 1) // Profile castclass/isinst -RELEASE_CONFIG_INTEGER(JitConsumeProfileForCasts, W("JitConsumeProfileForCasts"), 1) // Consume profile data (if any) - // for castclass/isinst - -RELEASE_CONFIG_INTEGER(JitClassProfiling, W("JitClassProfiling"), 1) // Profile virtual and interface calls -RELEASE_CONFIG_INTEGER(JitDelegateProfiling, W("JitDelegateProfiling"), 1) // Profile resolved delegate call targets -RELEASE_CONFIG_INTEGER(JitVTableProfiling, W("JitVTableProfiling"), 0) // Profile resolved vtable call targets -RELEASE_CONFIG_INTEGER(JitEdgeProfiling, W("JitEdgeProfiling"), 1) // Profile edges instead of blocks -RELEASE_CONFIG_INTEGER(JitCollect64BitCounts, W("JitCollect64BitCounts"), 0) // Collect counts as 64-bit values. +RELEASE_CONFIG_INTEGER(JitInterlockedProfiling, "JitInterlockedProfiling", 0) +RELEASE_CONFIG_INTEGER(JitScalableProfiling, "JitScalableProfiling", 1) +RELEASE_CONFIG_INTEGER(JitCounterPadding, "JitCounterPadding", 0) // number of unused extra slots per counter +RELEASE_CONFIG_INTEGER(JitMinimalJitProfiling, "JitMinimalJitProfiling", 1) +RELEASE_CONFIG_INTEGER(JitMinimalPrejitProfiling, "JitMinimalPrejitProfiling", 0) + +RELEASE_CONFIG_INTEGER(JitProfileValues, "JitProfileValues", 1) // Value profiling, e.g. Buffer.Memmove's size +RELEASE_CONFIG_INTEGER(JitProfileCasts, "JitProfileCasts", 1) // Profile castclass/isinst +RELEASE_CONFIG_INTEGER(JitConsumeProfileForCasts, "JitConsumeProfileForCasts", 1) // Consume profile data (if any) + // for castclass/isinst + +RELEASE_CONFIG_INTEGER(JitClassProfiling, "JitClassProfiling", 1) // Profile virtual and interface calls +RELEASE_CONFIG_INTEGER(JitDelegateProfiling, "JitDelegateProfiling", 1) // Profile resolved delegate call targets +RELEASE_CONFIG_INTEGER(JitVTableProfiling, "JitVTableProfiling", 0) // Profile resolved vtable call targets +RELEASE_CONFIG_INTEGER(JitEdgeProfiling, "JitEdgeProfiling", 1) // Profile edges instead of blocks +RELEASE_CONFIG_INTEGER(JitCollect64BitCounts, "JitCollect64BitCounts", 0) // Collect counts as 64-bit values. // Profile consumption options -RELEASE_CONFIG_INTEGER(JitDisablePGO, W("JitDisablePGO"), 0) // Ignore PGO data for all methods -CONFIG_STRING(JitEnablePGORange, W("JitEnablePGORange")) // Enable PGO data for only some methods -CONFIG_INTEGER(JitRandomEdgeCounts, W("JitRandomEdgeCounts"), 0) // Substitute random values for edge counts -CONFIG_INTEGER(JitCrossCheckDevirtualizationAndPGO, W("JitCrossCheckDevirtualizationAndPGO"), 0) -CONFIG_INTEGER(JitNoteFailedExactDevirtualization, W("JitNoteFailedExactDevirtualization"), 0) -CONFIG_INTEGER(JitRandomlyCollect64BitCounts, W("JitRandomlyCollect64BitCounts"), 0) // Collect 64-bit counts randomly - // for some methods. +RELEASE_CONFIG_INTEGER(JitDisablePGO, "JitDisablePGO", 0) // Ignore PGO data for all methods +CONFIG_STRING(JitEnablePGORange, "JitEnablePGORange") // Enable PGO data for only some methods +CONFIG_INTEGER(JitRandomEdgeCounts, "JitRandomEdgeCounts", 0) // Substitute random values for edge counts +CONFIG_INTEGER(JitCrossCheckDevirtualizationAndPGO, "JitCrossCheckDevirtualizationAndPGO", 0) +CONFIG_INTEGER(JitNoteFailedExactDevirtualization, "JitNoteFailedExactDevirtualization", 0) +CONFIG_INTEGER(JitRandomlyCollect64BitCounts, "JitRandomlyCollect64BitCounts", 0) // Collect 64-bit counts randomly + // for some methods. // 1: profile synthesis for root methods // 2: profile synthesis for root methods w/o PGO data // 3: profile synthesis for root methods, blend with existing PGO data -CONFIG_INTEGER(JitSynthesizeCounts, W("JitSynthesizeCounts"), 0) +CONFIG_INTEGER(JitSynthesizeCounts, "JitSynthesizeCounts", 0) // If instrumenting the method, run synthesis and save the synthesis results // as edge or block profile data. Do not actually instrument. -CONFIG_INTEGER(JitPropagateSynthesizedCountsToProfileData, W("JitPropagateSynthesizedCountsToProfileData"), 0) +CONFIG_INTEGER(JitPropagateSynthesizedCountsToProfileData, "JitPropagateSynthesizedCountsToProfileData", 0) // Use general (gauss-seidel) solver -CONFIG_INTEGER(JitSynthesisUseSolver, W("JitSynthesisUseSolver"), 1) +CONFIG_INTEGER(JitSynthesisUseSolver, "JitSynthesisUseSolver", 1) // Weight for exception regions for synthesis -CONFIG_STRING(JitSynthesisExceptionWeight, W("JitSynthesisExceptionWeight")) +CONFIG_STRING(JitSynthesisExceptionWeight, "JitSynthesisExceptionWeight") // Devirtualize virtual calls with getExactClasses (NativeAOT only for now) -RELEASE_CONFIG_INTEGER(JitEnableExactDevirtualization, W("JitEnableExactDevirtualization"), 1) +RELEASE_CONFIG_INTEGER(JitEnableExactDevirtualization, "JitEnableExactDevirtualization", 1) // Force the generation of CFG checks -RELEASE_CONFIG_INTEGER(JitForceControlFlowGuard, W("JitForceControlFlowGuard"), 0); +RELEASE_CONFIG_INTEGER(JitForceControlFlowGuard, "JitForceControlFlowGuard", 0); // JitCFGUseDispatcher values: // 0: Never use dispatcher // 1: Use dispatcher on all platforms that support it // 2: Default behavior, depends on platform (yes on x64, no on arm64) -RELEASE_CONFIG_INTEGER(JitCFGUseDispatcher, W("JitCFGUseDispatcher"), 2) +RELEASE_CONFIG_INTEGER(JitCFGUseDispatcher, "JitCFGUseDispatcher", 2) // Enable head and tail merging -RELEASE_CONFIG_INTEGER(JitEnableHeadTailMerge, W("JitEnableHeadTailMerge"), 1) +RELEASE_CONFIG_INTEGER(JitEnableHeadTailMerge, "JitEnableHeadTailMerge", 1) // Enable physical promotion -RELEASE_CONFIG_INTEGER(JitEnablePhysicalPromotion, W("JitEnablePhysicalPromotion"), 1) +RELEASE_CONFIG_INTEGER(JitEnablePhysicalPromotion, "JitEnablePhysicalPromotion", 1) // Enable cross-block local assertion prop -RELEASE_CONFIG_INTEGER(JitEnableCrossBlockLocalAssertionProp, W("JitEnableCrossBlockLocalAssertionProp"), 1) +RELEASE_CONFIG_INTEGER(JitEnableCrossBlockLocalAssertionProp, "JitEnableCrossBlockLocalAssertionProp", 1) // Do greedy RPO-based layout in Compiler::fgReorderBlocks. -RELEASE_CONFIG_INTEGER(JitDoReversePostOrderLayout, W("JitDoReversePostOrderLayout"), 1); +RELEASE_CONFIG_INTEGER(JitDoReversePostOrderLayout, "JitDoReversePostOrderLayout", 1); // Enable strength reduction -RELEASE_CONFIG_INTEGER(JitEnableStrengthReduction, W("JitEnableStrengthReduction"), 1) +RELEASE_CONFIG_INTEGER(JitEnableStrengthReduction, "JitEnableStrengthReduction", 1) // Enable IV optimizations -RELEASE_CONFIG_INTEGER(JitEnableInductionVariableOpts, W("JitEnableInductionVariableOpts"), 1) +RELEASE_CONFIG_INTEGER(JitEnableInductionVariableOpts, "JitEnableInductionVariableOpts", 1) // JitFunctionFile: Name of a file that contains a list of functions. If the currently compiled function is in the // file, certain other JIT config variables will be active. If the currently compiled function is not in the file, @@ -799,10 +802,10 @@ RELEASE_CONFIG_INTEGER(JitEnableInductionVariableOpts, W("JitEnableInductionVari // // If this is unset, then the JIT config values have their normal behavior. // -CONFIG_STRING(JitFunctionFile, W("JitFunctionFile")) +CONFIG_STRING(JitFunctionFile, "JitFunctionFile") -CONFIG_METHODSET(JitRawHexCode, W("JitRawHexCode")) -CONFIG_STRING(JitRawHexCodeFile, W("JitRawHexCodeFile")) +CONFIG_METHODSET(JitRawHexCode, "JitRawHexCode") +CONFIG_STRING(JitRawHexCodeFile, "JitRawHexCodeFile") #if defined(TARGET_ARM64) // JitSaveFpLrWithCalleeSavedRegisters: @@ -812,16 +815,16 @@ CONFIG_STRING(JitRawHexCodeFile, W("JitRawHexCodeFile")) // of the frame) // 3: force all frames to use the frame types that save FP/LR registers with the callee-saved registers (at the top // of the frame) and also force using the large funclet frame variation (frame 5) if possible. -CONFIG_INTEGER(JitSaveFpLrWithCalleeSavedRegisters, W("JitSaveFpLrWithCalleeSavedRegisters"), 0) +CONFIG_INTEGER(JitSaveFpLrWithCalleeSavedRegisters, "JitSaveFpLrWithCalleeSavedRegisters", 0) #endif // defined(TARGET_ARM64) #if defined(TARGET_LOONGARCH64) // Disable emitDispIns by default -CONFIG_INTEGER(JitDispIns, W("JitDispIns"), 0) +CONFIG_INTEGER(JitDispIns, "JitDispIns", 0) #endif // defined(TARGET_LOONGARCH64) // Allow to enregister locals with struct type. -RELEASE_CONFIG_INTEGER(JitEnregStructLocals, W("JitEnregStructLocals"), 1) +RELEASE_CONFIG_INTEGER(JitEnregStructLocals, "JitEnregStructLocals", 1) #undef CONFIG_INTEGER #undef CONFIG_STRING diff --git a/src/coreclr/jit/lsra.cpp b/src/coreclr/jit/lsra.cpp index 438c6ebc7e943..dc42353dcd689 100644 --- a/src/coreclr/jit/lsra.cpp +++ b/src/coreclr/jit/lsra.cpp @@ -9988,10 +9988,8 @@ void LinearScan::dumpLsraStats(FILE* file) fprintf(file, "----------\n"); #ifdef DEBUG - LPCWSTR lsraOrder = JitConfig.JitLsraOrdering() == nullptr ? W("ABCDEFGHIJKLMNOPQ") : JitConfig.JitLsraOrdering(); - char lsraOrderUtf8[(REGSELECT_HEURISTIC_COUNT * 3) + 1] = {}; - WideCharToMultiByte(CP_UTF8, 0, lsraOrder, -1, lsraOrderUtf8, ARRAY_SIZE(lsraOrderUtf8), nullptr, nullptr); - fprintf(file, "Register selection order: %s\n", lsraOrderUtf8); + const char* lsraOrder = JitConfig.JitLsraOrdering() == nullptr ? "ABCDEFGHIJKLMNOPQ" : JitConfig.JitLsraOrdering(); + fprintf(file, "Register selection order: %s\n", lsraOrder); #endif fprintf(file, "Total Tracked Vars: %d\n", compiler->lvaTrackedCount); fprintf(file, "Total Reg Cand Vars: %d\n", regCandidateVarCount); @@ -12395,10 +12393,10 @@ LinearScan::RegisterSelection::RegisterSelection(LinearScan* linearScan) #define BUSY_REG_SEL_DEF(stat, value, shortname, orderSeqId) REG_SEL_DEF(stat, value, shortname, orderSeqId) #include "lsra_score.h" - LPCWSTR ordering = JitConfig.JitLsraOrdering(); + const char* ordering = JitConfig.JitLsraOrdering(); if (ordering == nullptr) { - ordering = W("ABCDEFGHIJKLMNOPQ"); + ordering = "ABCDEFGHIJKLMNOPQ"; if (!linearScan->enregisterLocalVars && linearScan->compiler->opts.OptimizationDisabled() #ifdef TARGET_ARM64 @@ -12406,7 +12404,7 @@ LinearScan::RegisterSelection::RegisterSelection(LinearScan* linearScan) #endif ) { - ordering = W("MQQQQQQQQQQQQQQQQ"); + ordering = "MQQQQQQQQQQQQQQQQ"; } } diff --git a/src/coreclr/jit/utils.cpp b/src/coreclr/jit/utils.cpp index 2221b7c820184..26aeb348f55eb 100644 --- a/src/coreclr/jit/utils.cpp +++ b/src/coreclr/jit/utils.cpp @@ -24,8 +24,6 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX #include "opcode.h" #include "jitstd/algorithm.h" -#include // for u16_strtod - /*****************************************************************************/ #define DECLARE_DATA @@ -759,7 +757,7 @@ bool ConfigMethodRange::Contains(unsigned hash) // because of bad characters or too many entries, or had values // that were too large to represent. -void ConfigMethodRange::InitRanges(const WCHAR* rangeStr, unsigned capacity) +void ConfigMethodRange::InitRanges(const char* rangeStr, unsigned capacity) { // Make sure that the memory was zero initialized assert(m_inited == 0 || m_inited == 1); @@ -781,34 +779,34 @@ void ConfigMethodRange::InitRanges(const WCHAR* rangeStr, unsigned capacity) m_ranges = (Range*)jitHost->allocateMemory(capacity * sizeof(Range)); m_entries = capacity; - const WCHAR* p = rangeStr; - unsigned lastRange = 0; - bool setHighPart = false; + const char* p = rangeStr; + unsigned lastRange = 0; + bool setHighPart = false; while ((*p != 0) && (lastRange < m_entries)) { - while ((*p == L' ') || (*p == L',')) + while ((*p == ' ') || (*p == ',')) { p++; } int i = 0; - while (((L'0' <= *p) && (*p <= L'9')) || ((L'A' <= *p) && (*p <= L'F')) || ((L'a' <= *p) && (*p <= L'f'))) + while ((('0' <= *p) && (*p <= '9')) || (('A' <= *p) && (*p <= 'F')) || (('a' <= *p) && (*p <= 'f'))) { int n = 0; - if ((L'0' <= *p) && (*p <= L'9')) + if (('0' <= *p) && (*p <= '9')) { - n = (*p++) - L'0'; + n = (*p++) - '0'; } - else if ((L'A' <= *p) && (*p <= L'F')) + else if (('A' <= *p) && (*p <= 'F')) { - n = (*p++) - L'A' + 10; + n = (*p++) - 'A' + 10; } - else if ((L'a' <= *p) && (*p <= L'f')) + else if (('a' <= *p) && (*p <= 'f')) { - n = (*p++) - L'a' + 10; + n = (*p++) - 'a' + 10; } int j = 16 * i + n; @@ -842,13 +840,13 @@ void ConfigMethodRange::InitRanges(const WCHAR* rangeStr, unsigned capacity) // Must have been looking for the low part of a range m_ranges[lastRange].m_low = i; - while (*p == L' ') + while (*p == ' ') { p++; } // Was that the low part of a low-high pair? - if (*p == L'-') + if (*p == '-') { // Yep, skip the dash and set high part next time around. p++; @@ -921,22 +919,22 @@ void ConfigMethodRange::Dump() // Values are separated decimal with no whitespace. // Separators are any digit not '-' or '0-9' // -void ConfigIntArray::Init(const WCHAR* str) +void ConfigIntArray::Init(const char* str) { // Count the number of values // - const WCHAR* p = str; - unsigned numValues = 0; + const char* p = str; + unsigned numValues = 0; while (*p != 0) { - if ((*p == L'-') || ((L'0' <= *p) && (*p <= L'9'))) + if ((*p == '-') || (('0' <= *p) && (*p <= '9'))) { - if (*p == L'-') + if (*p == '-') { p++; } - while ((L'0' <= *p) && (*p <= L'9')) + while (('0' <= *p) && (*p <= '9')) { p++; } @@ -958,17 +956,17 @@ void ConfigIntArray::Init(const WCHAR* str) bool isNegative = false; while (*p != 0) { - if ((*p == L'-') || ((L'0' <= *p) && (*p <= L'9'))) + if ((*p == '-') || (('0' <= *p) && (*p <= '9'))) { - if (*p == L'-') + if (*p == '-') { isNegative = true; p++; } - while ((L'0' <= *p) && (*p <= L'9')) + while (('0' <= *p) && (*p <= '9')) { - currentValue = currentValue * 10 + (*p++) - L'0'; + currentValue = currentValue * 10 + (*p++) - '0'; } if (isNegative) @@ -1019,21 +1017,21 @@ void ConfigIntArray::Dump() // Values are comma, tab or space separated. // Consecutive separators are ignored // -void ConfigDoubleArray::Init(const WCHAR* str) +void ConfigDoubleArray::Init(const char* str) { // Count the number of values // - const WCHAR* p = str; - unsigned numValues = 0; + const char* p = str; + unsigned numValues = 0; while (*p != 0) { - if (*p == L',') + if (*p == ',') { p++; continue; } - WCHAR* pNext = nullptr; - u16_strtod(p, &pNext); + char* pNext = nullptr; + strtod(p, &pNext); if (errno == 0) { numValues++; @@ -1047,14 +1045,14 @@ void ConfigDoubleArray::Init(const WCHAR* str) numValues = 0; while (*p != 0) { - if (*p == L',') + if (*p == ',') { p++; continue; } - WCHAR* pNext = nullptr; - double val = u16_strtod(p, &pNext); + char* pNext = nullptr; + double val = strtod(p, &pNext); if (errno == 0) { m_values[numValues++] = val; @@ -1863,18 +1861,18 @@ void HelperCallProperties::init() // // You must use ';' as a separator; whitespace no longer works -AssemblyNamesList2::AssemblyNamesList2(const WCHAR* list, HostAllocator alloc) +AssemblyNamesList2::AssemblyNamesList2(const char* list, HostAllocator alloc) : m_alloc(alloc) { - WCHAR prevChar = '?'; // dummy - LPWSTR nameStart = nullptr; // start of the name currently being processed. nullptr if no current name + char prevChar = '?'; // dummy + const char* nameStart = nullptr; // start of the name currently being processed. nullptr if no current name AssemblyName** ppPrevLink = &m_pNames; - for (LPWSTR listWalk = const_cast(list); prevChar != '\0'; prevChar = *listWalk, listWalk++) + for (const char* listWalk = list; prevChar != '\0'; prevChar = *listWalk, listWalk++) { - WCHAR curChar = *listWalk; + char curChar = *listWalk; - if (curChar == W(';') || curChar == W('\0')) + if (curChar == ';' || curChar == '\0') { // Found separator or end of string if (nameStart) @@ -1883,29 +1881,15 @@ AssemblyNamesList2::AssemblyNamesList2(const WCHAR* list, HostAllocator alloc) AssemblyName* newName = new (m_alloc) AssemblyName(); - // Null out the current character so we can do zero-terminated string work; we'll restore it later. - *listWalk = W('\0'); + ptrdiff_t nameLen = listWalk - nameStart; + newName->m_assemblyName = new (m_alloc) char[nameLen + 1]; + memcpy(newName->m_assemblyName, nameStart, nameLen * sizeof(char)); + newName->m_assemblyName[nameLen] = '\0'; - // How much space do we need? - int convertedNameLenBytes = - WideCharToMultiByte(CP_UTF8, 0, nameStart, -1, nullptr, 0, nullptr, nullptr); - newName->m_assemblyName = new (m_alloc) char[convertedNameLenBytes]; // convertedNameLenBytes includes - // the trailing null character - if (WideCharToMultiByte(CP_UTF8, 0, nameStart, -1, newName->m_assemblyName, convertedNameLenBytes, - nullptr, nullptr) != 0) - { - *ppPrevLink = newName; - ppPrevLink = &newName->m_next; - } - else - { - // Failed to convert the string. Ignore this string (and leak the memory). - } + *ppPrevLink = newName; + ppPrevLink = &newName->m_next; nameStart = nullptr; - - // Restore the current character. - *listWalk = curChar; } } else if (!nameStart) @@ -1951,11 +1935,11 @@ bool AssemblyNamesList2::IsInList(const char* assemblyName) // MethodSet //============================================================================= -MethodSet::MethodSet(const WCHAR* filename, HostAllocator alloc) +MethodSet::MethodSet(const char* filename, HostAllocator alloc) : m_pInfos(nullptr) , m_alloc(alloc) { - FILE* methodSetFile = _wfopen(filename, W("r")); + FILE* methodSetFile = fopen_utf8(filename, "r"); if (methodSetFile == nullptr) { return; @@ -2054,16 +2038,16 @@ MethodSet::MethodSet(const WCHAR* filename, HostAllocator alloc) if (fclose(methodSetFile)) { - JITDUMP("Unable to close %ws\n", filename); + JITDUMP("Unable to close %s\n", filename); } if (m_pInfos == nullptr) { - JITDUMP("No methods read from %ws\n", filename); + JITDUMP("No methods read from %s\n", filename); } else { - JITDUMP("Methods read from %ws:\n", filename); + JITDUMP("Methods read from %s:\n", filename); int methodCount = 0; for (MethodInfo* pInfo = m_pInfos; pInfo != nullptr; pInfo = pInfo->m_next) @@ -4254,3 +4238,81 @@ bool CastFromDoubleOverflows(double fromValue, var_types toType) } } } // namespace CheckedOps + +template +class Utf16String +{ +private: + WCHAR m_bufferUnsafe[bufferSize]; + WCHAR* m_pBuffer = nullptr; + +public: + Utf16String(const char* str) + { + int strBufferSize = MultiByteToWideChar(CP_UTF8, 0, str, -1, nullptr, 0); + if (strBufferSize == 0) + { + return; + } + + if (strBufferSize > bufferSize) + { + m_pBuffer = new WCHAR[strBufferSize]; + } + else + { + m_pBuffer = m_bufferUnsafe; + } + + if (MultiByteToWideChar(CP_UTF8, 0, str, -1, m_pBuffer, strBufferSize) == 0) + { + if (m_pBuffer != m_bufferUnsafe) + { + delete[] m_pBuffer; + } + + m_pBuffer = nullptr; + } + } + + ~Utf16String() + { + if (m_pBuffer != m_bufferUnsafe) + { + delete[] m_pBuffer; + m_pBuffer = nullptr; + } + } + + const WCHAR* Result() + { + return m_pBuffer; + } +}; + +//------------------------------------------------------------------------ +// fopen_utf8: Open the file at the specified UTF8 path with the specified mode. +// +// Arguments: +// path - UTF8 path +// mode - UTF8 mode +// +// Returns: +// Opened file handle +// +FILE* fopen_utf8(const char* path, const char* mode) +{ +#ifdef HOST_WINDOWS + Utf16String<256> pathWide(path); + Utf16String<16> modeWide(mode); + + if ((pathWide.Result() == nullptr) || (modeWide.Result() == nullptr)) + { + return nullptr; + } + + return _wfopen(pathWide.Result(), modeWide.Result()); +#else + return fopen(path, mode); +#endif +} diff --git a/src/coreclr/jit/utils.h b/src/coreclr/jit/utils.h index b6b81ddd02029..3d3ef423b44b9 100644 --- a/src/coreclr/jit/utils.h +++ b/src/coreclr/jit/utils.h @@ -198,7 +198,7 @@ class ConfigMethodRange bool Contains(unsigned hash); // Ensure the range string has been parsed. - void EnsureInit(const WCHAR* rangeStr, unsigned capacity = DEFAULT_CAPACITY) + void EnsureInit(const char* rangeStr, unsigned capacity = DEFAULT_CAPACITY) { // Make sure that the memory was zero initialized assert(m_inited == 0 || m_inited == 1); @@ -235,7 +235,7 @@ class ConfigMethodRange unsigned m_high; }; - void InitRanges(const WCHAR* rangeStr, unsigned capacity); + void InitRanges(const char* rangeStr, unsigned capacity); unsigned m_entries; // number of entries in the range array unsigned m_lastRange; // count of low-high pairs @@ -256,7 +256,7 @@ class ConfigIntArray } // Ensure the string has been parsed. - void EnsureInit(const WCHAR* str) + void EnsureInit(const char* str) { if (m_values == nullptr) { @@ -275,7 +275,7 @@ class ConfigIntArray } private: - void Init(const WCHAR* str); + void Init(const char* str); int* m_values; unsigned m_length; }; @@ -292,7 +292,7 @@ class ConfigDoubleArray } // Ensure the string has been parsed. - void EnsureInit(const WCHAR* str) + void EnsureInit(const char* str) { if (m_values == nullptr) { @@ -311,7 +311,7 @@ class ConfigDoubleArray } private: - void Init(const WCHAR* str); + void Init(const char* str); double* m_values; unsigned m_length; }; @@ -690,8 +690,8 @@ class AssemblyNamesList2 HostAllocator m_alloc; // HostAllocator to use in this class public: - // Take a Unicode string list of assembly names, parse it, and store it. - AssemblyNamesList2(const WCHAR* list, HostAllocator alloc); + // Take a UTF8 string list of assembly names, parse it, and store it. + AssemblyNamesList2(const char* list, HostAllocator alloc); ~AssemblyNamesList2(); @@ -741,7 +741,7 @@ class MethodSet public: // Take a Unicode string with the filename containing a list of function names, parse it, and store it. - MethodSet(const WCHAR* filename, HostAllocator alloc); + MethodSet(const char* filename, HostAllocator alloc); ~MethodSet(); @@ -1193,4 +1193,6 @@ bool CastFromDoubleOverflows(double fromValue, var_types toType); #define STRINGIFY_(x) #x #define STRINGIFY(x) STRINGIFY_(x) +FILE* fopen_utf8(const char* path, const char* mode); + #endif // _UTILS_H_ diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs index 08e0e5df8e8fd..865cda25ffab1 100644 --- a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs +++ b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs @@ -1953,7 +1953,7 @@ private nuint printObjectDescription(CORINFO_OBJECT_STRUCT_* handle, byte* buffe return PrintFromUtf16(HandleToObject(handle).ToString(), buffer, bufferSize, pRequiredBufferSize); } - private nuint PrintFromUtf16(ReadOnlySpan utf16, byte* buffer, nuint bufferSize, nuint* pRequiredBufferSize) + internal static nuint PrintFromUtf16(ReadOnlySpan utf16, byte* buffer, nuint bufferSize, nuint* pRequiredBufferSize) { int written = 0; if (bufferSize > 0) @@ -3355,13 +3355,6 @@ private void getEEInfo(ref CORINFO_EE_INFO pEEInfoOut) pEEInfoOut.osType = TargetToOs(_compilation.NodeFactory.Target); } -#pragma warning disable CA1822 // Mark members as static - private char* getJitTimeLogFilename() -#pragma warning restore CA1822 // Mark members as static - { - return null; - } - private mdToken getMethodDefFromMethod(CORINFO_METHOD_STRUCT_* hMethod) { MethodDesc method = HandleToObject(hMethod); diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoImpl_generated.cs b/src/coreclr/tools/Common/JitInterface/CorInfoImpl_generated.cs index ddf080c72b445..91df884c58272 100644 --- a/src/coreclr/tools/Common/JitInterface/CorInfoImpl_generated.cs +++ b/src/coreclr/tools/Common/JitInterface/CorInfoImpl_generated.cs @@ -1784,21 +1784,6 @@ private static void _getEEInfo(IntPtr thisHandle, IntPtr* ppException, CORINFO_E } } - [UnmanagedCallersOnly] - private static char* _getJitTimeLogFilename(IntPtr thisHandle, IntPtr* ppException) - { - var _this = GetThis(thisHandle); - try - { - return _this.getJitTimeLogFilename(); - } - catch (Exception ex) - { - *ppException = _this.AllocException(ex); - return default; - } - } - [UnmanagedCallersOnly] private static mdToken _getMethodDefFromMethod(IntPtr thisHandle, IntPtr* ppException, CORINFO_METHOD_STRUCT_* hMethod) { @@ -2638,7 +2623,7 @@ private static uint _getJitFlags(IntPtr thisHandle, IntPtr* ppException, CORJIT_ private static IntPtr GetUnmanagedCallbacks() { - void** callbacks = (void**)Marshal.AllocCoTaskMem(sizeof(IntPtr) * 178); + void** callbacks = (void**)Marshal.AllocCoTaskMem(sizeof(IntPtr) * 177); callbacks[0] = (delegate* unmanaged)&_isIntrinsic; callbacks[1] = (delegate* unmanaged)&_notifyMethodInfoUsage; @@ -2760,64 +2745,63 @@ private static IntPtr GetUnmanagedCallbacks() callbacks[117] = (delegate* unmanaged)&_runWithErrorTrap; callbacks[118] = (delegate* unmanaged)&_runWithSPMIErrorTrap; callbacks[119] = (delegate* unmanaged)&_getEEInfo; - callbacks[120] = (delegate* unmanaged)&_getJitTimeLogFilename; - callbacks[121] = (delegate* unmanaged)&_getMethodDefFromMethod; - callbacks[122] = (delegate* unmanaged)&_printMethodName; - callbacks[123] = (delegate* unmanaged)&_getMethodNameFromMetadata; - callbacks[124] = (delegate* unmanaged)&_getMethodHash; - callbacks[125] = (delegate* unmanaged)&_getSystemVAmd64PassStructInRegisterDescriptor; - callbacks[126] = (delegate* unmanaged)&_getSwiftLowering; - callbacks[127] = (delegate* unmanaged)&_getFpStructLowering; - callbacks[128] = (delegate* unmanaged)&_getThreadTLSIndex; - callbacks[129] = (delegate* unmanaged)&_getAddrOfCaptureThreadGlobal; - callbacks[130] = (delegate* unmanaged)&_getHelperFtn; - callbacks[131] = (delegate* unmanaged)&_getFunctionEntryPoint; - callbacks[132] = (delegate* unmanaged)&_getFunctionFixedEntryPoint; - callbacks[133] = (delegate* unmanaged)&_getMethodSync; - callbacks[134] = (delegate* unmanaged)&_getLazyStringLiteralHelper; - callbacks[135] = (delegate* unmanaged)&_embedModuleHandle; - callbacks[136] = (delegate* unmanaged)&_embedClassHandle; - callbacks[137] = (delegate* unmanaged)&_embedMethodHandle; - callbacks[138] = (delegate* unmanaged)&_embedFieldHandle; - callbacks[139] = (delegate* unmanaged)&_embedGenericHandle; - callbacks[140] = (delegate* unmanaged)&_getLocationOfThisType; - callbacks[141] = (delegate* unmanaged)&_getAddressOfPInvokeTarget; - callbacks[142] = (delegate* unmanaged)&_GetCookieForPInvokeCalliSig; - callbacks[143] = (delegate* unmanaged)&_canGetCookieForPInvokeCalliSig; - callbacks[144] = (delegate* unmanaged)&_getJustMyCodeHandle; - callbacks[145] = (delegate* unmanaged)&_GetProfilingHandle; - callbacks[146] = (delegate* unmanaged)&_getCallInfo; - callbacks[147] = (delegate* unmanaged)&_getStaticFieldContent; - callbacks[148] = (delegate* unmanaged)&_getObjectContent; - callbacks[149] = (delegate* unmanaged)&_getStaticFieldCurrentClass; - callbacks[150] = (delegate* unmanaged)&_getVarArgsHandle; - callbacks[151] = (delegate* unmanaged)&_canGetVarArgsHandle; - callbacks[152] = (delegate* unmanaged)&_constructStringLiteral; - callbacks[153] = (delegate* unmanaged)&_emptyStringLiteral; - callbacks[154] = (delegate* unmanaged)&_getFieldThreadLocalStoreID; - callbacks[155] = (delegate* unmanaged)&_GetDelegateCtor; - callbacks[156] = (delegate* unmanaged)&_MethodCompileComplete; - callbacks[157] = (delegate* unmanaged)&_getTailCallHelpers; - callbacks[158] = (delegate* unmanaged)&_convertPInvokeCalliToCall; - callbacks[159] = (delegate* unmanaged)&_notifyInstructionSetUsage; - callbacks[160] = (delegate* unmanaged)&_updateEntryPointForTailCall; - callbacks[161] = (delegate* unmanaged)&_allocMem; - callbacks[162] = (delegate* unmanaged)&_reserveUnwindInfo; - callbacks[163] = (delegate* unmanaged)&_allocUnwindInfo; - callbacks[164] = (delegate* unmanaged)&_allocGCInfo; - callbacks[165] = (delegate* unmanaged)&_setEHcount; - callbacks[166] = (delegate* unmanaged)&_setEHinfo; - callbacks[167] = (delegate* unmanaged)&_logMsg; - callbacks[168] = (delegate* unmanaged)&_doAssert; - callbacks[169] = (delegate* unmanaged)&_reportFatalError; - callbacks[170] = (delegate* unmanaged)&_getPgoInstrumentationResults; - callbacks[171] = (delegate* unmanaged)&_allocPgoInstrumentationBySchema; - callbacks[172] = (delegate* unmanaged)&_recordCallSite; - callbacks[173] = (delegate* unmanaged)&_recordRelocation; - callbacks[174] = (delegate* unmanaged)&_getRelocTypeHint; - callbacks[175] = (delegate* unmanaged)&_getExpectedTargetArchitecture; - callbacks[176] = (delegate* unmanaged)&_getJitFlags; - callbacks[177] = (delegate* unmanaged)&_getSpecialCopyHelper; + callbacks[120] = (delegate* unmanaged)&_getMethodDefFromMethod; + callbacks[121] = (delegate* unmanaged)&_printMethodName; + callbacks[122] = (delegate* unmanaged)&_getMethodNameFromMetadata; + callbacks[123] = (delegate* unmanaged)&_getMethodHash; + callbacks[124] = (delegate* unmanaged)&_getSystemVAmd64PassStructInRegisterDescriptor; + callbacks[125] = (delegate* unmanaged)&_getSwiftLowering; + callbacks[126] = (delegate* unmanaged)&_getFpStructLowering; + callbacks[127] = (delegate* unmanaged)&_getThreadTLSIndex; + callbacks[128] = (delegate* unmanaged)&_getAddrOfCaptureThreadGlobal; + callbacks[129] = (delegate* unmanaged)&_getHelperFtn; + callbacks[130] = (delegate* unmanaged)&_getFunctionEntryPoint; + callbacks[131] = (delegate* unmanaged)&_getFunctionFixedEntryPoint; + callbacks[132] = (delegate* unmanaged)&_getMethodSync; + callbacks[133] = (delegate* unmanaged)&_getLazyStringLiteralHelper; + callbacks[134] = (delegate* unmanaged)&_embedModuleHandle; + callbacks[135] = (delegate* unmanaged)&_embedClassHandle; + callbacks[136] = (delegate* unmanaged)&_embedMethodHandle; + callbacks[137] = (delegate* unmanaged)&_embedFieldHandle; + callbacks[138] = (delegate* unmanaged)&_embedGenericHandle; + callbacks[139] = (delegate* unmanaged)&_getLocationOfThisType; + callbacks[140] = (delegate* unmanaged)&_getAddressOfPInvokeTarget; + callbacks[141] = (delegate* unmanaged)&_GetCookieForPInvokeCalliSig; + callbacks[142] = (delegate* unmanaged)&_canGetCookieForPInvokeCalliSig; + callbacks[143] = (delegate* unmanaged)&_getJustMyCodeHandle; + callbacks[144] = (delegate* unmanaged)&_GetProfilingHandle; + callbacks[145] = (delegate* unmanaged)&_getCallInfo; + callbacks[146] = (delegate* unmanaged)&_getStaticFieldContent; + callbacks[147] = (delegate* unmanaged)&_getObjectContent; + callbacks[148] = (delegate* unmanaged)&_getStaticFieldCurrentClass; + callbacks[149] = (delegate* unmanaged)&_getVarArgsHandle; + callbacks[150] = (delegate* unmanaged)&_canGetVarArgsHandle; + callbacks[151] = (delegate* unmanaged)&_constructStringLiteral; + callbacks[152] = (delegate* unmanaged)&_emptyStringLiteral; + callbacks[153] = (delegate* unmanaged)&_getFieldThreadLocalStoreID; + callbacks[154] = (delegate* unmanaged)&_GetDelegateCtor; + callbacks[155] = (delegate* unmanaged)&_MethodCompileComplete; + callbacks[156] = (delegate* unmanaged)&_getTailCallHelpers; + callbacks[157] = (delegate* unmanaged)&_convertPInvokeCalliToCall; + callbacks[158] = (delegate* unmanaged)&_notifyInstructionSetUsage; + callbacks[159] = (delegate* unmanaged)&_updateEntryPointForTailCall; + callbacks[160] = (delegate* unmanaged)&_allocMem; + callbacks[161] = (delegate* unmanaged)&_reserveUnwindInfo; + callbacks[162] = (delegate* unmanaged)&_allocUnwindInfo; + callbacks[163] = (delegate* unmanaged)&_allocGCInfo; + callbacks[164] = (delegate* unmanaged)&_setEHcount; + callbacks[165] = (delegate* unmanaged)&_setEHinfo; + callbacks[166] = (delegate* unmanaged)&_logMsg; + callbacks[167] = (delegate* unmanaged)&_doAssert; + callbacks[168] = (delegate* unmanaged)&_reportFatalError; + callbacks[169] = (delegate* unmanaged)&_getPgoInstrumentationResults; + callbacks[170] = (delegate* unmanaged)&_allocPgoInstrumentationBySchema; + callbacks[171] = (delegate* unmanaged)&_recordCallSite; + callbacks[172] = (delegate* unmanaged)&_recordRelocation; + callbacks[173] = (delegate* unmanaged)&_getRelocTypeHint; + callbacks[174] = (delegate* unmanaged)&_getExpectedTargetArchitecture; + callbacks[175] = (delegate* unmanaged)&_getJitFlags; + callbacks[176] = (delegate* unmanaged)&_getSpecialCopyHelper; return (IntPtr)callbacks; } diff --git a/src/coreclr/tools/Common/JitInterface/JitConfigProvider.cs b/src/coreclr/tools/Common/JitInterface/JitConfigProvider.cs index 010b23ed6f581..459e20a8b94b8 100644 --- a/src/coreclr/tools/Common/JitInterface/JitConfigProvider.cs +++ b/src/coreclr/tools/Common/JitInterface/JitConfigProvider.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Runtime.InteropServices; +using System.Text; using System.Threading; using Internal.TypeSystem; using NumberStyles = System.Globalization.NumberStyles; @@ -165,8 +166,8 @@ private static unsafe IntPtr CreateUnmanagedInstance() void** callbacks = (void**)Marshal.AllocCoTaskMem(sizeof(IntPtr) * numCallbacks); - callbacks[0] = (delegate* unmanaged)&getIntConfigValue; - callbacks[1] = (delegate* unmanaged)&getStringConfigValue; + callbacks[0] = (delegate* unmanaged)&getIntConfigValue; + callbacks[1] = (delegate* unmanaged)&getStringConfigValue; IntPtr instance = Marshal.AllocCoTaskMem(sizeof(IntPtr)); *(IntPtr*)instance = (IntPtr)callbacks; @@ -175,20 +176,24 @@ private static unsafe IntPtr CreateUnmanagedInstance() } [UnmanagedCallersOnly] - private static unsafe int getIntConfigValue(IntPtr thisHandle, char* name, int defaultValue) + private static unsafe int getIntConfigValue(IntPtr thisHandle, byte* name, int defaultValue) { - return s_instance.GetIntConfigValue(new string(name), defaultValue); + return s_instance.GetIntConfigValue(Marshal.PtrToStringUTF8((IntPtr)name), defaultValue); } [UnmanagedCallersOnly] - private static unsafe int getStringConfigValue(IntPtr thisHandle, char* name, char* retBuffer, int retBufferLength) + private static unsafe int getStringConfigValue(IntPtr thisHandle, byte* name, byte* retBuffer, int retBufferLength) { - string result = s_instance.GetStringConfigValue(new string(name)); + string result = s_instance.GetStringConfigValue(Marshal.PtrToStringUTF8((IntPtr)name)); - for (int i = 0; i < Math.Min(retBufferLength, result.Length); i++) - retBuffer[i] = result[i]; + if (result == "") + { + return 0; + } - return result.Length; + nuint requiredBufferSize; + CorInfoImpl.PrintFromUtf16(result, retBuffer, (nuint)retBufferLength, &requiredBufferSize); + return (int)requiredBufferSize; } #endregion diff --git a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt index f964d4d4a22d4..3aaa80673334f 100644 --- a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt +++ b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt @@ -284,7 +284,6 @@ FUNCTIONS [ManualNativeWrapper] bool runWithErrorTrap(ICorJitInfo::errorTrapFunction function, void* parameter); [ManualNativeWrapper] bool runWithSPMIErrorTrap(ICorJitInfo::errorTrapFunction function, void* parameter); void getEEInfo(CORINFO_EE_INFO* pEEInfoOut); - const char16_t * getJitTimeLogFilename(); mdMethodDef getMethodDefFromMethod(CORINFO_METHOD_HANDLE hMethod); size_t printMethodName(CORINFO_METHOD_HANDLE ftn, char* buffer, size_t bufferSize, size_t* pRequiredBufferSize) const char* getMethodNameFromMetadata(CORINFO_METHOD_HANDLE ftn, const char **className, const char **namespaceName, const char **enclosingClassNames, size_t maxEnclosingClassNames); diff --git a/src/coreclr/tools/aot/jitinterface/jithost.cpp b/src/coreclr/tools/aot/jitinterface/jithost.cpp index 20e5e223860c0..109fad12c62bb 100644 --- a/src/coreclr/tools/aot/jitinterface/jithost.cpp +++ b/src/coreclr/tools/aot/jitinterface/jithost.cpp @@ -9,13 +9,13 @@ class JitConfigProvider { public: virtual int STDMETHODCALLTYPE getIntConfigValue( - const wchar_t* name, + const char* name, int defaultValue ) = 0; virtual int STDMETHODCALLTYPE getStringConfigValue( - const wchar_t* name, - wchar_t* retBuffer, + const char* name, + char* retBuffer, int retBufferLength ) = 0; }; @@ -46,25 +46,27 @@ class JitHost } virtual int getIntConfigValue( - const wchar_t* name, + const char* name, int defaultValue ) { return pConfigProvider->getIntConfigValue(name, defaultValue); } - virtual const wchar_t* getStringConfigValue( - const wchar_t* name + virtual const char* getStringConfigValue( + const char* name ) { // Find out the required length of the buffer - int numCharacters = pConfigProvider->getStringConfigValue(name, nullptr, 0); - if (numCharacters == 0) + int numRequired = pConfigProvider->getStringConfigValue(name, nullptr, 0); + if (numRequired == 0) + { return nullptr; + } - // Allocate extra char for the null terminator - wchar_t* retBuffer = (wchar_t*)calloc(numCharacters + 1, sizeof(wchar_t)); - pConfigProvider->getStringConfigValue(name, retBuffer, numCharacters); + // getStringConfigValue returns required buffer size + char* retBuffer = (char*)calloc(numRequired, sizeof(char)); + pConfigProvider->getStringConfigValue(name, retBuffer, numRequired); return retBuffer; } diff --git a/src/coreclr/tools/aot/jitinterface/jitinterface_generated.h b/src/coreclr/tools/aot/jitinterface/jitinterface_generated.h index 356920821be8a..a1a6122037d27 100644 --- a/src/coreclr/tools/aot/jitinterface/jitinterface_generated.h +++ b/src/coreclr/tools/aot/jitinterface/jitinterface_generated.h @@ -131,7 +131,6 @@ struct JitInterfaceCallbacks bool (* runWithErrorTrap)(void * thisHandle, CorInfoExceptionClass** ppException, ICorJitInfo::errorTrapFunction function, void* parameter); bool (* runWithSPMIErrorTrap)(void * thisHandle, CorInfoExceptionClass** ppException, ICorJitInfo::errorTrapFunction function, void* parameter); void (* getEEInfo)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_EE_INFO* pEEInfoOut); - const char16_t* (* getJitTimeLogFilename)(void * thisHandle, CorInfoExceptionClass** ppException); mdMethodDef (* getMethodDefFromMethod)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_METHOD_HANDLE hMethod); size_t (* printMethodName)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_METHOD_HANDLE ftn, char* buffer, size_t bufferSize, size_t* pRequiredBufferSize); const char* (* getMethodNameFromMetadata)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_METHOD_HANDLE ftn, const char** className, const char** namespaceName, const char** enclosingClassNames, size_t maxEnclosingClassNames); @@ -1361,14 +1360,6 @@ class JitInterfaceWrapper : public ICorJitInfo if (pException != nullptr) throw pException; } - virtual const char16_t* getJitTimeLogFilename() -{ - CorInfoExceptionClass* pException = nullptr; - const char16_t* temp = _callbacks->getJitTimeLogFilename(_thisHandle, &pException); - if (pException != nullptr) throw pException; - return temp; -} - virtual mdMethodDef getMethodDefFromMethod( CORINFO_METHOD_HANDLE hMethod) { diff --git a/src/coreclr/tools/superpmi/superpmi-shared/icorjithostimpl.h b/src/coreclr/tools/superpmi/superpmi-shared/icorjithostimpl.h index edcca2c79420a..2d75683139187 100644 --- a/src/coreclr/tools/superpmi/superpmi-shared/icorjithostimpl.h +++ b/src/coreclr/tools/superpmi/superpmi-shared/icorjithostimpl.h @@ -29,15 +29,15 @@ void* allocateMemory(size_t size); void freeMemory(void* block); // Return an integer config value for the given key, if any exists. -int getIntConfigValue(const WCHAR* name, int defaultValue); +int getIntConfigValue(const char* name, int defaultValue); // Return a string config value for the given key, if any exists. -const WCHAR* getStringConfigValue(const WCHAR* name); +const char* getStringConfigValue(const char* name); // Free a string ConfigValue returned by the runtime. // JITs using the getStringConfigValue query are required // to return the string values to the runtime for deletion. // This avoids leaking the memory in the JIT. -void freeStringConfigValue(const WCHAR* value); +void freeStringConfigValue(const char* value); #endif diff --git a/src/coreclr/tools/superpmi/superpmi-shared/lwmlist.h b/src/coreclr/tools/superpmi/superpmi-shared/lwmlist.h index b1a9ee644077f..b9be6659ed773 100644 --- a/src/coreclr/tools/superpmi/superpmi-shared/lwmlist.h +++ b/src/coreclr/tools/superpmi/superpmi-shared/lwmlist.h @@ -97,7 +97,6 @@ LWM(GetHelperFtn, DWORD, DLDL) LWM(GetHFAType, DWORDLONG, DWORD) LWM(GetIntConfigValue, Agnostic_ConfigIntInfo, DWORD) LWM(GetJitFlags, DWORD, DD) -LWM(GetJitTimeLogFilename, DWORD, DWORD) LWM(GetJustMyCodeHandle, DWORDLONG, DLDL) LWM(GetLazyStringLiteralHelper, DWORDLONG, DWORD) LWM(GetLocationOfThisType, DWORDLONG, Agnostic_CORINFO_LOOKUP_KIND) diff --git a/src/coreclr/tools/superpmi/superpmi-shared/methodcontext.cpp b/src/coreclr/tools/superpmi/superpmi-shared/methodcontext.cpp index c54241ef46b53..191e18718bc56 100644 --- a/src/coreclr/tools/superpmi/superpmi-shared/methodcontext.cpp +++ b/src/coreclr/tools/superpmi/superpmi-shared/methodcontext.cpp @@ -1260,39 +1260,6 @@ DWORD MethodContext::repGetJitFlags(CORJIT_FLAGS* jitFlags, DWORD sizeInBytes) return value.B; } -void MethodContext::recGetJitTimeLogFilename(LPCWSTR tempFileName) -{ - if (GetJitTimeLogFilename == nullptr) - GetJitTimeLogFilename = new LightWeightMap(); - - DWORD name_index = -1; - if (tempFileName != nullptr) - { - name_index = GetJitTimeLogFilename->AddBuffer((unsigned char*)tempFileName, (DWORD)u16_strlen(tempFileName) + 2); - } - GetJitTimeLogFilename->Add(0, name_index); - DEBUG_REC(dmpGetJitTimeLogFilename(0, name_index)); -} -void MethodContext::dmpGetJitTimeLogFilename(DWORD key, DWORD value) -{ - unsigned char* fileName = nullptr; - if (value != 0) - fileName = (unsigned char*)GetJitTimeLogFilename->GetBuffer(value); - printf("GetJitTimeLogFilename key %u, value '%s'", key, fileName); - GetJitTimeLogFilename->Unlock(); -} -LPCWSTR MethodContext::repGetJitTimeLogFilename() -{ - DWORD offset = LookupByKeyOrMissNoMessage(GetJitTimeLogFilename, 0); - - DEBUG_REP(dmpGetJitTimeLogFilename(0, offset)); - - LPCWSTR value = nullptr; - if (offset != 0) - value = (LPCWSTR)GetJitTimeLogFilename->GetBuffer(offset); - return value; -} - void MethodContext::recCanInline(CORINFO_METHOD_HANDLE callerHnd, CORINFO_METHOD_HANDLE calleeHnd, CorInfoInline response, @@ -7150,7 +7117,7 @@ int MethodContext::repGetArrayOrStringLength(CORINFO_OBJECT_HANDLE objHandle) return (int)value; } -void MethodContext::recGetIntConfigValue(const WCHAR* name, int defaultValue, int result) +void MethodContext::recGetIntConfigValue(const char* name, int defaultValue, int result) { if (GetIntConfigValue == nullptr) GetIntConfigValue = new LightWeightMap(); @@ -7161,7 +7128,7 @@ void MethodContext::recGetIntConfigValue(const WCHAR* name, int defaultValue, in ZeroMemory(&key, sizeof(key)); // Zero key including any struct padding DWORD index = - (DWORD)GetIntConfigValue->AddBuffer((unsigned char*)name, sizeof(WCHAR) * ((unsigned int)u16_strlen(name) + 1)); + (DWORD)GetIntConfigValue->AddBuffer((unsigned char*)name, sizeof(char) * ((unsigned int)strlen(name) + 1)); key.nameIndex = index; key.defaultValue = defaultValue; @@ -7172,13 +7139,12 @@ void MethodContext::recGetIntConfigValue(const WCHAR* name, int defaultValue, in void MethodContext::dmpGetIntConfigValue(const Agnostic_ConfigIntInfo& key, int value) { - const WCHAR* name = (const WCHAR*)GetIntConfigValue->GetBuffer(key.nameIndex); - std::string nameUtf8 = ConvertToUtf8(name); - printf("GetIntConfigValue name %s, default value %d, value %d", nameUtf8.c_str(), key.defaultValue, value); + const char* name = (const char*)GetIntConfigValue->GetBuffer(key.nameIndex); + printf("GetIntConfigValue name %s, default value %d, value %d", name, key.defaultValue, value); GetIntConfigValue->Unlock(); } -int MethodContext::repGetIntConfigValue(const WCHAR* name, int defaultValue) +int MethodContext::repGetIntConfigValue(const char* name, int defaultValue) { if (ignoreStoredConfig) return defaultValue; @@ -7191,7 +7157,7 @@ int MethodContext::repGetIntConfigValue(const WCHAR* name, int defaultValue) Agnostic_ConfigIntInfo key; ZeroMemory(&key, sizeof(key)); // Zero key including any struct padding - size_t nameLenInBytes = sizeof(WCHAR) * (u16_strlen(name) + 1); + size_t nameLenInBytes = sizeof(char) * (strlen(name) + 1); int nameIndex = GetIntConfigValue->Contains((unsigned char*)name, (unsigned int)nameLenInBytes); if (nameIndex == -1) // config name not in map return defaultValue; @@ -7211,7 +7177,7 @@ int MethodContext::repGetIntConfigValue(const WCHAR* name, int defaultValue) return (int)value; } -void MethodContext::recGetStringConfigValue(const WCHAR* name, const WCHAR* result) +void MethodContext::recGetStringConfigValue(const char* name, const char* result) { if (GetStringConfigValue == nullptr) GetStringConfigValue = new LightWeightMap(); @@ -7219,12 +7185,12 @@ void MethodContext::recGetStringConfigValue(const WCHAR* name, const WCHAR* resu AssertCodeMsg(name != nullptr, EXCEPTIONCODE_MC, "Name can not be nullptr"); DWORD nameIndex = (DWORD)GetStringConfigValue->AddBuffer((unsigned char*)name, - sizeof(WCHAR) * ((unsigned int)u16_strlen(name) + 1)); + sizeof(char) * ((unsigned int)strlen(name) + 1)); DWORD resultIndex = (DWORD)-1; if (result != nullptr) resultIndex = (DWORD)GetStringConfigValue->AddBuffer((unsigned char*)result, - sizeof(WCHAR) * ((unsigned int)u16_strlen(result) + 1)); + sizeof(char) * ((unsigned int)strlen(result) + 1)); GetStringConfigValue->Add(nameIndex, resultIndex); DEBUG_REC(dmpGetStringConfigValue(nameIndex, resultIndex)); @@ -7232,13 +7198,13 @@ void MethodContext::recGetStringConfigValue(const WCHAR* name, const WCHAR* resu void MethodContext::dmpGetStringConfigValue(DWORD nameIndex, DWORD resultIndex) { - std::string name = ConvertToUtf8((const WCHAR*)GetStringConfigValue->GetBuffer(nameIndex)); - std::string result = ConvertToUtf8((const WCHAR*)GetStringConfigValue->GetBuffer(resultIndex)); - printf("GetStringConfigValue name %s, result %s", name.c_str(), result.c_str()); + const char* name = (const char*)GetStringConfigValue->GetBuffer(nameIndex); + const char* result = (const char*)GetStringConfigValue->GetBuffer(resultIndex); + printf("GetStringConfigValue name %s, result %s", name, result); GetStringConfigValue->Unlock(); } -const WCHAR* MethodContext::repGetStringConfigValue(const WCHAR* name) +const char* MethodContext::repGetStringConfigValue(const char* name) { if (ignoreStoredConfig) return nullptr; @@ -7248,14 +7214,14 @@ const WCHAR* MethodContext::repGetStringConfigValue(const WCHAR* name) AssertCodeMsg(name != nullptr, EXCEPTIONCODE_MC, "Name can not be nullptr"); - size_t nameLenInBytes = sizeof(WCHAR) * (u16_strlen(name) + 1); + size_t nameLenInBytes = sizeof(char) * (strlen(name) + 1); int nameIndex = GetStringConfigValue->Contains((unsigned char*)name, (unsigned int)nameLenInBytes); if (nameIndex == -1) // config name not in map return nullptr; int resultIndex = LookupByKeyOrMissNoMessage(GetStringConfigValue, nameIndex); - const WCHAR* value = (const WCHAR*)GetStringConfigValue->GetBuffer(resultIndex); + const char* value = (const char*)GetStringConfigValue->GetBuffer(resultIndex); DEBUG_REP(dmpGetStringConfigValue(nameIndex, (DWORD)resultIndex)); return value; diff --git a/src/coreclr/tools/superpmi/superpmi-shared/methodcontext.h b/src/coreclr/tools/superpmi/superpmi-shared/methodcontext.h index 109d3ba9854fc..b6997b94e6c25 100644 --- a/src/coreclr/tools/superpmi/superpmi-shared/methodcontext.h +++ b/src/coreclr/tools/superpmi/superpmi-shared/methodcontext.h @@ -174,10 +174,6 @@ class MethodContext void dmpGetJitFlags(DWORD key, DD value); DWORD repGetJitFlags(CORJIT_FLAGS* jitFlags, DWORD sizeInBytes); - void recGetJitTimeLogFilename(LPCWSTR tempFileName); - void dmpGetJitTimeLogFilename(DWORD key, DWORD value); - LPCWSTR repGetJitTimeLogFilename(); - void recCanInline(CORINFO_METHOD_HANDLE callerHnd, CORINFO_METHOD_HANDLE calleeHnd, CorInfoInline response, @@ -899,13 +895,13 @@ class MethodContext void dmpGetArrayOrStringLength(DWORDLONG key, DWORD value); int repGetArrayOrStringLength(CORINFO_OBJECT_HANDLE objHnd); - void recGetIntConfigValue(const WCHAR* name, int defaultValue, int result); + void recGetIntConfigValue(const char* name, int defaultValue, int result); void dmpGetIntConfigValue(const Agnostic_ConfigIntInfo& key, int value); - int repGetIntConfigValue(const WCHAR* name, int defaultValue); + int repGetIntConfigValue(const char* name, int defaultValue); - void recGetStringConfigValue(const WCHAR* name, const WCHAR* result); + void recGetStringConfigValue(const char* name, const char* result); void dmpGetStringConfigValue(DWORD nameIndex, DWORD result); - const WCHAR* repGetStringConfigValue(const WCHAR* name); + const char* repGetStringConfigValue(const char* name); void recGetSpecialCopyHelper(CORINFO_CLASS_HANDLE type, CORINFO_METHOD_HANDLE helper); void dmpGetSpecialCopyHelper(DWORDLONG key, DWORDLONG value); @@ -1047,7 +1043,7 @@ enum mcPackets Packet_GetHelperFtn = 63, //Packet_GetInlinedCallFrameVptr = 65, Packet_GetArrayIntrinsicID = 66, - Packet_GetJitTimeLogFilename = 67, + //Packet_GetJitTimeLogFilename = 67, Packet_GetJustMyCodeHandle = 68, Packet_GetLocationOfThisType = 69, Packet_GetMethodAttribs = 70, diff --git a/src/coreclr/tools/superpmi/superpmi-shim-collector/icorjitinfo.cpp b/src/coreclr/tools/superpmi/superpmi-shim-collector/icorjitinfo.cpp index a39adab7a9bff..fdf27620abb21 100644 --- a/src/coreclr/tools/superpmi/superpmi-shim-collector/icorjitinfo.cpp +++ b/src/coreclr/tools/superpmi/superpmi-shim-collector/icorjitinfo.cpp @@ -1365,15 +1365,6 @@ void interceptor_ICJI::getEEInfo(CORINFO_EE_INFO* pEEInfoOut) mc->recGetEEInfo(pEEInfoOut); } -// Returns name of the JIT timer log -const char16_t* interceptor_ICJI::getJitTimeLogFilename() -{ - mc->cr->AddCall("getJitTimeLogFilename"); - const char16_t* temp = original_ICorJitInfo->getJitTimeLogFilename(); - mc->recGetJitTimeLogFilename((LPCWSTR)temp); - return temp; -} - /*********************************************************************************/ // // Diagnostic methods diff --git a/src/coreclr/tools/superpmi/superpmi-shim-collector/jithost.cpp b/src/coreclr/tools/superpmi/superpmi-shim-collector/jithost.cpp index b096b7b0b8a40..cf0b874b86c7f 100644 --- a/src/coreclr/tools/superpmi/superpmi-shim-collector/jithost.cpp +++ b/src/coreclr/tools/superpmi/superpmi-shim-collector/jithost.cpp @@ -24,74 +24,74 @@ JitHost* g_ourJitHost; // RecordVariable: return `true` if the given DOTNET variable `key` should be recorded // in the method context. -bool RecordVariable(const WCHAR* key) +bool RecordVariable(const char* key) { // Special cases: we don't want to store some DOTNET variables during // collections, typically when they refer to file paths or simply because // it does not make sense to replay with it. - static const WCHAR* s_ignoredVars[] = { - W("EnableExtraSuperPmiQueries"), - W("JitDisasm"), - W("JitDump"), - W("JitDisasmWithAlignmentBoundaries"), - W("JitDumpASCII"), - W("JitHashBreak"), - W("JitHashDump"), - W("JitHashHalt"), - W("JitOrder"), - W("JitPrintInlinedMethods"), - W("JitPrintDevirtualizedMethods"), - W("JitBreak"), - W("JitDebugBreak"), - W("JitDisasmAssemblies"), - W("JitDisasmWithGC"), - W("JitDisasmWithDebugInfo"), - W("JitDisasmSpilled"), - W("JitDumpTier0"), - W("JitDumpAtOSROffset"), - W("JitDumpInlinePhases"), - W("JitEHDump"), - W("JitExclude"), - W("JitGCDump"), - W("JitDebugDump"), - W("JitHalt"), - W("JitImportBreak"), - W("JitInclude"), - W("JitLateDisasm"), - W("JitUnwindDump"), - W("JitDumpFg"), - W("JitDumpFgDir"), - W("JitDumpFgPhase"), - W("JitDumpFgPrePhase"), - W("JitDumpFgDot"), - W("JitDumpFgEH"), - W("JitDumpFgLoops"), - W("JitDumpFgConstrained"), - W("JitDumpFgBlockID"), - W("JitDumpFgBlockFlags"), - W("JitDumpFgLoopFlags"), - W("JitDumpFgBlockOrder"), - W("JITLateDisasmTo"), - W("JitDisasmSummary"), - W("JitStdOutFile"), - W("WriteRichDebugInfoFile"), - W("JitFuncInfoLogFile"), - W("JitTimeLogCsv"), - W("JitMeasureNowayAssertFile"), - W("JitInlineDumpData"), - W("JitInlineDumpXml"), - W("JitInlineDumpXmlFile"), - W("JitInlinePolicyDumpXml"), - W("JitInlineReplayFile"), - W("JitFunctionFile") - W("JitRawHexCode"), - W("JitRawHexCodeFile") + static const char* s_ignoredVars[] = { + "EnableExtraSuperPmiQueries", + "JitDisasm", + "JitDump", + "JitDisasmWithAlignmentBoundaries", + "JitDumpASCII", + "JitHashBreak", + "JitHashDump", + "JitHashHalt", + "JitOrder", + "JitPrintInlinedMethods", + "JitPrintDevirtualizedMethods", + "JitBreak", + "JitDebugBreak", + "JitDisasmAssemblies", + "JitDisasmWithGC", + "JitDisasmWithDebugInfo", + "JitDisasmSpilled", + "JitDumpTier0", + "JitDumpAtOSROffset", + "JitDumpInlinePhases", + "JitEHDump", + "JitExclude", + "JitGCDump", + "JitDebugDump", + "JitHalt", + "JitImportBreak", + "JitInclude", + "JitLateDisasm", + "JitUnwindDump", + "JitDumpFg", + "JitDumpFgDir", + "JitDumpFgPhase", + "JitDumpFgPrePhase", + "JitDumpFgDot", + "JitDumpFgEH", + "JitDumpFgLoops", + "JitDumpFgConstrained", + "JitDumpFgBlockID", + "JitDumpFgBlockFlags", + "JitDumpFgLoopFlags", + "JitDumpFgBlockOrder", + "JITLateDisasmTo", + "JitDisasmSummary", + "JitStdOutFile", + "WriteRichDebugInfoFile", + "JitFuncInfoLogFile", + "JitTimeLogCsv", + "JitMeasureNowayAssertFile", + "JitInlineDumpData", + "JitInlineDumpXml", + "JitInlineDumpXmlFile", + "JitInlinePolicyDumpXml", + "JitInlineReplayFile", + "JitFunctionFile" + "JitRawHexCode", + "JitRawHexCodeFile" }; - for (const WCHAR* ignoredVar : s_ignoredVars) + for (const char* ignoredVar : s_ignoredVars) { - if (_wcsicmp(key, ignoredVar) == 0) + if (_stricmp(key, ignoredVar) == 0) { return false; } @@ -114,13 +114,13 @@ void JitHost::freeMemory(void* block) return wrappedHost->freeMemory(block); } -int JitHost::getIntConfigValue(const WCHAR* key, int defaultValue) +int JitHost::getIntConfigValue(const char* key, int defaultValue) { // Special-case handling: don't collect this pseudo-variable, and don't // even record that it was called (since it would get recorded into the // global state). (See the superpmi.exe tool implementation of JitHost::getIntConfigValue() // for the special-case implementation of this.) - if (u16_strcmp(key, W("SuperPMIMethodContextNumber")) == 0) + if (strcmp(key, "SuperPMIMethodContextNumber") == 0) { return defaultValue; } @@ -138,10 +138,10 @@ int JitHost::getIntConfigValue(const WCHAR* key, int defaultValue) return result; } -const WCHAR* JitHost::getStringConfigValue(const WCHAR* key) +const char* JitHost::getStringConfigValue(const char* key) { mc->cr->AddCall("getStringConfigValue"); - const WCHAR* result = wrappedHost->getStringConfigValue(key); + const char* result = wrappedHost->getStringConfigValue(key); // Don't store null returns, which is the default if (RecordVariable(key) && (result != nullptr)) @@ -151,7 +151,7 @@ const WCHAR* JitHost::getStringConfigValue(const WCHAR* key) return result; } -void JitHost::freeStringConfigValue(const WCHAR* value) +void JitHost::freeStringConfigValue(const char* value) { mc->cr->AddCall("freeStringConfigValue"); wrappedHost->freeStringConfigValue(value); diff --git a/src/coreclr/tools/superpmi/superpmi-shim-counter/icorjitinfo_generated.cpp b/src/coreclr/tools/superpmi/superpmi-shim-counter/icorjitinfo_generated.cpp index 1f6d8a0530b20..d14acec9674bb 100644 --- a/src/coreclr/tools/superpmi/superpmi-shim-counter/icorjitinfo_generated.cpp +++ b/src/coreclr/tools/superpmi/superpmi-shim-counter/icorjitinfo_generated.cpp @@ -969,12 +969,6 @@ void interceptor_ICJI::getEEInfo( original_ICorJitInfo->getEEInfo(pEEInfoOut); } -const char16_t* interceptor_ICJI::getJitTimeLogFilename() -{ - mcs->AddCall("getJitTimeLogFilename"); - return original_ICorJitInfo->getJitTimeLogFilename(); -} - mdMethodDef interceptor_ICJI::getMethodDefFromMethod( CORINFO_METHOD_HANDLE hMethod) { diff --git a/src/coreclr/tools/superpmi/superpmi-shim-counter/jithost.cpp b/src/coreclr/tools/superpmi/superpmi-shim-counter/jithost.cpp index f3eed45ac34c7..0b20a3e43975d 100644 --- a/src/coreclr/tools/superpmi/superpmi-shim-counter/jithost.cpp +++ b/src/coreclr/tools/superpmi/superpmi-shim-counter/jithost.cpp @@ -28,19 +28,19 @@ void JitHost::freeMemory(void* block) return wrappedHost->freeMemory(block); } -int JitHost::getIntConfigValue(const WCHAR* key, int defaultValue) +int JitHost::getIntConfigValue(const char* key, int defaultValue) { mcs->AddCall("getIntConfigValue"); return wrappedHost->getIntConfigValue(key, defaultValue); } -const WCHAR* JitHost::getStringConfigValue(const WCHAR* key) +const char* JitHost::getStringConfigValue(const char* key) { mcs->AddCall("getStringConfigValue"); return wrappedHost->getStringConfigValue(key); } -void JitHost::freeStringConfigValue(const WCHAR* value) +void JitHost::freeStringConfigValue(const char* value) { mcs->AddCall("freeStringConfigValue"); wrappedHost->freeStringConfigValue(value); diff --git a/src/coreclr/tools/superpmi/superpmi-shim-simple/icorjitinfo_generated.cpp b/src/coreclr/tools/superpmi/superpmi-shim-simple/icorjitinfo_generated.cpp index 8df26208b464f..ee04f7d948bb0 100644 --- a/src/coreclr/tools/superpmi/superpmi-shim-simple/icorjitinfo_generated.cpp +++ b/src/coreclr/tools/superpmi/superpmi-shim-simple/icorjitinfo_generated.cpp @@ -849,11 +849,6 @@ void interceptor_ICJI::getEEInfo( original_ICorJitInfo->getEEInfo(pEEInfoOut); } -const char16_t* interceptor_ICJI::getJitTimeLogFilename() -{ - return original_ICorJitInfo->getJitTimeLogFilename(); -} - mdMethodDef interceptor_ICJI::getMethodDefFromMethod( CORINFO_METHOD_HANDLE hMethod) { diff --git a/src/coreclr/tools/superpmi/superpmi-shim-simple/jithost.cpp b/src/coreclr/tools/superpmi/superpmi-shim-simple/jithost.cpp index 4be05ff2afcfc..43c7c2e0ae1e4 100644 --- a/src/coreclr/tools/superpmi/superpmi-shim-simple/jithost.cpp +++ b/src/coreclr/tools/superpmi/superpmi-shim-simple/jithost.cpp @@ -22,17 +22,17 @@ void JitHost::freeMemory(void* block) return wrappedHost->freeMemory(block); } -int JitHost::getIntConfigValue(const WCHAR* key, int defaultValue) +int JitHost::getIntConfigValue(const char* key, int defaultValue) { return wrappedHost->getIntConfigValue(key, defaultValue); } -const WCHAR* JitHost::getStringConfigValue(const WCHAR* key) +const char* JitHost::getStringConfigValue(const char* key) { return wrappedHost->getStringConfigValue(key); } -void JitHost::freeStringConfigValue(const WCHAR* value) +void JitHost::freeStringConfigValue(const char* value) { wrappedHost->freeStringConfigValue(value); } diff --git a/src/coreclr/tools/superpmi/superpmi/commandline.cpp b/src/coreclr/tools/superpmi/superpmi/commandline.cpp index ddd42e3a2e098..7956fe10a315a 100644 --- a/src/coreclr/tools/superpmi/superpmi/commandline.cpp +++ b/src/coreclr/tools/superpmi/superpmi/commandline.cpp @@ -175,7 +175,7 @@ void CommandLine::DumpHelp(const char* program) printf(" ; if there are any failures, record their MC numbers in the file fail.mcl\n"); } -bool CommandLine::ParseJitOption(const char* optionString, WCHAR** key, WCHAR** value) +bool CommandLine::ParseJitOption(const char* optionString, char** key, char** value) { char tempKey[1024]; @@ -193,12 +193,12 @@ bool CommandLine::ParseJitOption(const char* optionString, WCHAR** key, WCHAR** const char* tempVal = &optionString[i + 1]; const unsigned keyLen = i; - WCHAR* keyBuf = new WCHAR[keyLen + 1]; - MultiByteToWideChar(CP_UTF8, 0, tempKey, keyLen + 1, keyBuf, keyLen + 1); + char* keyBuf = new char[keyLen + 1]; + strcpy_s(keyBuf, keyLen + 1, tempKey); const unsigned valLen = (unsigned)strlen(tempVal); - WCHAR* valBuf = new WCHAR[valLen + 1]; - MultiByteToWideChar(CP_UTF8, 0, tempVal, valLen + 1, valBuf, valLen + 1); + char* valBuf = new char[valLen + 1]; + strcpy_s(valBuf, valLen + 1, tempVal); *key = keyBuf; *value = valBuf; @@ -912,8 +912,8 @@ bool CommandLine::AddJitOption(int& currArgument, targetjitOptions = *pJitOptions; } - WCHAR* key; - WCHAR* value; + char* key; + char* value; if ((currArgument >= argc) || !ParseJitOption(argv[currArgument], &key, &value)) { DumpHelp(argv[0]); @@ -921,9 +921,9 @@ bool CommandLine::AddJitOption(int& currArgument, } DWORD keyIndex = - (DWORD)targetjitOptions->AddBuffer((unsigned char*)key, sizeof(WCHAR) * ((unsigned int)u16_strlen(key) + 1)); + (DWORD)targetjitOptions->AddBuffer((unsigned char*)key, sizeof(char) * ((unsigned int)strlen(key) + 1)); DWORD valueIndex = - (DWORD)targetjitOptions->AddBuffer((unsigned char*)value, sizeof(WCHAR) * ((unsigned int)u16_strlen(value) + 1)); + (DWORD)targetjitOptions->AddBuffer((unsigned char*)value, sizeof(char) * ((unsigned int)strlen(value) + 1)); targetjitOptions->Add(keyIndex, valueIndex); delete[] key; diff --git a/src/coreclr/tools/superpmi/superpmi/commandline.h b/src/coreclr/tools/superpmi/superpmi/commandline.h index 6c31264eadcc0..02a9ef4ee3846 100644 --- a/src/coreclr/tools/superpmi/superpmi/commandline.h +++ b/src/coreclr/tools/superpmi/superpmi/commandline.h @@ -59,7 +59,7 @@ class CommandLine LightWeightMap** pJitOptions, LightWeightMap** pForceJitOptions); - static bool ParseJitOption(const char* optionString, WCHAR** key, WCHAR** value); + static bool ParseJitOption(const char* optionString, char** key, char** value); private: static void DumpHelp(const char* program); diff --git a/src/coreclr/tools/superpmi/superpmi/icorjitinfo.cpp b/src/coreclr/tools/superpmi/superpmi/icorjitinfo.cpp index c8b36d5203e0c..d190ffe727303 100644 --- a/src/coreclr/tools/superpmi/superpmi/icorjitinfo.cpp +++ b/src/coreclr/tools/superpmi/superpmi/icorjitinfo.cpp @@ -1195,24 +1195,6 @@ void MyICJI::getEEInfo(CORINFO_EE_INFO* pEEInfoOut) jitInstance->mc->repGetEEInfo(pEEInfoOut); } -// Returns name of the JIT timer log -const char16_t* MyICJI::getJitTimeLogFilename() -{ - jitInstance->mc->cr->AddCall("getJitTimeLogFilename"); - // we have the ability to replay this, but we treat it in this case as EE context - // return jitInstance->eec->jitTimeLogFilename; - - // We want to be able to set DOTNET_JitTimeLogFile or COMPlus_JitTimeLogFile when replaying, to collect JIT - // statistics. So, just do a getenv() call. This isn't quite as thorough as - // the normal CLR config value functions (which also check the registry), and we've - // also hard-coded the variable name here instead of using: - // CLRConfig::GetConfigValue(CLRConfig::INTERNAL_JitTimeLogFile); - // like in the VM, but it works for our purposes. - const char16_t* dotnetVar = (const char16_t*)GetEnvironmentVariableWithDefaultW(W("DOTNET_JitTimeLogFile")); - return dotnetVar != nullptr ? dotnetVar : - (const char16_t*)GetEnvironmentVariableWithDefaultW(W("COMPlus_JitTimeLogFile")); -} - /*********************************************************************************/ // // Diagnostic methods diff --git a/src/coreclr/tools/superpmi/superpmi/jithost.cpp b/src/coreclr/tools/superpmi/superpmi/jithost.cpp index 65d4513e276f3..a326ebaee28b4 100644 --- a/src/coreclr/tools/superpmi/superpmi/jithost.cpp +++ b/src/coreclr/tools/superpmi/superpmi/jithost.cpp @@ -44,15 +44,53 @@ WCHAR* GetPrefixedEnvironmentVariable(const WCHAR* prefix, size_t prefixLen, con // Look for 'key' as an environment variable named DOTNET_ and fallback to COMPlus_. // The returned value is nullptr if it is not found, or a string if found. If not nullptr, // the returned value must be freed with jitInstance.freeLongLivedArray(value). -WCHAR* GetConfigFromEnvironmentVariable(const WCHAR* key, JitInstance& jitInstance) +char* GetConfigFromEnvironmentVariable(const char* key, JitInstance& jitInstance) { - WCHAR* result = GetPrefixedEnvironmentVariable(DOTNET_PREFIX, LEN_OF_DOTNET_PREFIX, key, jitInstance); + int keyLen = MultiByteToWideChar(CP_UTF8, 0, key, -1, nullptr, 0); + if (keyLen == 0) + { + return nullptr; + } + + WCHAR* keyUtf8 = new WCHAR[keyLen]; + if (MultiByteToWideChar(CP_UTF8, 0, key, -1, keyUtf8, keyLen) == 0) + { + delete[] keyUtf8; + return nullptr; + } + + WCHAR* result = GetPrefixedEnvironmentVariable(DOTNET_PREFIX, LEN_OF_DOTNET_PREFIX, keyUtf8, jitInstance); if (result == nullptr) { - result = GetPrefixedEnvironmentVariable(COMPLUS_PREFIX, LEN_OF_COMPLUS_PREFIX, key, jitInstance); + result = GetPrefixedEnvironmentVariable(COMPLUS_PREFIX, LEN_OF_COMPLUS_PREFIX, keyUtf8, jitInstance); } - return result; + delete[] keyUtf8; + + if (result == nullptr) + { + return nullptr; + } + + int resultLen = WideCharToMultiByte(CP_UTF8, 0, result, -1, nullptr, 0, nullptr, nullptr); + if (resultLen == 0) + { + jitInstance.freeLongLivedArray(result); + return nullptr; + } + + char* resultUtf8 = (char*)jitInstance.allocateLongLivedArray((size_t)resultLen); + + if (WideCharToMultiByte(CP_UTF8, 0, result, -1, resultUtf8, resultLen, nullptr, nullptr) == 0) + { + jitInstance.freeLongLivedArray(result); + jitInstance.freeLongLivedArray(resultUtf8); + return nullptr; + } + + jitInstance.freeLongLivedArray(result); + + return resultUtf8; } JitHost::JitHost(JitInstance& jitInstance) : jitInstance(jitInstance) @@ -69,15 +107,15 @@ void JitHost::freeMemory(void* block) jitInstance.freeLongLivedArray((void*)block); } -bool JitHost::convertStringValueToInt(const WCHAR* key, const WCHAR* stringValue, int& result) +bool JitHost::convertStringValueToInt(const char* key, const char* stringValue, int& result) { if (stringValue == nullptr) { return false; } - WCHAR* endPtr; - unsigned long longResult = u16_strtoul(stringValue, &endPtr, 16); + char* endPtr; + unsigned long longResult = strtoul(stringValue, &endPtr, 16); bool succeeded = (errno != ERANGE) && (endPtr != stringValue) && (longResult <= INT_MAX); if (!succeeded) { @@ -89,7 +127,7 @@ bool JitHost::convertStringValueToInt(const WCHAR* key, const WCHAR* stringValue return true; } -int JitHost::getIntConfigValue(const WCHAR* key, int defaultValue) +int JitHost::getIntConfigValue(const char* key, int defaultValue) { jitInstance.mc->cr->AddCall("getIntConfigValue"); @@ -117,7 +155,7 @@ int JitHost::getIntConfigValue(const WCHAR* key, int defaultValue) if (!valueFound) { // Look for special case keys. - if (u16_strcmp(key, W("SuperPMIMethodContextNumber")) == 0) + if (strcmp(key, "SuperPMIMethodContextNumber") == 0) { result = jitInstance.mc->index; valueFound = true; @@ -131,7 +169,7 @@ int JitHost::getIntConfigValue(const WCHAR* key, int defaultValue) if (!valueFound) { - WCHAR* envVar = GetConfigFromEnvironmentVariable(key, jitInstance); + char* envVar = GetConfigFromEnvironmentVariable(key, jitInstance); valueFound = convertStringValueToInt(key, envVar, result); if (envVar != nullptr) { @@ -141,18 +179,18 @@ int JitHost::getIntConfigValue(const WCHAR* key, int defaultValue) if (valueFound) { - LogDebug("Environment variable %ws=%d", key, result); + LogDebug("Environment variable %s=%d", key, result); } return valueFound ? result : defaultValue; } -const WCHAR* JitHost::getStringConfigValue(const WCHAR* key) +const char* JitHost::getStringConfigValue(const char* key) { jitInstance.mc->cr->AddCall("getStringConfigValue"); bool needToDup = true; - const WCHAR* result = nullptr; + const char* result = nullptr; // First check the force options, then mc value. If value is not presented there, probe the JIT options and then the // environment. @@ -178,20 +216,20 @@ const WCHAR* JitHost::getStringConfigValue(const WCHAR* key) if (result != nullptr && needToDup) { // Now we need to dup it, so you can call freeStringConfigValue() on what we return. - size_t resultLenInChars = u16_strlen(result) + 1; - WCHAR* dupResult = (WCHAR*)jitInstance.allocateLongLivedArray(sizeof(WCHAR) * resultLenInChars); - wcscpy_s(dupResult, resultLenInChars, result); + size_t resultLenInChars = strlen(result) + 1; + char* dupResult = (char*)jitInstance.allocateLongLivedArray(sizeof(char) * resultLenInChars); + strcpy_s(dupResult, resultLenInChars, result); result = dupResult; } if (result != nullptr) { - LogDebug("Environment variable %ws=%ws", key, result); + LogDebug("Environment variable %s=%s", key, result); } return result; } -void JitHost::freeStringConfigValue(const WCHAR* value) +void JitHost::freeStringConfigValue(const char* value) { jitInstance.mc->cr->AddCall("freeStringConfigValue"); jitInstance.freeLongLivedArray((void*)value); diff --git a/src/coreclr/tools/superpmi/superpmi/jithost.h b/src/coreclr/tools/superpmi/superpmi/jithost.h index b3fe89f3c963e..201609da1301d 100644 --- a/src/coreclr/tools/superpmi/superpmi/jithost.h +++ b/src/coreclr/tools/superpmi/superpmi/jithost.h @@ -12,7 +12,7 @@ class JitHost final : public ICorJitHost #include "icorjithostimpl.h" private: - bool convertStringValueToInt(const WCHAR* key, const WCHAR* stringValue, int& result); + bool convertStringValueToInt(const char* key, const char* stringValue, int& result); JitInstance& jitInstance; }; diff --git a/src/coreclr/tools/superpmi/superpmi/jitinstance.cpp b/src/coreclr/tools/superpmi/superpmi/jitinstance.cpp index 7ff9be6046eb5..2b14ce5aef1e8 100644 --- a/src/coreclr/tools/superpmi/superpmi/jitinstance.cpp +++ b/src/coreclr/tools/superpmi/superpmi/jitinstance.cpp @@ -31,10 +31,10 @@ JitInstance* JitInstance::InitJit(char* nameOfJit, // or to force it on, then propagate that to the jit flags. jit->forceClearAltJitFlag = false; jit->forceSetAltJitFlag = false; - const WCHAR* altJitFlag = jit->getForceOption(W("AltJit")); + const char* altJitFlag = jit->getForceOption("AltJit"); if (altJitFlag != nullptr) { - if (u16_strcmp(altJitFlag, W("")) == 0) + if (strcmp(altJitFlag, "") == 0) { jit->forceClearAltJitFlag = true; } @@ -43,10 +43,10 @@ JitInstance* JitInstance::InitJit(char* nameOfJit, jit->forceSetAltJitFlag = true; } } - const WCHAR* altJitNgenFlag = jit->getForceOption(W("AltJitNgen")); + const char* altJitNgenFlag = jit->getForceOption("AltJitNgen"); if (altJitNgenFlag != nullptr) { - if (u16_strcmp(altJitNgenFlag, W("")) == 0) + if (strcmp(altJitNgenFlag, "") == 0) { jit->forceClearAltJitFlag = true; } @@ -508,31 +508,31 @@ void JitInstance::timeResult(CORINFO_METHOD_INFO info, unsigned flags) /*-------------------------- Misc ---------------------------------------*/ -const WCHAR* JitInstance::getForceOption(const WCHAR* key) +const char* JitInstance::getForceOption(const char* key) { return getOption(key, forceOptions); } -const WCHAR* JitInstance::getOption(const WCHAR* key) +const char* JitInstance::getOption(const char* key) { return getOption(key, options); } -const WCHAR* JitInstance::getOption(const WCHAR* key, LightWeightMap* options) +const char* JitInstance::getOption(const char* key, LightWeightMap* options) { if (options == nullptr) { return nullptr; } - size_t keyLenInBytes = sizeof(WCHAR) * (u16_strlen(key) + 1); + size_t keyLenInBytes = sizeof(char) * (strlen(key) + 1); int keyIndex = options->Contains((unsigned char*)key, (unsigned int)keyLenInBytes); if (keyIndex == -1) { return nullptr; } - return (const WCHAR*)options->GetBuffer(options->Get(keyIndex)); + return (const char*)options->GetBuffer(options->Get(keyIndex)); } // Used to allocate memory that needs to handed to the EE. diff --git a/src/coreclr/tools/superpmi/superpmi/jitinstance.h b/src/coreclr/tools/superpmi/superpmi/jitinstance.h index f693f29552b78..492c29bf8e4db 100644 --- a/src/coreclr/tools/superpmi/superpmi/jitinstance.h +++ b/src/coreclr/tools/superpmi/superpmi/jitinstance.h @@ -71,9 +71,9 @@ class JitInstance ReplayResults CompileMethod(MethodContext* MethodToCompile, int mcIndex, bool collectThroughput); - const WCHAR* getForceOption(const WCHAR* key); - const WCHAR* getOption(const WCHAR* key); - const WCHAR* getOption(const WCHAR* key, LightWeightMap* options); + const char* getForceOption(const char* key); + const char* getOption(const char* key); + const char* getOption(const char* key, LightWeightMap* options); const MethodContext::Environment& getEnvironment(); diff --git a/src/coreclr/tools/superpmi/superpmi/parallelsuperpmi.cpp b/src/coreclr/tools/superpmi/superpmi/parallelsuperpmi.cpp index 756664d7a88e5..07b3cd5805bcb 100644 --- a/src/coreclr/tools/superpmi/superpmi/parallelsuperpmi.cpp +++ b/src/coreclr/tools/superpmi/superpmi/parallelsuperpmi.cpp @@ -410,10 +410,10 @@ void addJitOptionArgument(LightWeightMap* jitOptions, { for (unsigned i = 0; i < jitOptions->GetCount(); i++) { - std::string key = ConvertToUtf8((WCHAR*)jitOptions->GetBuffer(jitOptions->GetKey(i))); - std::string value = ConvertToUtf8((WCHAR*)jitOptions->GetBuffer(jitOptions->GetItem(i))); + const char* key = (const char*)jitOptions->GetBuffer(jitOptions->GetKey(i)); + const char* value = (const char*)jitOptions->GetBuffer(jitOptions->GetItem(i)); bytesWritten += sprintf_s(spmiArgs + bytesWritten, MAX_CMDLINE_SIZE - bytesWritten, " -%s %s=%s", - optionName, key.c_str(), value.c_str()); + optionName, key, value); } } } diff --git a/src/coreclr/tools/superpmi/superpmi/streamingsuperpmi.cpp b/src/coreclr/tools/superpmi/superpmi/streamingsuperpmi.cpp index 4da3f0f0561fb..79a08bb4f37ef 100644 --- a/src/coreclr/tools/superpmi/superpmi/streamingsuperpmi.cpp +++ b/src/coreclr/tools/superpmi/superpmi/streamingsuperpmi.cpp @@ -21,8 +21,8 @@ static bool AddJitOption(LightWeightMap* map, char* newOption) { - WCHAR* key; - WCHAR* value; + char* key; + char* value; if (!CommandLine::ParseJitOption(newOption, &key, &value)) { @@ -30,9 +30,9 @@ static bool AddJitOption(LightWeightMap* map, char* newOption) } DWORD keyIndex = - (DWORD)map->AddBuffer((unsigned char*)key, sizeof(WCHAR) * ((unsigned int)u16_strlen(key) + 1)); + (DWORD)map->AddBuffer((unsigned char*)key, sizeof(char) * ((unsigned int)strlen(key) + 1)); DWORD valueIndex = - (DWORD)map->AddBuffer((unsigned char*)value, sizeof(WCHAR) * ((unsigned int)u16_strlen(value) + 1)); + (DWORD)map->AddBuffer((unsigned char*)value, sizeof(char) * ((unsigned int)strlen(value) + 1)); map->Add(keyIndex, valueIndex); delete[] key; diff --git a/src/coreclr/vm/jithost.cpp b/src/coreclr/vm/jithost.cpp index 504e389faa62a..03f97bf7d477a 100644 --- a/src/coreclr/vm/jithost.cpp +++ b/src/coreclr/vm/jithost.cpp @@ -21,33 +21,66 @@ void JitHost::freeMemory(void* block) delete [] (BYTE*)block; } -int JitHost::getIntConfigValue(const WCHAR* name, int defaultValue) +int JitHost::getIntConfigValue(const char* name, int defaultValue) { WRAPPER_NO_CONTRACT; + StackSString str; + SString(SString::Utf8Literal, name).ConvertToUnicode(str); + // Translate JIT call into runtime configuration query - CLRConfig::ConfigDWORDInfo info{ name, (DWORD)defaultValue, CLRConfig::LookupOptions::Default }; + CLRConfig::ConfigDWORDInfo info{ str.GetUnicode(), (DWORD)defaultValue, CLRConfig::LookupOptions::Default }; // Perform a CLRConfig look up on behalf of the JIT. return CLRConfig::GetConfigValue(info); } -const WCHAR* JitHost::getStringConfigValue(const WCHAR* name) +const char* JitHost::getStringConfigValue(const char* name) { WRAPPER_NO_CONTRACT; + StackSString str; + SString(SString::Utf8Literal, name).ConvertToUnicode(str); + // Translate JIT call into runtime configuration query - CLRConfig::ConfigStringInfo info{ name, CLRConfig::LookupOptions::Default }; + CLRConfig::ConfigStringInfo info{ str.GetUnicode(), CLRConfig::LookupOptions::Default }; // Perform a CLRConfig look up on behalf of the JIT. - return CLRConfig::GetConfigValue(info); + LPWSTR allocatedStr = CLRConfig::GetConfigValue(info); + + if (allocatedStr == nullptr) + { + return nullptr; + } + + bool allAscii; + DWORD length; + HRESULT hr = FString::Unicode_Utf8_Length(allocatedStr, &allAscii, &length); + if (FAILED(hr)) + { + CLRConfig::FreeConfigString(allocatedStr); + return nullptr; + } + + NewArrayHolder utf8Result = new char[length + 1]; + hr = FString::Unicode_Utf8(allocatedStr, allAscii, utf8Result, length); + utf8Result[length] = '\0'; + + CLRConfig::FreeConfigString(allocatedStr); + + if (FAILED(hr)) + { + return nullptr; + } + + return utf8Result.Extract(); } -void JitHost::freeStringConfigValue(const WCHAR* value) +void JitHost::freeStringConfigValue(const char* value) { WRAPPER_NO_CONTRACT; - CLRConfig::FreeConfigString(const_cast(value)); + delete[] value; } // diff --git a/src/coreclr/vm/jithost.h b/src/coreclr/vm/jithost.h index 4695eaafebc3f..1d44d70ebd212 100644 --- a/src/coreclr/vm/jithost.h +++ b/src/coreclr/vm/jithost.h @@ -33,9 +33,9 @@ class JitHost : public ICorJitHost public: virtual void* allocateMemory(size_t size); virtual void freeMemory(void* block); - virtual int getIntConfigValue(const WCHAR* name, int defaultValue); - virtual const WCHAR* getStringConfigValue(const WCHAR* name); - virtual void freeStringConfigValue(const WCHAR* value); + virtual int getIntConfigValue(const char* name, int defaultValue); + virtual const char* getStringConfigValue(const char* name); + virtual void freeStringConfigValue(const char* value); virtual void* allocateSlab(size_t size, size_t* pActualSize); virtual void freeSlab(void* slab, size_t actualSize); diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index 0eee2e39ff16c..058f5a88a8769 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -10210,26 +10210,7 @@ void CEEInfo::getEEInfo(CORINFO_EE_INFO *pEEInfoOut) EE_TO_JIT_TRANSITION(); } -const char16_t * CEEInfo::getJitTimeLogFilename() -{ - CONTRACTL { - THROWS; - GC_TRIGGERS; - MODE_PREEMPTIVE; - } CONTRACTL_END; - - LPCWSTR result = NULL; - - JIT_TO_EE_TRANSITION(); - result = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_JitTimeLogFile); - EE_TO_JIT_TRANSITION(); - - return (const char16_t *)result; -} - - - - // Return details about EE internal data structures +// Return details about EE internal data structures uint32_t CEEInfo::getThreadTLSIndex(void **ppIndirection) { CONTRACTL {