Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/coreclr/jit/codegencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2097,6 +2097,26 @@ void CodeGen::genEmitUnwindDebugGCandEH()
getDisAssembler().disAsmCode((BYTE*)*codePtr, finalHotCodeSize, (BYTE*)coldCodePtr, finalColdCodeSize);
#endif // LATE_DISASM

#ifdef DEBUG
if ((compiler->opts.disAsm || compiler->verbose) && compiler->opts.disAsmHexDumpFile)
Comment thread
TIHan marked this conversation as resolved.
Outdated
{
FILE* hexDmpf;
errno_t ec = _wfopen_s(&hexDmpf, compiler->opts.disAsmHexDumpFile, W("at")); // NOTE: file append mode
if (ec == 0)
{
assert(hexDmpf);

BYTE* addr = (BYTE*)*codePtr + compiler->GetEmitter()->writeableOffset;
for (unsigned int i = 0; i < codeSize; i++)
Comment thread
TIHan marked this conversation as resolved.
Outdated
{
fprintf(hexDmpf, "%02X", *addr++);
}

fclose(hexDmpf);
}
}
#endif // DEBUG

/* Report any exception handlers to the VM */

genReportEH();
Expand Down
8 changes: 8 additions & 0 deletions src/coreclr/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2847,6 +2847,8 @@ void Compiler::compInitOptions(JitFlags* jitFlags)
opts.compLongAddress = false;
opts.optRepeat = false;

opts.disAsmHexDumpFile = nullptr;

#ifdef LATE_DISASM
opts.doLateDisasm = false;
#endif // LATE_DISASM
Expand Down Expand Up @@ -2931,6 +2933,12 @@ void Compiler::compInitOptions(JitFlags* jitFlags)
opts.doLateDisasm = true;
#endif // LATE_DISASM

const WCHAR* disAsmHexDumpFile = JitConfig.JitDisasmHexDumpFile();
if (disAsmHexDumpFile != nullptr)
{
opts.disAsmHexDumpFile = disAsmHexDumpFile;
}

// This one applies to both Ngen/Jit Disasm output: DOTNET_JitDasmWithAddress=1
if (JitConfig.JitDasmWithAddress() != 0)
{
Expand Down
35 changes: 18 additions & 17 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -9705,23 +9705,24 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
bool disAlignment; // Display alignment boundaries in disassembly code
bool disCodeBytes; // Display instruction code bytes in disassembly code
#ifdef DEBUG
bool compProcedureSplittingEH; // Separate cold code from hot code for functions with EH
bool dspCode; // Display native code generated
bool dspEHTable; // Display the EH table reported to the VM
bool dspDebugInfo; // Display the Debug info reported to the VM
bool dspInstrs; // Display the IL instructions intermixed with the native code output
bool dspLines; // Display source-code lines intermixed with native code output
bool dmpHex; // Display raw bytes in hex of native code output
bool varNames; // Display variables names in native code output
bool disAsmSpilled; // Display native code when any register spilling occurs
bool disasmWithGC; // Display GC info interleaved with disassembly.
bool disAddr; // Display process address next to each instruction in disassembly code
bool disAsm2; // Display native code after it is generated using external disassembler
bool dspOrder; // Display names of each of the methods that we ngen/jit
bool dspUnwind; // Display the unwind info output
bool compLongAddress; // Force using large pseudo instructions for long address
// (IF_LARGEJMP/IF_LARGEADR/IF_LARGLDC)
bool dspGCtbls; // Display the GC tables
bool compProcedureSplittingEH; // Separate cold code from hot code for functions with EH
bool dspCode; // Display native code generated
bool dspEHTable; // Display the EH table reported to the VM
bool dspDebugInfo; // Display the Debug info reported to the VM
bool dspInstrs; // Display the IL instructions intermixed with the native code output
bool dspLines; // Display source-code lines intermixed with native code output
bool dmpHex; // Display raw bytes in hex of native code output
bool varNames; // Display variables names in native code output
bool disAsmSpilled; // Display native code when any register spilling occurs
bool disasmWithGC; // Display GC info interleaved with disassembly.
bool disAddr; // Display process address next to each instruction in disassembly code
bool disAsm2; // Display native code after it is generated using external disassembler
bool dspOrder; // Display names of each of the methods that we ngen/jit
bool dspUnwind; // Display the unwind info output
bool compLongAddress; // Force using large pseudo instructions for long address
// (IF_LARGEJMP/IF_LARGEADR/IF_LARGLDC)
bool dspGCtbls; // Display the GC tables
const WCHAR* disAsmHexDumpFile; // Writes the raw bytes in hex of native code to the specified file
Comment thread
TIHan marked this conversation as resolved.
Outdated
#endif

// Default numbers used to perform loop alignment. All the numbers are chosen
Expand Down
4 changes: 4 additions & 0 deletions src/coreclr/jit/jitconfigvalues.h
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,10 @@ CONFIG_INTEGER(JitEnableCrossBlockLocalAssertionProp, W("JitEnableCrossBlockLoca
CONFIG_STRING(JitFunctionFile, W("JitFunctionFile"))
#endif // DEBUG

#if defined(DEBUG)
CONFIG_STRING(JitDisasmHexDumpFile, W("JitDisasmHexDumpFile"))
#endif // DEBUG

#if defined(DEBUG)
#if defined(TARGET_ARM64)
// JitSaveFpLrWithCalleeSavedRegisters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ bool RecordVariable(const WCHAR* key)
W("JitInlinePolicyDumpXml"),
W("JitInlineReplayFile"),
W("JitFunctionFile")
W("JitDisasmHexDumpFile")
};

for (const WCHAR* ignoredVar : s_ignoredVars)
Expand Down