Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ArgIterator::GetNextOffset for macOS arm64 #48632

Merged
2 commits merged into from
Feb 23, 2021
Merged
Changes from 1 commit
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
21 changes: 20 additions & 1 deletion src/coreclr/vm/callingconvention.h
Original file line number Diff line number Diff line change
Expand Up @@ -1437,7 +1437,8 @@ int ArgIteratorTemplate<ARGITERATOR_BASE>::GetNextOffset()
break;
}
const bool isValueType = (argType == ELEMENT_TYPE_VALUETYPE);
const int cbArg = StackElemSize(argSize, isValueType, thValueType.IsFloatHfa());
const bool isFloatHfa = thValueType.IsFloatHfa();
const int cbArg = StackElemSize(argSize, isValueType, isFloatHfa);
if (cFPRegs>0 && !this->IsVarArg())
{
if (cFPRegs + m_idxFPReg <= 8)
Expand Down Expand Up @@ -1495,6 +1496,24 @@ int ArgIteratorTemplate<ARGITERATOR_BASE>::GetNextOffset()
}
}

#ifdef OSX_ARM64_ABI
int alignment;
if (!isValueType)
{
_ASSERTE((cbArg & (cbArg - 1)) == 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: indentation is off.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for noticing this, fixed.

alignment = cbArg;
}
else if (isFloatHfa)
{
alignment = 4;
}
else
{
alignment = 8;
}
m_ofsStack = (int)ALIGN_UP(m_ofsStack, alignment);
#endif // OSX_ARM64_ABI

int argOfs = TransitionBlock::GetOffsetOfArgs() + m_ofsStack;
m_ofsStack += cbArg;
return argOfs;
Expand Down