Skip to content

Commit c653208

Browse files
authored
JIT: Switch config values to UTF8 (dotnet#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
1 parent d3f4de1 commit c653208

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+995
-1003
lines changed

src/coreclr/inc/clrconfigvalues.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,6 @@ RETAIL_CONFIG_DWORD_INFO(EXTERNAL_JitHostMaxSlabCache, W("JitHostMaxSlabCache"),
329329
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_JitOptimizeType, W("JitOptimizeType"), 0 /* OPT_DEFAULT */, "")
330330
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_JitPrintInlinedMethods, W("JitPrintInlinedMethods"), 0, "")
331331
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_JitTelemetry, W("JitTelemetry"), 1, "If non-zero, gather JIT telemetry data")
332-
RETAIL_CONFIG_STRING_INFO(INTERNAL_JitTimeLogFile, W("JitTimeLogFile"), "If set, gather JIT throughput data and write to this file.")
333-
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.")
334332
RETAIL_CONFIG_STRING_INFO(INTERNAL_JitFuncInfoLogFile, W("JitFuncInfoLogFile"), "If set, gather JIT function info and write to this file.")
335333
CONFIG_DWORD_INFO(INTERNAL_JitVerificationDisable, W("JitVerificationDisable"), 0, "")
336334
RETAIL_CONFIG_DWORD_INFO(INTERNAL_JitLockWrite, W("JitLockWrite"), 0, "Force all volatile writes to be 'locked'")

src/coreclr/inc/corinfo.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2962,9 +2962,6 @@ class ICorStaticInfo
29622962
CORINFO_EE_INFO *pEEInfoOut
29632963
) = 0;
29642964

2965-
// Returns name of the JIT timer log
2966-
virtual const char16_t *getJitTimeLogFilename() = 0;
2967-
29682965
/*********************************************************************************/
29692966
//
29702967
// Diagnostic methods

src/coreclr/inc/corjithost.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,21 @@ class ICorJitHost
2222

2323
// Return an integer config value for the given key, if any exists.
2424
virtual int getIntConfigValue(
25-
const WCHAR* name,
25+
const char* name,
2626
int defaultValue
2727
) = 0;
2828

2929
// Return a string config value for the given key, if any exists.
30-
virtual const WCHAR* getStringConfigValue(
31-
const WCHAR* name
30+
virtual const char* getStringConfigValue(
31+
const char* name
3232
) = 0;
3333

3434
// Free a string ConfigValue returned by the runtime.
3535
// JITs using the getStringConfigValue query are required
3636
// to return the string values to the runtime for deletion.
3737
// This avoids leaking the memory in the JIT.
3838
virtual void freeStringConfigValue(
39-
const WCHAR* value
39+
const char* value
4040
) = 0;
4141

4242
// Allocate memory slab of the given size in bytes. The host is expected to pool

src/coreclr/inc/icorjitinfoimpl_generated.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,8 +498,6 @@ bool runWithSPMIErrorTrap(
498498
void getEEInfo(
499499
CORINFO_EE_INFO* pEEInfoOut) override;
500500

501-
const char16_t* getJitTimeLogFilename() override;
502-
503501
mdMethodDef getMethodDefFromMethod(
504502
CORINFO_METHOD_HANDLE hMethod) override;
505503

src/coreclr/inc/jiteeversionguid.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ typedef const GUID *LPCGUID;
4343
#define GUID_DEFINED
4444
#endif // !GUID_DEFINED
4545

46-
constexpr GUID JITEEVersionIdentifier = { /* 04021b93-e969-41ed-96cd-4c583673b9ab */
47-
0x04021b93,
48-
0xe969,
49-
0x41ed,
50-
{0x96, 0xcd, 0x4c, 0x58, 0x36, 0x73, 0xb9, 0xab}
46+
constexpr GUID JITEEVersionIdentifier = { /* 6f498741-c4a2-4863-9dd7-06ad7d788443 */
47+
0x6f498741,
48+
0xc4a2,
49+
0x4863,
50+
{0x9d, 0xd7, 0x06, 0xad, 0x7d, 0x78, 0x84, 0x43}
5151
};
5252

5353
//////////////////////////////////////////////////////////////////////////////////////////////////////////

src/coreclr/jit/ICorJitInfo_names_generated.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ DEF_CLR_API(getHFAType)
124124
DEF_CLR_API(runWithErrorTrap)
125125
DEF_CLR_API(runWithSPMIErrorTrap)
126126
DEF_CLR_API(getEEInfo)
127-
DEF_CLR_API(getJitTimeLogFilename)
128127
DEF_CLR_API(getMethodDefFromMethod)
129128
DEF_CLR_API(printMethodName)
130129
DEF_CLR_API(getMethodNameFromMetadata)

src/coreclr/jit/ICorJitInfo_wrapper_generated.hpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,14 +1181,6 @@ void WrapICorJitInfo::getEEInfo(
11811181
API_LEAVE(getEEInfo);
11821182
}
11831183

1184-
const char16_t* WrapICorJitInfo::getJitTimeLogFilename()
1185-
{
1186-
API_ENTER(getJitTimeLogFilename);
1187-
const char16_t* temp = wrapHnd->getJitTimeLogFilename();
1188-
API_LEAVE(getJitTimeLogFilename);
1189-
return temp;
1190-
}
1191-
11921184
mdMethodDef WrapICorJitInfo::getMethodDefFromMethod(
11931185
CORINFO_METHOD_HANDLE hMethod)
11941186
{

src/coreclr/jit/bitset.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ void BitSetSupport::BitSetOpCounter::RecordOp(BitSetSupport::Operation op)
139139
{
140140
if (OpOutputFile == nullptr)
141141
{
142-
OpOutputFile = fopen(m_fileName, "a");
142+
OpOutputFile = fopen_utf8(m_fileName, "a");
143143
}
144144
fprintf(OpOutputFile, "@ %d total ops.\n", TotalOps);
145145

src/coreclr/jit/codegencommon.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2259,14 +2259,12 @@ void CodeGen::genEmitUnwindDebugGCandEH()
22592259
BYTE* dumpAddr = (BYTE*)codePtrRW;
22602260
size_t dumpSize = finalHotCodeSize;
22612261

2262-
const WCHAR* rawHexCodeFilePath = JitConfig.JitRawHexCodeFile();
2262+
const char* rawHexCodeFilePath = JitConfig.JitRawHexCodeFile();
22632263
if (rawHexCodeFilePath)
22642264
{
2265-
FILE* hexDmpf;
2266-
errno_t ec = _wfopen_s(&hexDmpf, rawHexCodeFilePath, W("at")); // NOTE: file append mode
2267-
if (ec == 0)
2265+
FILE* hexDmpf = fopen_utf8(rawHexCodeFilePath, "at"); // NOTE: file append mode
2266+
if (hexDmpf != nullptr)
22682267
{
2269-
assert(hexDmpf);
22702268
hexDump(hexDmpf, dumpAddr, dumpSize);
22712269
fclose(hexDmpf);
22722270
}
@@ -6823,7 +6821,7 @@ void CodeGen::genReportRichDebugInfoToFile()
68236821
static CritSecObject s_critSect;
68246822
CritSecHolder holder(s_critSect);
68256823

6826-
FILE* file = _wfopen(JitConfig.WriteRichDebugInfoFile(), W("a"));
6824+
FILE* file = fopen(JitConfig.WriteRichDebugInfoFile(), "a");
68276825
if (file == nullptr)
68286826
{
68296827
return;

src/coreclr/jit/codegenlinear.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2678,7 +2678,7 @@ void CodeGen::genEmitterUnitTests()
26782678
return;
26792679
}
26802680

2681-
const WCHAR* unitTestSection = JitConfig.JitEmitUnitTestsSections();
2681+
const char* unitTestSection = JitConfig.JitEmitUnitTestsSections();
26822682

26832683
if (unitTestSection == nullptr)
26842684
{
@@ -2695,24 +2695,24 @@ void CodeGen::genEmitterUnitTests()
26952695
// Add NOPs at the start and end for easier script parsing.
26962696
instGen(INS_nop);
26972697

2698-
bool unitTestSectionAll = (u16_strstr(unitTestSection, W("all")) != nullptr);
2698+
bool unitTestSectionAll = (strstr(unitTestSection, "all") != nullptr);
26992699

27002700
#if defined(TARGET_AMD64)
2701-
if (unitTestSectionAll || (u16_strstr(unitTestSection, W("sse2")) != nullptr))
2701+
if (unitTestSectionAll || (strstr(unitTestSection, "sse2") != nullptr))
27022702
{
27032703
genAmd64EmitterUnitTestsSse2();
27042704
}
27052705

27062706
#elif defined(TARGET_ARM64)
2707-
if (unitTestSectionAll || (u16_strstr(unitTestSection, W("general")) != nullptr))
2707+
if (unitTestSectionAll || (strstr(unitTestSection, "general") != nullptr))
27082708
{
27092709
genArm64EmitterUnitTestsGeneral();
27102710
}
2711-
if (unitTestSectionAll || (u16_strstr(unitTestSection, W("advsimd")) != nullptr))
2711+
if (unitTestSectionAll || (strstr(unitTestSection, "advsimd") != nullptr))
27122712
{
27132713
genArm64EmitterUnitTestsAdvSimd();
27142714
}
2715-
if (unitTestSectionAll || (u16_strstr(unitTestSection, W("sve")) != nullptr))
2715+
if (unitTestSectionAll || (strstr(unitTestSection, "sve") != nullptr))
27162716
{
27172717
genArm64EmitterUnitTestsSve();
27182718
}

0 commit comments

Comments
 (0)