Resolve generic descriptor method signatures in ILC#128123
Conversation
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/391677e2-3e7d-4e0f-a9c2-1fa5d5657d9e Co-authored-by: MichalStrehovsky <13110571+MichalStrehovsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/913290c3-43f1-4e16-9827-4fb7db797640 Co-authored-by: MichalStrehovsky <13110571+MichalStrehovsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/810611fa-e03c-4232-813d-f8de8ad62578 Co-authored-by: MichalStrehovsky <13110571+MichalStrehovsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/810611fa-e03c-4232-813d-f8de8ad62578 Co-authored-by: MichalStrehovsky <13110571+MichalStrehovsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/810611fa-e03c-4232-813d-f8de8ad62578 Co-authored-by: MichalStrehovsky <13110571+MichalStrehovsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/810611fa-e03c-4232-813d-f8de8ad62578 Co-authored-by: MichalStrehovsky <13110571+MichalStrehovsky@users.noreply.github.com>
|
@copilot ILCompiler.Trimming.Tests are failing, I think it's because we actually fixed this for ILCompiler: |
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/e85e6e55-0409-469d-9288-7283c85af2f8 Co-authored-by: MichalStrehovsky <13110571+MichalStrehovsky@users.noreply.github.com>
Addressed in 5c81b46. Since ILCompiler now resolves the generic descriptor signature, I updated the shared test expectation so |
There was a problem hiding this comment.
Pull request overview
This PR improves descriptor-driven method signature matching so XML descriptors that reference generic parameters (e.g., System.Void GenericMethod(T)) resolve consistently across toolchains, and adjusts ILTrim’s unreachable-body rewriting behavior/tests to align more closely with ILLink/NativeAOT expectations.
Changes:
- Update XML descriptor signature formatting to include method/type generic context and print signature variables using their generic parameter names.
- Refine ILTrim unreachable-body rewriting to preserve extremely small bodies (
retandnop; ret) instead of converting them to a sharedldnull; throwstub. - Re-enable/adjust test coverage by removing ILTrim expected-failure entries and updating LinkXml expectations.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/tools/illink/test/Mono.Linker.Tests.Cases/LinkXml/UnusedMethodPreservedByLinkXmlIsKept.cs | Updates test expectation so the descriptor-rooted generic method is expected to be kept generally. |
| src/coreclr/tools/ILTrim.Tests/ILTrimExpectedFailures.txt | Removes several entries that should now pass with the improved signature matching and unreachable-body behavior. |
| src/coreclr/tools/ILTrim.Core/DependencyAnalysis/TokenBased/MethodDefinitionNode.cs | Adds a small-body heuristic to avoid converting ret / nop; ret methods to an unreachable throw body when optimizing. |
| src/coreclr/tools/Common/Compiler/ProcessLinkerXmlBase.cs | Formats method signatures with generic context so signature variables can be emitted as generic parameter names for XML comparison. |
|
/ba-g the tests completed successfully, but there was some Python error after they were done. looks like infra hiccup |
Description
NativeAOT could not resolve XML descriptor method signatures that reference generic parameters, e.g.
System.Void Method(T), while ILLink accepted the same descriptor.Descriptor matching
ILTrim coverage and parity
--disable-opt unreachablebodies testworkaround.IsWorthConvertingToThrowapproximation so empty method bodies composed of an optionalnopfollowed byretare preserved as-is, matching ILLink behavior closely enough for these tests.ILCompiler test coverage
Example descriptor now handled consistently: