Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / mini / mini-arm-gsharedvt.c
index aef522b28560b891cdca760f376ac4224b40a2e0..5ec0f4ac68c8f186dcd58530ebab380c7f87a81c 100644 (file)
@@ -1,5 +1,6 @@
-/*
- * mini-arm-gsharedvt.c: gsharedvt support code for arm
+/**
+ * \file
+ * gsharedvt support code for arm
  *
  * Authors:
  *   Zoltan Varga <vargaz@gmail.com>
@@ -121,6 +122,7 @@ mono_arch_get_gsharedvt_call_info (gpointer addr, MonoMethodSignature *normal_si
        MonoMethodSignature *caller_sig, *callee_sig;
        int aindex, i;
        gboolean var_ret = FALSE;
+       gboolean have_fregs = FALSE;
        CallInfo *cinfo, *gcinfo;
        MonoMethodSignature *sig, *gsig;
        GPtrArray *map;
@@ -191,6 +193,11 @@ mono_arch_get_gsharedvt_call_info (gpointer addr, MonoMethodSignature *normal_si
                int *src = NULL, *dst = NULL;
                int nsrc, ndst, nslots, src_slot, arg_marshal;
 
+               if (ainfo->storage == RegTypeFP || ainfo2->storage == RegTypeFP) {
+                       have_fregs = TRUE;
+                       continue;
+               }
+
                /*
                 * The src descriptor looks like this:
                 * - 4 bits src slot
@@ -211,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 */
@@ -250,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)
@@ -298,11 +305,17 @@ mono_arch_get_gsharedvt_call_info (gpointer addr, MonoMethodSignature *normal_si
                        info->ret_marshal = GSHAREDVT_RET_IREGS;
                        break;
                case RegTypeFP:
-                       // FIXME: VFP
-                       if (cinfo->ret.size == 4)
-                               info->ret_marshal = GSHAREDVT_RET_IREG;
-                       else
-                               info->ret_marshal = GSHAREDVT_RET_IREGS;
+                       if (mono_arm_is_hard_float ()) {
+                               if (cinfo->ret.size == 4)
+                                       info->ret_marshal = GSHAREDVT_RET_VFP_R4;
+                               else
+                                       info->ret_marshal = GSHAREDVT_RET_VFP_R8;
+                       } else {
+                               if (cinfo->ret.size == 4)
+                                       info->ret_marshal = GSHAREDVT_RET_IREG;
+                               else
+                                       info->ret_marshal = GSHAREDVT_RET_IREGS;
+                       }
                        break;
                case RegTypeStructByAddr:
                        info->ret_marshal = GSHAREDVT_RET_NONE;
@@ -319,11 +332,11 @@ mono_arch_get_gsharedvt_call_info (gpointer addr, MonoMethodSignature *normal_si
        }
 
        info->stack_usage = ALIGN_TO (info->stack_usage, MONO_ARCH_FRAME_ALIGNMENT);
-
-       g_free (caller_cinfo);
-       g_free (callee_cinfo);
+       info->caller_cinfo = caller_cinfo;
+       info->callee_cinfo = callee_cinfo;
+       info->have_fregs = have_fregs;
 
        return info;
 }
 
-#endif
\ No newline at end of file
+#endif