Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
20 changes: 20 additions & 0 deletions src/coreclr/src/jit/codegenarmarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2658,6 +2658,26 @@ void CodeGen::genCallInstruction(GenTreeCall* call)
INDEBUG_LDISASM_COMMA(sigInfo) nullptr, // addr
retSize MULTIREG_HAS_SECOND_GC_RET_ONLY_ARG(secondRetSize), ilOffset, target->GetRegNum());
}
#if defined(FEATURE_READYTORUN_COMPILER) && defined(TARGET_ARMARCH)
else if (call->IsR2RRelativeIndir())
{
// Generate a direct call to a non-virtual user defined or helper method
assert(callType == CT_HELPER || callType == CT_USER_FUNC);
assert(call->gtEntryPoint.accessType == IAT_PVALUE);

regNumber tmpReg = call->GetSingleTempReg();
GetEmitter()->emitIns_R_R(ins_Load(TYP_I_IMPL), emitActualTypeSize(TYP_I_IMPL), tmpReg, REG_R2R_INDIRECT_PARAM);

// We have already generated code for gtControlExpr evaluating it into a register.
// We just need to emit "call reg" in this case.
//
assert(genIsValidIntReg(tmpReg));

genEmitCall(emitter::EC_INDIR_R, methHnd,
INDEBUG_LDISASM_COMMA(sigInfo) nullptr, // addr
retSize MULTIREG_HAS_SECOND_GC_RET_ONLY_ARG(secondRetSize), ilOffset, tmpReg);
}
#endif // FEATURE_READYTORUN_COMPILER && TARGET_ARMARCH
else
{
// Generate a direct call to a non-virtual user defined or helper method
Expand Down
18 changes: 13 additions & 5 deletions src/coreclr/src/jit/lower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3282,11 +3282,19 @@ GenTree* Lowering::LowerDirectCall(GenTreeCall* call)

case IAT_PVALUE:
{
// Non-virtual direct calls to addresses accessed by
// a single indirection.
GenTree* cellAddr = AddrGen(addr);
GenTree* indir = Ind(cellAddr);
result = indir;
bool isR2RRelativeIndir = false;
#if defined(FEATURE_READYTORUN_COMPILER) && defined(TARGET_ARMARCH)
isR2RRelativeIndir = call->IsR2RRelativeIndir();
#endif // FEATURE_READYTORUN_COMPILER && TARGET_ARMARCH

if (!isR2RRelativeIndir)
{
// Non-virtual direct calls to addresses accessed by
// a single indirection.
GenTree* cellAddr = AddrGen(addr);
GenTree* indir = Ind(cellAddr);
result = indir;
}
break;
}

Expand Down
6 changes: 6 additions & 0 deletions src/coreclr/src/jit/lsraarmarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ int LinearScan::BuildCall(GenTreeCall* call)
ctrlExprCandidates = RBM_FASTTAILCALL_TARGET;
}
}
#if defined(FEATURE_READYTORUN_COMPILER) && defined(TARGET_ARMARCH)
else if (call->IsR2RRelativeIndir())
{
buildInternalIntRegisterDefForNode(call);
}
#endif // FEATURE_READYTORUN_COMPILER && TARGET_ARMARCH
#ifdef TARGET_ARM
else
{
Expand Down