-
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
Preserve static type info for return value of ctor #101212
Conversation
With these changes, are we able to remove the runtime/src/tools/illink/src/linker/Linker.Dataflow/MethodBodyScanner.cs Lines 1107 to 1119 in b35b67d
runtime/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/MethodBodyScanner.cs Lines 1302 to 1319 in b35b67d
|
Tagging subscribers to this area: @agocke, @sbomer, @vitek-karas |
On the linker side I'm seeing some cases where |
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.
Assuming you tested it on the code that caused the original issue, LGTM.
If we want to remove that, I'd remove the whole We have too many codepaths that try to manufacture a default return value. There's the one this PR is changing on line 1170 of HandleCallAction, but we also have these: runtime/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReflectionMethodBodyScanner.cs Lines 778 to 784 in 65f6a08
runtime/src/tools/illink/src/linker/Linker.Dataflow/ReflectionMethodBodyScanner.cs Lines 355 to 361 in 65f6a08
I wonder if we should change those too. Ideally there would only be one place that manufactures these and not 3. This place has the most context to do the right thing though (it is the place where we see it's a constructor, and the instruction was |
src/tools/illink/src/ILLink.Shared/TrimAnalysis/HandleCallAction.cs
Outdated
Show resolved
Hide resolved
...lynAnalyzer.Tests.Generator/ILLink.RoslynAnalyzer.Tests.TestCaseGenerator/DataFlowTests.g.cs
Outdated
Show resolved
Hide resolved
src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/IReflectDataflow.cs
Show resolved
Hide resolved
Instead of tracking the return value as "TopValue" or "unknown", this models the constructor as returning a value with a static type when called with newobj, letting us undo the workaround from dotnet#101031.
Instead of tracking the return value as "TopValue" or "unknown", this models the constructor as returning a value with a static type when called with newobj, letting us undo the workaround from dotnet#101031.
Fixes #101102.
Instead of tracking the return value as "unknown", this models the constructor as returning a value with a static type, letting us undo the workaround from #101031.