Skip to content

Conversation

pavelsavara
Copy link
Member

@pavelsavara pavelsavara commented Aug 22, 2025

  • stop validating generic constraints for classes created for AOT wrappers
  • new field MonoClass->skip_generic_constraints

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 lewing and BrzVlad 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
Copy link
Member Author

pavelsavara commented Aug 23, 2025

RegularExpressions are fixed🎉

[16:24:27] info: Finished:    System.Text.RegularExpressions.Tests.dll
[16:24:27] info: === TEST EXECUTION SUMMARY ===
[16:24:27] info: Tests run: 21220 Passed: 21205 Inconclusive: 0 Failed: 0 Ignored: 0 Skipped: 15

But as it is, it breaks System.Text.Json.Tests probably because of the impact to ValueTuple and maybe in combination with Jiterpreter table xx is out of space

Log

[16:51:44] info: Starting:    System.Text.Json.Tests.dll
[16:52:25] info: MONO_WASM: Jiterpreter table 20 is out of space (3073 entries allocated)
[16:52:30] info: MONO_WASM: Jiterpreter table 12 is out of space (3073 entries allocated)
[16:52:32] info: MONO_WASM: Jiterpreter table 4 is out of space (3073 entries allocated)
[16:52:48] info: MONO_WASM: Jiterpreter table 11 is out of space (3073 entries allocated)
[16:53:25] fail: MONO_WASM: null function or function signature mismatch
RuntimeError: null function or function signature mismatch
    at aot_instances_aot_wrapper_gsharedvt_out_sig_obj_cl4c_Mono_dValueTuple_602_3cbyte_2c_20Mono_dValueTuple_602_3clong_2c_20long_3e_3e_ (http://127.0.0.1:49170/_framework/dotnet.native.wasm:wasm-function[64727]:0x124bbe4)
    at corlib_System_Collections_Generic_List_1_Enumerator_T_GSHAREDVT_System_Collections_IEnumerator_get_Current (http://127.0.0.1:49170/_framework/dotnet.native.wasm:wasm-function[41060]:0xa7117d)
    at ut_corlib_System_Collections_Generic_List_1_Enumerator_T_GSHAREDVT_System_Collections_IEnumerator_get_Current (http://127.0.0.1:49170/_framework/dotnet.native.wasm:wasm-function[41061]:0xa711ab)
    at System_Collections_NonGeneric_System_Collections_Queue__ctor_System_Collections_ICollection (http://127.0.0.1:49170/_framework/dotnet.native.wasm:wasm-function[10716]:0x36e085)
    at JsonSchema_Net_aot_wrapper_gsharedvt_out_sig_void_this_obj (http://127.0.0.1:49170/_framework/dotnet.native.wasm:wasm-function[1405]:0xe1bf6)
    at jit_call_cb (http://127.0.0.1:49170/_framework/dotnet.native.wasm:wasm-function[90040]:0x1874692)
    at mono_llvm_cpp_catch_exception (http://127.0.0.1:49170/_framework/dotnet.native.wasm:wasm-function[93325]:0x196775c)
    at mono_llvm_catch_exception (http://127.0.0.1:49170/_framework/dotnet.native.wasm:wasm-function[93377]:0x196bdbf)
    at do_jit_call (http://127.0.0.1:49170/_framework/dotnet.native.wasm:wasm-function[89960]:0x18711a8)
    at mono_interp_exec_method (http://127.0.0.1:49170/_framework/dotnet.native.wasm:wasm-function[89955]:0x1870669)
    at interp_entry (http://127.0.0.1:49170/_framework/dotnet.native.wasm:wasm-function[90034]:0x187431b)
    at interp_entry_static_ret_2 (http://127.0.0.1:49170/_framework/dotnet.native.wasm:wasm-function[90063]:0x1875282)
    at aot_instances_aot_wrapper_gsharedvt_in_sig_obj_objcl40_Mono_dValueTuple_601_3cMono_dValueTuple_602_3cint_2c_20int_3e_3e_ (http://127.0.0.1:49170/_framework/dotnet.native.wasm:wasm-function[64689]:0x124a425)
    at corlib_wrapper_delegate_invoke__Module_invoke_object_object_Span_1_object_object_System_Span_1_object (http://127.0.0.1:49170/_framework/dotnet.native.wasm:wasm-function[41560]:0xa8cdca)
    at corlib_System_Reflection_MethodBaseInvoker_InvokeWithOneArg_object_System_Reflection_BindingFlags_System_Reflection_Binder_object___System_Globalization_CultureInfo (http://127.0.0.1:49170/_framework/dotnet.native.wasm:wasm-function[36407]:0x956a33)
    at corlib_System_Reflection_RuntimeConstructorInfo_Invoke_System_Reflection_BindingFlags_System_Reflection_Binder_object___System_Globalization_CultureInfo (http://127.0.0.1:49170/_framework/dotnet.native.wasm:wasm-function[36553]:0x95f10a)
    at corlib_System_RuntimeType_CreateInstanceImpl_System_Reflection_BindingFlags_System_Reflection_Binder_object___System_Globalization_CultureInfo (http://127.0.0.1:49170/_framework/dotnet.native.wasm:wasm-function[25237]:0x790c5d)
    at corlib_System_Activator_CreateInstance_System_Type_System_Reflection_BindingFlags_System_Reflection_Binder_object___System_Globalization_CultureInfo_object__ (http://127.0.0.1:49170/_framework/dotnet.native.wasm:wasm-function[25968]:0x7b5197)
    at corlib_System_Activator_CreateInstance_System_Type_object__ (http://127.0.0.1:49170/_framework/dotnet.native.wasm:wasm-function[25969]:0x7b51e3)
    at aot_instances_aot_wrapper_gsharedvt_out_sig_obj_objobj (http://127.0.0.1:49170/_framework/dotnet.native.wasm:wasm-function[64647]:0x12496d1)

The test is [STRT] System.Text.Json.Serialization.Tests.NumberHandlingTestsDynamic.Number_AsCollectionElement_RoundTrip

[MONO] AOT NOT FOUND: System.Text.Json.Serialization.JsonConverter`1<System.Nullable`1<System.Int128>>:TryWrite (System.Text.Json.Utf8JsonWriter,System.Nullable`1<System.Int128>&,System.Text.Json.JsonSerializerOptions,System.Text.Json.WriteStack&).
dotnet.runtime.js:1415 [MONO] GC_MINOR: (Nursery full) time 1.40ms, stw 1.40ms promoted 1K major size: 15824K in use: 14434K empty reserved: 64K los size: 14844K in use: 14328K
dotnet.runtime.js:1415 [MONO] GC_MINOR: (Nursery full) time 2.70ms, stw 2.70ms promoted 168K major size: 16000K in use: 14609K empty reserved: 0K los size: 14844K in use: 14328K
dotnet.runtime.js:1415 [MONO] GC_MAJOR_SWEEP: major size: 14032K in use: 15185K empty reserved: 0K
dotnet.runtime.js:1415 [MONO] GC_MAJOR: (LOS overflow) time 78.60ms, stw 78.60ms los size: 2454K in use: 1942K
dotnet.runtime.js:1415 [MONO] GC_MINOR: (Nursery full) time 1.60ms, stw 1.90ms promoted 0K major size: 14032K in use: 10980K empty reserved: 2048K los size: 2575K in use: 2062K
dotnet.runtime.js:1415 [MONO] AOT NOT FOUND: System.Collections.Generic.List`1<System.Nullable`1<System.Int128>>:get_Item (int).
dotnet.runtime.js:1415 [MONO] AOT NOT FOUND: (wrapper other) object:gsharedvt_in_sig (int,intptr).
dotnet.runtime.js:1415 [MONO] AOT NOT FOUND: System.Nullable`1<System.Int128>:Box (System.Nullable`1<System.Int128>).

Nullable<System.Int128> seems to be the troublemaker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Codegen-AOT-mono NO-REVIEW Experimental/testing PR, do NOT review it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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