2008-08-22 Zoltan Varga <vargaz@gmail.com>
authorZoltan Varga <vargaz@gmail.com>
Fri, 22 Aug 2008 12:19:04 +0000 (12:19 -0000)
committerZoltan Varga <vargaz@gmail.com>
Fri, 22 Aug 2008 12:19:04 +0000 (12:19 -0000)
* tramp-<ARCH>.c (mono_arch_get_rgctx_lazy_fetch_offset): Removed, no longer
needed.

* mini-trampolines.c (mono_rgctx_lazy_fetch_trampoline): Get the additional
trampoline argument from MONO_ARCH_VTABLE_REG.

* tramp-x86.c (mono_arch_create_rgctx_lazy_fetch_trampoline): Change the
order of the arguments to the C trampoline: pass 'slot' as the trampoline
argument, and pass the vtable in VTABLE_REG.

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

14 files changed:
mono/mini/ChangeLog
mono/mini/mini-trampolines.c
mono/mini/mini.h
mono/mini/tramp-alpha.c
mono/mini/tramp-amd64.c
mono/mini/tramp-arm.c
mono/mini/tramp-hppa.c
mono/mini/tramp-ia64.c
mono/mini/tramp-mips.c
mono/mini/tramp-ppc.c
mono/mini/tramp-s390.c
mono/mini/tramp-s390x.c
mono/mini/tramp-sparc.c
mono/mini/tramp-x86.c

index 82055e85c0fd654b3c7b864f719c8c2f87ef9035..e47b98aedb4b217e45dfae4dc96d7d657367b1fd 100644 (file)
@@ -1,5 +1,15 @@
 2008-08-22  Zoltan Varga  <vargaz@gmail.com>
 
+       * tramp-<ARCH>.c (mono_arch_get_rgctx_lazy_fetch_offset): Removed, no longer
+       needed.
+
+       * mini-trampolines.c (mono_rgctx_lazy_fetch_trampoline): Get the additional
+       trampoline argument from MONO_ARCH_VTABLE_REG.
+
+       * tramp-x86.c (mono_arch_create_rgctx_lazy_fetch_trampoline): Change the
+       order of the arguments to the C trampoline: pass 'slot' as the trampoline
+       argument, and pass the vtable in VTABLE_REG.
+
        * tramp-amd64.c (mono_arch_create_rgctx_lazy_fetch_trampoline): Change the
        order of the arguments to the C trampoline: pass 'slot' as the trampoline
        argument, and pass the vtable in VTABLE_REG.
index 2394930ba7157740d9ceafc4c98eb38753d32027..068bc62dec8f2c08cd00f626b6605837cba7b175 100644 (file)
@@ -461,16 +461,11 @@ mono_generic_class_init_trampoline (gssize *regs, guint8 *code, MonoVTable *vtab
 static gpointer
 mono_rgctx_lazy_fetch_trampoline (gssize *regs, guint8 *code, gpointer data, guint8 *tramp)
 {
+#ifdef MONO_ARCH_VTABLE_REG
        static gboolean inited = FALSE;
        static int num_lookups = 0;
-
-#ifdef __x86_64__
        guint32 slot = GPOINTER_TO_UINT (data);
        gpointer arg = (gpointer)(gssize)regs [MONO_ARCH_VTABLE_REG];
-#else
-       guint32 slot = mono_arch_get_rgctx_lazy_fetch_offset ((gpointer*)regs);
-       gpointer arg = data;
-#endif
        guint32 index = MONO_RGCTX_SLOT_INDEX (slot);
        gboolean mrgctx = MONO_RGCTX_SLOT_IS_MRGCTX (slot);
 
@@ -485,6 +480,9 @@ mono_rgctx_lazy_fetch_trampoline (gssize *regs, guint8 *code, gpointer data, gui
                return mono_method_fill_runtime_generic_context (arg, index);
        else
                return mono_class_fill_runtime_generic_context (arg, index);
+#else
+       g_assert_not_reached ();
+#endif
 }
 
 #ifdef MONO_ARCH_HAVE_CREATE_DELEGATE_TRAMPOLINE
index dde75b5a4043c0c797a0c70583a388e3907f3240..38fd02072a39ff48285c1b022bf8e72ce76d977a 100644 (file)
@@ -1415,7 +1415,6 @@ gpointer  mono_arch_get_throw_corlib_exception  (void) MONO_INTERNAL;
 guchar*   mono_arch_create_trampoline_code      (MonoTrampolineType tramp_type) MONO_INTERNAL;
 guchar*   mono_arch_create_trampoline_code_full (MonoTrampolineType tramp_type, guint32 *code_size, MonoJumpInfo **ji, gboolean aot) MONO_INTERNAL;
 gpointer  mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 slot) MONO_INTERNAL;
-guint32          mono_arch_get_rgctx_lazy_fetch_offset (gpointer *regs) MONO_INTERNAL;
 gpointer  mono_arch_get_nullified_class_init_trampoline (guint32 *code_len) MONO_INTERNAL;
 GList    *mono_arch_get_allocatable_int_vars    (MonoCompile *cfg) MONO_INTERNAL;
 GList    *mono_arch_get_global_int_regs         (MonoCompile *cfg) MONO_INTERNAL;
index 7138813a015f1c127b2fe734c5bbce127b79cac3..6cb4adc8b08ffa71aaad4446e3efaae688047a67 100644 (file)
@@ -636,11 +636,3 @@ mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 encoded_offset)
        g_assert_not_reached ();
        return NULL;
 }
-
-guint32
-mono_arch_get_rgctx_lazy_fetch_offset (gpointer *regs)
-{
-       /* FIXME: implement! */
-       g_assert_not_reached ();
-       return 0;
-}
index a238b4f04176e80dc6c4c4b93684b92f88a51610..f86aee9ac115f4e6e1d5a800ea073d1373b80022 100644 (file)
@@ -651,12 +651,6 @@ mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 slot)
        return code;
 }
 
-guint32
-mono_arch_get_rgctx_lazy_fetch_offset (gpointer *regs)
-{
-       return (guint32)(gulong)(regs [MONO_AMD64_ARG_REG2]);
-}
-
 void
 mono_arch_invalidate_method (MonoJitInfo *ji, void *func, gpointer func_arg)
 {
index 15de561a1f44c37fa5d6045ad8ef29cd5e153aeb..2e07508400b9855bfa393ef42dba9d0bc05e32f0 100644 (file)
@@ -438,11 +438,3 @@ mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 encoded_offset)
        g_assert_not_reached ();
        return NULL;
 }
-
-guint32
-mono_arch_get_rgctx_lazy_fetch_offset (gpointer *regs)
-{
-       /* FIXME: implement! */
-       g_assert_not_reached ();
-       return 0;
-}
index 31e2e9f088dc9eaa9efb264f444e441f4d1b0af1..6fe57d9eb246a3929fe545f739825da3c175618e 100644 (file)
@@ -442,11 +442,3 @@ mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 encoded_offset)
        g_assert_not_reached ();
        return NULL;
 }
-
-guint32
-mono_arch_get_rgctx_lazy_fetch_offset (gpointer *regs)
-{
-       /* FIXME: implement! */
-       g_assert_not_reached ();
-       return 0;
-}
index 0a06af88bcf22c68195c2847d732eed9d37f32c2..cb962da6251a1190457437f7b6d15d5dd0824ff3 100644 (file)
@@ -422,11 +422,3 @@ mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 encoded_offset)
        g_assert_not_reached ();
        return NULL;
 }
-
-guint32
-mono_arch_get_rgctx_lazy_fetch_offset (gpointer *regs)
-{
-       /* FIXME: implement! */
-       g_assert_not_reached ();
-       return 0;
-}
index f21c3f66fbdf5712c394e1bc009cd0f99e957255..d054c1fab336594723154e6c97139045e800d73c 100644 (file)
@@ -501,11 +501,3 @@ mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 encoded_offset)
        g_assert_not_reached ();
        return NULL;
 }
-
-guint32
-mono_arch_get_rgctx_lazy_fetch_offset (gpointer *regs)
-{
-       /* FIXME: implement! */
-       g_assert_not_reached ();
-       return 0;
-}
index d79e81c8cd420de3f88a37acc98f552d3a6f8e31..f7cc6363da9685b5190e852922fb496da4d8af38 100644 (file)
@@ -374,11 +374,3 @@ mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 encoded_offset)
        g_assert_not_reached ();
        return NULL;
 }
-
-guint32
-mono_arch_get_rgctx_lazy_fetch_offset (gpointer *regs)
-{
-       /* FIXME: implement! */
-       g_assert_not_reached ();
-       return 0;
-}
index 5503d9d02d7f691ee2aa69a46b9aeb004a055678..3087c64df258fb3d57976be39fc2940e1c0c97fb 100644 (file)
@@ -522,11 +522,3 @@ mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 encoded_offset)
        g_assert_not_reached ();
        return NULL;
 }
-
-guint32
-mono_arch_get_rgctx_lazy_fetch_offset (gpointer *regs)
-{
-       /* FIXME: implement! */
-       g_assert_not_reached ();
-       return 0;
-}
index c7e48920c8d7aae20fbcd574a0c2c1336af65b55..b382c84a8e0ca6b35b95a58927f2fe23ac5fab54 100644 (file)
@@ -540,11 +540,3 @@ mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 encoded_offset)
        g_assert_not_reached ();
        return NULL;
 }
-
-guint32
-mono_arch_get_rgctx_lazy_fetch_offset (gpointer *regs)
-{
-       /* FIXME: implement! */
-       g_assert_not_reached ();
-       return 0;
-}
index 948614f14c37143561b2ad1503b16fdf12eb81f6..ecf8579cc9707eebd9a26537872d02c1a273d3e2 100644 (file)
@@ -277,11 +277,3 @@ mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 encoded_offset)
        g_assert_not_reached ();
        return NULL;
 }
-
-guint32
-mono_arch_get_rgctx_lazy_fetch_offset (gpointer *regs)
-{
-       /* FIXME: implement! */
-       g_assert_not_reached ();
-       return 0;
-}
index 59c468f13497f6c804d8f729e65504d71d17bd0c..1203738b01fc29ea6bc390ef8eee8e77e4b01874 100644 (file)
@@ -437,7 +437,7 @@ mono_arch_create_specific_trampoline (gpointer arg1, MonoTrampolineType tramp_ty
 gpointer
 mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 slot)
 {
-       guint8 *tramp = mono_get_trampoline_code (MONO_TRAMPOLINE_RGCTX_LAZY_FETCH);
+       guint8 *tramp;
        guint8 *code, *buf;
        guint8 **rgctx_null_jumps;
        int tramp_size;
@@ -445,8 +445,6 @@ mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 slot)
        int i;
        gboolean mrgctx;
 
-       g_assert (tramp);
-
        mrgctx = MONO_RGCTX_SLOT_IS_MRGCTX (slot);
        index = MONO_RGCTX_SLOT_INDEX (slot);
        if (mrgctx)
@@ -505,35 +503,11 @@ mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 slot)
 
        g_free (rgctx_null_jumps);
 
-       /*
-        * our stack looks like this (tos on top):
-        *
-        * | ret addr   |
-        * | vtable ptr |
-        * | ...        |
-        *
-        * the trampoline code expects it to look like this:
-        *
-        * | vtable ptr |
-        * | ret addr   |
-        * | ...        |
-        *
-        * whereas our caller expects to still have one argument on
-        * the stack when we return, so we transform the stack into
-        * this:
-        *
-        * | vtable ptr |
-        * | ret addr   |
-        * | dummy      |
-        * | ...        |
-        *
-        * which actually only requires us to push the vtable ptr, and
-        * the "old" vtable ptr becomes the dummy.
-        */
+       x86_mov_reg_membase (buf, MONO_ARCH_VTABLE_REG, X86_ESP, 4, 4);
 
-       x86_push_membase (buf, X86_ESP, 4);
+       tramp = mono_arch_create_specific_trampoline (GUINT_TO_POINTER (slot), MONO_TRAMPOLINE_RGCTX_LAZY_FETCH, mono_get_root_domain (), NULL);
 
-       x86_mov_reg_imm (buf, X86_EAX, slot);
+       /* jump to the actual trampoline */
        x86_jump_code (buf, tramp);
 
        mono_arch_flush_icache (code, buf - code);
@@ -543,12 +517,6 @@ mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 slot)
        return code;
 }
 
-guint32
-mono_arch_get_rgctx_lazy_fetch_offset (gpointer *regs)
-{
-       return (guint32)(regs [X86_EAX]);
-}
-
 void
 mono_arch_invalidate_method (MonoJitInfo *ji, void *func, gpointer func_arg)
 {