[interp] fix issues around conv.ovf.* bytecodes
authorBernhard Urban <bernhard.urban@xamarin.com>
Tue, 7 Mar 2017 09:46:58 +0000 (10:46 +0100)
committerBernhard Urban <bernhard.urban@xamarin.com>
Wed, 8 Mar 2017 22:02:51 +0000 (23:02 +0100)
mono/mini/iltests.il
mono/mini/interp/interp.c
mono/mini/interp/transform.c

index eed995c8a248b85d85efc4a56e6c19d9f13c346d..d14483d8e2968c90b624e04abed3c9cd697aa6ef 100644 (file)
@@ -753,7 +753,6 @@ COND:   ldloc.0
        }
 
        .method public static int32 test_0_conv_ovf_u_un () cil managed {
-               .custom instance void [TestDriver]CategoryAttribute::.ctor(string) = ( 01 00 0C 21 49 4E 54 45 52 50 52 45 54 45 52 00 00 )   // ...!INTERPRETER.
                .maxstack 16
 
                ldc.i4 1234
@@ -856,7 +855,6 @@ COND:   ldloc.0
        }
 
        .method public static int32 test_0_lconv_ovf_u_un () cil managed {
-               .custom instance void [TestDriver]CategoryAttribute::.ctor(string) = ( 01 00 0C 21 49 4E 54 45 52 50 52 45 54 45 52 00 00 )   // ...!INTERPRETER.
                .maxstack 16
 
                ldc.i4 1234
@@ -889,7 +887,6 @@ COND:   ldloc.0
        }
 
        .method public static int32 test_0_lconv_to_ovf_u8_un () cil managed {
-               .custom instance void [TestDriver]CategoryAttribute::.ctor(string) = ( 01 00 0C 21 49 4E 54 45 52 50 52 45 54 45 52 00 00 )   // ...!INTERPRETER.
                .maxstack 16
 
                ldc.i4 1234
@@ -906,7 +903,6 @@ COND:   ldloc.0
        }
 
        .method public static int32 test_2_lconv_to_ovf_i4_un () cil managed {
-               .custom instance void [TestDriver]CategoryAttribute::.ctor(string) = ( 01 00 0C 21 49 4E 54 45 52 50 52 45 54 45 52 00 00 )   // ...!INTERPRETER.
                .maxstack 16
                .locals init (int32 res)
 
@@ -1129,7 +1125,6 @@ COND:   ldloc.0
        }
 
        .method public static int32 test_7_conv_ovf_u8_un () {
-               .custom instance void [TestDriver]CategoryAttribute::.ctor(string) = ( 01 00 0C 21 49 4E 54 45 52 50 52 45 54 45 52 00 00 )   // ...!INTERPRETER.
        .maxstack  2
         .locals    init (unsigned int64)
 
index 1783854f7fc45235dc075cca3f4bb11453d7a202..7092c749b08e07ac241dbcf6f10f6c34fe503cd5 100644 (file)
@@ -3432,7 +3432,7 @@ array_constructed:
                        ++ip;
                        MINT_IN_BREAK;
                MINT_IN_CASE(MINT_CONV_OVF_I4_I8)
-                       if (sp [-1].data.l < MYGINT32_MIN || sp [-1].data.l > MYGINT32_MAX)
+                       if (sp [-1].data.l <= MYGINT32_MIN || sp [-1].data.l > MYGINT32_MAX)
                                THROW_EX (mono_get_exception_overflow (), ip);
                        sp [-1].data.i = (gint32) sp [-1].data.l;
                        ++ip;
index b20062fa6a46108509833a48c6fcf9cdbbdd2bfd..7496c18596ce23add761361ecd41464a033d8e58 100644 (file)
@@ -2098,6 +2098,7 @@ generate (MonoMethod *method, RuntimeMethod *rtm, unsigned char *is_bb_start, Mo
                        break;
                }
                case CEE_CONV_OVF_I_UN:
+               case CEE_CONV_OVF_U_UN:
                        CHECK_STACK (&td, 1);
                        switch (td.sp [-1].type) {
                        case STACK_TYPE_R8:
@@ -2108,7 +2109,9 @@ generate (MonoMethod *method, RuntimeMethod *rtm, unsigned char *is_bb_start, Mo
 #endif
                                break;
                        case STACK_TYPE_I8:
-                               /*FIX*/
+#if SIZEOF_VOID_P == 4
+                               ADD_CODE (&td, MINT_CONV_OVF_I4_UN_I8);
+#endif
                                break;
                        case STACK_TYPE_I4:
 #if SIZEOF_VOID_P == 8
@@ -2123,6 +2126,7 @@ generate (MonoMethod *method, RuntimeMethod *rtm, unsigned char *is_bb_start, Mo
                        ++td.ip;
                        break;
                case CEE_CONV_OVF_I8_UN:
+               case CEE_CONV_OVF_U8_UN:
                        CHECK_STACK (&td, 1);
                        switch (td.sp [-1].type) {
                        case STACK_TYPE_R8: