2010-08-02 Zoltan Varga <vargaz@gmail.com>
authorZoltan Varga <vargaz@gmail.com>
Mon, 2 Aug 2010 18:52:21 +0000 (20:52 +0200)
committerZoltan Varga <vargaz@gmail.com>
Mon, 2 Aug 2010 18:52:39 +0000 (20:52 +0200)
* mini-sparc.c: Change the calling convention to pass this as first as on other
architectures. Remove some dead code from the get_vcall_slot().

mono/mini/mini-sparc.c
mono/mini/mini-sparc.h

index eb94c7c862b2c0a1480b51266c098b00f931e09f..aefde7dfc14175d376efbb2f4b7c02460a39d8b2 100644 (file)
@@ -504,6 +504,8 @@ get_call_info (MonoCompile *cfg, MonoMethodSignature *sig, gboolean is_pinvoke)
                /* The address of the return value is passed in %o0 */
                add_general (&gr, &stack_size, &cinfo->ret, FALSE);
                cinfo->ret.reg += sparc_i0;
+               /* FIXME: Pass this after this as on other platforms */
+               NOT_IMPLEMENTED;
        }
 #endif
 
@@ -2265,73 +2267,8 @@ mono_sparc_is_virtual_call (guint32 *code)
 gpointer
 mono_arch_get_vcall_slot (guint8 *code8, mgreg_t *regs, int *displacement)
 {
-       guint32 *code = (guint32*)(gpointer)code8;
-       guint32 ins = code [0];
-       guint32 prev_ins = code [-1];
-
-       mono_sparc_flushw ();
-
-       *displacement = 0;
-
-       if (!mono_sparc_is_virtual_call (code))
-               return NULL;
-
-       if ((sparc_inst_op (ins) == 0x2) && (sparc_inst_op3 (ins) == 0x38)) {
-               if ((sparc_inst_op (prev_ins) == 0x3) && (sparc_inst_i (prev_ins) == 1) && (sparc_inst_op3 (prev_ins) == 0 || sparc_inst_op3 (prev_ins) == 0xb)) {
-                       /* ld [r1 + CONST ], r2; call r2 */
-                       guint32 base = sparc_inst_rs1 (prev_ins);
-                       gint32 disp = (((gint32)(sparc_inst_imm13 (prev_ins))) << 19) >> 19;
-                       gpointer base_val;
-
-                       g_assert (sparc_inst_rd (prev_ins) == sparc_inst_rs1 (ins));
-
-                       g_assert ((base >= sparc_o0) && (base <= sparc_i7));
-
-                       base_val = regs [base];
-
-                       *displacement = disp;
-
-                       return (gpointer)base_val;
-               }
-               else if ((sparc_inst_op (prev_ins) == 0x3) && (sparc_inst_i (prev_ins) == 0) && (sparc_inst_op3 (prev_ins) == 0)) {
-                       /* set r1, ICONST; ld [r1 + r2], r2; call r2 */
-                       /* Decode a sparc_set32 */
-                       guint32 base = sparc_inst_rs1 (prev_ins);
-                       guint32 disp;
-                       gpointer base_val;
-                       guint32 s1 = code [-3];
-                       guint32 s2 = code [-2];
-
-#ifdef SPARCV9
-                       NOT_IMPLEMENTED;
-#endif
-
-                       /* sparc_sethi */
-                       g_assert (sparc_inst_op (s1) == 0);
-                       g_assert (sparc_inst_op2 (s1) == 4);
-
-                       /* sparc_or_imm */
-                       g_assert (sparc_inst_op (s2) == 2);
-                       g_assert (sparc_inst_op3 (s2) == 2);
-                       g_assert (sparc_inst_i (s2) == 1);
-                       g_assert (sparc_inst_rs1 (s2) == sparc_inst_rd (s2));
-                       g_assert (sparc_inst_rd (s1) == sparc_inst_rs1 (s2));
-
-                       disp = ((s1 & 0x3fffff) << 10) | sparc_inst_imm13 (s2);
-
-                       g_assert ((base >= sparc_o0) && (base <= sparc_i7));
-
-                       base_val = regs [base];
-
-                       *displacement = disp;
-
-                       return (gpointer)base_val;
-               } else
-                       g_assert_not_reached ();
-       }
-       else
-               g_assert_not_reached ();
-
+       /* Not used on sparc */
+       g_assert_not_reached ();
        return NULL;
 }
 
index 3f3eefd6ab9ce3f8ca65500a1eb9d88914c9ce68..e67048be62f43541818807ca7ab3b818002e9f32 100644 (file)
@@ -122,6 +122,8 @@ typedef struct MonoCompileArch {
 #define MONO_ARCH_NO_EMULATE_LONG_SHIFT_OPS
 #endif
 
+#define MONO_ARCH_THIS_AS_FIRST_ARG 1
+
 #ifndef __GNUC__
 /* assume Sun compiler if not GCC */
 static void * __builtin_return_address(int depth)