Skip to content

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

Closed

Description

@lewing

Build Information

Build: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1107614
Build error leg or test failing: [wasm][aot] gsharedvt_out_sig - RegularExpressions.Symbolic.SymbolicRegexBuilder

Error Message

Fill the error message using step by step known issues guidance.

{
  "ErrorMessage": "interp.c:2737",
  "BuildRetry": false,
  "ExcludeConsoleLog": false
}

Log

[18:17:27] fail: [MONO] * Assertion at D:/a/_work/1/s/src/mono/mono/mini/interp/interp.c:2737, 
condition `is_ok (error)' not met, function:init_jit_call_info, 
Attempting to JIT compile method '(wrapper other) 
void object:gsharedvt_out_sig (intptr,System.Text.RegularExpressions.Symbolic.SymbolicRegexBuilder`1/NodeCacheKey<object>&,intptr)' 
while running in aot-only mode. See https://learn.microsoft.com/xamarin/ios/internals/limitations for more information.
 assembly:<unknown assembly> type:<unknown type> member:(null)

Error
    at Mc (http://127.0.0.1:49169/_framework/dotnet.runtime.js:3:172233)
    at wasm_trace_logger (http://127.0.0.1:49169/_framework/dotnet.native.wasm:wasm-function[149696]:0x2a41ac1)
    at eglib_log_adapter (http://127.0.0.1:49169/_framework/dotnet.native.wasm:wasm-function[141965]:0x285016a)
    at monoeg_g_logv_nofree (http://127.0.0.1:49169/_framework/dotnet.native.wasm:wasm-function[141891]:0x284e0fa)
    at monoeg_assertion_message (http://127.0.0.1:49169/_framework/dotnet.native.wasm:wasm-function[141894]:0x284e1f8)
    at do_jit_call (http://127.0.0.1:49169/_framework/dotnet.native.wasm:wasm-function[141263]:0x2823cab)
    at mono_interp_exec_method (http://127.0.0.1:49169/_framework/dotnet.native.wasm:wasm-function[141258]:0x2816d50)
    at interp_entry (http://127.0.0.1:49169/_framework/dotnet.native.wasm:wasm-function[141337]:0x28270bc)
    at interp_entry_instance_ret_2 (http://127.0.0.1:49169/_framework/dotnet.native.wasm:wasm-function[141348]:0x282791b)
    at aot_instances_aot_wrapper_gsharedvt_in_sig_u1_this_cl26_Mono_dValueTuple_602_3cint_2c_20int_3e_cl26_Mono_dValueTuple_602_3cint_2c_20int_3e_ (http://127.0.0.1:49169/_framework/dotnet.native.wasm:wasm-function[104406]:0x1f108f7)
    at System_Text_RegularExpressions_System_Text_RegularExpressions_Symbolic_SymbolicRegexNode_1_TSet_REF_Create_System_Text_RegularExpressions_Symbolic_SymbolicRegexBuilder_1_TSet_REF_System_Text_RegularExpressions_Symbolic_SymbolicRegexNodeKind_System_Text_RegularExpressions_Symbolic_SymbolicRegexNode_1_TSet_REF_System_Text_RegularExpressions_Symbolic_SymbolicRegexNode_1_TSet_REF_int_int_TSet_REF_System_Text_RegularExpressions_Symbolic_SymbolicRegexInfo (http://127.0.0.1:49169/_framework/dotnet.native.wasm:wasm-function[94120]:0x1a8bd5c)
    at System_Text_RegularExpressions_System_Text_RegularExpressions_Symbolic_SymbolicRegexNode_1_TSet_REF_CreateLoop_System_Text_RegularExpressions_Symbolic_SymbolicRegexBuilder_1_TSet_REF_System_Text_RegularExpressions_Symbolic_SymbolicRegexNode_1_TSet_REF_int_int_bool (http://127.0.0.1:49169/_framework/dotnet.native.wasm:wasm-function[94141]:0x1a8cea7)
    at System_Text_RegularExpressions_System_Text_RegularExpressions_Symbolic_SymbolicRegexBuilder_1_TSet_REF_CreateLoop_System_Text_RegularExpressions_Symbolic_SymbolicRegexNode_1_TSet_REF_bool_int_int (http://127.0.0.1:49169/_framework/dotnet.native.wasm:wasm-function[94071]:0x1a87de6)
    at System_Text_RegularExpressions_System_Text_RegularExpressions_Symbolic_RegexNodeConverter_ConvertToSymbolicRegexNode_System_Text_RegularExpressions_RegexNode (http://127.0.0.1:49169/_framework/dotnet.native.wasm:wasm-function[94067]:0x1a86cf0)
    at System_Text_RegularExpressions_System_Text_RegularExpressions_Symbolic_SymbolicRegexRunnerFactory__ctor_System_Text_RegularExpressions_RegexTree_System_Text_RegularExpressions_RegexOptions_System_TimeSpan (http://127.0.0.1:49169/_framework/dotnet.native.wasm:wasm-function[93494]:0x1a4d068)
    at System_Text_RegularExpressions_System_Text_RegularExpressions_Regex__ctor_string_System_Text_RegularExpressions_RegexOptions_System_TimeSpan_System_Globalization_CultureInfo (http://127.0.0.1:49169/_framework/dotnet.native.wasm:wasm-function[93487]:0x1a4cc8e)
    at System_Text_RegularExpressions_System_Text_RegularExpressions_Regex__ctor_string_System_Text_RegularExpressions_RegexOptions (http://127.0.0.1:49169/_framework/dotnet.native.wasm:wasm-function[93486]:0x1a4cbe3)
    at System_Text_RegularExpressions_Tests_System_Text_RegularExpressions_Tests_GetGroupNamesTests_GroupNumberFromName_InvalidName_ReturnsMinusOne_string_string_System_Text_RegularExpressions_RegexOptions (http://127.0.0.1:49169/_framework/dotnet.native.wasm:wasm-function[95850]:0x1b9c7a8)
    at aot_instances_aot_wrapper_gsharedvt_out_sig_void_this_objobji4 (http://127.0.0.1:49169/_framework/dotnet.native.wasm:wasm-function[105794]:0x1f6037e)

Known issue validation

Build: 🔎 https://dev.azure.com/dnceng-public/public/_build/results?buildId=1107614
Error message validated: [interp.c:2737]
Result validation: ✅ Known issue matched with the provided build.
Validation performed at: 7/29/2025 10:27:18 AM UTC

Report

Build Definition Test Pull Request
1134095 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1133869 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1133715 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1133415 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1133193 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1132919 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1132478 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1132454 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1132305 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1132127 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1132133 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution #117585
1131882 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1131505 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1131491 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1130996 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1130729 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1130610 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1130379 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1129517 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1129101 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1129055 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1128945 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1128703 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1128424 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1127938 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1127398 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1126859 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1126567 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1126311 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1125728 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1125220 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1124846 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1124754 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1124626 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1124606 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1124503 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1124063 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1123492 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1122948 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1122352 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1121801 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1121266 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1120869 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1119240 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1118935 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1118830 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1118741 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1118622 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1118287 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1117612 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1117080 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1116605 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1116101 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1115438 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1115257 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1114699 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution #117585
1114686 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1113991 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1113411 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1112651 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1112367 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1112200 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1112098 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1111945 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1111636 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1111091 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1110710 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1110214 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1110201 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1109817 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1109292 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution
1108891 dotnet/runtime WasmTestOnChrome-ST-System.Text.RegularExpressions.Tests.WorkItemExecution

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
4 22 72

Activity

  1. removed
    untriagedNew issue has not been triaged by the area owner
    on Jul 11, 2025
  2. added
    needs-area-labelAn area label is needed to ensure this gets routed to the appropriate area owners
    on Jul 11, 2025
  3. added
    arch-wasmWebAssembly architecture
    and removed
    needs-area-labelAn area label is needed to ensure this gets routed to the appropriate area owners
    on Jul 11, 2025
  4. added this to the 10.0.0 milestone on Jul 11, 2025
  5. lewing commented on Jul 11, 2025

    @lewing
    MemberAuthor

    Appears to be a regular failure in runtime-extra-platforms rolling build in the high-resource AOT lane

  6. lewing commented on Jul 11, 2025

    @lewing
    MemberAuthor
  7. pavelsavara commented on Jul 18, 2025

    @pavelsavara
    Member

    if (need_wrapper) {
    MonoMethod *wrapper = mini_get_gsharedvt_out_sig_wrapper (sig);
    jit_wrapper = mono_jit_compile_method_jit_only (wrapper, error);
    mono_error_assert_ok (error);
    }

    Maybe we can print the actual error here ^^

    And I wonder what makes this WASM only error, maybe this ?

    //FIXME mini_jit_info_table_find doesn't work yet under wasm due to code_start/code_end issues.
    #ifndef HOST_WASM
    if ((method->wrapper_type == MONO_WRAPPER_WRITE_BARRIER || method->wrapper_type == MONO_WRAPPER_ALLOC)) {
    /*
    * SGEN requires the JIT info for these methods to be registered, see is_ip_in_managed_allocator ().
    */
    MonoJitInfo *ji = mini_jit_info_table_find (code);
    g_assert (ji);
    }
    #endif

  8. self-assigned this
    on Jul 18, 2025
  9. changed the title [-][wasm][aot] System.Text.RegularExpressions failure[/-] [+][wasm][aot] gsharedvt_out_sig - RegularExpressions.Symbolic.SymbolicRegexBuilder[/+] on Jul 29, 2025
  10. added
    Known Build ErrorUse this to report build issues in the .NET Helix tab
    and removed
    Known Build ErrorUse this to report build issues in the .NET Helix tab
    on Jul 29, 2025
  11. 5 remaining items

  12. pavelsavara commented on Aug 6, 2025

    @pavelsavara
    Member

    [MONO] AOT NOT FOUND: (wrapper other) object:gsharedvt_out_sig (intptr,System.Text.RegularExpressions.Symbolic.SymbolicRegexBuilder'1/NodeCacheKey<object>&,intptr).

    jit_call: SymbolicRegexBuilder.NodeCacheKey.Equals()

    System.Text.RegularExpressions.Symbolic.SymbolicRegexBuilder'1/NodeCacheKey<System.Text.RegularExpressions.Symbolic.BDD>:Equals (System.Text.RegularExpressions.Symbolic.SymbolicRegexBuilder'1/NodeCacheKey<System.Text.RegularExpressions.Symbolic.BDD>)
    

    Ideal call stack (captured on windows)

    SymbolicRegexBuilder<Symbolic.BDD>.NodeCacheKey.Equals(Symbolic.SymbolicRegexBuilder<Symbolic.BDD>.NodeCacheKey other)
    GenericEqualityComparer<Symbolic.SymbolicRegexBuilder<Symbolic.BDD>.NodeCacheKey>.Equals(Symbolic.SymbolicRegexBuilder<Symbolic.BDD>.NodeCacheKey x, Symbolic.SymbolicRegexBuilder<Symbolic.BDD>.NodeCacheKey y)
    Dictionary<Symbolic.SymbolicRegexBuilder<Symbolic.BDD>.NodeCacheKey, Symbolic.SymbolicRegexNode<Symbolic.BDD>>.FindValue(Symbolic.SymbolicRegexBuilder<Symbolic.BDD>.NodeCacheKey key)
    Dictionary<Symbolic.SymbolicRegexBuilder<Symbolic.BDD>.NodeCacheKey, Symbolic.SymbolicRegexNode<Symbolic.BDD>>.TryGetValue(Symbolic.SymbolicRegexBuilder<Symbolic.BDD>.NodeCacheKey key, out Symbolic.SymbolicRegexNode<Symbolic.BDD> value)
    SymbolicRegexNode<Symbolic.BDD>.Create(Symbolic.SymbolicRegexBuilder<Symbolic.BDD> builder, Symbolic.SymbolicRegexNodeKind kind, Symbolic.SymbolicRegexNode<Symbolic.BDD> left, Symbolic.SymbolicRegexNode<Symbolic.BDD> right, int lower, int upper, Symbolic.BDD set, Symbolic.SymbolicRegexInfo info)
    SymbolicRegexNode<Symbolic.BDD>.CreateConcat(Symbolic.SymbolicRegexBuilder<Symbolic.BDD> builder, Symbolic.SymbolicRegexNode<Symbolic.BDD> left, Symbolic.SymbolicRegexNode<Symbolic.BDD> right)
    SymbolicRegexNode<Symbolic.BDD>.AddFixedLengthMarkers(Symbolic.SymbolicRegexBuilder<Symbolic.BDD> builder, int lengthSoFar)
    SymbolicRegexNode<Symbolic.BDD>.AddFixedLengthMarkers(Symbolic.SymbolicRegexBuilder<Symbolic.BDD> builder, int lengthSoFar)
    SymbolicRegexRunnerFactory.SymbolicRegexRunnerFactory(RegexTree regexTree, RegexOptions options, System.TimeSpan matchTimeout)
    Regex.Regex(string pattern, RegexOptions options, System.TimeSpan matchTimeout, System.Globalization.CultureInfo culture)
    Regex.Regex(string pattern, RegexOptions options)
    

    Minimal repro is
    new Regex("[a-z0-9]+", RegexOptions.NonBacktracking);

    [MONO] AOT NOT FOUND: System.Collections.Generic.GenericEqualityComparer`1<System.Text.RegularExpressions.Symbolic.SymbolicRegexBuilder`1/NodeCacheKey<System.Text.RegularExpressions.Symbolic.BDD>>:Equals (System.Text.RegularExpressions.Symbolic.SymbolicRegexBuilder`1/NodeCacheKey<System.Text.RegularExpressions.Symbolic.BDD>,System.Text.RegularExpressions.Symbolic.SymbolicRegexBuilder`1/NodeCacheKey<System.Text.RegularExpressions.Symbolic.BDD>).
    
  13. pavelsavara commented on Aug 6, 2025

    @pavelsavara
    Member

    There are following methods in the AOT's .wasm file

    func    $aot_instances_System_Text_RegularExpressions_Symbolic_SymbolicRegexBuilder_1_NodeCacheKey_System_Text_RegularExpressions_Symbolic_BitVector_Equals_System_Text_RegularExpressions_Symbolic_SymbolicRegexBuilder_1_NodeCacheKey_System_Text_RegularExpressions_Symbolic_BitVector
    func $ut_aot_instances_System_Text_RegularExpressions_Symbolic_SymbolicRegexBuilder_1_NodeCacheKey_System_Text_RegularExpressions_Symbolic_BitVector_Equals_System_Text_RegularExpressions_Symbolic_SymbolicRegexBuilder_1_NodeCacheKey_System_Text_RegularExpressions_Symbolic_BitVector
    func $ut_aot_instances_System_Text_RegularExpressions_Symbolic_SymbolicRegexBuilder_1_NodeCacheKey_ulong_Equals_object
    func $ut_aot_instances_System_Text_RegularExpressions_Symbolic_SymbolicRegexBuilder_1_NodeCacheKey_ulong_Equals_System_Text_RegularExpressions_Symbolic_SymbolicRegexBuilder_1_NodeCacheKey_ulong
    
  14. pavelsavara commented on Aug 11, 2025

    @pavelsavara
  15. pavelsavara commented on Aug 11, 2025

    @pavelsavara
  16. lewing commented on Aug 16, 2025

    @lewing
    MemberAuthor

    @lambdageek just in case you have any ideas

  17. pavelsavara commented on Aug 18, 2025

    @pavelsavara
    Member

    Compilation log

    Adding method bool Builder`1/Key<TSet_GSHAREDVT>:Equals (Builder`1/Key<TSet_GSHAREDVT>).
    Adding generic instance Builder`1<BDD> [typespec].
    void Builder`1<BDD>:.ctor () SKIP: mono_method_is_generic_sharable_full Builder`1<BDD> [typespec].
    Adding generic instance Builder`1/Key<BDD> [typespec].
    bool Builder`1/Key<BDD>:Equals (Builder`1/Key<BDD>) SKIP: mono_method_is_generic_sharable_full Builder`1/Key<BDD> [typespec].
     Adding generic instance Builder`1/Node<BDD> [field].
    Adding generic instance System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>> [typespec].
     use_gsharedvt=TRUE System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>> [typespec].
    System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>> System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>>:get_Default () SKIP: mono_method_is_generic_sharable_full System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>> [typespec].
    System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>> System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>>:CreateComparer () SKIP: mono_method_is_generic_sharable_full System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>> [typespec].
    bool System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>>:Equals (Builder`1/Key<BDD>,Builder`1/Key<BDD>) SKIP: mono_method_is_generic_sharable_full System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>> [typespec].
    int System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>>:GetHashCode (Builder`1/Key<BDD>) SKIP: mono_method_is_generic_sharable_full System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>> [typespec].
    int System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>>:IndexOf (Builder`1/Key<BDD>[],Builder`1/Key<BDD>,int,int) SKIP: mono_method_is_generic_sharable_full System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>> [typespec].
    int System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>>:LastIndexOf (Builder`1/Key<BDD>[],Builder`1/Key<BDD>,int,int) SKIP: mono_method_is_generic_sharable_full System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>> [typespec].
    void System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>>:.ctor () SKIP: mono_method_is_generic_sharable_full System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>> [typespec].
     PAVEL1 System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>> [typespec].
     PAVEL2 System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>> [typespec].
    Adding generic instance System.Collections.Generic.GenericEqualityComparer`1<Builder`1/Key<BDD>> [GenericEqualityComparer<T>].
     use_gsharedvt=TRUE System.Collections.Generic.GenericEqualityComparer`1<Builder`1/Key<BDD>> [GenericEqualityComparer<T>].
    bool System.Collections.Generic.GenericEqualityComparer`1<Builder`1/Key<BDD>>:Equals (Builder`1/Key<BDD>,Builder`1/Key<BDD>) SKIP: mono_method_is_generic_sharable_full System.Collections.Generic.GenericEqualityComparer`1<Builder`1/Key<BDD>> [GenericEqualityComparer<T>].
    int System.Collections.Generic.GenericEqualityComparer`1<Builder`1/Key<BDD>>:GetHashCode (Builder`1/Key<BDD>) SKIP: mono_method_is_generic_sharable_full System.Collections.Generic.GenericEqualityComparer`1<Builder`1/Key<BDD>> [GenericEqualityComparer<T>].
    bool System.Collections.Generic.GenericEqualityComparer`1<Builder`1/Key<BDD>>:Equals (object) SKIP: mono_method_is_generic_sharable_full System.Collections.Generic.GenericEqualityComparer`1<Builder`1/Key<BDD>> [GenericEqualityComparer<T>].
    int System.Collections.Generic.GenericEqualityComparer`1<Builder`1/Key<BDD>>:GetHashCode () SKIP: mono_method_is_generic_sharable_full System.Collections.Generic.GenericEqualityComparer`1<Builder`1/Key<BDD>> [GenericEqualityComparer<T>].
    void System.Collections.Generic.GenericEqualityComparer`1<Builder`1/Key<BDD>>:.ctor () SKIP: mono_method_is_generic_sharable_full System.Collections.Generic.GenericEqualityComparer`1<Builder`1/Key<BDD>> [GenericEqualityComparer<T>].
    
    Adding method bool Builder`1/Key<TSet_GSHAREDVT>:Equals (Builder`1/Key<TSet_GSHAREDVT>).
    Adding generic instance Builder`1<BDD> [typespec].
    void Builder`1<BDD>:.ctor () SKIP: mono_method_is_generic_sharable_full Builder`1<BDD> [typespec].
    Adding generic instance Builder`1/Key<BDD> [typespec].
    bool Builder`1/Key<BDD>:Equals (Builder`1/Key<BDD>) SKIP: mono_method_is_generic_sharable_full Builder`1/Key<BDD> [typespec].
     Adding generic instance Builder`1/Node<BDD> [field].
    Adding generic instance System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>> [typespec].
     use_gsharedvt=TRUE System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>> [typespec].
    System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>> System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>>:get_Default () SKIP: mono_method_is_generic_sharable_full System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>> [typespec].
    System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>> System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>>:CreateComparer () SKIP: mono_method_is_generic_sharable_full System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>> [typespec].
    bool System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>>:Equals (Builder`1/Key<BDD>,Builder`1/Key<BDD>) SKIP: mono_method_is_generic_sharable_full System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>> [typespec].
    int System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>>:GetHashCode (Builder`1/Key<BDD>) SKIP: mono_method_is_generic_sharable_full System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>> [typespec].
    int System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>>:IndexOf (Builder`1/Key<BDD>[],Builder`1/Key<BDD>,int,int) SKIP: mono_method_is_generic_sharable_full System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>> [typespec].
    int System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>>:LastIndexOf (Builder`1/Key<BDD>[],Builder`1/Key<BDD>,int,int) SKIP: mono_method_is_generic_sharable_full System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>> [typespec].
    void System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>>:.ctor () SKIP: mono_method_is_generic_sharable_full System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>> [typespec].
     PAVEL1 System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>> [typespec].
     PAVEL2 System.Collections.Generic.EqualityComparer`1<Builder`1/Key<BDD>> [typespec].
    Adding generic instance System.Collections.Generic.GenericEqualityComparer`1<Builder`1/Key<BDD>> [GenericEqualityComparer<T>].
     use_gsharedvt=TRUE System.Collections.Generic.GenericEqualityComparer`1<Builder`1/Key<BDD>> [GenericEqualityComparer<T>].
    bool System.Collections.Generic.GenericEqualityComparer`1<Builder`1/Key<BDD>>:Equals (Builder`1/Key<BDD>,Builder`1/Key<BDD>) SKIP: mono_method_is_generic_sharable_full System.Collections.Generic.GenericEqualityComparer`1<Builder`1/Key<BDD>> [GenericEqualityComparer<T>].
    int System.Collections.Generic.GenericEqualityComparer`1<Builder`1/Key<BDD>>:GetHashCode (Builder`1/Key<BDD>) SKIP: mono_method_is_generic_sharable_full System.Collections.Generic.GenericEqualityComparer`1<Builder`1/Key<BDD>> [GenericEqualityComparer<T>].
    bool System.Collections.Generic.GenericEqualityComparer`1<Builder`1/Key<BDD>>:Equals (object) SKIP: mono_method_is_generic_sharable_full System.Collections.Generic.GenericEqualityComparer`1<Builder`1/Key<BDD>> [GenericEqualityComparer<T>].
    int System.Collections.Generic.GenericEqualityComparer`1<Builder`1/Key<BDD>>:GetHashCode () SKIP: mono_method_is_generic_sharable_full System.Collections.Generic.GenericEqualityComparer`1<Builder`1/Key<BDD>> [GenericEqualityComparer<T>].
    void System.Collections.Generic.GenericEqualityComparer`1<Builder`1/Key<BDD>>:.ctor () SKIP: mono_method_is_generic_sharable_full System.Collections.Generic.GenericEqualityComparer`1<Builder`1/Key<BDD>> [GenericEqualityComparer<T>].
    Adding generic instance System.IEquatable`1<BDD> [typespec].
    bool System.IEquatable`1<BDD>:Equals (BDD) SKIP: mono_method_is_generic_sharable_full System.IEquatable`1<BDD> [typespec].
     Adding method System.Collections.Generic.EqualityComparer`1<T_INST> System.Collections.Generic.EqualityComparer`1<T_INST>:get_Default ().
    Adding method (wrapper other) byte object:gsharedvt_in_sig (Builder`1/Key<object>,Builder`1/Key<object>,intptr).
    Adding method (wrapper other) void object:gsharedvt_out_sig (intptr,Builder`1/Key<object>&,intptr).
      Adding method System.Collections.Generic.EqualityComparer`1<T_INST> System.Collections.Generic.EqualityComparer`1<T_INST>:CreateComparer ().
       Adding method void System.Collections.Generic.ObjectEqualityComparer`1<T_INST>:.ctor ().
        Adding method void System.Collections.Generic.EqualityComparer`1<T_INST>:.ctor ().
    

    execution log

    [MONO] AOT NOT FOUND: System.Collections.Generic.GenericEqualityComparer`1<Builder`1/Key<BDD>>:Equals (Builder`1/Key<BDD>,Builder`1/Key<BDD>).
    [MONO] AOT: FOUND method (wrapper other) object:gsharedvt_in_sig (Builder`1/Key<object>,Builder`1/Key<object>,intptr) [0x62e0 - 0x62e1 0xfa6d0]
    [MONO] AOT: FOUND method Builder`1/Key:Equals (Builder`1/Key<TSet>) [0x3559 - 0x355a 0x7cec0]
    jit_call: Builder`1/Key<BDD>:Equals (Builder`1/Key<BDD>)
    [MONO] AOT NOT FOUND: (wrapper other) object:gsharedvt_out_sig (intptr,Builder`1/Key<object>&,intptr).
    Attempting to JIT compile method '(wrapper other) void object:gsharedvt_out_sig (intptr,Builder`1/Key<object>&,intptr)' while running in aot-only mode.
    
  18. pavelsavara commented on Aug 18, 2025

    @pavelsavara
    Member

    Note that object:gsharedvt_out_sig (intptr,Builder`1/Key<object>&,intptr) is added during AOT but not found during execution.

  19. pavelsavara commented on Aug 18, 2025

    @pavelsavara
    Member
    Adding method bool Builder`1/Key<TSet_GSHAREDVT>:Equals (Builder`1/Key<TSet_GSHAREDVT>).
    
    converting llvm gshared method bool Builder`1/Key<TSet_REF>:Equals (Builder`1/Key<TSet_REF>)
    method to IR Builder`1/Key<TSet_REF>:Equals (Builder`1/Key<TSet_REF>)
    bool Builder`1/Key<TSet_REF>:Equals (Builder`1/Key<TSet_REF>) emitted as Wasm_Browser_Sample_Builder_1_Key_TSet_REF_Equals_Builder_1_Key_TSet_REF
    call add_extra_method: (wrapper other) void object:gsharedvt_out_sig (intptr,Builder`1/Key<object>&,intptr) sig: byte(Builder`1/Key<TSet_REF>) 
    Adding method (wrapper other) void object:gsharedvt_out_sig (intptr,Builder`1/Key<object>&,intptr).
    
    converting llvm gsharedvt method bool Builder`1/Key<TSet_GSHAREDVT>:Equals (Builder`1/Key<TSet_GSHAREDVT>)
    gsharedvt failed for method .Key.Equals/1 opcode nop D:\runtime\src\mono\mono\mini\method-to-ir.c:7052
            reason: cfg->gsharedvt_min && mini_is_gsharedvt_variable_signature()
    

    Possibly this could be solved by adding class constraint
    SymbolicRegexBuilder<TSet> where TSet : class, IComparable<TSet>, IEquatable<TSet>.
    Unfortunately System.Text.RegularExpressions.Symbolic.BitVector is a struct and makes the NodeCacheKey truly variable size.

  20. pavelsavara commented on Aug 19, 2025

    @pavelsavara
    Member

    Repro that doesn't depend on special treatment of System.Collections.Generic in the Mono AOT.
    It also reproduces with <WasmDedup>false</WasmDedup>

    using System;
    using System.Runtime.CompilerServices;
    using System.Runtime.InteropServices;
    using System.Runtime.InteropServices.JavaScript;
    using System.Text.RegularExpressions;
    using System.Threading.Tasks;
    
    
    namespace Sample;
    
    public class Test
    {
        static int Main(string[] args)
        {
            var builder = new Builder<BDD>();
            var key = new Builder<BDD>.Key();
            var c = EqualityFoo<Builder<BDD>.Key>.Default;
            Console.WriteLine("Comparer " + c.GetType().FullName);
            // this will fail
            var e = c.Bar(key, key);
            return e ? 1 : 0;
        }
    }
    
    public interface IFoo<T> where T : allows ref struct
    {
        bool Baz(T other);
    }
    
    public abstract class EqualityFoo<T>  where T : IFoo<T>
    {
        private static EqualityFoo<T> CreateComparer()
        {
            return new GenericEqualityFoo<T>();
        }
    
        public abstract bool Bar(T x, T y);
    
        public static EqualityFoo<T> Default { get; } = CreateComparer();
    }
    
    public sealed partial class GenericEqualityFoo<T> : EqualityFoo<T> where T : IFoo<T>
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public override bool Bar(T x, T y)
        {
            if (x != null)
            {
                if (y != null) return x.Baz(y);
                return false;
            }
            if (y != null) return false;
            return true;
        }
    }
    
    public sealed class BDD : IFoo<BDD>
    {
        public bool Baz(BDD other) => throw new NotImplementedException();
    }
    
    public sealed class Builder<TSet> where TSet : IFoo<TSet>
    {
        public sealed class Node
        {
            public bool Dummy(TSet other) => throw new NotImplementedException();
        }
    
        public readonly struct Key : IFoo<Key>
        {
            public readonly Node Left;
    
            public bool Baz(Key other)
            {
                return false;
            }
        }
    }
  21. pavelsavara commented on Aug 21, 2025

    @pavelsavara
    Member

    We can't compile the
    gsharedvt_out_sig (intptr,Sample.Builder`1/Key<object>&,intptr)
    or gsharedvt_in_sig (Sample.Builder`1/Key<object>,Sample.Builder`1/Key<object>,intptr)

    because Sample.Builder`1/Key<object> -> has_failure == 1

    if (mono_class_is_ginst (field_class) && !mono_verifier_class_is_valid_generic_instantiation (field_class)) {
    mono_class_set_type_load_failure (klass, "Field '%s' is an invalid generic instantiation of type %s", field->name, mono_type_get_full_name (field_class));

    Field 'Left' is an invalid generic instantiation of type Sample.Builder`1+Node[System.Object]

    This is because System.Object parameter doesn't satisfy IFoo<T> constraint of the Builder<TSet> where TSet : IFoo<TSet>

    Image

    But that is non-sense

    Image
  22. BrzVlad commented on Aug 21, 2025

    @BrzVlad
    Member

    We try to share gsharedvt wrappers as much as possible, so I believe we reduce all the reference type arguments to Object, because it doesn't impact the signature in any way. So for these wrappers you should aim to ignore the type constraints.

  23. pavelsavara commented on Aug 21, 2025

    @pavelsavara
    Member

    We try to share gsharedvt wrappers as much as possible, so I believe we reduce all the reference type arguments to Object, because it doesn't impact the signature in any way. So for these wrappers you should aim to ignore the type constraints.

    I believe that mini_get_underlying_signature via get_wrapper_shared_type_full is responsible for creating the new signature.
    So possibly I can strip constraints there.

    @BrzVlad how do I do it ?

    klass = mono_class_from_mono_type_internal (t);
    orig_ctx = &mono_class_get_generic_class (klass)->context;
    memset (&ctx, 0, sizeof (MonoGenericContext));
    inst = orig_ctx->class_inst;
    if (inst) {
    g_assert (inst->type_argc < 16);
    for (guint i = 0; i < inst->type_argc; ++i)
    args [i] = get_wrapper_shared_type_full (inst->type_argv [i], TRUE);
    ctx.class_inst = mono_metadata_get_generic_inst (inst->type_argc, args);
    }
    inst = orig_ctx->method_inst;
    if (inst) {
    g_assert (inst->type_argc < 16);
    for (guint i = 0; i < inst->type_argc; ++i)
    args [i] = get_wrapper_shared_type_full (inst->type_argv [i], TRUE);
    ctx.method_inst = mono_metadata_get_generic_inst (inst->type_argc, args);
    }
    klass = mono_class_inflate_generic_class_checked (mono_class_get_generic_class (klass)->container_class, &ctx, error);

  24. BrzVlad commented on Aug 22, 2025

    @BrzVlad
    Member

    The easiest approach I think would be to add a new bit field to MonoClass, something like skip_generic_constraints. When we artificially inflate the generic type with object here we could set this flag here. Then when we do class init we could skip the type constraint checks. I believe this should work ?

  25. locked and limited conversation to collaborators on Sep 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions