Skip to content
Merged
Changes from 3 commits
Commits
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
24 changes: 22 additions & 2 deletions src/coreclr/interpreter/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,8 @@ void ValidateEmittedSequenceTermination(InterpInst *lastIns)
(lastIns->opcode == INTOP_CALLVIRT_TAIL) ||
(lastIns->opcode == INTOP_RETHROW) ||
(lastIns->opcode == INTOP_LEAVE_FILTER) ||
(lastIns->opcode == INTOP_LEAVE_CATCH))
(lastIns->opcode == INTOP_LEAVE_CATCH) ||
(lastIns->opcode == INTOP_JMP))
Comment thread
janvorli marked this conversation as resolved.
Outdated
{
// Valid terminating instruction
return;
Expand Down Expand Up @@ -2233,7 +2234,7 @@ void InterpCompiler::CreateBasicBlocks(CORINFO_METHOD_INFO* methodInfo)
default:
assert(0);
}
if (opcode == CEE_THROW || opcode == CEE_ENDFINALLY || opcode == CEE_RETHROW)
if (opcode == CEE_THROW || opcode == CEE_ENDFINALLY || opcode == CEE_RETHROW || opcode == CEE_JMP)
GetBB((int32_t)(ip - codeStart));
}
}
Expand Down Expand Up @@ -3900,6 +3901,7 @@ void InterpCompiler::EmitCall(CORINFO_RESOLVED_TOKEN* pConstrainedToken, bool re

bool isVirtual = (*m_ip == CEE_CALLVIRT);
bool isDelegateInvoke = false;
bool isJmp = (*m_ip == CEE_JMP);

CORINFO_RESOLVED_TOKEN resolvedCallToken;
CORINFO_CALL_INFO callInfo;
Expand Down Expand Up @@ -4031,6 +4033,16 @@ void InterpCompiler::EmitCall(CORINFO_RESOLVED_TOKEN* pConstrainedToken, bool re
CORINFO_ARG_LIST_HANDLE args;
args = callInfo.sig.args;

if (isJmp)
{
assert(tailcall);
// CEE_JMP is simulated as a tail call, so we need to load the current method's args
for (int i = 0; i < numArgsFromStack; i++)
{
EmitLoadVar(i);
}
}

for (int iActualArg = 0, iLogicalArg = 0; iActualArg < numArgs; iActualArg++)
{
if (iActualArg == extraParamArgLocation)
Expand All @@ -4046,6 +4058,7 @@ void InterpCompiler::EmitCall(CORINFO_RESOLVED_TOKEN* pConstrainedToken, bool re
else
{
int iCurrentStackArg = iLogicalArg - numArgsFromStack;

if (iLogicalArg != 0 || !callInfo.sig.hasThis() || newObj)
{
CORINFO_CLASS_HANDLE classHandle;
Expand Down Expand Up @@ -6929,6 +6942,13 @@ void InterpCompiler::GenerateCode(CORINFO_METHOD_INFO* methodInfo)
EmitUnaryArithmeticOp(INTOP_NOT_I4);
m_ip++;
break;
case CEE_JMP:
{
CHECK_STACK(0);
EmitCall(pConstrainedToken, readonly, true /* tailcall */, false /*newObj*/, false /*isCalli*/);
linkBBlocks = false;
break;
}
case CEE_CALLVIRT:
case CEE_CALL:
EmitCall(pConstrainedToken, readonly, tailcall, false /*newObj*/, false /*isCalli*/);
Expand Down
Loading