Repository navigation
Fix ReadyToRun allocation side effects for versionable base types - #137933
Conversation
|
Azure Pipelines: Successfully started running 3 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Tagging subscribers to this area: @dotnet/crossgen-contrib |
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
There was a problem hiding this comment.
🔵 Needs a closer look
Execution was unavailable, leaving unverified whether mainv2 runs the new allocation methods as ReadyToRun code and whether derived and indirect cases fail without the fix and pass with it.
No open issues 🎉
What changed in this PR
Fixes Crossgen2’s ReadyToRun allocation analysis to account for base types outside the version bubble that could gain a finalizer. This preserves allocation ordering around throwing arguments, preventing finalization of objects whose constructors never ran.
Changes:
- Check version-bubble membership throughout the inheritance chain, stopping at
System.Object. - Extend versioning regression tests with direct, derived, and indirectly derived allocations after a throwing argument.
| File | Description |
|---|---|
src/tests/readytorun/tests/test.cs |
Adds a versioned fixture that gains a finalizer and tracks finalization. |
src/tests/readytorun/tests/main.cs |
Adds allocation-ordering checks for three inheritance scenarios. |
src/coreclr/tools/aot/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs |
Includes versionable base types when determining allocation side effects. |
Review effort: Balanced
davidwrighton
left a comment
There was a problem hiding this comment.
Generally good, need to handle ValueTypes specially.
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…foImpl.ReadyToRun.cs
|
/ba-g dead letter |
Crossgen2 can hoist an in-bubble type’s allocation above a throwing argument even when an out-of-bubble base could gain a finalizer. After the base is updated, this can finalize an object whose constructor never ran.
System.Object, which cannot gain a finalizer.