From e36431719109208cdc56d3e98ac9deb859e13b2a Mon Sep 17 00:00:00 2001 From: Jonghyun Park Date: Wed, 2 Aug 2017 12:05:34 +0900 Subject: [PATCH] Resolve FEATURE_GDBJIT/FEATURE_INTERPRETER conflict --- src/vm/jitinterface.cpp | 19 ++++++++++++++++--- src/vm/prestub.cpp | 15 ++++++++++++--- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/vm/jitinterface.cpp b/src/vm/jitinterface.cpp index 677a7ba..ff3010d 100644 --- a/src/vm/jitinterface.cpp +++ b/src/vm/jitinterface.cpp @@ -11761,6 +11761,7 @@ CorJitResult invokeCompileMethodHelper(EEJitManager *jitMgr, #ifdef FEATURE_INTERPRETER static ConfigDWORD s_InterpreterFallback; + bool isInterpreterStub = false; bool interpreterFallback = (s_InterpreterFallback.val(CLRConfig::INTERNAL_InterpreterFallback) != 0); if (interpreterFallback == false) @@ -11769,7 +11770,10 @@ CorJitResult invokeCompileMethodHelper(EEJitManager *jitMgr, // (We assume that importation is completely architecture-independent, or at least nearly so.) if (FAILED(ret) && !jitFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_IMPORT_ONLY) && !jitFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_MAKEFINALCODE)) { - ret = Interpreter::GenerateInterpreterStub(comp, info, nativeEntry, nativeSizeOfCode); + if (SUCCEEDED(ret = Interpreter::GenerateInterpreterStub(comp, info, nativeEntry, nativeSizeOfCode))) + { + isInterpreterStub = true; + } } } @@ -11789,7 +11793,10 @@ CorJitResult invokeCompileMethodHelper(EEJitManager *jitMgr, // (We assume that importation is completely architecture-independent, or at least nearly so.) if (FAILED(ret) && !jitFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_IMPORT_ONLY) && !jitFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_MAKEFINALCODE)) { - ret = Interpreter::GenerateInterpreterStub(comp, info, nativeEntry, nativeSizeOfCode); + if (SUCCEEDED(ret = Interpreter::GenerateInterpreterStub(comp, info, nativeEntry, nativeSizeOfCode))) + { + isInterpreterStub = true; + } } } #else @@ -11824,7 +11831,13 @@ CorJitResult invokeCompileMethodHelper(EEJitManager *jitMgr, #if defined(FEATURE_GDBJIT) - if (SUCCEEDED(ret) && *nativeEntry != NULL) + bool isJittedEntry = SUCCEEDED(ret) && *nativeEntry != NULL; + +#ifdef FEATURE_INTERPRETER + isJittedEntry &= !isInterpreterStub; +#endif // FEATURE_INTERPRETER + + if (isJittedEntry) { CodeHeader* pCH = ((CodeHeader*)((PCODE)*nativeEntry & ~1)) - 1; pCH->SetCalledMethods((PTR_VOID)comp->GetCalledMethods()); diff --git a/src/vm/prestub.cpp b/src/vm/prestub.cpp index e7014be..8f72d23 100644 --- a/src/vm/prestub.cpp +++ b/src/vm/prestub.cpp @@ -795,9 +795,13 @@ PCODE MethodDesc::JitCompileCodeLockedEventWrapper(PrepareCodeConfig* pConfig, J } #endif // PROFILING_SUPPORTED +#ifdef FEATURE_INTERPRETER + bool isJittedMethod = (Interpreter::InterpretationStubToMethodInfo(pCode) == NULL); +#endif + // Interpretted methods skip this notification #ifdef FEATURE_INTERPRETER - if (Interpreter::InterpretationStubToMethodInfo(pCode) == NULL) + if (isJittedMethod) #endif { #ifdef FEATURE_PERFMAP @@ -822,8 +826,13 @@ PCODE MethodDesc::JitCompileCodeLockedEventWrapper(PrepareCodeConfig* pConfig, J } #endif - // The notification will only occur if someone has registered for this method. - DACNotifyCompilationFinished(this); +#ifdef FEATURE_INTERPRETER + if (isJittedMethod) +#endif + { + // The notification will only occur if someone has registered for this method. + DACNotifyCompilationFinished(this); + } return pCode; } -- 2.7.4