-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Move ILLink generic handling to scanner #118708
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
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 moves ILLink's generic argument dataflow analysis from MarkStep into the scanner phase, aligning it with the implementations in ILC (Native AOT) and ILLink.RoslynAnalyzer. This change unifies the behavior across all three tools for handling generic parameter validation.
- Generic dataflow analysis is moved from marking phase to scanning phase
- Test expectations are updated to reflect consistent behavior across tools
- Additional infrastructure is added to track generic instantiation patterns during scanning
Reviewed Changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
RequiresOnClass.cs |
Removes unexpected warning annotations that are now properly handled |
RequiresExcludeStatics.cs |
Removes unexpected warning annotations for static/instance fields |
UnresolvedMembers.cs |
Removes expected warning for local variable type |
GenericParameterWarningLocation.cs |
Updates comments and warning expectations to reflect unified behavior |
GenericParameterDataFlow.cs |
Updates comments and removes trimmer-specific warning expectations |
CompilerGeneratedTypes.cs |
Removes trimmer-specific unexpected warnings for compiler-generated code |
CompilerGeneratedCodeInPreservedAssemblyWithWarning.cs |
Removes expected warnings that are now properly suppressed |
ApplyTypeAnnotations.cs |
Changes Kept attribute from trimmer-specific to general |
MarkStep.cs |
Moves generic argument validation to scanner and adds type access validation |
TrimAnalysisPatternStore.cs |
Adds support for tracking generic instantiation access patterns |
TrimAnalysisGenericInstantiationAccessPattern.cs |
New pattern type for generic instantiation access tracking |
RequireDynamicallyAccessedMembersAction.cs |
Adds generic argument dataflow processing for resolved types |
ReflectionMethodBodyScanner.cs |
Adds token access handlers and generic dataflow processing |
ReflectionMarker.cs |
Changes internal field to public property for scanner access |
MethodBodyScanner.cs |
Adds abstract methods for token access handling |
GenericArgumentDataFlow.cs |
Refactors to static class with unified processing methods |
FlowAnnotations.cs |
Adds methods to check for generic parameter annotations |
Tagging subscribers to this area: @dotnet/illink |
Co-authored-by: Copilot <[email protected]>
...r/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/RequireDynamicallyAccessedMembersAction.cs
Show resolved
Hide resolved
src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/ApplyTypeAnnotations.cs
Show resolved
Hide resolved
Seems native AOT trims some interface methods, probably because it is doing some devirt.
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.
Thank you!
This moves the ILLink generic dataflow analysis out of MarkStep and into the scanner, unifying it with the logic (not actually sharing code) in ILC and ILLink.RoslynAnalyzer. It is essentially a port of the ILC logic into ILLink.
This ran into an issue with incorrect suppressions in DI (see #81358) that we have a workaround for in native AOT, so I've implemented a similar workaround in ILLink. I copied over the native AOT smoke test for that workaround and adjusted it to run as a shared testcase.
Fixes #113249