Skip to content

Conversation

pavelsavara
Copy link
Member

@pavelsavara pavelsavara commented Aug 22, 2025

Fixes #117557

…ppers

- next field MonoClass->skip_generic_constraints
@pavelsavara pavelsavara added this to the 10.0.0 milestone Aug 22, 2025
@pavelsavara pavelsavara requested review from BrzVlad and lewing August 22, 2025 14:31
@pavelsavara pavelsavara self-assigned this Aug 22, 2025
@pavelsavara
Copy link
Member Author

/azp run runtime-wasm

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@pavelsavara
Copy link
Member Author

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 ?

@pavelsavara
Copy link
Member Author

/azp run runtime-wasm

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@pavelsavara pavelsavara added the NO-REVIEW Experimental/testing PR, do NOT review it label Aug 22, 2025
@pavelsavara
Copy link
Member Author

/azp run runtime-wasm

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@pavelsavara

This comment was marked as off-topic.

@dotnet-policy-service dotnet-policy-service bot added the linkable-framework Issues associated with delivering a linker friendly framework label Aug 27, 2025
@pavelsavara
Copy link
Member Author

/azp run runtime-wasm

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@pavelsavara pavelsavara removed the linkable-framework Issues associated with delivering a linker friendly framework label Aug 27, 2025
@dotnet-policy-service dotnet-policy-service bot added the linkable-framework Issues associated with delivering a linker friendly framework label Aug 27, 2025
@pavelsavara
Copy link
Member Author

json fail is actually independent issue #119143 which also fails on main

@pavelsavara
Copy link
Member Author

/azp run runtime-wasm

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@pavelsavara pavelsavara removed linkable-framework Issues associated with delivering a linker friendly framework NO-REVIEW Experimental/testing PR, do NOT review it labels Aug 27, 2025
@dotnet-policy-service dotnet-policy-service bot added the linkable-framework Issues associated with delivering a linker friendly framework label Aug 27, 2025
@pavelsavara pavelsavara marked this pull request as ready for review August 27, 2025 20:01
@Copilot Copilot AI review requested due to automatic review settings August 27, 2025 20:01
Copy link
Contributor

@Copilot Copilot AI left a 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>
@pavelsavara pavelsavara removed the linkable-framework Issues associated with delivering a linker friendly framework label Aug 28, 2025
@dotnet-policy-service dotnet-policy-service bot added the linkable-framework Issues associated with delivering a linker friendly framework label Aug 28, 2025
@pavelsavara
Copy link
Member Author

/azp run runtime-wasm

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@pavelsavara pavelsavara requested a review from BrzVlad August 28, 2025 07:55
@pavelsavara
Copy link
Member Author

/azp run runtime-wasm

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@pavelsavara pavelsavara merged commit 47c406e into dotnet:main Aug 28, 2025
116 of 120 checks passed
@pavelsavara pavelsavara deleted the rx_aot2 branch August 28, 2025 20:16
@github-actions github-actions bot locked and limited conversation to collaborators Sep 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-Codegen-AOT-mono linkable-framework Issues associated with delivering a linker friendly framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[wasm][aot] gsharedvt_out_sig - RegularExpressions.Symbolic.SymbolicRegexBuilder

3 participants