Skip to content

Commit

Permalink
[RISC-V] Disable FastTailCall in case of split arg (#93655)
Browse files Browse the repository at this point in the history
  • Loading branch information
t-mustafin committed Oct 27, 2023
1 parent 92aeed0 commit 5f0fe49
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -10352,7 +10352,7 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

unsigned compArgSize; // total size of arguments in bytes (including register args (lvIsRegArg))

#ifdef TARGET_ARM
#if defined(TARGET_ARM) || defined(TARGET_RISCV64)
bool compHasSplitParam;
#endif

Expand Down
7 changes: 5 additions & 2 deletions src/coreclr/jit/lclvars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,9 @@ void Compiler::lvaInitTypeRef()
LclVarDsc* varDsc = varDscInfo.varDsc;
CORINFO_ARG_LIST_HANDLE localsSig = info.compMethodInfo->locals.args;

#ifdef TARGET_ARM
#if defined(TARGET_ARM) || defined(TARGET_RISCV64)
compHasSplitParam = varDscInfo.hasSplitParam;
#endif
#endif // TARGET_ARM || TARGET_RISCV64

for (unsigned i = 0; i < info.compMethodInfo->locals.numArgs;
i++, varNum++, varDsc++, localsSig = info.compCompHnd->getArgNext(localsSig))
Expand Down Expand Up @@ -1043,6 +1043,9 @@ void Compiler::lvaInitUserArgs(InitVarDscInfo* varDscInfo, unsigned skipArgs, un
varDscInfo->setAllRegArgUsed(argRegTypeInStruct1);
#if FEATURE_FASTTAILCALL
varDscInfo->stackArgSize += TARGET_POINTER_SIZE;
#endif
#ifdef TARGET_RISCV64
varDscInfo->hasSplitParam = true;
#endif
}
}
Expand Down
13 changes: 8 additions & 5 deletions src/coreclr/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5439,24 +5439,27 @@ bool Compiler::fgCanFastTailCall(GenTreeCall* callee, const char** failReason)
{
calleeArgStackSize = roundUp(calleeArgStackSize, arg.AbiInfo.ByteAlignment);
calleeArgStackSize += arg.AbiInfo.GetStackByteSize();
#ifdef TARGET_ARM

#if defined(TARGET_ARM) || defined(TARGET_RISCV64)
if (arg.AbiInfo.IsSplit())
{
reportFastTailCallDecision("Argument splitting in callee is not supported on ARM32");
reportFastTailCallDecision("Argument splitting in callee is not supported on " TARGET_READABLE_NAME);
return false;
}
#endif // TARGET_ARM
#endif // TARGET_ARM || TARGET_RISCV64
}

calleeArgStackSize = GetOutgoingArgByteSize(calleeArgStackSize);

#ifdef TARGET_ARM
#if defined(TARGET_ARM) || defined(TARGET_RISCV64)
if (compHasSplitParam)
{
reportFastTailCallDecision("Argument splitting in caller is not supported on ARM32");
reportFastTailCallDecision("Argument splitting in caller is not supported on " TARGET_READABLE_NAME);
return false;
}
#endif // TARGET_ARM || TARGET_RISCV64

#ifdef TARGET_ARM
if (compIsProfilerHookNeeded())
{
reportFastTailCallDecision("Profiler is not supported on ARM32");
Expand Down
10 changes: 8 additions & 2 deletions src/coreclr/jit/registerargconvention.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ struct InitVarDscInfo
// handles arguments.
regMaskTP fltArgSkippedRegMask;
bool anyFloatStackArgs;
bool hasSplitParam;
#endif // TARGET_ARM

#if defined(TARGET_ARM) || defined(TARGET_RISCV64)
bool hasSplitParam;
#endif // TARGET_ARM || TARGET_RISCV64

#if FEATURE_FASTTAILCALL
// It is used to calculate argument stack size information in byte
unsigned stackArgSize;
Expand All @@ -46,9 +49,12 @@ struct InitVarDscInfo
#ifdef TARGET_ARM
fltArgSkippedRegMask = RBM_NONE;
anyFloatStackArgs = false;
hasSplitParam = false;
#endif // TARGET_ARM

#if defined(TARGET_ARM) || defined(TARGET_RISCV64)
hasSplitParam = false;
#endif // TARGET_ARM || TARGET_RISCV64

#if FEATURE_FASTTAILCALL
stackArgSize = 0;
#endif // FEATURE_FASTTAILCALL
Expand Down

0 comments on commit 5f0fe49

Please sign in to comment.