Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix IL interpreter to run on Hello World #37825

Merged
merged 33 commits into from
Jun 19, 2020
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
b3df29f
Fixed type cast compilation errors
yuchong-pan May 21, 2020
8c68662
Merge branch 'master' of github.com:dotnet/runtime into yuchong-pan/i…
yuchong-pan May 27, 2020
ae05745
Temporary changes to trigger the IL interpreter
yuchong-pan May 27, 2020
aeb3aba
Added lock holder when invoking JIT from interpreter
yuchong-pan May 27, 2020
e6ec764
Merge branch 'master' of github.com:dotnet/runtime into yuchong-pan/i…
yuchong-pan May 29, 2020
07f40dc
Added get_IsSupported as an intrinsic
yuchong-pan Jun 2, 2020
f3684a9
Merge branch 'master' of github.com:dotnet/runtime into yuchong-pan/i…
yuchong-pan Jun 3, 2020
5493832
Fixed widening of narrow integral types
yuchong-pan Jun 8, 2020
f093538
Added COMPlus_InterpreterDebuggable flag to trigger the IL interprete…
yuchong-pan Jun 10, 2020
1a42c39
Merge branch 'master' of github.com:dotnet/runtime into yuchong-pan/i…
yuchong-pan Jun 10, 2020
1c2f442
Added more accurate description of InterpreterJITThreshold
yuchong-pan Jun 11, 2020
ef0332f
Fixed assertion failure in AsyncPromoteToTier1
yuchong-pan Jun 11, 2020
b8a4316
Renamed env var to ForceInterpreterTier0
yuchong-pan Jun 11, 2020
e8aa942
Fixed a bug in AsyncPromoteToTier1
yuchong-pan Jun 11, 2020
7574667
Fixed the correct semantics of the env var ForceInterpreterTier0
yuchong-pan Jun 12, 2020
0f1b085
Added env var ForceInterpreterAlways
yuchong-pan Jun 12, 2020
6783276
Turned off FEATURE_INTERPRETER
yuchong-pan Jun 12, 2020
748c7ad
Moved CodeVersionManager::LockHolder to minimize scope
yuchong-pan Jun 16, 2020
3345ef3
Removed redundant check for ForceInterpreterAlways
yuchong-pan Jun 16, 2020
e4dccdf
Renamed COMPlus_ env vars to ForceJitOptimization and ForceInterpreter
yuchong-pan Jun 16, 2020
f01109b
Fixed a pre-existing bug for async promotion to tier 1
yuchong-pan Jun 16, 2020
2328ced
Removed redundant annotations on CLR config values
yuchong-pan Jun 16, 2020
46a004c
Modified handling of get_IsSupported as a JIT intrinsic
yuchong-pan Jun 16, 2020
96d76fc
This does not seems a correct fix for the pre-existing promotion bug
yuchong-pan Jun 16, 2020
24c8de1
Added call to ScheduleBackgroundWork after AsyncPromoteToTier1
yuchong-pan Jun 17, 2020
2fd5c4b
Added more precise check for hardware intrinsics in interpreter
yuchong-pan Jun 17, 2020
76425bd
Converted C-style type casts to static_cast<...>
yuchong-pan Jun 17, 2020
ce301ad
Renamed ForceJitOptimization to EnableJitOptimization
yuchong-pan Jun 17, 2020
ba907e0
Added COMPlus environment variable to force get_IsSupported to return…
yuchong-pan Jun 17, 2020
b2fc10b
Update src/coreclr/src/vm/interpreter.cpp
yuchong-pan Jun 19, 2020
74d235a
Removed #ifdef PAL_STDCPP_COMPAT when including 'type_traits'
yuchong-pan Jun 19, 2020
6d3a977
Merge branch 'yuchong-pan/interp' of github.com:yuchong-pan/runtime i…
yuchong-pan Jun 19, 2020
e9a94f1
Removed EnableJitOptimization variable
yuchong-pan Jun 19, 2020
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
4 changes: 3 additions & 1 deletion src/coreclr/src/inc/clrconfigvalues.h
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ RETAIL_CONFIG_DWORD_INFO(INTERNAL_InterpreterMethHashMin, W("InterpreterMethHash
RETAIL_CONFIG_DWORD_INFO(INTERNAL_InterpreterMethHashMax, W("InterpreterMethHashMax"), UINT32_MAX, "If non-zero, only interpret methods selected by 'Interpret' whose hash is at most this value")
RETAIL_CONFIG_DWORD_INFO(INTERNAL_InterpreterStubMin, W("InterpreterStubMin"), 0, "Only interpret methods selected by 'Interpret' whose stub num is at least this value.")
RETAIL_CONFIG_DWORD_INFO(INTERNAL_InterpreterStubMax, W("InterpreterStubMax"), UINT32_MAX, "If non-zero, only interpret methods selected by 'Interpret' whose stub number is at most this value.")
RETAIL_CONFIG_DWORD_INFO(INTERNAL_InterpreterJITThreshold, W("InterpreterJITThreshold"), 10, "The number of times a method should be interpreted before being JITted")
RETAIL_CONFIG_DWORD_INFO(INTERNAL_InterpreterJITThreshold, W("InterpreterJITThreshold"), 10, "The number of times (in hexadecimal) a method should be interpreted before being JITted")
yuchong-pan marked this conversation as resolved.
Show resolved Hide resolved
RETAIL_CONFIG_DWORD_INFO(INTERNAL_InterpreterDoLoopMethods, W("InterpreterDoLoopMethods"), 0, "If set, don't check for loops, start by interpreting *all* methods")
RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_InterpreterUseCaching, W("InterpreterUseCaching"), 1, "If non-zero, use the caching mechanism.", CLRConfig::EEConfig_default)
RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_InterpreterLooseRules, W("InterpreterLooseRules"), 1, "If non-zero, allow ECMA spec violations required by managed C++.", CLRConfig::EEConfig_default)
Expand All @@ -395,6 +395,8 @@ RETAIL_CONFIG_DWORD_INFO(INTERNAL_TraceInterpreterIL, W("TraceInterpreterIL"), 0
RETAIL_CONFIG_DWORD_INFO(INTERNAL_TraceInterpreterOstack, W("TraceInterpreterOstack"), 0, "Logs operand stack after each IL instruction of interpreted methods to the console")
CONFIG_DWORD_INFO(INTERNAL_TraceInterpreterVerbose, W("TraceInterpreterVerbose"), 0, "Logs interpreter progress with detailed messages to the console")
CONFIG_DWORD_INFO(INTERNAL_TraceInterpreterJITTransition, W("TraceInterpreterJITTransition"), 0, "Logs when the interpreter determines a method should be JITted")
RETAIL_CONFIG_DWORD_INFO(INTERNAL_ForceInterpreterTier0, W("ForceInterpreterTier0"), 0, "If non-zero, force the interpreter to be used as Tier 0 in Tiered Compilation") // this has no effect in Release
yuchong-pan marked this conversation as resolved.
Show resolved Hide resolved
RETAIL_CONFIG_DWORD_INFO(INTERNAL_ForceInterpreterAlways, W("ForceInterpreterAlways"), 0, "If non-zero, force the interpreter to be used always") // this suppresses ForceInterpreterTier0
#endif
// The JIT queries this ConfigDWORD but it doesn't know if FEATURE_INTERPRETER is enabled
RETAIL_CONFIG_DWORD_INFO(INTERNAL_InterpreterFallback, W("InterpreterFallback"), 0, "Fallback to the interpreter when the JIT compiler fails")
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/src/inc/corinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,7 @@ enum CorInfoIntrinsics
CORINFO_INTRINSIC_Span_GetItem,
CORINFO_INTRINSIC_ReadOnlySpan_GetItem,
CORINFO_INTRINSIC_GetRawHandle,
CORINFO_INTRINSIC_GetIsSupported, // for interpreting hardware intrinsics
yuchong-pan marked this conversation as resolved.
Show resolved Hide resolved

CORINFO_INTRINSIC_Count,
CORINFO_INTRINSIC_Illegal = -1, // Not a true intrinsic,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,31 @@ static IntrinsicHashtable InitializeIntrinsicHashtable()
table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_GetRawHandle, "EETypePtrOf", "System", "EETypePtr");
table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_GetRawHandle, "DefaultConstructorOf", "System", "Activator");
table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_GetRawHandle, "AllocatorOf", "System", "Activator");
table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_GetIsSupported, "get_IsSupported", "System.Runtime.Intrinsics.X86", "Aes");
table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_GetIsSupported, "get_IsSupported", "System.Runtime.Intrinsics.X86", "Avx");
table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_GetIsSupported, "get_IsSupported", "System.Runtime.Intrinsics.X86", "Avx2");
table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_GetIsSupported, "get_IsSupported", "System.Runtime.Intrinsics.X86", "Bmi1");
table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_GetIsSupported, "get_IsSupported", "System.Runtime.Intrinsics.X86", "Bmi2");
table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_GetIsSupported, "get_IsSupported", "System.Runtime.Intrinsics.X86", "Fma");
table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_GetIsSupported, "get_IsSupported", "System.Runtime.Intrinsics.X86", "Lzcnt");
table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_GetIsSupported, "get_IsSupported", "System.Runtime.Intrinsics.X86", "Pclmulqdq");
table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_GetIsSupported, "get_IsSupported", "System.Runtime.Intrinsics.X86", "Popcnt");
table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_GetIsSupported, "get_IsSupported", "System.Runtime.Intrinsics.X86", "Sse");
table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_GetIsSupported, "get_IsSupported", "System.Runtime.Intrinsics.X86", "Sse2");
table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_GetIsSupported, "get_IsSupported", "System.Runtime.Intrinsics.X86", "Sse3");
table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_GetIsSupported, "get_IsSupported", "System.Runtime.Intrinsics.X86", "Sse41");
table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_GetIsSupported, "get_IsSupported", "System.Runtime.Intrinsics.X86", "Sse42");
table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_GetIsSupported, "get_IsSupported", "System.Runtime.Intrinsics.X86", "Ssse3");
table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_GetIsSupported, "get_IsSupported", "System.Runtime.Intrinsics.X86", "X86Base");
table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_GetIsSupported, "get_IsSupported", "System.Runtime.Intrinsics.Arm", "AdvSimd");
table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_GetIsSupported, "get_IsSupported", "System.Runtime.Intrinsics.Arm", "Aes");
table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_GetIsSupported, "get_IsSupported", "System.Runtime.Intrinsics.Arm", "ArmBase");
table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_GetIsSupported, "get_IsSupported", "System.Runtime.Intrinsics.Arm", "Crc32");
table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_GetIsSupported, "get_IsSupported", "System.Runtime.Intrinsics.Arm", "Sha1");
table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_GetIsSupported, "get_IsSupported", "System.Runtime.Intrinsics.Arm", "Sha256");

// If this assert fails, make sure to add the new intrinsics to the table above and update the expected count below.
Debug.Assert((int)CorInfoIntrinsics.CORINFO_INTRINSIC_Count == 56, "Please update intrinsic hash table");
Debug.Assert((int)CorInfoIntrinsics.CORINFO_INTRINSIC_Count == 57, "Please update intrinsic hash table");

return table;
}
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/src/tools/Common/JitInterface/CorInfoTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ public enum CorInfoIntrinsics
CORINFO_INTRINSIC_Span_GetItem,
CORINFO_INTRINSIC_ReadOnlySpan_GetItem,
CORINFO_INTRINSIC_GetRawHandle,
CORINFO_INTRINSIC_GetIsSupported,

CORINFO_INTRINSIC_Count,
CORINFO_INTRINSIC_Illegal = -1, // Not a true intrinsic,
Expand Down
68 changes: 58 additions & 10 deletions src/coreclr/src/vm/interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ void InterpreterMethodInfo::InitArgInfo(CEEInfo* comp, CORINFO_METHOD_INFO* meth
}
m_argDescs[k].m_typeStackNormal = m_argDescs[k].m_type;
m_argDescs[k].m_nativeOffset = argOffsets_[k];
m_argDescs[k].m_directOffset = reinterpret_cast<short>(ArgSlotEndianessFixup(directOffset, sizeof(void*)));
m_argDescs[k].m_directOffset = (short) reinterpret_cast<intptr_t>(ArgSlotEndianessFixup(directOffset, sizeof(void*)));
yuchong-pan marked this conversation as resolved.
Show resolved Hide resolved
directOffset++;
k++;
}
Expand All @@ -302,18 +302,18 @@ void InterpreterMethodInfo::InitArgInfo(CEEInfo* comp, CORINFO_METHOD_INFO* meth
#endif // defined(HOST_ARM)
)
{
directRetBuffOffset = reinterpret_cast<short>(ArgSlotEndianessFixup(directOffset, sizeof(void*)));
directRetBuffOffset = (short) reinterpret_cast<intptr_t>(ArgSlotEndianessFixup(directOffset, sizeof(void*)));
directOffset++;
}
#if defined(HOST_AMD64)
if (GetFlag<Flag_isVarArg>())
{
directVarArgOffset = reinterpret_cast<short>(ArgSlotEndianessFixup(directOffset, sizeof(void*)));
directVarArgOffset = (short) reinterpret_cast<intptr_t>(ArgSlotEndianessFixup(directOffset, sizeof(void*)));
directOffset++;
}
if (GetFlag<Flag_hasGenericsContextArg>())
{
directTypeParamOffset = reinterpret_cast<short>(ArgSlotEndianessFixup(directOffset, sizeof(void*)));
directTypeParamOffset = (short) reinterpret_cast<intptr_t>(ArgSlotEndianessFixup(directOffset, sizeof(void*)));
directOffset++;
}
#endif
Expand Down Expand Up @@ -343,11 +343,11 @@ void InterpreterMethodInfo::InitArgInfo(CEEInfo* comp, CORINFO_METHOD_INFO* meth
// When invoking the interpreter directly, large value types are always passed by reference.
if (it.IsLargeStruct(comp))
{
m_argDescs[k].m_directOffset = reinterpret_cast<short>(ArgSlotEndianessFixup(directOffset, sizeof(void*)));
m_argDescs[k].m_directOffset = (short) reinterpret_cast<intptr_t>(ArgSlotEndianessFixup(directOffset, sizeof(void*)));
}
else
{
m_argDescs[k].m_directOffset = reinterpret_cast<short>(ArgSlotEndianessFixup(directOffset, it.Size(comp)));
m_argDescs[k].m_directOffset = (short) reinterpret_cast<intptr_t>(ArgSlotEndianessFixup(directOffset, it.Size(comp)));
}
argPtr = comp->getArgNext(argPtr);
directOffset++;
Expand Down Expand Up @@ -1636,6 +1636,7 @@ void Interpreter::JitMethodIfAppropriate(InterpreterMethodInfo* interpMethInfo,

if (InterpretationStubToMethodInfo(stub) == md)
{
CodeVersionManager::LockHolder _lockHolder;
yuchong-pan marked this conversation as resolved.
Show resolved Hide resolved
#if INTERP_TRACING
if (s_TraceInterpreterJITTransitionFlag.val(CLRConfig::INTERNAL_TraceInterpreterJITTransition))
{
Expand Down Expand Up @@ -1665,7 +1666,12 @@ void Interpreter::JitMethodIfAppropriate(InterpreterMethodInfo* interpMethInfo,
#ifdef FEATURE_TIERED_COMPILATION
bool scheduleTieringBackgroundWork = false;
NativeCodeVersion activeCodeVersion = md->GetCodeVersionManager()->GetActiveILCodeVersion(md).GetActiveNativeCodeVersion(md);
GetAppDomain()->GetTieredCompilationManager()->AsyncPromoteToTier1(activeCodeVersion, &scheduleTieringBackgroundWork);
ILCodeVersion ilCodeVersion = activeCodeVersion.GetILCodeVersion();
if (activeCodeVersion.GetOptimizationTier() == NativeCodeVersion::OptimizationTier0 &&
!ilCodeVersion.HasAnyOptimizedNativeCodeVersion(activeCodeVersion))
{
GetAppDomain()->GetTieredCompilationManager()->AsyncPromoteToTier1(activeCodeVersion, &scheduleTieringBackgroundWork);
}
yuchong-pan marked this conversation as resolved.
Show resolved Hide resolved
#else
#error FEATURE_INTERPRETER depends on FEATURE_TIERED_COMPILATION now
#endif
Expand Down Expand Up @@ -7887,16 +7893,40 @@ void Interpreter::LdElemWithType()
}
else
{
T res = reinterpret_cast<Array<T>*>(a)->GetDirectConstPointerToNonObjectElements()[index];
intptr_t res_ptr = reinterpret_cast<intptr_t>(reinterpret_cast<Array<T>*>(a)->GetDirectConstPointerToNonObjectElements());
if (cit == CORINFO_TYPE_INT)
{
assert(std::is_integral<T>::value);

// Widen narrow types.
int ires = (int)res;
int ires;
switch (sizeof(T))
{
case 1:
ires = std::is_same<T, INT8>::value ?
static_cast<int>(reinterpret_cast<INT8*>(res_ptr)[index]) :
static_cast<int>(reinterpret_cast<UINT8*>(res_ptr)[index]);
break;
case 2:
ires = std::is_same<T, INT16>::value ?
static_cast<int>(reinterpret_cast<INT16*>(res_ptr)[index]) :
static_cast<int>(reinterpret_cast<UINT16*>(res_ptr)[index]);
break;
case 4:
ires = std::is_same<T, INT32>::value ?
static_cast<int>(reinterpret_cast<INT32*>(res_ptr)[index]) :
static_cast<int>(reinterpret_cast<UINT32*>(res_ptr)[index]);
break;
default:
_ASSERTE_MSG(false, "This should have exhausted all the possible sizes.");
break;
}

OpStackSet<int>(arrInd, ires);
}
else
{
OpStackSet<T>(arrInd, res);
OpStackSet<T>(arrInd, ((T*) res_ptr)[index]);
}
}
}
Expand Down Expand Up @@ -9015,6 +9045,10 @@ void Interpreter::DoCallWork(bool virtualCall, void* thisArg, CORINFO_RESOLVED_T
m_curStackHt++; didIntrinsic = true;
break;
#endif // INTERP_ILSTUBS
case CORINFO_INTRINSIC_GetIsSupported:
DoGetIsSupported();
didIntrinsic = true;
break;
default:
#if INTERP_TRACING
InterlockedIncrement(&s_totalInterpCallsToIntrinsicsUnhandled);
Expand Down Expand Up @@ -10615,6 +10649,20 @@ void Interpreter::DoSIMDHwAccelerated()
LdIcon(1);
}


void Interpreter::DoGetIsSupported()
{
CONTRACTL{
THROWS;
GC_TRIGGERS;
MODE_COOPERATIVE;
} CONTRACTL_END;

OpStackSet<BOOL>(m_curStackHt, false);
OpStackTypeSet(m_curStackHt, InterpreterType(CORINFO_TYPE_INT));
yuchong-pan marked this conversation as resolved.
Show resolved Hide resolved
m_curStackHt++;
}

void Interpreter::RecordConstrainedCall()
{
CONTRACTL {
Expand Down
8 changes: 8 additions & 0 deletions src/coreclr/src/vm/interpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
#include "stack.h"
#include "crst.h"
#include "callhelpers.h"
#include "codeversion.h"

#ifdef PAL_STDCPP_COMPAT
yuchong-pan marked this conversation as resolved.
Show resolved Hide resolved
#include <type_traits>
#else
#include "clr_std/type_traits"
#endif

typedef SSIZE_T NativeInt;
typedef SIZE_T NativeUInt;
Expand Down Expand Up @@ -1767,6 +1774,7 @@ class Interpreter
void DoByReferenceCtor();
void DoByReferenceValue();
void DoSIMDHwAccelerated();
void DoGetIsSupported();

// Returns the proper generics context for use in resolving tokens ("precise" in the sense of including generic instantiation
// information).
Expand Down
25 changes: 21 additions & 4 deletions src/coreclr/src/vm/jitinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8722,6 +8722,8 @@ CorInfoIntrinsics CEEInfo::getIntrinsicID(CORINFO_METHOD_HANDLE methodHnd,

MethodDesc* method = GetMethod(methodHnd);

LPCUTF8 methodName = method->GetName();

if (method->IsArray())
{
ArrayMethodDesc * arrMethod = (ArrayMethodDesc *)method;
Expand All @@ -8735,6 +8737,9 @@ CorInfoIntrinsics CEEInfo::getIntrinsicID(CORINFO_METHOD_HANDLE methodHnd,
else
{
MethodTable * pMT = method->GetMethodTable();

LPCUTF8 moduleName = pMT->GetModule()->GetSimpleName();

if (pMT->GetModule()->IsSystem() && pMT->IsByRefLike())
{
if (pMT->HasSameTypeDefAs(g_pByReferenceClass))
Expand Down Expand Up @@ -8769,6 +8774,12 @@ CorInfoIntrinsics CEEInfo::getIntrinsicID(CORINFO_METHOD_HANDLE methodHnd,
}
}
}
else if (strcmp(pMT->GetModule()->GetSimpleName(), "System.Private.CoreLib") == 0 &&
strcmp(method->GetName(), "get_IsSupported") == 0)
{
// the get_Intrinsics method for hardware intrinsics
result = CORINFO_INTRINSIC_GetIsSupported;
}
}

EE_TO_JIT_TRANSITION();
Expand Down Expand Up @@ -12248,15 +12259,19 @@ CorJitResult invokeCompileMethodHelper(EEJitManager *jitMgr,

#ifdef FEATURE_INTERPRETER
static ConfigDWORD s_InterpreterFallback;
static ConfigDWORD s_ForceInterpreterAlways;

bool isInterpreterStub = false;
bool interpreterFallback = (s_InterpreterFallback.val(CLRConfig::INTERNAL_InterpreterFallback) != 0);
bool isInterpreterStub = false;
bool interpreterFallback = (s_InterpreterFallback.val(CLRConfig::INTERNAL_InterpreterFallback) != 0);
bool forceInterpreterAlways = (s_ForceInterpreterAlways.val(CLRConfig::INTERNAL_ForceInterpreterAlways) != 0);

if (interpreterFallback == false)
{
// If we're doing an "import_only" compilation, it's for verification, so don't interpret.
// (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))
if (FAILED(ret) &&
!jitFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_IMPORT_ONLY) &&
(forceInterpreterAlways || !jitFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_MAKEFINALCODE)))
{
if (SUCCEEDED(ret = Interpreter::GenerateInterpreterStub(comp, info, nativeEntry, nativeSizeOfCode)))
{
Expand All @@ -12279,7 +12294,9 @@ CorJitResult invokeCompileMethodHelper(EEJitManager *jitMgr,
{
// If we're doing an "import_only" compilation, it's for verification, so don't interpret.
// (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))
if (FAILED(ret) &&
!jitFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_IMPORT_ONLY) &&
(forceInterpreterAlways || !jitFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_MAKEFINALCODE)))
{
if (SUCCEEDED(ret = Interpreter::GenerateInterpreterStub(comp, info, nativeEntry, nativeSizeOfCode)))
{
Expand Down
10 changes: 10 additions & 0 deletions src/coreclr/src/vm/method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4865,6 +4865,16 @@ bool MethodDesc::IsJitOptimizationDisabled()
{
WRAPPER_NO_CONTRACT;

#ifdef FEATURE_INTERPRETER
static ConfigDWORD s_ForceInterpreterTier0;
static ConfigDWORD s_ForceInterpreterAlways;
if (s_ForceInterpreterAlways.val(CLRConfig::INTERNAL_ForceInterpreterAlways) == 0 &&
yuchong-pan marked this conversation as resolved.
Show resolved Hide resolved
s_ForceInterpreterTier0.val(CLRConfig::INTERNAL_ForceInterpreterTier0) != 0)
{
return false;
}
#endif

return
g_pConfig->JitMinOpts() ||
#ifdef _DEBUG
Expand Down