Repository navigation
Home DIM instantiating thunks on System.Object - #136128
Merged
Merged
Conversation
Fixes dotnet#136073 These need to be homed on something that is not generic so we cannot place them on the interface itself: it causes issues around whether these require instantiating argument (they don't) that requires lots of special casing to back out. This is probably the cleanest local fix. It doesn't work for the multi-obj file mode (these now all look like they should be compiled into CoreLib.obj). We can live with that, considering everything else.
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib |
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
NativeAOT execution remains unverified, and the acknowledged multi-object compilation limitation requires maintainer acceptance.
No open issues 🎉
What changed in this PR
Addresses NativeAOT issue #136073 by moving default interface method instantiating thunks onto the non-generic System.Object type.
Changes:
- Removes explicit thunk-owner storage and construction arguments.
- Adds regression coverage for shared generic default implementations using
objectandstring.
| File | Description |
|---|---|
| src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github136073.csproj | Includes the regression test source. |
| src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github136073.cs | Tests receiver casting and generic type identity. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.InterfaceThunks.cs | Homes instantiating thunks on System.Object. |
Review effort: Balanced
jkotas
reviewed
Oct 20, 2026
jkotas
approved these changes
Oct 20, 2026
Member
Author
|
/azp run runtime-nativeaot-outerloop |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Member
Author
|
/ba-g the native AOT failure is known |
Member
Author
|
/backport to release/11.0 |
Contributor
|
Started backporting to |
2 of 4 tasks
agocke
pushed a commit
that referenced
this pull request
Nov 11, 2026
Backport of #136128 to release/11.0 /cc @MichalStrehovsky ## Customer Impact - [X] Customer reported - [ ] Found internally #136073 - default interface method instantiating thunks need to be homed on a different type but they're conceptually instance methods on the interface. Inlining into these thunks can produce bad optimizations. In this case, RyuJIT optimized out "impossible" code path that is actually possible. ## Regression - [X] Yes - [ ] No We have always reported these on the "wrong" type, this was triggered by more inlining. ## Testing Added targeted regression test. This requires interaction of at least two optimizations (first we need to inline, and then make a decision about `this`). ## Risk The risk should be low, the fix was straightforward and didn't require any adjustments with our existing DIM testing. **IMPORTANT**: If this backport is for a servicing release, please verify that: - For .NET 8 and .NET 9: The PR target branch is `release/X.0-staging`, not `release/X.0`. - For .NET 10+: The PR target branch is `release/X.0` (no `-staging` suffix). ## Package authoring no longer needed in .NET 9 **IMPORTANT**: Starting with .NET 9, you no longer need to edit a NuGet package's csproj to enable building and bump the version. Keep in mind that we still need package authoring in .NET 8 and older versions. Co-authored-by: Michal Strehovský <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes #136073
These need to be homed on something that is not generic so we cannot place them on the interface itself: it causes issues around whether these require instantiating argument (they don't) that requires lots of special casing to back out.
This is probably the cleanest local fix. It doesn't work for the multi-obj file mode (these now all look like they should be compiled into CoreLib.obj). We can live with that, considering everything else.