Author: zoltan
Date: 2006-04-25 17:02:14 -0400 (Tue, 25 Apr 2006)
New Revision: 59874
Modified:
trunk/mono/mono/mini/ChangeLog
trunk/mono/mono/mini/aot-compiler.c
trunk/mono/mono/mini/aot-runtime.c
trunk/mono/mono/mini/cpu-amd64.md
trunk/mono/mono/mini/mini-amd64.c
Log:
2006-04-25 Zoltan Varga <[EMAIL PROTECTED]>
* aot-runtime.c aot-compiler.c cpu-amd64.md mini-amd64.c: Update parts
of the
amd64 AOT support.
Modified: trunk/mono/mono/mini/ChangeLog
===================================================================
--- trunk/mono/mono/mini/ChangeLog 2006-04-25 21:00:57 UTC (rev 59873)
+++ trunk/mono/mono/mini/ChangeLog 2006-04-25 21:02:14 UTC (rev 59874)
@@ -1,5 +1,8 @@
2006-04-25 Zoltan Varga <[EMAIL PROTECTED]>
+ * aot-runtime.c aot-compiler.c cpu-amd64.md mini-amd64.c: Update parts
of the
+ amd64 AOT support.
+
* Makefile.am (common_sources): Fix build breakage.
* aot-runtime.c aot-compiler.c: Reorganize the AOT code yet again: Make
all
Modified: trunk/mono/mono/mini/aot-compiler.c
===================================================================
--- trunk/mono/mono/mini/aot-compiler.c 2006-04-25 21:00:57 UTC (rev 59873)
+++ trunk/mono/mono/mini/aot-compiler.c 2006-04-25 21:02:14 UTC (rev 59874)
@@ -526,7 +526,7 @@
}
if (direct_call_target) {
-#ifdef __i386__
+#if defined(__i386__) || defined(__x86_64__)
g_assert (code [i] == 0xe8);
/* Need to make sure this is exactly 5
bytes long */
fprintf (tmpfp, "\n.byte 0xe8");
@@ -1001,7 +1001,6 @@
static void
emit_plt (MonoAotCompile *acfg)
{
-#ifdef __i386__
char *symbol;
int i, buf_size;
guint8 *p, *buf;
@@ -1030,9 +1029,13 @@
label = g_strdup_printf (".Lp_%d", i);
emit_label (acfg->fp, label);
g_free (label);
+#if defined(__i386__) || defined (__x86_64__)
/* Need to make sure this is 5 bytes long */
fprintf (acfg->fp, "\t.byte 0xe9\n");
fprintf (acfg->fp, "\t.long .Lpd_%d - . - 4\n", i);
+#else
+ g_assert_not_reached ();
+#endif
}
symbol = g_strdup_printf ("plt_end");
@@ -1067,8 +1070,15 @@
emit_label (acfg->fp, label);
g_free (label);
+#if defined(__i386__)
fprintf (acfg->fp, "\tpushl $%d\n", plt_info_offsets [i]);
fprintf (acfg->fp, "\tjmp .Lp_0\n");
+#elif defined(__x86_64__)
+ fprintf (acfg->fp, "\tpush $%d\n", plt_info_offsets [i]);
+ fprintf (acfg->fp, "\tjmp .Lp_0\n");
+#else
+ g_assert_not_reached ();
+#endif
}
/* Emit PLT info */
@@ -1084,7 +1094,6 @@
}
fprintf (acfg->fp, "\n");
g_free (buf);
-#endif
}
static gboolean
Modified: trunk/mono/mono/mini/aot-runtime.c
===================================================================
--- trunk/mono/mono/mini/aot-runtime.c 2006-04-25 21:00:57 UTC (rev 59873)
+++ trunk/mono/mono/mini/aot-runtime.c 2006-04-25 21:02:14 UTC (rev 59874)
@@ -1004,7 +1004,7 @@
case MONO_PATCH_INFO_INTERNAL_METHOD: {
guint32 len = decode_value (p, &p);
- ji->data.name = p;
+ ji->data.name = (char*)p;
p += len + 1;
break;
}
@@ -1693,18 +1693,20 @@
static void
init_plt (MonoAotModule *info)
{
+ make_writable (info->plt, info->plt_end - info->plt);
+
#ifdef __i386__
/* Initialize the first PLT entry */
guint8 *buf = info->plt;
- make_writable (info->plt, info->plt_end - info->plt);
-
/* This is a special kind of trampoline */
/* We use the return address on the stack as the third parameter */
x86_push_imm (buf, info);
x86_call_code (buf, aot_dyn_resolve);
x86_alu_reg_imm (buf, X86_ADD, X86_ESP, 8);
x86_jump_reg (buf, X86_EAX);
+#else
+ g_assert_not_reached ();
#endif
}
Modified: trunk/mono/mono/mini/cpu-amd64.md
===================================================================
--- trunk/mono/mono/mini/cpu-amd64.md 2006-04-25 21:00:57 UTC (rev 59873)
+++ trunk/mono/mono/mini/cpu-amd64.md 2006-04-25 21:02:14 UTC (rev 59874)
@@ -214,6 +214,7 @@
cond_exc_nc: len:8
cond_exc_iov: len:8
cond_exc_ic: len:8
+long_add: dest:i src1:i src2:i len:3 clob:1
long_mul: dest:i src1:i src2:i clob:1 len:4
long_mul_imm: dest:i src1:i clob:1 len:12
long_div: dest:a src1:a src2:i len:16 clob:d
Modified: trunk/mono/mono/mini/mini-amd64.c
===================================================================
--- trunk/mono/mono/mini/mini-amd64.c 2006-04-25 21:00:57 UTC (rev 59873)
+++ trunk/mono/mono/mini/mini-amd64.c 2006-04-25 21:02:14 UTC (rev 59874)
@@ -1438,10 +1438,7 @@
{
mono_add_patch_info (cfg, code - cfg->native_code, patch_type, data);
- if (cfg->compile_aot) {
- amd64_call_membase (code, AMD64_RIP, 0);
- }
- else {
+ {
gboolean near_call = FALSE;
/*
@@ -1502,6 +1499,9 @@
/* These methods are allocated using malloc */
near_call = FALSE;
+ if (cfg->compile_aot)
+ near_call = TRUE;
+
if (near_call) {
amd64_call_code (code, 0);
}
@@ -2426,6 +2426,7 @@
break;
case OP_ADDCC:
case CEE_ADD:
+ case OP_LADD:
amd64_alu_reg_reg (code, X86_ADD, ins->sreg1,
ins->sreg2);
break;
case OP_ADC:
@@ -4481,8 +4482,7 @@
patch_info->ip.i = code - cfg->native_code;
if (cfg->compile_aot) {
- amd64_mov_reg_membase (code,
GP_SCRATCH_REG, AMD64_RIP, 0, 8);
- amd64_call_reg (code, GP_SCRATCH_REG);
+ amd64_call_code (code, 0);
} else {
/* The callee is in memory allocated
using the code manager */
amd64_call_code (code, 0);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches