Skip to content
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

Assertion failed 'genFuncletInfo.fiSpDelta1 >= -240' during 'Generate code' #65996

Closed
kunalspathak opened this issue Mar 1, 2022 · 3 comments · Fixed by #66124
Closed

Assertion failed 'genFuncletInfo.fiSpDelta1 >= -240' during 'Generate code' #65996

kunalspathak opened this issue Mar 1, 2022 · 3 comments · Fixed by #66124
Assignees
Labels
arch-arm64 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI os-linux Linux OS (any supported distro)
Milestone

Comments

@kunalspathak
Copy link
Member

// Found by Antigen

using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
public class TestClass
{
    public struct S1
    {
        public struct S1_D1_F1
        {
            public decimal decimal_0;
            public long long_1;
            public uint uint_2;
        }
        public struct S1_D1_F2
        {
            public S1.S1_D1_F1 s1_s1_d1_f1_3;
            public S1.S1_D1_F1 s1_s1_d1_f1_4;
        }
        public sbyte sbyte_5;
    }
    public struct S2
    {
        public struct S2_D1_F1
        {
            public double double_7;
        }
    }
    static int s_int_15 = -1;
    static ulong s_ulong_22 = 2;
    static S1.S1_D1_F2 s_s1_s1_d1_f2_24 = new S1.S1_D1_F2();
    static S1 s_s1_25 = new S1();
    static S2.S2_D1_F1 s_s2_s2_d1_f1_26 = new S2.S2_D1_F1();
    static S2 s_s2_27 = new S2();
    char char_30 = 'Y';
    int int_34 = -2147483648;
    ushort ushort_39 = 1;
    ulong ulong_41 = 3;
    S1.S1_D1_F2 s1_s1_d1_f2_43 = new S1.S1_D1_F2();
    S1 s1_44 = new S1();
    S2.S2_D1_F1 s2_s2_d1_f1_45 = new S2.S2_D1_F1();
    S2 s2_46 = new S2();
    static int s_loopInvariant = 8;
    public decimal LeafMethod3()
    {
        unchecked
        {
            return 15+4;
        }
    }
    [MethodImpl(MethodImplOptions.NoInlining)]
    public double LeafMethod4()
    {
        unchecked
        {
            return 15+4;
        }
    }
    public int LeafMethod6()
    {
        unchecked
        {
            return int_34 <<= s_int_15 >>= 15+4;
        }
    }
    [MethodImpl(MethodImplOptions.NoInlining)]
    public sbyte LeafMethod8()
    {
        unchecked
        {
            return 15%4;
        }
    }
    [MethodImpl(MethodImplOptions.NoInlining)]
    public ushort LeafMethod11()
    {
        unchecked
        {
            return 15-4;
        }
    }
    [MethodImpl(MethodImplOptions.NoInlining)]
    public uint LeafMethod12()
    {
        unchecked
        {
            return s1_s1_d1_f2_43.s1_s1_d1_f1_3.uint_2 <<= int_34;
        }
    }
    public S1.S1_D1_F2 LeafMethod15()
    {
        unchecked
        {
            return s_s1_s1_d1_f2_24;
        }
    }
    public S2 Method1(ref S2 p_s2_47)
    {
        unchecked
        {
            bool bool_48 = false;
            double double_52 = 1.0909090909090908;
            short short_53 = -2;
            int int_54 = 5;
            ushort ushort_59 = 5;
            ulong ulong_61 = 2;
            S1 s1_64 = new S1();
            switch (char_30)
            {
                case '8':
                {
                    try
                    {
                        if ((ulong_41 = 15+4)* s_ulong_22<= (15-4* (ulong_61 &= ulong_61)& s_ulong_22 % 15-4+ 11))
                        {
                        }
                        else
                        {
                        }
                    }
                    catch (System.InvalidCastException)
                    {
                    }
                    finally
                    {
                        s_s1_s1_d1_f2_24.s1_s1_d1_f1_4.uint_2 |= s_s1_s1_d1_f2_24.s1_s1_d1_f1_3.uint_2 /= LeafMethod12()+ 7;
                    }
                    break;
                }
                case '2':
                {
                    break;
                }
                case '0':
                {
                    int __loopvar1 = s_loopInvariant, __loopSecondaryVar1_0 = s_loopInvariant;
                    for (;;)
                    {
                        if (__loopvar1 > 15+4)
                            break;
                        int __loopvar0 = s_loopInvariant;
                        while (bool_48 = bool_48)
                        {
                            if (__loopvar0 <= 15-4)
                                break;
                            LeafMethod3();
                        }
                        if (short_53 >= (short_53 = 15+4))
                        {
                            s_s1_25.sbyte_5 |= (sbyte)(LeafMethod8() / LeafMethod8() >> 15+4- s1_64.sbyte_5<< LeafMethod6());
                        }
                        else
                        {
                            LeafMethod15();
                        }
                    }
                    double_52 = s2_s2_d1_f1_45.double_7 * LeafMethod4();
                    break;
                }
                default:
                {
                    ushort_59 ^= ushort_39 >>= s_int_15 *= int_54| 15/4- ushort_59 / LeafMethod11()+ 93/ (ushort_39 | LeafMethod11())+ 26+ 37;
                    break;
                }
            }
            return s2_46;
        }
    }
    public S1 Method3(out S1.S1_D1_F2 p_s1_s1_d1_f2_90, ref double p_double_91, uint p_uint_92, ref S2.S2_D1_F1 p_s2_s2_d1_f1_93, S2.S2_D1_F1 p_s2_s2_d1_f1_94, ref S1.S1_D1_F2 p_s1_s1_d1_f2_95, ref S2 p_s2_96, ref S1.S1_D1_F2 p_s1_s1_d1_f2_97, out decimal p_decimal_98, ref S1.S1_D1_F2 p_s1_s1_d1_f2_99, S1.S1_D1_F2 p_s1_s1_d1_f2_100, S2.S2_D1_F1 p_s2_s2_d1_f1_101, S1.S1_D1_F2 p_s1_s1_d1_f2_102, out S2.S2_D1_F1 p_s2_s2_d1_f1_103, out S2 p_s2_104, ref ulong p_ulong_105)
    {
        unchecked
        {
            S1.S1_D1_F2 s1_s1_d1_f2_121 = new S1.S1_D1_F2();
            p_s1_s1_d1_f2_90 = s1_s1_d1_f2_121;
            p_decimal_98 = 15+4;
            p_s2_s2_d1_f1_103 = s_s2_s2_d1_f1_26;
            Method1(ref s2_46);
            return s1_44;
        }
    }
    public void Method0()
    {
        unchecked
        {
            ulong ulong_3041 = 5;
            S1.S1_D1_F1 s1_s1_d1_f1_3042 = new S1.S1_D1_F1();
            S1.S1_D1_F2 s1_s1_d1_f2_3044 = new S1.S1_D1_F2();
            S2.S2_D1_F1 s2_s2_d1_f1_3046 = new S2.S2_D1_F1();
            S2 s2_3047 = new S2();
            s_s2_27 = Method1(ref s_s2_27);
            s1_44 = Method3(out s1_s1_d1_f2_3044, ref s_s2_s2_d1_f1_26.double_7, 15+4, ref s2_s2_d1_f1_45, s_s2_s2_d1_f1_26, ref s1_s1_d1_f2_3044, ref s2_3047, ref s1_s1_d1_f2_43, out s1_s1_d1_f1_3042.decimal_0, ref s_s1_s1_d1_f2_24, s1_s1_d1_f2_3044, s2_s2_d1_f1_3046, s1_s1_d1_f2_3044, out s2_s2_d1_f1_45, out s_s2_27, ref ulong_3041);
            return;
        }
    }
    public static void Main(string[] args)
    {
        new TestClass().Method0();
    }
}
/*
Environment:

set COMPlus_TC_OnStackReplacement=1
set COMPlus_TC_QuickJitForLoops=1
set COMPlus_TC_OnStackReplacement_InitialCounter=1
set COMPlus_OSR_HitLimit=2
set COMPlus_JitRandomOnStackReplacement=15
set COMPlus_JitStress=2
set COMPlus_AltJitName=clrjit_universal_arm64_x64.dll
set COMPlus_AltJit=Method1

Assert failure(PID 98024 [0x00017ee8], Thread: 54984 [0xd6c8]): Assertion failed 'genFuncletInfo.fiSpDelta1 >= -240' in 'TestClass:Method1(byref):S2:this' during 'Generate code' (IL size 387)
    File: D:\git\dotnet-runtime\src\coreclr\jit\codegenarm64.cpp Line: 1620
    Image: d:\git\dotnet-runtime\artifacts\tests\coreclr\windows.x64.Checked\tests\Core_Root\CoreRun.exe
*/
@kunalspathak kunalspathak added arch-arm64 os-linux Linux OS (any supported distro) area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI labels Mar 1, 2022
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Mar 1, 2022
@ghost
Copy link

ghost commented Mar 1, 2022

Tagging subscribers to this area: @JulieLeeMSFT
See info in area-owners.md if you want to be subscribed.

Issue Details
// Found by Antigen

using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
public class TestClass
{
    public struct S1
    {
        public struct S1_D1_F1
        {
            public decimal decimal_0;
            public long long_1;
            public uint uint_2;
        }
        public struct S1_D1_F2
        {
            public S1.S1_D1_F1 s1_s1_d1_f1_3;
            public S1.S1_D1_F1 s1_s1_d1_f1_4;
        }
        public sbyte sbyte_5;
    }
    public struct S2
    {
        public struct S2_D1_F1
        {
            public double double_7;
        }
    }
    static int s_int_15 = -1;
    static ulong s_ulong_22 = 2;
    static S1.S1_D1_F2 s_s1_s1_d1_f2_24 = new S1.S1_D1_F2();
    static S1 s_s1_25 = new S1();
    static S2.S2_D1_F1 s_s2_s2_d1_f1_26 = new S2.S2_D1_F1();
    static S2 s_s2_27 = new S2();
    char char_30 = 'Y';
    int int_34 = -2147483648;
    ushort ushort_39 = 1;
    ulong ulong_41 = 3;
    S1.S1_D1_F2 s1_s1_d1_f2_43 = new S1.S1_D1_F2();
    S1 s1_44 = new S1();
    S2.S2_D1_F1 s2_s2_d1_f1_45 = new S2.S2_D1_F1();
    S2 s2_46 = new S2();
    static int s_loopInvariant = 8;
    public decimal LeafMethod3()
    {
        unchecked
        {
            return 15+4;
        }
    }
    [MethodImpl(MethodImplOptions.NoInlining)]
    public double LeafMethod4()
    {
        unchecked
        {
            return 15+4;
        }
    }
    public int LeafMethod6()
    {
        unchecked
        {
            return int_34 <<= s_int_15 >>= 15+4;
        }
    }
    [MethodImpl(MethodImplOptions.NoInlining)]
    public sbyte LeafMethod8()
    {
        unchecked
        {
            return 15%4;
        }
    }
    [MethodImpl(MethodImplOptions.NoInlining)]
    public ushort LeafMethod11()
    {
        unchecked
        {
            return 15-4;
        }
    }
    [MethodImpl(MethodImplOptions.NoInlining)]
    public uint LeafMethod12()
    {
        unchecked
        {
            return s1_s1_d1_f2_43.s1_s1_d1_f1_3.uint_2 <<= int_34;
        }
    }
    public S1.S1_D1_F2 LeafMethod15()
    {
        unchecked
        {
            return s_s1_s1_d1_f2_24;
        }
    }
    public S2 Method1(ref S2 p_s2_47)
    {
        unchecked
        {
            bool bool_48 = false;
            double double_52 = 1.0909090909090908;
            short short_53 = -2;
            int int_54 = 5;
            ushort ushort_59 = 5;
            ulong ulong_61 = 2;
            S1 s1_64 = new S1();
            switch (char_30)
            {
                case '8':
                {
                    try
                    {
                        if ((ulong_41 = 15+4)* s_ulong_22<= (15-4* (ulong_61 &= ulong_61)& s_ulong_22 % 15-4+ 11))
                        {
                        }
                        else
                        {
                        }
                    }
                    catch (System.InvalidCastException)
                    {
                    }
                    finally
                    {
                        s_s1_s1_d1_f2_24.s1_s1_d1_f1_4.uint_2 |= s_s1_s1_d1_f2_24.s1_s1_d1_f1_3.uint_2 /= LeafMethod12()+ 7;
                    }
                    break;
                }
                case '2':
                {
                    break;
                }
                case '0':
                {
                    int __loopvar1 = s_loopInvariant, __loopSecondaryVar1_0 = s_loopInvariant;
                    for (;;)
                    {
                        if (__loopvar1 > 15+4)
                            break;
                        int __loopvar0 = s_loopInvariant;
                        while (bool_48 = bool_48)
                        {
                            if (__loopvar0 <= 15-4)
                                break;
                            LeafMethod3();
                        }
                        if (short_53 >= (short_53 = 15+4))
                        {
                            s_s1_25.sbyte_5 |= (sbyte)(LeafMethod8() / LeafMethod8() >> 15+4- s1_64.sbyte_5<< LeafMethod6());
                        }
                        else
                        {
                            LeafMethod15();
                        }
                    }
                    double_52 = s2_s2_d1_f1_45.double_7 * LeafMethod4();
                    break;
                }
                default:
                {
                    ushort_59 ^= ushort_39 >>= s_int_15 *= int_54| 15/4- ushort_59 / LeafMethod11()+ 93/ (ushort_39 | LeafMethod11())+ 26+ 37;
                    break;
                }
            }
            return s2_46;
        }
    }
    public S1 Method3(out S1.S1_D1_F2 p_s1_s1_d1_f2_90, ref double p_double_91, uint p_uint_92, ref S2.S2_D1_F1 p_s2_s2_d1_f1_93, S2.S2_D1_F1 p_s2_s2_d1_f1_94, ref S1.S1_D1_F2 p_s1_s1_d1_f2_95, ref S2 p_s2_96, ref S1.S1_D1_F2 p_s1_s1_d1_f2_97, out decimal p_decimal_98, ref S1.S1_D1_F2 p_s1_s1_d1_f2_99, S1.S1_D1_F2 p_s1_s1_d1_f2_100, S2.S2_D1_F1 p_s2_s2_d1_f1_101, S1.S1_D1_F2 p_s1_s1_d1_f2_102, out S2.S2_D1_F1 p_s2_s2_d1_f1_103, out S2 p_s2_104, ref ulong p_ulong_105)
    {
        unchecked
        {
            S1.S1_D1_F2 s1_s1_d1_f2_121 = new S1.S1_D1_F2();
            p_s1_s1_d1_f2_90 = s1_s1_d1_f2_121;
            p_decimal_98 = 15+4;
            p_s2_s2_d1_f1_103 = s_s2_s2_d1_f1_26;
            Method1(ref s2_46);
            return s1_44;
        }
    }
    public void Method0()
    {
        unchecked
        {
            ulong ulong_3041 = 5;
            S1.S1_D1_F1 s1_s1_d1_f1_3042 = new S1.S1_D1_F1();
            S1.S1_D1_F2 s1_s1_d1_f2_3044 = new S1.S1_D1_F2();
            S2.S2_D1_F1 s2_s2_d1_f1_3046 = new S2.S2_D1_F1();
            S2 s2_3047 = new S2();
            s_s2_27 = Method1(ref s_s2_27);
            s1_44 = Method3(out s1_s1_d1_f2_3044, ref s_s2_s2_d1_f1_26.double_7, 15+4, ref s2_s2_d1_f1_45, s_s2_s2_d1_f1_26, ref s1_s1_d1_f2_3044, ref s2_3047, ref s1_s1_d1_f2_43, out s1_s1_d1_f1_3042.decimal_0, ref s_s1_s1_d1_f2_24, s1_s1_d1_f2_3044, s2_s2_d1_f1_3046, s1_s1_d1_f2_3044, out s2_s2_d1_f1_45, out s_s2_27, ref ulong_3041);
            return;
        }
    }
    public static void Main(string[] args)
    {
        new TestClass().Method0();
    }
}
/*
Environment:

set COMPlus_TC_OnStackReplacement=1
set COMPlus_TC_QuickJitForLoops=1
set COMPlus_TC_OnStackReplacement_InitialCounter=1
set COMPlus_OSR_HitLimit=2
set COMPlus_JitRandomOnStackReplacement=15
set COMPlus_JitStress=2
set COMPlus_AltJitName=clrjit_universal_arm64_x64.dll
set COMPlus_AltJit=Method1

Assert failure(PID 98024 [0x00017ee8], Thread: 54984 [0xd6c8]): Assertion failed 'genFuncletInfo.fiSpDelta1 >= -240' in 'TestClass:Method1(byref):S2:this' during 'Generate code' (IL size 387)
    File: D:\git\dotnet-runtime\src\coreclr\jit\codegenarm64.cpp Line: 1620
    Image: d:\git\dotnet-runtime\artifacts\tests\coreclr\windows.x64.Checked\tests\Core_Root\CoreRun.exe
*/


<table>
  <tr>
    <th align="left">Author:</th>
    <td>kunalspathak</td>
  </tr>
  <tr>
    <th align="left">Assignees:</th>
    <td>-</td>
  </tr>
  <tr>
    <th align="left">Labels:</th>
    <td>

`arch-arm64`, `os-linux`, `area-CodeGen-coreclr`

</td>
  </tr>
  <tr>
    <th align="left">Milestone:</th>
    <td>-</td>
  </tr>
</table>
</details>

@kunalspathak
Copy link
Member Author

@dotnet/jit-contrib

@BruceForstall BruceForstall removed the untriaged New issue has not been triaged by the area owner label Mar 1, 2022
@BruceForstall BruceForstall added this to the 7.0.0 milestone Mar 1, 2022
@AndyAyersMS
Copy link
Member

Failure is in OSR funclet codegen:

Funclet prolog / epilog info
                        Save regs: [x19-x26 fp lr]
                          OSR Pad: 432
  SP to FP/LR save location delta: 512
             SP to PSP slot delta: 16
    SP to callee-saved area delta: 24
      Caller SP to PSP slot delta: -520
                       Frame type: 5
                       SP delta 1: -528
                       SP delta 2: 0

AndyAyersMS added a commit to AndyAyersMS/runtime that referenced this issue Mar 3, 2022
… frame

Because OSR funclet frames must pad with Tier0 frame size, initial SP delta
may exceed 240 bytes.

Fixes dotnet#65996.
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Mar 3, 2022
AndyAyersMS added a commit that referenced this issue Mar 19, 2022
#66124)

Because OSR funclet frames must pad with Tier0 frame size, initial SP delta
may exceed 240 bytes.

Fixes #65996.
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Mar 19, 2022
radekdoulik pushed a commit to radekdoulik/runtime that referenced this issue Mar 30, 2022
dotnet#66124)

Because OSR funclet frames must pad with Tier0 frame size, initial SP delta
may exceed 240 bytes.

Fixes dotnet#65996.
@ghost ghost locked as resolved and limited conversation to collaborators Apr 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-arm64 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI os-linux Linux OS (any supported distro)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants