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

Commit

Permalink
[aarch64] Enable the interpreter on linux as well
Browse files Browse the repository at this point in the history
  • Loading branch information
kangaroo committed Jul 28, 2015
1 parent 16c43e3 commit 8c4e600
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 43 deletions.
2 changes: 1 addition & 1 deletion src/inc/switches.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@
#define FEATURE_STACK_SAMPLING #define FEATURE_STACK_SAMPLING
#endif // defined (ALLOW_SXS_JIT) #endif // defined (ALLOW_SXS_JIT)


#if defined(_TARGET_ARM64_) && !defined(FEATURE_CORECLR) #if defined(_TARGET_ARM64_)
#define FEATURE_INTERPRETER #define FEATURE_INTERPRETER
#endif // defined(_TARGET_ARM64_) #endif // defined(_TARGET_ARM64_)


Expand Down
36 changes: 12 additions & 24 deletions src/vm/interpreter.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -42,22 +42,22 @@ static CorInfoType asCorInfoType(CORINFO_CLASS_HANDLE clsHnd)
InterpreterMethodInfo::InterpreterMethodInfo(CEEInfo* comp, CORINFO_METHOD_INFO* methInfo) InterpreterMethodInfo::InterpreterMethodInfo(CEEInfo* comp, CORINFO_METHOD_INFO* methInfo)
: m_method(methInfo->ftn), : m_method(methInfo->ftn),
m_module(methInfo->scope), m_module(methInfo->scope),
m_jittedCode(0),
m_ILCode(methInfo->ILCode), m_ILCode(methInfo->ILCode),
m_ILCodeEnd(methInfo->ILCode + methInfo->ILCodeSize), m_ILCodeEnd(methInfo->ILCode + methInfo->ILCodeSize),
m_maxStack(methInfo->maxStack), m_maxStack(methInfo->maxStack),
m_numArgs(methInfo->args.numArgs),
m_flags(0),
m_argDescs(NULL),
m_numLocals(methInfo->locals.numArgs),
m_returnType(methInfo->args.retType),
m_invocations(0),
m_jittedCode(0),
#if INTERP_PROFILE #if INTERP_PROFILE
m_totIlInstructionsExeced(0), m_totIlInstructionsExeced(0),
m_maxIlInstructionsExeced(0), m_maxIlInstructionsExeced(0),
#endif #endif
m_ehClauseCount(methInfo->EHcount), m_ehClauseCount(methInfo->EHcount),
m_varArgHandleArgNum(NO_VA_ARGNUM), m_varArgHandleArgNum(NO_VA_ARGNUM),
m_numArgs(methInfo->args.numArgs),
m_numLocals(methInfo->locals.numArgs),
m_flags(0),
m_argDescs(NULL),
m_returnType(methInfo->args.retType),
m_invocations(0),
m_methodCache(NULL) m_methodCache(NULL)
{ {
// Overflow sanity check. (Can ILCodeSize ever be zero?) // Overflow sanity check. (Can ILCodeSize ever be zero?)
Expand Down Expand Up @@ -431,7 +431,7 @@ InterpreterMethodInfo::~InterpreterMethodInfo()
{ {
if (m_methodCache != NULL) if (m_methodCache != NULL)
{ {
delete m_methodCache; delete reinterpret_cast<ILOffsetToItemCache*>(m_methodCache);
} }
} }


Expand Down Expand Up @@ -534,7 +534,7 @@ void Interpreter::ArgState::AddArg(unsigned canonIndex, short numSlots, bool noR
argOffsets[canonIndex] = offset.Value(); argOffsets[canonIndex] = offset.Value();
#if defined(_ARM_) || defined(_ARM64_) #if defined(_ARM_) || defined(_ARM64_)
callerArgStackSlots += numSlots; callerArgStackSlots += numSlots;
#endif; #endif
} }
#endif // !_AMD64_ #endif // !_AMD64_
} }
Expand Down Expand Up @@ -1063,7 +1063,7 @@ CorJitResult Interpreter::GenerateInterpreterStub(CEEInfo* comp,
// for instance a VT with two float fields will have the same size as a VT with 1 double field. (ARM64TODO: Verify it) // for instance a VT with two float fields will have the same size as a VT with 1 double field. (ARM64TODO: Verify it)
// It works on ARM because the overlapping layout of the floating point registers // It works on ARM because the overlapping layout of the floating point registers
// but it won't work on ARM64. // but it won't work on ARM64.
cHFAVars = (comp->getHFAType(info->args.retTypeClass) == ELEMENT_TYPE_R4) ? HFARetTypeSize/sizeof(float) : HFARetTypeSize/sizeof(double); cHFAVars = (CorInfoTypeIsFloatingPoint(comp->getHFAType(info->args.retTypeClass))) ? HFARetTypeSize/sizeof(float) : HFARetTypeSize/sizeof(double);
#endif #endif
} }


Expand Down Expand Up @@ -1816,14 +1816,6 @@ enum OPCODE_2BYTE {
#undef OPDEF #undef OPDEF
}; };


#ifdef _DEBUG
static const char* getMethodName(CEEInfo* info, CORINFO_METHOD_HANDLE meth, const char** pClsName)
{
GCX_PREEMP();
return info->getMethodName(meth, pClsName);
}
#endif // _DEBUG

// Optimize the interpreter loop for speed. // Optimize the interpreter loop for speed.
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma optimize("t", on) #pragma optimize("t", on)
Expand Down Expand Up @@ -4825,10 +4817,6 @@ void Interpreter::BinaryArithOvfOp()
} }
break; break;


case CORINFO_TYPE_SHIFTED_CLASS:
VerificationError("Can't do binary arithmetic overflow operation on object references.");
break;

default: default:
_ASSERTE_MSG(false, "Non-stack-normal type on stack."); _ASSERTE_MSG(false, "Non-stack-normal type on stack.");
} }
Expand Down Expand Up @@ -5099,7 +5087,7 @@ void Interpreter::ShiftOpWork(unsigned op1idx, CorInfoType cit2)
res = (static_cast<UT>(val)) >> shiftAmt; res = (static_cast<UT>(val)) >> shiftAmt;
} }
} }
else if (cit2 = CORINFO_TYPE_NATIVEINT) else if (cit2 == CORINFO_TYPE_NATIVEINT)
{ {
NativeInt shiftAmt = OpStackGet<NativeInt>(op2idx); NativeInt shiftAmt = OpStackGet<NativeInt>(op2idx);
if (op == CEE_SHL) if (op == CEE_SHL)
Expand Down Expand Up @@ -5932,7 +5920,7 @@ void Interpreter::NewObj()
{ {
void* dest = LargeStructOperandStackPush(sz); void* dest = LargeStructOperandStackPush(sz);
memcpy(dest, tempDest, sz); memcpy(dest, tempDest, sz);
delete[] tempDest; delete[] reinterpret_cast<BYTE*>(tempDest);
OpStackSet<void*>(m_curStackHt, dest); OpStackSet<void*>(m_curStackHt, dest);
} }
else else
Expand Down
36 changes: 18 additions & 18 deletions src/vm/interpreter.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ bool IsStackNormalType(CorInfoType cit);
CorInfoType CorInfoTypeStackNormalize(CorInfoType cit); CorInfoType CorInfoTypeStackNormalize(CorInfoType cit);


// Returns the (byte) size of "cit". Requires that "cit" is not a CORINFO_TYPE_VALUECLASS. // Returns the (byte) size of "cit". Requires that "cit" is not a CORINFO_TYPE_VALUECLASS.
inline size_t CorInfoTypeSize(CorInfoType cit); size_t CorInfoTypeSize(CorInfoType cit);


// Returns true iff "cit" is an unsigned integral type. // Returns true iff "cit" is an unsigned integral type.
bool CorInfoTypeIsUnsigned(CorInfoType cit); bool CorInfoTypeIsUnsigned(CorInfoType cit);
Expand All @@ -101,7 +101,7 @@ inline size_t CorInfoTypeStackNormalSize(CorInfoType cit)
return CorInfoTypeSize(cit); return CorInfoTypeSize(cit);
} }


inline getClassSize(CORINFO_CLASS_HANDLE clsHnd) inline size_t getClassSize(CORINFO_CLASS_HANDLE clsHnd)
{ {
TypeHandle VMClsHnd(clsHnd); TypeHandle VMClsHnd(clsHnd);
return VMClsHnd.GetSize(); return VMClsHnd.GetSize();
Expand Down Expand Up @@ -778,40 +778,40 @@ class Interpreter
// operand type stack. // operand type stack.
Interpreter(InterpreterMethodInfo* methInfo_, bool directCall_, BYTE* ilArgs_, void* stubContext_, BYTE* frameMemory) Interpreter(InterpreterMethodInfo* methInfo_, bool directCall_, BYTE* ilArgs_, void* stubContext_, BYTE* frameMemory)
: m_methInfo(methInfo_), : m_methInfo(methInfo_),
m_interpCeeInfo(methInfo_->m_method),
m_ILCodePtr(methInfo_->m_ILCode),
m_directCall(directCall_), m_directCall(directCall_),
m_ilArgs(ilArgs_), m_ilArgs(ilArgs_),
m_stubContext(stubContext_), m_stubContext(stubContext_),
m_ILCodePtr(methInfo_->m_ILCode), m_orOfPushedInterpreterTypes(0),
m_curStackHt(0),
m_interpCeeInfo(methInfo_->m_method),
m_largeStructOperandStack(NULL), m_largeStructOperandStack(NULL),
m_largeStructOperandStackHt(0), m_largeStructOperandStackHt(0),
m_largeStructOperandStackAllocSize(0), m_largeStructOperandStackAllocSize(0),
m_thisArg(NULL), m_curStackHt(0),
m_securityObject(TADDR(NULL)), m_leaveInfoStack(),
m_args(NULL),
m_argsSize(0),
m_structRetValITPtr(NULL),
m_callThisArg(NULL),
m_orOfPushedInterpreterTypes(0),
m_preciseGenericsContext(NULL),
m_functionPointerStack(NULL),
m_genericsCtxtArg(NULL),
m_inFlightException(NULL),
m_filterNextScan(0), m_filterNextScan(0),
m_filterHandlerOffset(0), m_filterHandlerOffset(0),
m_filterExcILOffset(0), m_filterExcILOffset(0),
m_inFlightException(NULL),
m_thisArg(NULL),
#ifdef USE_CHECKED_OBJECTREFS #ifdef USE_CHECKED_OBJECTREFS
m_retBufArg(NULL), // Initialize to NULL so we can safely declare protected. m_retBufArg(NULL), // Initialize to NULL so we can safely declare protected.
#endif // USE_CHECKED_OBJECTREFS #endif // USE_CHECKED_OBJECTREFS
m_genericsCtxtArg(NULL),
m_securityObject(TADDR(NULL)),
m_args(NULL),
m_argsSize(0),
m_callThisArg(NULL),
m_structRetValITPtr(NULL),
#ifndef DACCESS_COMPILE #ifndef DACCESS_COMPILE
// Means "uninitialized" // Means "uninitialized"
m_thisExecCache(UninitExecCache), m_thisExecCache(UninitExecCache),
#endif #endif
m_constrainedFlag(false), m_constrainedFlag(false),
m_readonlyFlag(false), m_readonlyFlag(false),
m_locAllocData(NULL), m_locAllocData(NULL),
m_leaveInfoStack() m_preciseGenericsContext(NULL),
m_functionPointerStack(NULL)
{ {
// We must zero the locals. // We must zero the locals.
memset(frameMemory, 0, methInfo_->LocalMemSize() + sizeof(GSCookie)); memset(frameMemory, 0, methInfo_->LocalMemSize() + sizeof(GSCookie));
Expand Down Expand Up @@ -1604,7 +1604,7 @@ class Interpreter
{ {
for (unsigned i = 0; i < m_locAllocCurIdx; i++) for (unsigned i = 0; i < m_locAllocCurIdx; i++)
{ {
delete[] m_locAllocs[i]; delete[] reinterpret_cast<char*>(m_locAllocs[i]);
} }
} }
delete[] m_locAllocs; delete[] m_locAllocs;
Expand Down

0 comments on commit 8c4e600

Please sign in to comment.