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 incoming arg struct splitting #71701

Merged
merged 1 commit into from
Jul 7, 2022
Merged

Conversation

BruceForstall
Copy link
Member

This only affects Windows/arm64 with varargs.

For incoming structs split between register and stack, handle the splitting
correctly.

Fixes #57606

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jul 6, 2022
@ghost ghost assigned BruceForstall Jul 6, 2022
@ghost
Copy link

ghost commented Jul 6, 2022

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Issue Details

This only affects Windows/arm64 with varargs.

For incoming structs split between register and stack, handle the splitting
correctly.

Fixes #57606

Author: BruceForstall
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

@BruceForstall
Copy link
Member Author

Note this comment in lvaInitUserArgs:

#if defined(TARGET_ARM64)
if (compFeatureArgSplit())
{
// On arm64 Windows we will need to properly handle the case where a >8byte <=16byte
// struct is split between register r7 and virtual stack slot s[0]
// We will only do this for calls to vararg methods on Windows Arm64
//
// !!This does not affect the normal arm64 calling convention or Unix Arm64!!
if (this->info.compIsVarArgs && argType == TYP_STRUCT)
{
if (varDscInfo->canEnreg(TYP_INT, 1) && // The beginning of the struct can go in a register
!varDscInfo->canEnreg(TYP_INT, cSlots)) // The end of the struct can't fit in a register
{
cSlotsToEnregister = 1; // Force the split
}
}
}

This change only affects Windows/arm64 with varargs.

For incoming structs split between register and stack, handle the splitting
correctly.

Fixes dotnet#57606
@BruceForstall
Copy link
Member Author

@jakobbotsch @dotnet/jit-contrib PTAL

@BruceForstall BruceForstall merged commit e633272 into dotnet:main Jul 7, 2022
@BruceForstall BruceForstall deleted the Fix57606 branch July 7, 2022 16:14
@BruceForstall
Copy link
Member Author

No diffs

@ghost ghost locked as resolved and limited conversation to collaborators Aug 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Assertion failed 'regArgTab[regArgNum + i].slot == 0'
2 participants