-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[clr-interp] Fix argument alignment of 16 byte or greater aligned structures in the interpreter #120723
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
Conversation
…ures in the interpreter - Arguments are up to 16 byte aligned - Handle this in the call stub generator, and call emission. (We already did this in the argument input processing in the interpreter We need to align these at 16byte boundaries as the various ABIs tend to have a hard requirement around 16 byte alignment, when they don't have such a requirement around 32 or 64 byte alignment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes argument alignment of 16-byte or greater aligned structures in the CLR interpreter to properly handle structures that require 16-byte alignment boundaries as mandated by various ABIs.
Key Changes
- Updated call stub generator to allocate space for alignment injection routines (3x args instead of 2x)
- Added alignment logic in call stub computation to handle 16-byte aligned value types
- Implemented
InjectInterpStackAlign
assembly routines across x64 and ARM64 platforms
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/tests/Interop/PInvoke/Int128/Int128Test.cs |
Removed FIXME comment indicating the interpreter issue is now resolved |
src/coreclr/vm/callstubgenerator.h |
Updated comment and allocation size calculation for call stub routines array |
src/coreclr/vm/callstubgenerator.cpp |
Added alignment logic and InjectInterpStackAlign function declaration |
src/coreclr/vm/arm64/asmhelpers.asm |
Added ARM64 assembly implementation of InjectInterpStackAlign |
src/coreclr/vm/arm64/asmhelpers.S |
Added ARM64 Unix assembly implementation of InjectInterpStackAlign |
src/coreclr/vm/amd64/asmhelpers.S |
Added x64 Unix assembly implementation of InjectInterpStackAlign |
src/coreclr/vm/amd64/AsmHelpers.asm |
Added x64 Windows assembly implementation of InjectInterpStackAlign |
src/coreclr/interpreter/compileropt.cpp |
Added alignment logic for variable allocation in interpreter |
src/coreclr/interpreter/compiler.cpp |
Added alignment constraint and fixed stack type for unbox operation |
Tagging subscribers to this area: @BrzVlad, @janvorli, @kg |
Thanks for figuring this out and fixing it - that test failure had me stumped! |
We need to align these at 16byte boundaries as the various ABIs tend to have a hard requirement around 16 byte alignment, when they don't have such a requirement around 32 or 64 byte alignment.