summaryrefslogtreecommitdiff
path: root/src/jit
diff options
context:
space:
mode:
authorBruce Forstall <brucefo@microsoft.com>2016-05-06 12:47:11 -0700
committerBruce Forstall <brucefo@microsoft.com>2016-05-06 12:47:11 -0700
commitf45cfa6dab8c5e40ebf613d98d1abf0a326727a5 (patch)
treea327edfe016e1c7dd76b711a9d227298a2ba46c2 /src/jit
parent17549875be841b032770e2e11ad027986e44a549 (diff)
parent4eb10dbf742604906019931ac4b1540b451f7322 (diff)
downloadcoreclr-f45cfa6dab8c5e40ebf613d98d1abf0a326727a5.tar.gz
coreclr-f45cfa6dab8c5e40ebf613d98d1abf0a326727a5.tar.bz2
coreclr-f45cfa6dab8c5e40ebf613d98d1abf0a326727a5.zip
Merge pull request #4811 from BruceForstall/FixFunctionTrace
Fix COMPlus_JitFunctionTrace=1 to work better with NYI
Diffstat (limited to 'src/jit')
-rw-r--r--src/jit/compiler.cpp83
-rw-r--r--src/jit/compiler.h3
-rw-r--r--src/jit/error.cpp9
3 files changed, 66 insertions, 29 deletions
diff --git a/src/jit/compiler.cpp b/src/jit/compiler.cpp
index 1c2c11efb3..3b2c3d6b3d 100644
--- a/src/jit/compiler.cpp
+++ b/src/jit/compiler.cpp
@@ -3412,6 +3412,53 @@ bool Compiler::compRsvdRegCheck(FrameLayoutState curState)
}
#endif // _TARGET_ARMARCH_
+void Compiler::compFunctionTraceStart()
+{
+#ifdef DEBUG
+ if (compIsForInlining())
+ return;
+
+ if ((JitConfig.JitFunctionTrace() != 0) && !opts.disDiffable)
+ {
+ LONG newJitNestingLevel = InterlockedIncrement(&Compiler::jitNestingLevel);
+ if (newJitNestingLevel <= 0)
+ {
+ printf("{ Illegal nesting level %d }\n", newJitNestingLevel);
+ }
+
+ for (LONG i = 0; i < newJitNestingLevel - 1; i++)
+ printf(" ");
+ printf("{ Start Jitting %s\n", info.compFullName); /* } editor brace matching workaround for this printf */
+ }
+#endif // DEBUG
+}
+
+void Compiler::compFunctionTraceEnd(void* methodCodePtr, ULONG methodCodeSize, bool isNYI)
+{
+#ifdef DEBUG
+ assert(!compIsForInlining());
+
+ if ((JitConfig.JitFunctionTrace() != 0) && !opts.disDiffable)
+ {
+ LONG newJitNestingLevel = InterlockedDecrement(&Compiler::jitNestingLevel);
+ if (newJitNestingLevel < 0)
+ {
+ printf("{ Illegal nesting level %d }\n", newJitNestingLevel);
+ }
+
+ for (LONG i = 0; i < newJitNestingLevel; i++)
+ printf(" ");
+ /* { editor brace-matching workaround for following printf */
+ printf("} Jitted Entry %03x at" FMT_ADDR "method %s size %08x%s\n",
+ Compiler::jitTotalMethodCompiled,
+ DBG_ADDR(methodCodePtr),
+ info.compFullName,
+ methodCodeSize,
+ isNYI ? " NYI" : (compIsForImportOnly() ? " import only" : ""));
+ }
+#endif // DEBUG
+}
+
//*********************************************************************************************
// #Phases
//
@@ -3441,21 +3488,7 @@ void Compiler::compCompile(void * * methodCodePtr,
EndPhase(PHASE_PRE_IMPORT);
-#ifdef DEBUG
- bool funcTrace = JitConfig.JitFunctionTrace() != 0;
-
- if (!compIsForInlining())
- {
- LONG newJitNestingLevel = InterlockedIncrement(&Compiler::jitNestingLevel);
- assert(newJitNestingLevel > 0);
- if (funcTrace && !opts.disDiffable)
- {
- for (LONG i = 0; i < newJitNestingLevel - 1; i++)
- printf(" ");
- printf("{ Start Jitting %s\n", info.compFullName); /* } editor brace matching workaround for this printf */
- }
- }
-#endif // DEBUG
+ compFunctionTraceStart();
/* Convert the instrs in each basic block to a tree based intermediate representation */
@@ -3489,7 +3522,10 @@ void Compiler::compCompile(void * * methodCodePtr,
// Maybe the caller was not interested in generating code
if (compIsForImportOnly())
+ {
+ compFunctionTraceEnd(nullptr, 0, false);
return;
+ }
#if !FEATURE_EH
// If we aren't yet supporting EH in a compiler bring-up, remove as many EH handlers as possible, so
@@ -3889,28 +3925,17 @@ void Compiler::compCompile(void * * methodCodePtr,
++Compiler::jitTotalMethodCompiled;
#endif // defined(DEBUG)
-#ifdef DEBUG
- LONG newJitNestingLevel = InterlockedDecrement(&Compiler::jitNestingLevel);
- assert(newJitNestingLevel >= 0);
-
- if (funcTrace && !opts.disDiffable)
- {
- for (LONG i = 0; i < newJitNestingLevel; i++)
- printf(" ");
- /* { editor brace-matching workaround for following printf */
- printf("} Jitted Entry %03x at" FMT_ADDR "method %s size %08x\n",
- Compiler::jitTotalMethodCompiled, DBG_ADDR(*methodCodePtr),
- info.compFullName, *methodCodeSize);
- }
+ compFunctionTraceEnd(*methodCodePtr, *methodCodeSize, false);
#if FUNC_INFO_LOGGING
+#ifdef DEBUG // We only have access to info.compFullName in DEBUG builds.
if (compJitFuncInfoFile != NULL)
{
assert(!compIsForInlining());
fprintf(compJitFuncInfoFile, "%s\n", info.compFullName);
}
+#endif // DEBUG
#endif // FUNC_INFO_LOGGING
-#endif // DEBUG
}
/*****************************************************************************/
diff --git a/src/jit/compiler.h b/src/jit/compiler.h
index 818408a35d..6ae1b08a20 100644
--- a/src/jit/compiler.h
+++ b/src/jit/compiler.h
@@ -8238,6 +8238,9 @@ public:
#endif // DEBUG
#endif // MEASURE_MEM_ALLOC
+ void compFunctionTraceStart();
+ void compFunctionTraceEnd(void* methodCodePtr, ULONG methodCodeSize, bool isNYI);
+
protected:
unsigned compMaxUncheckedOffsetForNullObject;
diff --git a/src/jit/error.cpp b/src/jit/error.cpp
index a52f9e5836..065d3f6553 100644
--- a/src/jit/error.cpp
+++ b/src/jit/error.cpp
@@ -170,6 +170,15 @@ void notYetImplemented(const char * msg, const char * filename, unsigned line)
#endif // !DEBUG
#endif // FUNC_INFO_LOGGING
+#ifdef DEBUG
+ Compiler* pCompiler = JitTls::GetCompiler();
+ if (pCompiler != nullptr)
+ {
+ // Assume we're within a compFunctionTrace boundary, which might not be true.
+ pCompiler->compFunctionTraceEnd(nullptr, 0, true);
+ }
+#endif // DEBUG
+
DWORD value = JitConfig.AltJitAssertOnNYI();
// 0 means just silently skip