-
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
Implement support for InlineArray
in the trimmer
#92060
Conversation
Types annotated with `InlineArray` need to preserve all of their fields, even if otherwise this would not be the case. It's possible to have a struct with `LayoutKind.Auto` and with `InlineArray` - trimmer would normally trim fields on such struct. This leads to corruption since the field is never accessed directly. This changes the marking to preserve all fields on a type with `InlineArray` attribute just like we would for explicit layout struct and similar other types. Adds tests to cover both the explicit usage of `InlineArray` attribute as well as the compiler generate usage via collection literals.
Tagging subscribers to this area: @agocke, @sbomer, @vitek-karas Issue DetailsTypes annotated with This changes the marking to preserve all fields on a type with Adds tests to cover both the explicit usage of This should resolve the trimming part of #92022
|
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, thanks!
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, thanks!
src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/InlineArrayDataflow.cs
Outdated
Show resolved
Hide resolved
…rrayDataflow.cs Co-authored-by: Sven Boemer <sbomer@gmail.com>
/backport to release/8.0 |
Started backporting to release/8.0: https://github.com/dotnet/runtime/actions/runs/6195934219 |
Types annotated with
InlineArray
need to preserve all of their fields, even if otherwise this would not be the case. It's possible to have a struct withLayoutKind.Auto
and withInlineArray
- trimmer would normally trim fields on such struct. This leads to corruption since the field is never accessed directly.This changes the marking to preserve all fields on a type with
InlineArray
attribute just like we would for explicit layout struct and similar other types.Adds tests to cover both the explicit usage of
InlineArray
attribute as well as the compiler generate usage via collection literals.This should resolve the trimming part of #92022
And it also adds tests for #88684