Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 3019808

Browse files
mskvortsovjkotas
authored andcommitted
[ARM32/Linux] Initial bring up of FEATURE_INTERPRETER (#8594)
* Bring up FEATURE_INTERPRETER for ARM32/Linux * Add a disclaimer message for GC preemption workaround
1 parent f1391bb commit 3019808

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

src/inc/clrconfigvalues.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -606,11 +606,11 @@ RETAIL_CONFIG_DWORD_INFO(INTERNAL_InterpreterDoLoopMethods, W("InterpreterDoLoop
606606
RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_InterpreterUseCaching, W("InterpreterUseCaching"), 1, "If non-zero, use the caching mechanism.", CLRConfig::REGUTIL_default)
607607
RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_InterpreterLooseRules, W("InterpreterLooseRules"), 1, "If non-zero, allow ECMA spec violations required by managed C++.", CLRConfig::REGUTIL_default)
608608
RETAIL_CONFIG_DWORD_INFO(INTERNAL_InterpreterPrintPostMortem, W("InterpreterPrintPostMortem"), 0, "Prints summary information about the execution to the console")
609-
CONFIG_STRING_INFO_EX(INTERNAL_InterpreterLogFile, W("InterpreterLogFile"), "If non-null, append interpreter logging to this file, else use stdout", CLRConfig::REGUTIL_default)
610-
CONFIG_DWORD_INFO(INTERNAL_DumpInterpreterStubs, W("DumpInterpreterStubs"), 0, "Prints all interpreter stubs that are created to the console")
611-
CONFIG_DWORD_INFO(INTERNAL_TraceInterpreterEntries, W("TraceInterpreterEntries"), 0, "Logs entries to interpreted methods to the console")
612-
CONFIG_DWORD_INFO(INTERNAL_TraceInterpreterIL, W("TraceInterpreterIL"), 0, "Logs individual instructions of interpreted methods to the console")
613-
CONFIG_DWORD_INFO(INTERNAL_TraceInterpreterOstack, W("TraceInterpreterOstack"), 0, "Logs operand stack after each IL instruction of interpreted methods to the console")
609+
RETAIL_CONFIG_STRING_INFO_EX(INTERNAL_InterpreterLogFile, W("InterpreterLogFile"), "If non-null, append interpreter logging to this file, else use stdout", CLRConfig::REGUTIL_default)
610+
RETAIL_CONFIG_DWORD_INFO(INTERNAL_DumpInterpreterStubs, W("DumpInterpreterStubs"), 0, "Prints all interpreter stubs that are created to the console")
611+
RETAIL_CONFIG_DWORD_INFO(INTERNAL_TraceInterpreterEntries, W("TraceInterpreterEntries"), 0, "Logs entries to interpreted methods to the console")
612+
RETAIL_CONFIG_DWORD_INFO(INTERNAL_TraceInterpreterIL, W("TraceInterpreterIL"), 0, "Logs individual instructions of interpreted methods to the console")
613+
RETAIL_CONFIG_DWORD_INFO(INTERNAL_TraceInterpreterOstack, W("TraceInterpreterOstack"), 0, "Logs operand stack after each IL instruction of interpreted methods to the console")
614614
CONFIG_DWORD_INFO(INTERNAL_TraceInterpreterVerbose, W("TraceInterpreterVerbose"), 0, "Logs interpreter progress with detailed messages to the console")
615615
CONFIG_DWORD_INFO(INTERNAL_TraceInterpreterJITTransition, W("TraceInterpreterJITTransition"), 0, "Logs when the interpreter determines a method should be JITted")
616616
#endif

src/vm/interpreter.cpp

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -903,9 +903,10 @@ CorJitResult Interpreter::GenerateInterpreterStub(CEEInfo* comp,
903903
#endif
904904
{
905905
// But we also have to use r4, because ThumbEmitCondRegJump below requires a low register.
906+
sl.ThumbEmitMovConstant(r11, 0);
906907
sl.ThumbEmitMovConstant(r12, UINT_PTR(interpMethInfo));
907908
sl.ThumbEmitLoadRegIndirect(r12, r12, offsetof(InterpreterMethodInfo, m_jittedCode));
908-
sl.ThumbEmitCmpImm(r12, 0); // Set condition codes.
909+
sl.ThumbEmitCmpReg(r12, r11); // Set condition codes.
909910
// If r12 is zero, then go on to do the interpretation.
910911
CodeLabel* doInterpret = sl.NewCodeLabel();
911912
sl.ThumbEmitCondFlagJump(doInterpret, thumbCondEq.cond);
@@ -1578,7 +1579,7 @@ CorJitResult Interpreter::GenerateInterpreterStub(CEEInfo* comp,
15781579
#else
15791580
#error unsupported platform
15801581
#endif
1581-
stub = sl.Link();
1582+
stub = sl.Link(SystemDomain::GetGlobalLoaderAllocator()->GetStubHeap());
15821583

15831584
*nativeSizeOfCode = static_cast<ULONG>(stub->GetNumCodeBytes());
15841585
// TODO: manage reference count of interpreter stubs. Look for examples...
@@ -8607,6 +8608,8 @@ void Interpreter::BoxStructRefAt(unsigned ind, CORINFO_CLASS_HANDLE valCls)
86078608
if (th.IsTypeDesc())
86088609
COMPlusThrow(kInvalidOperationException,W("InvalidOperation_TypeCannotBeBoxed"));
86098610

8611+
MethodTable* pMT = th.AsMethodTable();
8612+
86108613
{
86118614
Object* res = OBJECTREFToObject(pMT->Box(valPtr));
86128615

@@ -9578,7 +9581,9 @@ void Interpreter::DoCallWork(bool virtualCall, void* thisArg, CORINFO_RESOLVED_T
95789581

95799582
// This is the argument slot that will be used to hold the return value.
95809583
ARG_SLOT retVal = 0;
9584+
#ifndef _ARM_
95819585
_ASSERTE (NUMBER_RETURNVALUE_SLOTS == 1);
9586+
#endif
95829587

95839588
// If the return type is a structure, then these will be initialized.
95849589
CORINFO_CLASS_HANDLE retTypeClsHnd = NULL;
@@ -10316,15 +10321,23 @@ void Interpreter::CallI()
1031610321
}
1031710322
else
1031810323
{
10319-
pMD = g_pPrepareConstrainedRegionsMethod; // A random static method.
10324+
pMD = g_pExecuteBackoutCodeHelperMethod; // A random static method.
1032010325
}
1032110326
MethodDescCallSite mdcs(pMD, &mSig, ftnPtr);
10327+
#if 0
1032210328
// If the current method being interpreted is an IL stub, we're calling native code, so
1032310329
// change the GC mode. (We'll only do this at the call if the calling convention turns out
1032410330
// to be a managed calling convention.)
1032510331
MethodDesc* pStubContextMD = reinterpret_cast<MethodDesc*>(m_stubContext);
1032610332
bool transitionToPreemptive = (pStubContextMD != NULL && !pStubContextMD->IsIL());
1032710333
mdcs.CallTargetWorker(args, &retVal, sizeof(retVal), transitionToPreemptive);
10334+
#else
10335+
// TODO The code above triggers assertion at threads.cpp:6861:
10336+
// _ASSERTE(thread->PreemptiveGCDisabled()); // Should have been in managed code
10337+
// The workaround will likely break more things than what it is fixing:
10338+
// just do not make transition to preemptive GC for now.
10339+
mdcs.CallTargetWorker(args, &retVal, sizeof(retVal));
10340+
#endif
1032810341
}
1032910342
// retVal is now vulnerable.
1033010343
GCX_FORBID();

src/vm/interpreter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ class InterpreterCEEInfo: public CEEInfo
718718
{
719719
CEEJitInfo m_jitInfo;
720720
public:
721-
InterpreterCEEInfo(CORINFO_METHOD_HANDLE meth): CEEInfo((MethodDesc*)meth), m_jitInfo((MethodDesc*)meth, NULL, NULL, CorJitFlag(0)) { m_pOverride = this; }
721+
InterpreterCEEInfo(CORINFO_METHOD_HANDLE meth): CEEInfo((MethodDesc*)meth), m_jitInfo((MethodDesc*)meth, NULL, NULL, CORJIT_FLAGS::CORJIT_FLAG_SPEED_OPT) { m_pOverride = this; }
722722

723723
// Certain methods are unimplemented by CEEInfo (they hit an assert). They are implemented by CEEJitInfo, yet
724724
// don't seem to require any of the CEEJitInfo state we can't provide. For those case, delegate to the "partial"

0 commit comments

Comments
 (0)