diff --git a/src/coreclr/jit/codegencommon.cpp b/src/coreclr/jit/codegencommon.cpp index 7509ddc74f2f9..c24745c0b5af4 100644 --- a/src/coreclr/jit/codegencommon.cpp +++ b/src/coreclr/jit/codegencommon.cpp @@ -1966,7 +1966,7 @@ void CodeGen::genEmitMachineCode() trackedStackPtrsContig = !compiler->opts.compDbgEnC; #endif - if (compiler->opts.disAsm) + if (compiler->opts.disAsm && compiler->opts.disTesting) { printf("; BEGIN METHOD %s\n", compiler->eeGetMethodFullName(compiler->info.compMethodHnd)); } @@ -1990,7 +1990,7 @@ void CodeGen::genEmitMachineCode() ((double)compiler->info.compTotalColdCodeSize * (double)PERFSCORE_CODESIZE_COST_COLD); #endif // DEBUG || LATE_DISASM - if (compiler->opts.disAsm) + if (compiler->opts.disAsm && compiler->opts.disTesting) { printf("; END METHOD %s\n", compiler->eeGetMethodFullName(compiler->info.compMethodHnd)); } diff --git a/src/coreclr/jit/compiler.cpp b/src/coreclr/jit/compiler.cpp index 4faeb885c8bae..dbba935070028 100644 --- a/src/coreclr/jit/compiler.cpp +++ b/src/coreclr/jit/compiler.cpp @@ -3038,6 +3038,10 @@ void Compiler::compInitOptions(JitFlags* jitFlags) if (opts.disAsm) #endif { + if (JitConfig.JitDisasmTesting()) + { + opts.disTesting = true; + } if (JitConfig.JitDisasmWithAlignmentBoundaries()) { opts.disAlignment = true; diff --git a/src/coreclr/jit/compiler.h b/src/coreclr/jit/compiler.h index 59f6961381112..e752044acf82f 100644 --- a/src/coreclr/jit/compiler.h +++ b/src/coreclr/jit/compiler.h @@ -9639,6 +9639,7 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX #endif bool disAsm; // Display native code as it is generated + bool disTesting; // Display BEGIN METHOD/END METHOD anchors for disasm testing bool dspDiffable; // Makes the Jit Dump 'diff-able' (currently uses same DOTNET_* flag as disDiffable) bool disDiffable; // Makes the Disassembly code 'diff-able' bool disAlignment; // Display alignment boundaries in disassembly code diff --git a/src/coreclr/jit/jitconfigvalues.h b/src/coreclr/jit/jitconfigvalues.h index 8c61e43221ad4..cb16514deb910 100644 --- a/src/coreclr/jit/jitconfigvalues.h +++ b/src/coreclr/jit/jitconfigvalues.h @@ -251,7 +251,8 @@ CONFIG_STRING(JitStressRange, W("JitStressRange")) // Internal Jit CONFIG_INTEGER(EnableIncompleteISAClass, W("EnableIncompleteISAClass"), 0) // Enable testing not-yet-implemented #endif // defined(DEBUG) -CONFIG_METHODSET(JitDisasm, W("JitDisasm")) // Print codegen for given methods +CONFIG_METHODSET(JitDisasm, W("JitDisasm")) // Print codegen for given methods +CONFIG_INTEGER(JitDisasmTesting, W("JitDisasmTesting"), 0) // Display BEGIN METHOD/END METHOD anchors for disasm testing CONFIG_INTEGER(JitDisasmDiffable, W("JitDisasmDiffable"), 0) // Make the disassembly diff-able CONFIG_INTEGER(JitDisasmSummary, W("JitDisasmSummary"), 0) // Prints all jitted methods to the console CONFIG_INTEGER(JitDisasmWithAlignmentBoundaries, W("JitDisasmWithAlignmentBoundaries"), 0) // Print the alignment diff --git a/src/tests/Common/CLRTest.Jit.targets b/src/tests/Common/CLRTest.Jit.targets index 31d9e15aa286d..aa48396d19fe1 100644 --- a/src/tests/Common/CLRTest.Jit.targets +++ b/src/tests/Common/CLRTest.Jit.targets @@ -233,6 +233,7 @@ if [[ ( -z "$DOTNET_JitStress" ) && ( -z "$DOTNET_JitStressRegs" ) && ( -z "$DOT @(DisasmCheckFiles -> ' dotnet $CORE_ROOT/SuperFileCheck/SuperFileCheck.dll --csharp-list-method-names "%(Identity)" --allow-unused-prefixes --check-prefixes=CHECK,$(TargetArchitecture.ToUpperInvariant()),$(TargetArchitecture.ToUpperInvariant())-$(TargetOS.ToUpperInvariant()) > "$(BashDisasmListOutputFile)" ERRORLEVEL=$? export DOTNET_JitDisasm=`cat $(BashDisasmListOutputFile)` + export DOTNET_JitDisasmTesting=1 export DOTNET_JitDiffableDasm=1 export DOTNET_JitStdOutFile=$(BashDisasmOutputFile) rm -f $(BashDisasmOutputFile) @@ -280,6 +281,7 @@ IF "%DOTNET_JitStress%"=="" IF "%DOTNET_JitStressRegs%"=="" IF "%DOTNET_Tailcall Exit /b 1 )', '%0d%0a') for /F "delims=" %%g in ($(BatchDisasmListOutputFile)) do set DOTNET_JitDisasm=%%g + set DOTNET_JitDisasmTesting=1 set DOTNET_JitDiffableDasm=1 set DOTNET_JitStdOutFile=$(BatchDisasmOutputFile) del $(BatchDisasmOutputFile) >nul 2>&1