Skip to content
Merged
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
6 changes: 0 additions & 6 deletions src/coreclr/jit/codegenarmarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -751,12 +751,6 @@ void CodeGen::genPutArgStk(GenTreePutArgStk* treeNode)
// we are storing arg slot number in GT_PUTARG_STK node in lowering phase.
unsigned argOffsetOut = treeNode->getArgOffset();

#ifdef DEBUG
CallArg* callArg = treeNode->gtCall->gtArgs.FindByNode(treeNode);
assert(callArg != nullptr);
DEBUG_ARG_SLOTS_ASSERT(argOffsetOut == (callArg->AbiInfo.SlotNum * TARGET_POINTER_SIZE));
#endif // DEBUG

// Whether to setup stk arg in incoming or out-going arg area?
// Fast tail calls implemented as epilog+jmp = stk arg is setup in incoming arg area.
// All other calls - stk arg is setup in out-going arg area.
Expand Down
20 changes: 0 additions & 20 deletions src/coreclr/jit/codegencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2052,26 +2052,6 @@ void CodeGen::genEmitMachineCode()
}
#endif

#if EMIT_TRACK_STACK_DEPTH && defined(DEBUG_ARG_SLOTS)
// Check our max stack level. Needed for fgAddCodeRef().
// We need to relax the assert as our estimation won't include code-gen
// stack changes (which we know don't affect fgAddCodeRef()).
// NOTE: after emitEndCodeGen (including here), emitMaxStackDepth is a
// count of DWORD-sized arguments, NOT argument size in bytes.
{
unsigned maxAllowedStackDepth = compiler->fgGetPtrArgCntMax() + // Max number of pointer-sized stack arguments.
compiler->compHndBBtabCount + // Return address for locally-called finallys
genTypeStSz(TYP_LONG) + // longs/doubles may be transferred via stack, etc
(compiler->compTailCallUsed ? 4 : 0); // CORINFO_HELP_TAILCALL args
#if defined(UNIX_X86_ABI)
// Convert maxNestedAlignment to DWORD count before adding to maxAllowedStackDepth.
assert(maxNestedAlignment % sizeof(int) == 0);
maxAllowedStackDepth += maxNestedAlignment / sizeof(int);
#endif
assert(GetEmitter()->emitMaxStackDepth <= maxAllowedStackDepth);
}
#endif // EMIT_TRACK_STACK_DEPTH && DEBUG

*nativeSizeOfCode = codeSize;
compiler->info.compNativeCodeSize = (UNATIVE_OFFSET)codeSize;

Expand Down
8 changes: 3 additions & 5 deletions src/coreclr/jit/codegenxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3507,7 +3507,6 @@ void CodeGen::genStructPutArgPush(GenTreePutArgStk* putArgNode)
const unsigned byteSize = putArgNode->GetStackByteSize();
assert((byteSize % TARGET_POINTER_SIZE == 0) && ((byteSize < XMM_REGSIZE_BYTES) || layout->HasGCPtr()));
const unsigned numSlots = byteSize / TARGET_POINTER_SIZE;
assert(putArgNode->gtNumSlots == numSlots);

for (int i = numSlots - 1; i >= 0; --i)
{
Expand Down Expand Up @@ -3557,7 +3556,6 @@ void CodeGen::genStructPutArgPartialRepMovs(GenTreePutArgStk* putArgNode)
const unsigned byteSize = putArgNode->GetStackByteSize();
assert(byteSize % TARGET_POINTER_SIZE == 0);
const unsigned numSlots = byteSize / TARGET_POINTER_SIZE;
assert(putArgNode->gtNumSlots == numSlots);

// No need to disable GC the way COPYOBJ does. Here the refs are copied in atomic operations always.
for (unsigned i = 0; i < numSlots;)
Expand Down Expand Up @@ -5390,7 +5388,7 @@ void CodeGen::genCall(GenTreeCall* call)
unsigned size = argNode->AsPutArgStk()->GetStackByteSize();
stackArgBytes += size;
#ifdef DEBUG
assert(size == (arg.AbiInfo.NumSlots * TARGET_POINTER_SIZE));
assert(size == arg.AbiInfo.ByteSize);
#ifdef FEATURE_PUT_STRUCT_ARG_STK
if (!source->OperIs(GT_FIELD_LIST) && (source->TypeGet() == TYP_STRUCT))
{
Expand All @@ -5402,7 +5400,7 @@ void CodeGen::genCall(GenTreeCall* call)
// Note that on x64/ux this will be handled by unrolling in genStructPutArgUnroll.
assert((argBytes == obj->GetLayout()->GetSize()) || obj->Addr()->IsLocalAddrExpr());
#endif // TARGET_X86
assert((arg.AbiInfo.NumSlots * TARGET_POINTER_SIZE) == argBytes);
assert(arg.AbiInfo.ByteSize == argBytes);
}
#endif // FEATURE_PUT_STRUCT_ARG_STK
#endif // DEBUG
Expand Down Expand Up @@ -7971,7 +7969,7 @@ void CodeGen::genPutArgStk(GenTreePutArgStk* putArgStk)
#ifdef DEBUG
CallArg* callArg = putArgStk->gtCall->gtArgs.FindByNode(putArgStk);
assert(callArg != nullptr);
assert(argOffset == callArg->AbiInfo.SlotNum * TARGET_POINTER_SIZE);
assert(argOffset == callArg->AbiInfo.ByteOffset);
#endif

if (data->isContainedIntOrIImmed())
Expand Down
119 changes: 5 additions & 114 deletions src/coreclr/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1111,93 +1111,10 @@ void CallArgABIInformation::SetByteSize(unsigned byteSize, unsigned byteAlignmen
assert(roundedByteSize % byteAlignment == 0);
#endif // TARGET_ARM

#if defined(DEBUG_ARG_SLOTS)
if (!compMacOsArm64Abi() && !isStruct)
{
assert(roundedByteSize == GetSlotCount() * TARGET_POINTER_SIZE);
}
#endif
ByteSize = roundedByteSize;
ByteAlignment = byteAlignment;
}

#ifdef DEBUG_ARG_SLOTS
//---------------------------------------------------------------
// GetSlotCount: Get the number of slots used by this argument.
//
// Returns:
// The number of slots, in terms of registers and whole stack slots.
//
// Remarks:
// Note that a slot may not necessarily be TARGET_POINTER_SIZE in size.
// For example, a SIMD16 may be passed in a single register where this
// function will return 1.
unsigned CallArgABIInformation::GetSlotCount() const
{
if (IsBackFilled)
{
assert(IsPassedInRegisters());
assert(NumRegs == 1);
}
else if (GetRegNum() == REG_STK)
{
assert(!IsPassedInRegisters());
assert(NumRegs == 0);
}
else
{
assert(NumRegs > 0);
}
return NumSlots + NumRegs;
}

//---------------------------------------------------------------
// GetSize: Get the size of the argument normalized to TARGET_POINTER_SIZE
// stack slots.
//
// Returns:
// The size of the argument, normalized to TARGET_POINTER_SIZE stack slots.
//
// Remarks:
// Unlike GetSlotCount() this function applies normalization and returns the
// answer in terms of TARGET_POINTER_SIZE slots.
// For example, a SIMD16 argument passed in a single register will return 2
// on ARM64.
unsigned CallArgABIInformation::GetSize() const
{
unsigned size = GetSlotCount();
if (GlobalJitOptions::compFeatureHfa)
{
if (IsHfaRegArg())
{
#ifdef TARGET_ARM
// We counted the number of regs, but if they are DOUBLE hfa regs we have to double the size.
if (GetHfaType() == TYP_DOUBLE)
{
assert(!IsSplit());
size <<= 1;
}
#elif defined(TARGET_ARM64)
// We counted the number of regs, but if they are FLOAT hfa regs we have to halve the size,
// or if they are SIMD16 vector hfa regs we have to double the size.
if (GetHfaType() == TYP_FLOAT)
{
// Round up in case of odd HFA count.
size = (size + 1) >> 1;
}
#ifdef FEATURE_SIMD
else if (GetHfaType() == TYP_SIMD16)
{
size <<= 1;
}
#endif // FEATURE_SIMD
#endif // TARGET_ARM64
}
}
return size;
}
#endif

//---------------------------------------------------------------
// SetMultiRegsNumw: Set the registers for a multi-reg arg using 'sequential' registers.
//
Expand Down Expand Up @@ -1302,7 +1219,7 @@ void CallArg::CheckIsStruct()
#ifdef TARGET_ARM
if (!isPassedAsPrimitiveType)
{
if (node->TypeGet() == TYP_DOUBLE && AbiInfo.NumRegs == 0 && (AbiInfo.NumSlots == 2))
if (node->TypeGet() == TYP_DOUBLE && AbiInfo.NumRegs == 0 && (AbiInfo.GetStackSlotsNumber() == 2))
{
isPassedAsPrimitiveType = true;
}
Expand Down Expand Up @@ -11662,19 +11579,7 @@ void Compiler::gtDispTree(GenTree* tree,
else if (tree->OperGet() == GT_PUTARG_STK)
{
const GenTreePutArgStk* putArg = tree->AsPutArgStk();
#if !defined(DEBUG_ARG_SLOTS)
printf(" (%d stackByteSize), (%d byteOffset)", putArg->GetStackByteSize(), putArg->getArgOffset());
#else
if (compMacOsArm64Abi())
{
printf(" (%d stackByteSize), (%d byteOffset)", putArg->GetStackByteSize(), putArg->getArgOffset());
}
else
{
printf(" (%d slots), (%d stackByteSize), (%d slot), (%d byteOffset)", putArg->gtNumSlots,
putArg->GetStackByteSize(), putArg->gtSlotNum, putArg->getArgOffset());
}
#endif
if (putArg->gtPutArgStkKind != GenTreePutArgStk::Kind::Invalid)
{
switch (putArg->gtPutArgStkKind)
Expand All @@ -11700,19 +11605,7 @@ void Compiler::gtDispTree(GenTree* tree,
else if (tree->OperGet() == GT_PUTARG_SPLIT)
{
const GenTreePutArgSplit* putArg = tree->AsPutArgSplit();
#if !defined(DEBUG_ARG_SLOTS)
printf(" (%d stackByteSize), (%d numRegs)", putArg->GetStackByteSize(), putArg->gtNumRegs);
#else
if (compMacOsArm64Abi())
{
printf(" (%d stackByteSize), (%d numRegs)", putArg->GetStackByteSize(), putArg->gtNumRegs);
}
else
{
printf(" (%d slots), (%d stackByteSize), (%d numRegs)", putArg->gtNumSlots, putArg->GetStackByteSize(),
putArg->gtNumRegs);
}
#endif
}
#endif // FEATURE_ARG_SPLIT
#endif // FEATURE_PUT_STRUCT_ARG_STK
Expand Down Expand Up @@ -12173,8 +12066,7 @@ void Compiler::gtGetArgMsg(GenTreeCall* call, CallArg* arg, char* bufp, unsigned
regNumber firstReg = arg->AbiInfo.GetRegNum();
if (arg->AbiInfo.NumRegs == 1)
{
sprintf_s(bufp, bufLength, " %s out+%02x", compRegVarName(firstReg),
arg->AbiInfo.SlotNum * TARGET_POINTER_SIZE);
sprintf_s(bufp, bufLength, " %s out+%02x", compRegVarName(firstReg), arg->AbiInfo.ByteOffset);
}
else
{
Expand All @@ -12191,7 +12083,7 @@ void Compiler::gtGetArgMsg(GenTreeCall* call, CallArg* arg, char* bufp, unsigned
lastReg = genMapIntRegArgNumToRegNum(lastRegNum);
}
sprintf_s(bufp, bufLength, " %s%c%s out+%02x", compRegVarName(firstReg), separator,
compRegVarName(lastReg), arg->AbiInfo.SlotNum * TARGET_POINTER_SIZE);
compRegVarName(lastReg), arg->AbiInfo.ByteOffset);
}

return;
Expand Down Expand Up @@ -12238,8 +12130,7 @@ void Compiler::gtGetLateArgMsg(GenTreeCall* call, CallArg* arg, char* bufp, unsi
regNumber firstReg = arg->AbiInfo.GetRegNum();
if (arg->AbiInfo.NumRegs == 1)
{
sprintf_s(bufp, bufLength, " %s out+%02x", compRegVarName(firstReg),
arg->AbiInfo.SlotNum * TARGET_POINTER_SIZE);
sprintf_s(bufp, bufLength, " %s out+%02x", compRegVarName(firstReg), arg->AbiInfo.ByteOffset);
}
else
{
Expand All @@ -12256,7 +12147,7 @@ void Compiler::gtGetLateArgMsg(GenTreeCall* call, CallArg* arg, char* bufp, unsi
lastReg = genMapIntRegArgNumToRegNum(lastRegNum);
}
sprintf_s(bufp, bufLength, " %s%c%s out+%02x", compRegVarName(firstReg), separator,
compRegVarName(lastReg), arg->AbiInfo.SlotNum * TARGET_POINTER_SIZE);
compRegVarName(lastReg), arg->AbiInfo.ByteOffset);
}

return;
Expand Down
Loading