Skip to content

[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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

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

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)

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