2010-06-29 Zoltan Varga <vargaz@gmail.com>
authorZoltan Varga <vargaz@gmail.com>
Tue, 29 Jun 2010 19:44:51 +0000 (19:44 -0000)
committerZoltan Varga <vargaz@gmail.com>
Tue, 29 Jun 2010 19:44:51 +0000 (19:44 -0000)
* mini-trampolines.c (mono_vcall_trampoline): Fix a warning.

* mini-x86.c (mono_arch_get_vcall_slot): Remove most cases as the only caller
is now mono_arch_nullify_class_init_trampoline ().
(mono_arch_output_basic_block): Remove the special casing from the CALL_MEMBASE
opcodes, they are no longer needed.

svn path=/trunk/mono/; revision=159688

mono/mini/ChangeLog
mono/mini/mini-trampolines.c
mono/mini/mini-x86.c

index 7ac87eda8046c584c0480398b313631fc037c8fe..dd4532534414c90076ebd508ae4a2a18b3dbbb4f 100755 (executable)
@@ -1,5 +1,12 @@
 2010-06-29  Zoltan Varga  <vargaz@gmail.com>
 
+       * mini-trampolines.c (mono_vcall_trampoline): Fix a warning.
+
+       * mini-x86.c (mono_arch_get_vcall_slot): Remove most cases as the only caller
+       is now mono_arch_nullify_class_init_trampoline ().
+       (mono_arch_output_basic_block): Remove the special casing from the CALL_MEMBASE
+       opcodes, they are no longer needed.
+       
        * mini-amd64.c (mono_arch_get_vcall_slot): Remove most cases as the only caller is
        now mono_arch_nullify_class_init_trampoline ().
        (mono_arch_output_basic_block): Remove the special casing from the CALL_MEMBASE
index 05aad4576688f8400199291dd3e65167dec563c6..96a50223fe4f1b480dc0ab061a9181b733c605b3 100644 (file)
@@ -579,8 +579,10 @@ mono_vcall_trampoline (mgreg_t *regs, guint8 *code, int slot, guint8 *tramp)
        gpointer *vtable_slot;
        MonoMethod *m;
        gboolean need_rgctx_tramp = FALSE;
-       int displacement;
        gpointer addr;
+#ifndef MONO_ARCH_THIS_AS_FIRST_ARG
+       int displacement;
+#endif
 
        trampoline_calls ++;
 
index f702cc9eaff5c8428d7c2b88060ba7b1a9f242a1..344d01d309f40ce9ab40f31f62d056d740ea748c 100644 (file)
@@ -2962,13 +2962,6 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                case OP_CALL_MEMBASE:
                        call = (MonoCallInst*)ins;
 
-                       /* 
-                        * Emit a few nops to simplify get_vcall_slot ().
-                        */
-                       x86_nop (code);
-                       x86_nop (code);
-                       x86_nop (code);
-
                        x86_call_membase (code, ins->sreg1, ins->inst_offset);
                        if (call->stack_usage && !CALLCONV_IS_STDCALL (call->signature)) {
                                if (call->stack_usage == 4)
@@ -5514,35 +5507,17 @@ mono_arch_get_vcall_slot (guint8 *code, mgreg_t *regs, int *displacement)
 
        code -= 6;
 
-       /* 
-        * A given byte sequence can match more than case here, so we have to be
-        * really careful about the ordering of the cases. Longer sequences
-        * come first.
-        * There are two types of calls:
-        * - direct calls: 0xff address_byte 8/32 bits displacement
-        * - indirect calls: nop nop nop <call>
-        * The nops make sure we don't confuse the instruction preceeding an indirect
-        * call with a direct call.
+       /*
+        * This function is no longer used, the only caller is
+        * mono_arch_nullify_class_init_trampoline ().
         */
-       if ((code [1] != 0xe8) && (code [3] == 0xff) && ((code [4] & 0x18) == 0x10) && ((code [4] >> 6) == 1)) {
-               reg = code [4] & 0x07;
-               disp = (signed char)code [5];
-       } else if ((code [0] == 0xff) && ((code [1] & 0x18) == 0x10) && ((code [1] >> 6) == 2)) {
+       if ((code [0] == 0xff) && ((code [1] & 0x18) == 0x10) && ((code [1] >> 6) == 2)) {
                reg = code [1] & 0x07;
                disp = *((gint32*)(code + 2));
-       } else if ((code [1] == 0xe8)) {
-                       return NULL;
-       } else if ((code [4] == 0xff) && (((code [5] >> 6) & 0x3) == 0) && (((code [5] >> 3) & 0x7) == 2)) {
-               /*
-                * This is a interface call
-                * 8b 40 30   mov    0x30(%eax),%eax
-                * ff 10      call   *(%eax)
-                */
-               disp = 0;
-               reg = code [5] & 0x07;
-       }
-       else
+       } else {
+               g_assert_not_reached ();
                return NULL;
+       }
 
        *displacement = disp;
        return (gpointer)regs [reg];