-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[mono][AOT] gsharedvt - stop validating generic constraints #119004
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
Conversation
…ppers - next field MonoClass->skip_generic_constraints
/azp run runtime-wasm |
Azure Pipelines successfully started running 1 pipeline(s). |
This could enable wrappers with arguments like public partial struct Nullable<T> where T : struct
public struct ValueTuple<T1> : IEquatable<ValueTuple<T1>>, IStructuralEquatable, IStructuralComparable, IComparable, IComparable<ValueTuple<T1>>, IValueTupleInternal, ITuple
struct AddOperator<T> : IAggregationOperator<T> where T : IAdditionOperators<T, T, T>, IAdditiveIdentity<T, T>
struct WeakGCHandle<T> : System.IDisposable, System.IEquatable<System.Runtime.InteropServices.WeakGCHandle<T>> where T : class? Quick list of types with constraints Would that break anything ? Would that make AOT binary (much) bigger ? Would that make TensorPrimitives faster ? |
/azp run runtime-wasm |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run runtime-wasm |
Azure Pipelines successfully started running 1 pipeline(s). |
This comment was marked as off-topic.
This comment was marked as off-topic.
/azp run runtime-wasm |
Azure Pipelines successfully started running 1 pipeline(s). |
json fail is actually independent issue #119143 which also fails on main |
/azp run runtime-wasm |
Azure Pipelines successfully started running 1 pipeline(s). |
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 adds a mechanism to skip generic constraint validation for MonoClass instances created during Ahead-of-Time (AOT) compilation wrapper generation. The change resolves issues where wrapper classes fail constraint validation even though they don't need to comply with generic constraints in the AOT context.
Key changes:
- Adds a new
skip_generic_constraints
field to MonoClass to mark classes that should bypass generic constraint validation - Implements conditional constraint checking in class initialization and field layout routines
- Includes test configuration updates to address browser platform limitations
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/mono/mono/metadata/class-private-definition.h |
Adds skip_generic_constraints field to MonoClass structure |
src/mono/mono/metadata/class-internals.h |
Declares new mono_class_skip_generic_constraints function |
src/mono/mono/metadata/class-accessors.c |
Implements the mono_class_skip_generic_constraints function with thread-safe field setting |
src/mono/mono/metadata/class-init.c |
Adds conditional constraint checking based on the new field in class initialization and field layout |
src/mono/mono/mini/mini-generic-sharing.c |
Calls the new function to mark wrapper classes as constraint-exempt and updates function comment |
src/libraries/System.Text.Json/tests/System.Text.Json.Tests/System.Text.Json.Tests.csproj |
Enables test progress reporting for browser targets |
src/libraries/System.Text.Json/tests/System.Text.Json.Tests/ILLink.Descriptors.xml |
Adds assembly references for Collections.Immutable and Collections.NonGeneric |
src/libraries/System.Text.Json/tests/Common/NumberHandlingTests.cs |
Disables Int128/UInt128/Half tests on browser platform due to known issue |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
/azp run runtime-wasm |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run runtime-wasm |
Azure Pipelines successfully started running 1 pipeline(s). |
Fixes #117557