Stop rooting nested types for helper types #1521
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While looking at sizoscope traces with @jkoritzinsky, he noticed that the linker was rooting a considerable amount of code due to virtual methods on nested types for helper types, ie. all of the vtable types. These vtable types are no longer used at all with new projections (and NAOT will not even attempt to find them at all, and will just fail if using old projections). This PR updates the trimming annotations to stop rooting all of these nested vtable types, making the fallback path using older projections not trim-safe. It will still work though, and we added some explicit annotations to preserve the generic vtable types that are generally needed by applications, only on CoreCLR, so we should be able to maintain back-compat there when trimming is used. This makes the back-compat support pay-for-play and avoid the binary size increase for customers using new projections and NAOT especially.
See: