Skip to content

Commit d37cba7

Browse files
committed
Compute ByteSize the old way
1 parent 00f5bbc commit d37cba7

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

src/coreclr/jit/morph.cpp

+22-9
Original file line numberDiff line numberDiff line change
@@ -2145,14 +2145,12 @@ void CallArgs::AddFinalArgsAndDetermineABIInfo(Compiler* comp, GenTreeCall* call
21452145

21462146
arg.AbiInfo.SetSplit(true);
21472147
arg.AbiInfo.ByteOffset = 0;
2148-
arg.AbiInfo.ByteSize = 0;
21492148
unsigned regNumIndex = 0;
21502149
for (unsigned i = 0; i < abiInfo.NumSegments; i++)
21512150
{
21522151
const ABIPassingSegment& segment = abiInfo.Segments[i];
21532152
if (segment.IsPassedInRegister())
21542153
{
2155-
arg.AbiInfo.ByteSize += segment.Size;
21562154
if (regNumIndex < MAX_ARG_REG_COUNT)
21572155
{
21582156
arg.AbiInfo.SetRegNum(regNumIndex, segment.GetRegister());
@@ -2163,7 +2161,6 @@ void CallArgs::AddFinalArgsAndDetermineABIInfo(Compiler* comp, GenTreeCall* call
21632161
}
21642162
else
21652163
{
2166-
arg.AbiInfo.ByteSize += roundUp(segment.Size, TARGET_POINTER_SIZE);
21672164
assert(segment.GetStackOffset() == 0);
21682165
}
21692166
}
@@ -2173,7 +2170,6 @@ void CallArgs::AddFinalArgsAndDetermineABIInfo(Compiler* comp, GenTreeCall* call
21732170
// This is a register argument
21742171
m_hasRegArgs = true;
21752172

2176-
arg.AbiInfo.ByteSize = 0;
21772173
unsigned regNumIndex = 0;
21782174
for (unsigned i = 0; i < abiInfo.NumSegments; i++)
21792175
{
@@ -2185,7 +2181,6 @@ void CallArgs::AddFinalArgsAndDetermineABIInfo(Compiler* comp, GenTreeCall* call
21852181
regNumIndex++;
21862182
}
21872183

2188-
arg.AbiInfo.ByteSize += segment.Size;
21892184
arg.AbiInfo.NumRegs++;
21902185

21912186
#ifdef TARGET_ARM
@@ -2216,7 +2211,6 @@ void CallArgs::AddFinalArgsAndDetermineABIInfo(Compiler* comp, GenTreeCall* call
22162211
m_hasStackArgs = true;
22172212
const ABIPassingSegment& segment = abiInfo.Segments[0];
22182213
arg.AbiInfo.SetRegNum(0, REG_STK);
2219-
arg.AbiInfo.ByteSize = roundUp(segment.Size, TARGET_POINTER_SIZE);
22202214
arg.AbiInfo.ByteOffset = segment.GetStackOffset();
22212215
}
22222216

@@ -2249,6 +2243,28 @@ void CallArgs::AddFinalArgsAndDetermineABIInfo(Compiler* comp, GenTreeCall* call
22492243
}
22502244
}
22512245

2246+
if (arg.AbiInfo.PassedByRef)
2247+
{
2248+
arg.AbiInfo.ByteSize = TARGET_POINTER_SIZE;
2249+
}
2250+
else
2251+
{
2252+
unsigned size = argLayout != nullptr ? argLayout->GetSize() : genTypeSize(argSigType);
2253+
2254+
// Apple arm64 reuses the same stack slot for multiple args in some
2255+
// cases; old ABI info reflects that in the size.
2256+
// Primitives and float HFAs do not necessarily take up full stack
2257+
// slots.
2258+
if (compAppleArm64Abi() && (!varTypeIsStruct(argSigType) || (isHfaArg && (hfaType == TYP_FLOAT))))
2259+
{
2260+
arg.AbiInfo.ByteSize = size;
2261+
}
2262+
else
2263+
{
2264+
arg.AbiInfo.ByteSize = roundUp(size, TARGET_POINTER_SIZE);
2265+
}
2266+
}
2267+
22522268
if (isHfaArg)
22532269
{
22542270
arg.AbiInfo.SetHfaType(hfaType, hfaSlots);
@@ -4607,9 +4623,6 @@ bool Compiler::fgCanFastTailCall(GenTreeCall* callee, const char** failReason)
46074623
unsigned calleeArgStackSize = callee->gtArgs.OutgoingArgsStackSize();
46084624
unsigned callerArgStackSize = roundUp(lvaParameterStackSize, TARGET_POINTER_SIZE);
46094625

4610-
JITDUMP("Caller parameter stack size: %u\n", callerArgStackSize);
4611-
JITDUMP("Callee arguments stack size: %u", calleeArgStackSize);
4612-
46134626
auto reportFastTailCallDecision = [&](const char* thisFailReason) {
46144627
if (failReason != nullptr)
46154628
{

0 commit comments

Comments
 (0)