-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Ensure we track MakeGenericType #118479
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
Ensure we track MakeGenericType #118479
Conversation
...even if there's no constructor. This was found in https://github.com/dotnet/runtime/pull/118060/files#r2247963234 but the test case I'm adding is also failing in .NET 9 and doesn't require an IL-only repro to hit.
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 fixes a bug in the NativeAOT compiler where types with required constructors weren't being marked as allocated when they have no actual constructor methods. The fix ensures that types requiring constructors (like structs) are properly marked as allocated during reflection analysis, even when no constructor is found.
Key changes:
- Added explicit allocation marking for types with constructor requirements
- Added test coverage for struct activation scenarios without constructors
- Changed a test attribute from conditional to unconditional
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReflectionMarker.cs |
Added allocation marking for types requiring constructors in two methods to ensure they're considered allocated even without explicit constructors |
src/tests/nativeaot/SmokeTests/Reflection/Reflection.cs |
Added comprehensive test case for struct activation scenarios using various methods like Activator.CreateInstance and RuntimeHelpers.GetUninitializedObject |
src/libraries/Common/tests/System/Security/Cryptography/MLKemCngTests.NotSupported.cs |
Changed test attribute from conditional to unconditional |
|
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas |
|
/azp run runtime-nativeaot-outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Ooof, a bit more than expected. The fact that the Size statistics
|
src/coreclr/tools/aot/ILCompiler.Compiler/IL/ILImporter.Scanner.cs
Outdated
Show resolved
Hide resolved
src/coreclr/nativeaot/System.Private.CoreLib/src/System/ValueType.cs
Outdated
Show resolved
Hide resolved
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReflectionMarker.cs
Outdated
Show resolved
Hide resolved
We don't need reflection metadata to answer this. Change salvaged out of dotnet#118479, rt-sz will decide if we want it.
I'm not completely sure this is a fine assumption to make (we're assuming something that RyuJIT should do). Wanted to collect numbers if this is worth pursuing. Change salvaged out of dotnet#118479, rt-sz will decide if we want to pursue it.
|
Much better now. Tge regression in Avalonia is caused by tons of Func/Action delegates used with MakeGeneric in S.L.Expressions implementation. It fixes a correctness issue: Size statisticsPull request #118479
|
...even if there's no member access following the call.
This was found in https://github.com/dotnet/runtime/pull/118060/files#r2247963234 but the test case I'm adding is also failing in .NET 9 and doesn't require an IL-only repro to hit because all we need is a struct.