2008-07-12 Zoltan Varga <vargaz@gmail.com>
authorZoltan Varga <vargaz@gmail.com>
Sat, 12 Jul 2008 17:44:09 +0000 (17:44 -0000)
committerZoltan Varga <vargaz@gmail.com>
Sat, 12 Jul 2008 17:44:09 +0000 (17:44 -0000)
* mini-x86.h aot-compiler.c aot-runtime.c: Store the plt info offset inline
on x86.

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

mono/mini/ChangeLog
mono/mini/aot-compiler.c
mono/mini/aot-runtime.c
mono/mini/mini-x86.h

index 818df37727d7caf6ca45865b4bb248e5112ce2a9..ccd1eb710fe17fee72a26a363ca04f7b88d93750 100644 (file)
@@ -1,5 +1,8 @@
 2008-07-12  Zoltan Varga  <vargaz@gmail.com>
 
+       * mini-x86.h aot-compiler.c aot-runtime.c: Store the plt info offset inline
+       on x86.
+
        * mini-amd64.h aot-compiler.c aot-runtime.c: Store the plt info offset inline
        on amd64 similar to the way it is done on arm.
 
index aa8e47086c6103eb918d3ddad510a6b6a9389bb9..ea3cfa1caf6cd6508532ba2ad4e1e60f159442c5 100644 (file)
@@ -2729,11 +2729,10 @@ emit_plt (MonoAotCompile *acfg)
                        /* It is filled up during loading by the AOT loader. */
                        emit_zero_bytes (acfg, 16);
                } else {
-                       /* Need to make sure this is 5 bytes long */
+                       /* Need to make sure this is 9 bytes long */
                        emit_byte (acfg, '\xe9');
-                       label = g_strdup_printf (".Lpd_%d", i);
-                       emit_symbol_diff (acfg, label, ".", -4);
-                       g_free (label);
+                       emit_symbol_diff (acfg, "plt", ".", -4);
+                       emit_int32 (acfg, plt_info_offsets [i]);
                }
 #elif defined(__x86_64__)
                /*
@@ -2773,41 +2772,6 @@ emit_plt (MonoAotCompile *acfg)
        emit_global (acfg, symbol, TRUE);
        emit_label (acfg, symbol);
 
-       /* 
-        * Emit the default targets for the PLT entries separately since these will not
-        * be modified at runtime.
-        */
-       for (i = 1; i < acfg->plt_offset; ++i) {
-               char *label;
-
-               label = g_strdup_printf (".Lpd_%d", i);
-               emit_label (acfg, label);
-               g_free (label);
-
-               /* Put the offset into the register expected by mono_aot_plt_trampoline */
-#if defined(__i386__)
-               /* movl $const, %eax */
-               emit_byte (acfg, '\xb8');
-               emit_int32 (acfg, plt_info_offsets [i]);
-               /* jmp .Lp_0 */
-               emit_byte (acfg, '\xe9');
-               emit_symbol_diff (acfg, ".Lp_0", ".", -4);
-#elif defined(__x86_64__)
-               /* Emitted along with the PLT entries since they will not be patched */
-#elif defined(__arm__)
-               /* Emitted along with the PLT entries since they will not be patched */
-#if 0
-               /* This is 12 bytes long, init_plt () depends on this */
-               emit_unset_mode (acfg);
-               fprintf (acfg->fp, "\tldr ip, [pc, #0]\n");
-               fprintf (acfg->fp, "\tb .Lp_0\n");
-               fprintf (acfg->fp, "\t.word %d\n", plt_info_offsets [i]);
-#endif
-#else
-               g_assert_not_reached ();
-#endif
-       }
-
        /* Emit PLT info */
        symbol = g_strdup_printf ("plt_info");
        emit_global (acfg, symbol, FALSE);
index 3d0c01e1cd8316b76aaa4897cbd675ede0d3d0f9..60f4b19f95a90d259e1d1a2d6bd54eee981e88c5 100644 (file)
@@ -2151,19 +2151,16 @@ mono_aot_get_plt_entry (guint8 *code)
 guint32
 mono_aot_get_plt_info_offset (gssize *regs, guint8 *code)
 {
-#if defined(__i386__)
-       return regs [MONO_ARCH_AOT_PLT_OFFSET_REG];
-#elif defined(__x86_64__)
        guint8 *plt_entry = mono_aot_get_plt_entry (code);
 
        g_assert (plt_entry);
 
+       /* The offset is embedded inside the code after the plt entry */
+#if defined(__i386__)
+       return *(guint32*)(plt_entry + 5);
+#elif defined(__x86_64__)
        return *(guint32*)(plt_entry + 6);
 #elif defined(__arm__)
-       guint8 *plt_entry = mono_aot_get_plt_entry (code);
-
-       g_assert (plt_entry);
-
        /* The offset is stored as the 5th word of the plt entry */
        return ((guint32*)plt_entry) [4];
 #else
index 9d0812ec5dacab592dfa34255d35c455b8576f3e..e86a78c2dbee598342831b98a1dde331657d4bbb 100644 (file)
@@ -110,8 +110,6 @@ LONG CALLBACK seh_handler(EXCEPTION_POINTERS* ep);
 #define MONO_ARCH_RETREG1 X86_EAX
 #define MONO_ARCH_RETREG2 X86_EDX
 
-#define MONO_ARCH_AOT_PLT_OFFSET_REG X86_EAX
-
 #define MONO_ARCH_ENCODE_LREG(r1,r2) (r1 | (r2<<3))
 
 #define inst_dreg_low dreg&7