Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / mini / mini-amd64-gsharedvt.c
index a4143e8a34494d926f21f4276b166100aca50eb3..d6cc6a743e547b5a6cf0dc8a13ee6a2bdec7d322 100644 (file)
@@ -128,7 +128,7 @@ Format for the destination descriptor:
        bits 24:32 - slot count
 */
 #define SRC_DESCRIPTOR_MARSHAL_SHIFT 16
-#define SRC_DESCRIPTOR_MARSHAL_MASK 0x0Ff
+#define SRC_DESCRIPTOR_MARSHAL_MASK 0x0ff
 
 #define SLOT_COUNT_SHIFT 24
 #define SLOT_COUNT_MASK 0xff
@@ -378,6 +378,23 @@ mono_arch_get_gsharedvt_call_info (gpointer addr, MonoMethodSignature *normal_si
                default:
                        g_error ("Gsharedvt can't handle dest arg type %d", (int)dst_info->storage); // See above
                }
+
+               if (arg_marshal == GSHAREDVT_ARG_BYREF_TO_BYVAL && dst_info->byte_arg_size) {
+                       /* Have to load less than 4 bytes */
+                       // FIXME: Signed types
+                       switch (dst_info->byte_arg_size) {
+                       case 1:
+                               arg_marshal = GSHAREDVT_ARG_BYREF_TO_BYVAL_U1;
+                               break;
+                       case 2:
+                               arg_marshal = GSHAREDVT_ARG_BYREF_TO_BYVAL_U2;
+                               break;
+                       default:
+                               arg_marshal = GSHAREDVT_ARG_BYREF_TO_BYVAL_U4;
+                               break;
+                       }
+               }
+
                if (nsrc)
                        src [0] |= (arg_marshal << SRC_DESCRIPTOR_MARSHAL_SHIFT) | (arg_slots << SLOT_COUNT_SHIFT);