[arm] Fix a gsharedvt assertion which happens with gsharedvt methods with a lot of...
authorZoltan Varga <vargaz@gmail.com>
Tue, 11 Apr 2017 15:51:45 +0000 (11:51 -0400)
committerZoltan Varga <vargaz@gmail.com>
Tue, 11 Apr 2017 15:51:53 +0000 (11:51 -0400)
mono/mini/mini-arm-gsharedvt.c
mono/mini/tramp-arm-gsharedvt.c

index 78e7f8064fc5955dd3a51aacf4c92359b6d972d7..5ec0f4ac68c8f186dcd58530ebab380c7f87a81c 100644 (file)
@@ -218,8 +218,8 @@ mono_arch_get_gsharedvt_call_info (gpointer addr, MonoMethodSignature *normal_si
                        else
                                src_slot = map_stack_slot (ainfo->offset / 4);
                        g_assert (ndst < 256);
-                       g_assert (src_slot < 16);
-                       src [0] = (ndst << 4) | src_slot;
+                       g_assert (src_slot < 256);
+                       src [0] = (ndst << 8) | src_slot;
 
                        if (ainfo2->storage == RegTypeGeneral && ainfo2->size != 0 && ainfo2->size != 4) {
                                /* Have to load less than 4 bytes */
@@ -257,7 +257,7 @@ mono_arch_get_gsharedvt_call_info (gpointer addr, MonoMethodSignature *normal_si
                        ndst = get_arg_slots (ainfo2, &dst);
                }
                if (nsrc)
-                       src [0] |= (arg_marshal << 16);
+                       src [0] |= (arg_marshal << 24);
                nslots = MIN (nsrc, ndst);
 
                for (i = 0; i < nslots; ++i)
index fe96db64815a1b78653b7d163e7e472d2b4a62b7..4e4334a2e9f580123ec451b73c18e13acba7c0f6 100644 (file)
@@ -54,7 +54,7 @@ mono_arm_start_gsharedvt_call (GSharedVtCallInfo *info, gpointer *caller, gpoint
        for (i = 0; i < info->map_count; ++i) {
                int src = info->map [i * 2];
                int dst = info->map [(i * 2) + 1];
-               int arg_marshal = (src >> 16) & 0xff;
+               int arg_marshal = (src >> 24) & 0xff;
 
                switch (arg_marshal) {
                case GSHAREDVT_ARG_NONE:
@@ -67,8 +67,8 @@ mono_arm_start_gsharedvt_call (GSharedVtCallInfo *info, gpointer *caller, gpoint
                        break;
                case GSHAREDVT_ARG_BYREF_TO_BYVAL: {
                        /* gsharedvt argument passed by value */
-                       int nslots = (src >> 4) & 0xff;
-                       int src_slot = src & 0xf;
+                       int nslots = (src >> 8) & 0xff;
+                       int src_slot = src & 0xff;
                        int j;
                        gpointer *addr = caller [src_slot];
 
@@ -77,28 +77,28 @@ mono_arm_start_gsharedvt_call (GSharedVtCallInfo *info, gpointer *caller, gpoint
                        break;
                }
                case GSHAREDVT_ARG_BYREF_TO_BYVAL_I1: {
-                       int src_slot = src & 0xf;
+                       int src_slot = src & 0xff;
                        gpointer *addr = caller [src_slot];
 
                        callee [dst] = GINT_TO_POINTER ((int)*(gint8*)addr);
                        break;
                }
                case GSHAREDVT_ARG_BYREF_TO_BYVAL_I2: {
-                       int src_slot = src & 0xf;
+                       int src_slot = src & 0xff;
                        gpointer *addr = caller [src_slot];
 
                        callee [dst] = GINT_TO_POINTER ((int)*(gint16*)addr);
                        break;
                }
                case GSHAREDVT_ARG_BYREF_TO_BYVAL_U1: {
-                       int src_slot = src & 0xf;
+                       int src_slot = src & 0xff;
                        gpointer *addr = caller [src_slot];
 
                        callee [dst] = GUINT_TO_POINTER ((guint)*(guint8*)addr);
                        break;
                }
                case GSHAREDVT_ARG_BYREF_TO_BYVAL_U2: {
-                       int src_slot = src & 0xf;
+                       int src_slot = src & 0xff;
                        gpointer *addr = caller [src_slot];
 
                        callee [dst] = GUINT_TO_POINTER ((guint)*(guint16*)addr);