Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
bf756bc
Use liberal vn for tls indirects
EgorBo Aug 1, 2022
c33bd4b
Merge branch 'main' of github.com:dotnet/runtime into main
EgorBo Aug 3, 2022
e9164de
Merge branch 'main' of github.com:dotnet/runtime into main
EgorBo Aug 3, 2022
24fc8a6
Initial impl
EgorBo Aug 4, 2022
75db099
Enable JitDisasm in Release
EgorBo Aug 4, 2022
0dfb332
Merge branch 'main' of github.com:dotnet/runtime into jit-disasm-release
EgorBo Aug 4, 2022
98a2a9d
Fix compilation errors
EgorBo Aug 4, 2022
3952560
Run jit-format
EgorBo Aug 4, 2022
c2d397a
Don't allocate instrDescDebugInfo when JitDisasm is not set
EgorBo Aug 4, 2022
f760723
fix build
EgorBo Aug 5, 2022
99c9254
clean up
EgorBo Aug 5, 2022
7fe3596
fix build
EgorBo Aug 5, 2022
4d776af
Apply Jakob's patch
EgorBo Aug 6, 2022
e95daa8
Remove some #ifdef DEBUG for displaying frame refs
jakobbotsch Aug 6, 2022
7255863
Fix alignment insertion assuming only emitForceNewIG can create new IGs
jakobbotsch Aug 6, 2022
be97773
Account for debug info when allocating IG buffers
jakobbotsch Aug 6, 2022
8f66d90
C++ify accessors
jakobbotsch Aug 6, 2022
611b9d2
Run jit-format
jakobbotsch Aug 6, 2022
adb7772
Fix a missing m_debugInfoSize add
jakobbotsch Aug 6, 2022
5e020ca
Couple of small cleanups
jakobbotsch Aug 6, 2022
9fa3367
Delete instrDesc constructors
jakobbotsch Aug 6, 2022
c0cb6da
Run jit-format
jakobbotsch Aug 6, 2022
8768b0e
Ensure alignment in inlineInstrDesc
jakobbotsch Aug 6, 2022
29f7c62
Update emitCheckAlignFitInCurIG
jakobbotsch Aug 6, 2022
6a1c872
Revert "Fix alignment insertion assuming only emitForceNewIG can crea…
jakobbotsch Aug 6, 2022
f266806
Oops
jakobbotsch Aug 6, 2022
829b019
Minor assertion nit
jakobbotsch Aug 6, 2022
13190b8
Update codegencommon.cpp
EgorBo Aug 8, 2022
b075a03
Tiny optimization
jakobbotsch Aug 8, 2022
d6759c2
Switch a couple of checks to m_debugInfoSize > 0
jakobbotsch Aug 8, 2022
00e754b
Move assert back
jakobbotsch Aug 8, 2022
318f275
Update emitarm64.cpp
EgorBo Aug 8, 2022
963596d
Add emitFirstInstrDesc and emitAdvanceInstrDesc
jakobbotsch Aug 9, 2022
840f26e
Fix function header
jakobbotsch Aug 9, 2022
4057d73
Fix build, fix bad refactor
jakobbotsch Aug 9, 2022
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
Prev Previous commit
Next Next commit
Initial impl
  • Loading branch information
EgorBo committed Aug 4, 2022
commit 24fc8a626beb187df02788a47fadd292f597b121
15 changes: 13 additions & 2 deletions src/coreclr/jit/codegencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1740,11 +1740,18 @@ void CodeGen::genGenerateMachineCode()
{
compiler->opts.disAsm = true;
}
#endif
compiler->compCurBB = compiler->fgFirstBB;

if (compiler->opts.disAsm)
{
printf("; Assembly listing for method %s\n", compiler->info.compFullName);
#ifdef DEBUG
const char* fullName = compiler->info.compFullName;
#else
const char* fullName = compiler->eeGetMethodFullName(compiler->info.compMethodHnd);
#endif

printf("; Assembly listing for method %s\n", fullName);

printf("; Emitting ");

Expand Down Expand Up @@ -1905,7 +1912,6 @@ void CodeGen::genGenerateMachineCode()
printf("; invoked as altjit\n");
}
}
#endif // DEBUG

// We compute the final frame layout before code generation. This is because LSRA
// has already computed exactly the maximum concurrent number of spill temps of each type that are
Expand Down Expand Up @@ -2057,6 +2063,11 @@ void CodeGen::genEmitMachineCode()
printf("*************** After end code gen, before unwindEmit()\n");
GetEmitter()->emitDispIGlist(true);
}
#else
if (compiler->opts.disAsm)
{
printf("\n; Total bytes of code %d\n", codeSize);
}
#endif

*nativeSizeOfCode = codeSize;
Expand Down
37 changes: 34 additions & 3 deletions src/coreclr/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2819,14 +2819,15 @@ void Compiler::compInitOptions(JitFlags* jitFlags)

opts.compJitEarlyExpandMDArrays = (JitConfig.JitEarlyExpandMDArrays() != 0);

opts.disAsm = false;
opts.disDiffable = false;
opts.dspDiffable = false;
#ifdef DEBUG
opts.dspInstrs = false;
opts.dspLines = false;
opts.varNames = false;
opts.dmpHex = false;
opts.disAsm = false;
opts.disAsmSpilled = false;
opts.disDiffable = false;
opts.disAddr = false;
opts.disAlignment = false;
opts.dspCode = false;
Expand Down Expand Up @@ -3069,8 +3070,38 @@ void Compiler::compInitOptions(JitFlags* jitFlags)
}
s_pJitFunctionFileInitialized = true;
}
#else // DEBUG
if (!jitFlags->IsSet(JitFlags::JIT_FLAG_PREJIT))
{
if (!JitConfig.JitDisasm().isEmpty())
{
const char* methodName = info.compCompHnd->getMethodName(info.compMethodHnd, nullptr);
const char* className = info.compCompHnd->getClassName(info.compClassHnd);

#endif // DEBUG
if (JitConfig.JitDisasm().contains(methodName, className, &info.compMethodInfo->args))
{
opts.disAsm = true;
}
}
}
else
{
if (!JitConfig.NgenDisasm().isEmpty())
{
const char* methodName = info.compCompHnd->getMethodName(info.compMethodHnd, nullptr);
const char* className = info.compCompHnd->getClassName(info.compClassHnd);

if (JitConfig.NgenDisasm().contains(methodName, className, &info.compMethodInfo->args))
{
opts.disAsm = true;
}
}
}

bool diffable = JitConfig.DiffableDasm();
opts.disDiffable = diffable;
opts.dspDiffable = diffable;
#endif // !DEBUG

//-------------------------------------------------------------------------

Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -9170,6 +9170,9 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
bool optRepeat; // Repeat optimizer phases k times
#endif

bool disAsm; // Display native code as it is generated
bool dspDiffable; // Makes the Jit Dump 'diff-able' (currently uses same COMPlus_* flag as disDiffable)
bool disDiffable; // Makes the Disassembly code 'diff-able'
#ifdef DEBUG
bool compProcedureSplittingEH; // Separate cold code from hot code for functions with EH
bool dspCode; // Display native code generated
Expand All @@ -9179,16 +9182,13 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
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 disAsm; // Display native code as it is generated
bool disAsmSpilled; // Display native code when any register spilling occurs
bool disasmWithGC; // Display GC info interleaved with disassembly.
bool disDiffable; // Makes the Disassembly code 'diff-able'
bool disAddr; // Display process address next to each instruction in disassembly code
bool disAlignment; // Display alignment boundaries 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 dspDiffable; // Makes the Jit Dump 'diff-able' (currently uses same COMPlus_* flag as disDiffable)
bool compLongAddress; // Force using large pseudo instructions for long address
// (IF_LARGEJMP/IF_LARGEADR/IF_LARGLDC)
bool dspGCtbls; // Display the GC tables
Expand Down
20 changes: 15 additions & 5 deletions src/coreclr/jit/emit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2638,15 +2638,17 @@ void* emitter::emitAddInlineLabel()
return emitCurIG;
}

#ifdef DEBUG

//-----------------------------------------------------------------------------
// emitPrintLabel: Print the assembly label for an insGroup. We could use emitter::emitLabelString()
// to be consistent, but that seems silly.
//
void emitter::emitPrintLabel(insGroup* ig)
{
#ifdef DEBUG
printf("G_M%03u_IG%02u", emitComp->compMethodID, ig->igNum);
#else
printf("IG_%02u", ig->igNum);
#endif
}

//-----------------------------------------------------------------------------
Expand All @@ -2664,14 +2666,16 @@ const char* emitter::emitLabelString(insGroup* ig)
static char buf[4][TEMP_BUFFER_LEN];
const char* retbuf;

#ifdef DEBUG
sprintf_s(buf[curBuf], TEMP_BUFFER_LEN, "G_M%03u_IG%02u", emitComp->compMethodID, ig->igNum);
#else
sprintf_s(buf[curBuf], TEMP_BUFFER_LEN, "IG_%02u", ig->igNum);
#endif
retbuf = buf[curBuf];
curBuf = (curBuf + 1) % 4;
return retbuf;
}

#endif // DEBUG

#if defined(TARGET_ARMARCH) || defined(TARGET_LOONGARCH64)

// Does the argument location point to an IG at the end of a function or funclet?
Expand Down Expand Up @@ -6675,7 +6679,13 @@ unsigned emitter::emitEndCodeGen(Compiler* comp,
printf("\n");
}
}
#endif // DEBUG
#else // DEBUG
if (emitComp->opts.disAsm)
{
printf("\n%s:", emitLabelString(ig));
printf("\n");
}
#endif // !DEBUG

BYTE* bp = cp;

Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/jit/emit.h
Original file line number Diff line number Diff line change
Expand Up @@ -2184,10 +2184,8 @@ class emitter
// continues to track GC info as if there was no label.
void* emitAddInlineLabel();

#ifdef DEBUG
void emitPrintLabel(insGroup* ig);
const char* emitLabelString(insGroup* ig);
#endif

#if defined(TARGET_ARMARCH) || defined(TARGET_LOONGARCH64)

Expand Down
10 changes: 8 additions & 2 deletions src/coreclr/jit/jitconfigvalues.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ CONFIG_METHODSET(JitUnwindDump, W("JitUnwindDump")) // Dump the unwind codes for
///
/// NGEN
///
CONFIG_METHODSET(NgenDisasm, W("NgenDisasm")) // Same as JitDisasm, but for ngen
CONFIG_METHODSET(NgenDump, W("NgenDump")) // Same as JitDump, but for ngen
CONFIG_METHODSET(NgenEHDump, W("NgenEHDump")) // Dump the EH table for the method, as reported to the VM
CONFIG_METHODSET(NgenGCDump, W("NgenGCDump"))
Expand Down Expand Up @@ -270,7 +269,14 @@ CONFIG_STRING(NgenDumpFgFile, W("NgenDumpFgFile")) // Ngen Xml/Dot flowgraph dum
CONFIG_INTEGER(EnableIncompleteISAClass, W("EnableIncompleteISAClass"), 0) // Enable testing not-yet-implemented
// intrinsic classes

#endif // defined(DEBUG)
#else // defined(DEBUG)

// JitDisasm works in Release too
CONFIG_METHODSET(JitDisasm, W("JitDisasm"))
CONFIG_INTEGER(DiffableDasm, W("JitDiffableDasm"), 0)
CONFIG_METHODSET(NgenDisasm, W("NgenDisasm")) // Same as JitDisasm, but for R2R/ILC

#endif // !defined(DEBUG)

CONFIG_INTEGER(RichDebugInfo, W("RichDebugInfo"), 0) // If 1, keep rich debug info and report it back to the EE

Expand Down