Skip to content

Commit

Permalink
JIT: Switch config values to UTF8 (#109418)
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
jakobbotsch authored Nov 14, 2024
1 parent d3f4de1 commit c653208
Show file tree
Hide file tree
Showing 53 changed files with 995 additions and 1,003 deletions.
2 changes: 0 additions & 2 deletions src/coreclr/inc/clrconfigvalues.h
Original file line number Diff line number Diff line change
Expand Up @@ -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'")
Expand Down
3 changes: 0 additions & 3 deletions src/coreclr/inc/corinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/coreclr/inc/corjithost.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ 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.
// 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.
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
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/inc/icorjitinfoimpl_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
10 changes: 5 additions & 5 deletions src/coreclr/inc/jiteeversionguid.h
Original file line number Diff line number Diff line change
Expand Up @@ -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}
};

//////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/jit/ICorJitInfo_names_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 0 additions & 8 deletions src/coreclr/jit/ICorJitInfo_wrapper_generated.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/bitset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
10 changes: 4 additions & 6 deletions src/coreclr/jit/codegencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions src/coreclr/jit/codegenlinear.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2678,7 +2678,7 @@ void CodeGen::genEmitterUnitTests()
return;
}

const WCHAR* unitTestSection = JitConfig.JitEmitUnitTestsSections();
const char* unitTestSection = JitConfig.JitEmitUnitTestsSections();

if (unitTestSection == nullptr)
{
Expand All @@ -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();
}
Expand Down
Loading

0 comments on commit c653208

Please sign in to comment.