2008-08-29 Geoff Norton <gnorton@novell.com>
[mono.git] / mono / mini / iltests.il.in
index d4f6638402c5c6f5c23c183fcc2b520c1b904f69..44359946250f2ac56a25469502fbd4ff1cdb6ede 100644 (file)
@@ -563,16 +563,33 @@ COND:   ldloc.0
 #endif
 
        .method public static int32 test_5_jmp () cil managed {
-               jmp int32 Tests::jmp2 ()
-               ldc.i4.0
+               ldc.i4.1
+               ldc.i4.2
+               call int32 Tests::jmp2 (int32, int32)
                ret
        }
 
-       .method public static int32 jmp2 () cil managed {
-               ldc.i4.5
+       .method public static int32 jmp2 (int32, int32) cil managed {
+               ldarg.0
+               ldc.i4.1
+               add
+               starg.s 0
+               ldarg.1
+               ldc.i4.1
+               add
+               starg.s 1
+               jmp int32 Tests::jmp3 (int32, int32)
+               ldc.i4.0
                ret
        }               
 
+       .method public static int32 jmp3 (int32 i, int32 j) cil managed {
+               ldarg.0
+               ldarg.1
+               add
+               ret
+       }
+
        .method static public int32 test_11_switch_with_nonempty_stack () il managed {
                .maxstack 16
 
@@ -709,6 +726,15 @@ COND:   ldloc.0
                ret
        }
 
+       .method public static int32 test_1234_conv_ovf_i8_un () cil managed {
+               .maxstack 16
+
+               ldc.i4 1234
+               conv.ovf.i8.un
+               conv.i4
+               ret
+       }
+
        .method public static int32 test_0_lconv_ovf_i () cil managed {
                .maxstack 16
 
@@ -876,6 +902,21 @@ COND:   ldloc.0
                ret
        }
 
+       .method public static int32 test_0_fconv_to_i () cil managed {
+               .maxstack 16
+
+               ldc.r8 2147483648.0
+               conv.i
+               ldc.i8 2147483648
+               conv.i
+               beq L1
+               ldc.i4.1
+               ret
+       L1:
+               ldc.i4.0
+               ret
+       }
+
        .method public static int32 test_0_get_type_from_handle_on_bblock_boundary () cil managed 
        {
                .maxstack 16
@@ -1094,6 +1135,25 @@ COND:   ldloc.0
                ret
        }
 
+       .method public static int32 test_0_newobj_vtype_primitive () {
+               .maxstack 6
+               .locals init (
+                       native int V_0
+               )
+
+               ldc.i4.s 10
+               newobj instance void native int::'.ctor'(int32)
+               stloc.0
+               ldloc.0
+               ldc.i4.s 10
+               beq OK
+               ldc.i4.s 1
+               ret
+       OK:
+               ldc.i4.s 0
+               ret
+       }
+
        .method public static int32 test_1_filters () {
                .maxstack 16
                .locals init (
@@ -1759,4 +1819,101 @@ HAS_VALUE:      ldc.i4.1
                conv.u4
                ret
        }
+
+       // Test calling ldfld directly on a vtype instead of a vtype address
+       .method public static int32 test_5_call_ldfld_vtype () cil managed
+       {
+               .maxstack 16
+               .locals init (
+                       valuetype Tests/TailCallStruct arg
+               )
+               ldloca 0
+               ldc.i4.2
+               stfld int32 Tests/TailCallStruct::a
+               ldloca 0
+               ldc.i4.4
+               stfld int32 Tests/TailCallStruct::b
+               ldloc.0
+               call valuetype Tests/TailCallStruct Tests::tail2 (valuetype Tests/TailCallStruct)
+               ldfld int32 Tests/TailCallStruct::a
+               ret
+       }
+
+       .method public static int32 throw_ret () cil managed
+       {
+               ldstr "FOO"
+               newobj instance void class [mscorlib]System.OverflowException::.ctor(string)
+               throw
+               ldc.i4.4
+               ret
+       }
+
+       .method public static int32 throw2_ret () cil managed
+       {
+               // Disable inlining
+               ldc.i4.5
+               localloc
+               pop
+
+               call int32 Tests::throw_ret ()
+               ret
+       }
+
+       // Test inlining a method which contains just a throw
+       .method public static int32 test_0_inline_throw () cil managed
+       {
+               .maxstack 16
+               .locals init (
+                               int32 v_0
+               )
+
+               .try {
+                       call int32 Tests::throw2_ret ()
+                       stloc.0
+                       leave L0
+               } catch [mscorlib]System.OverflowException {
+                       pop
+                       leave L1
+               }
+
+               L0:
+                       ldc.i4.1
+                       ret
+               L1:
+                       ldc.i4.0
+                       ret                     
+       }
+
+    .method public static int32 test_0_stelem_any_null_opt () cil managed
+    {
+               .maxstack 16
+               .locals init (
+                               object[]        V_0,
+                               int32   V_1)
+
+               ldc.i4.s 10
+               newarr [mscorlib]System.Object
+               stloc.0
+
+               ldc.i4.0
+               stloc.1
+               br L0
+
+       L1:
+               ldloc.0
+               ldloc.1
+               ldnull
+               stelem.any [mscorlib]System.Object
+               ldloc.1
+               ldc.i4.1
+               add
+               stloc.1
+       L0:
+               ldloc.1
+               ldc.i4.s 10
+               blt L1
+
+               ldc.i4.0
+               ret
+       }
 }