public static void call_finally()
 {
     try {
         JitClass.throw_ex();
     } finally {
         finally_called = true;
     }
 }
 public static int test_0_throw()
 {
     // Throw an exception from jitted code, catch it in interpreted code
     try {
         JitClass.throw_ex();
     } catch {
         return(0);
     }
     return(1);
 }
    // Finally exception will be thrown from this stack : interp -> jit -> eh -> interp
    // Test that we propagate the finally exception over the jitted frames
    public static int test_0_finex()
    {
        bool called_finally = false;

        try {
            try {
                JitClass.throw_ex();
                return(3);
            } finally {
                called_finally = true;
                throw new Exception("E2");
            }
        } catch (Exception) {
            if (!called_finally)
            {
                return(1);
            }
            return(0);
        }
        return(2);
    }
    [Category("!WASM")]      //Stack traces / EH are super broken on WASM + Interpreter
    public static int test_0_stack_traces()
    {
        //
        // Get a stacktrace for an interp->jit->interp call stack
        //
        StackTrace st = JitClass.get_stacktrace_jit2();

        var frame0 = st.GetFrame(0);
        var frame1 = st.GetFrame(1);
        var frame2 = st.GetFrame(2);
        var frame3 = st.GetFrame(3);
        var frame4 = st.GetFrame(4);

        if (frame0.GetMethod().Name != "get_stacktrace_interp")
        {
            return(1);
        }

        if (frame1.GetMethod().Name != "get_stacktrace_jit")
        {
            return(2);
        }

        if (frame2.GetMethod().Name != "get_stacktrace_interp2")
        {
            return(3);
        }

        if (frame3.GetMethod().Name != "get_stacktrace_jit2")
        {
            return(4);
        }

        if (frame4.GetMethod().Name != "test_0_stack_traces")
        {
            return(5);
        }
        return(0);
    }
Esempio n. 5
0
    public static int test_0_exit()
    {
        var astruct = new AStruct()
        {
            i = 1
        };
        var astruct2 = JitClass.exit_vtype(astruct);

        if (astruct2.i != 1)
        {
            return(1);
        }
        var ginst  = new List <string> ();
        var ginst2 = JitClass.exit_ginst(ginst);

        if (ginst != ginst2)
        {
            return(2);
        }
        var gstruct = new GStruct <string> ()
        {
            i = 1
        };
        var gstruct2 = JitClass.exit_ginst_vtype(gstruct);

        if (gstruct2.i != 1)
        {
            return(3);
        }
        var anint = 1;

        JitClass.exit_byref(ref anint);
        if (anint != 2)
        {
            return(4);
        }
        return(0);
    }
Esempio n. 6
0
    public static int test_0_stack_traces()
    {
        //
        // Get a stacktrace for an interp->jit->interp call stack
        //
        StackTrace st    = JitClass.get_stacktrace_jit();
        var        frame = st.GetFrame(0);

        if (frame.GetMethod().Name != "get_stacktrace_interp")
        {
            return(1);
        }
        frame = st.GetFrame(1);
        if (frame.GetMethod().Name != "get_stacktrace_jit")
        {
            return(2);
        }
        frame = st.GetFrame(2);
        if (frame.GetMethod().Name != "test_0_stack_traces")
        {
            return(3);
        }
        return(0);
    }
Esempio n. 7
0
 public static int test_0_entry()
 {
     // This does an interp->jit transition
     return(JitClass.entry());
 }
 public static void throw_ex()
 {
     JitClass.throw_ex();
 }
 public static StackTrace get_stacktrace_interp2()
 {
     return(JitClass.get_stacktrace_jit());
 }
Esempio n. 10
0
    public static int test_0_stringctor()
    {
        string s = JitClass.string_from_interp();

        return(s == "abcdefghij" ? 0 : 1);
    }