Allow type loading when merging array types#122121
Conversation
If the runtime is merging two array types, the merged type may be one that is not yet loaded. Allow the runtime to load the type. Fixes dotnet#120903.
|
@jkotas PTAL Seems like this is the first test I've added to the regression part of the tree since we merged #121078. It wasn't obvious to me how to decide which csproj should be updated. Also we have been burned by this kind of "need to explicitly include" logic before and ended up with tests that never got built or run. |
|
LGTM |
There was a problem hiding this comment.
Pull request overview
This PR fixes issue #120903 by allowing the runtime to load array types when merging them. Previously, the runtime would forbid type loading during array type merging, which could cause issues when the merged type had not yet been loaded.
Key Changes
- Removed loader restrictions in
MergeArrayTypeHandlesToCommonParentto allow type loading during array type merging - Added a regression test demonstrating the scenario where array type merging requires loading a new type
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/coreclr/vm/typehandle.cpp | Simplified MergeArrayTypeHandlesToCommonParent by removing the ENABLE_FORBID_GC_LOADER_USE_IN_THIS_SCOPE() block and ClassLoader::DontLoadTypes flag, allowing type loading when needed |
| src/tests/JIT/Regression/JitBlue/Runtime_120903/Runtime_120903.cs | Added regression test that exercises array type merging with Unsafe.As casting between related array types |
| src/tests/JIT/Regression/Regression_ro_1.csproj | Added new test file to the build (though placement is out of order) |
src/tests/JIT/Regression/JitBlue/Runtime_120903/Runtime_120903.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Tagging subscribers to this area: @mangod9 |
If the runtime is merging two array types, the merged type may be one that is not yet loaded. Allow the runtime to load the type.
Fixes #120903.