-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[release/7.0-rc1] Disable Int128 use in by value ABI scenarios, and fix field layout behavior #74279
[release/7.0-rc1] Disable Int128 use in by value ABI scenarios, and fix field layout behavior #74279
Conversation
…n Unix platforms (64 bit) use 16 byte alignment - On Arm32 use 8 byte alignment matching the 128 byte vector type - On other Windows platforms the 128 bit integer type isn't defined by the C compiler, but match the behavior of other 128 bit types (16 byte alignment) Add tests to call down to native that should pass with these rules - Disable use of Int128 as p/invoke parameter passed by value
…hese types for parameter passing in R2R images
Co-authored-by: Jeremy Koritzinsky <[email protected]>
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.
LGTM, thank you! I should probably wait with my layout fix (PR #73978) until your change gets in as I suspect we'll hit conflicts and my change is much more modest and easier to rebase.
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.
approved. once we get a green ci we can merge
Backport of #74123 to release/7.0-rc1
/cc @davidwrighton
Customer Impact
This fix adjust the alignment behavior of Int128 and UInt128 to match the native platform layout rules, and disables the ability to pass Int128 or structures containing Int128 by value across interop boundaries.
The combination of these two changes allows us to support customers who wish to interop with Int128 types without performing the extensive work necessary to make by-value passing of Int128 structures interoperate correctly with Native code.
If this fix is not taken for .NET 7, we will establish a new backwards compatibility problem where some customers may take a dependency on the incorrect layout behavior, thus preventing us from easily being able to fix this behavior in the future. We have not yet established a compatibility concern in this space as Int128 has not been part of a release which is under support.
Testing
Manual testing, as well as targeted test development.
Risk
Any and all changes to field layout and interop behavior are somewhat risky; however, this fix is scoped to impact Int128 scenarios only, which are extremely rare at this time, as .NET 7 is the first product to ship the Int128 type.
IMPORTANT: Is this backport for a servicing release? If so and this change touches code that ships in a NuGet package, please make certain that you have added any necessary package authoring and gotten it explicitly reviewed.