Author: lupus
Date: 2007-10-04 12:51:51 -0400 (Thu, 04 Oct 2007)
New Revision: 86890
Modified:
trunk/mono/mono/mini/ChangeLog
trunk/mono/mono/mini/mini-ppc.c
trunk/mono/mono/mini/tramp-ppc.c
Log:
Thu Oct 4 19:01:59 CEST 2007 Paolo Molaro <[EMAIL PROTECTED]>
* mini-ppc.c, tramp-ppc.c: don't use r13 as it's used by the PPC EABI
systems already. This also reduces the specific trampiline sizes and
prepares for the use of r12 as the IMT identifier register.
Modified: trunk/mono/mono/mini/ChangeLog
===================================================================
--- trunk/mono/mono/mini/ChangeLog 2007-10-04 16:45:26 UTC (rev 86889)
+++ trunk/mono/mono/mini/ChangeLog 2007-10-04 16:51:51 UTC (rev 86890)
@@ -1,4 +1,10 @@
+Thu Oct 4 19:01:59 CEST 2007 Paolo Molaro <[EMAIL PROTECTED]>
+
+ * mini-ppc.c, tramp-ppc.c: don't use r13 as it's used by the PPC EABI
+ systems already. This also reduces the specific trampiline sizes and
+ prepares for the use of r12 as the IMT identifier register.
+
Thu Oct 4 16:38:27 CEST 2007 Paolo Molaro <[EMAIL PROTECTED]>
* mini-mips.h: endianess fix (simplified from a patch by
Modified: trunk/mono/mono/mini/mini-ppc.c
===================================================================
--- trunk/mono/mono/mini/mini-ppc.c 2007-10-04 16:45:26 UTC (rev 86889)
+++ trunk/mono/mono/mini/mini-ppc.c 2007-10-04 16:51:51 UTC (rev 86890)
@@ -319,7 +319,8 @@
int i, top = 32;
if (cfg->frame_reg != ppc_sp)
top = 31;
- for (i = 13; i < top; ++i)
+ /* ppc_r13 is used by the system on PPC EABI */
+ for (i = 14; i < top; ++i)
regs = g_list_prepend (regs, GUINT_TO_POINTER (i));
return regs;
Modified: trunk/mono/mono/mini/tramp-ppc.c
===================================================================
--- trunk/mono/mono/mini/tramp-ppc.c 2007-10-04 16:45:26 UTC (rev 86889)
+++ trunk/mono/mono/mini/tramp-ppc.c 2007-10-04 16:51:51 UTC (rev 86890)
@@ -249,11 +249,10 @@
offset += sizeof (double);
}
/*
- * now the integer registers. r13 is already saved in the
trampoline,
- * and at this point contains the method to compile, so we skip
it.
+ * now the integer registers.
*/
- offset = STACK - sizeof (MonoLMF) + G_STRUCT_OFFSET (MonoLMF,
iregs) + sizeof (gulong);
- ppc_stmw (buf, ppc_r14, ppc_r1, offset);
+ offset = STACK - sizeof (MonoLMF) + G_STRUCT_OFFSET (MonoLMF,
iregs);
+ ppc_stmw (buf, ppc_r13, ppc_r1, offset);
/* Now save the rest of the registers below the MonoLMF struct,
first 14
* fp regs and then the 13 gregs.
@@ -263,7 +262,8 @@
ppc_stfd (buf, i, offset, ppc_r1);
offset += sizeof (double);
}
- offset = STACK - sizeof (MonoLMF) - (14 * sizeof (double)) -
(13 * sizeof (gulong));
+#define GREGS_OFFSET (STACK - sizeof (MonoLMF) - (14 * sizeof (double)) - (13
* sizeof (gulong)))
+ offset = GREGS_OFFSET;
for (i = 0; i < 13; i++) {
ppc_stw (buf, i, offset, ppc_r1);
offset += sizeof (gulong);
@@ -291,8 +291,10 @@
ppc_stw (buf, ppc_r0, G_STRUCT_OFFSET(MonoLMF, previous_lmf),
ppc_r11);
/* *(lmf_addr) = r11 */
ppc_stw (buf, ppc_r11, G_STRUCT_OFFSET(MonoLMF, previous_lmf),
ppc_r3);
- /* save method info (it's in r13) */
- ppc_stw (buf, ppc_r13, G_STRUCT_OFFSET(MonoLMF, method),
ppc_r11);
+ /* save method info (it's stored on the stack, so get it first
and put it
+ * in r3 as it's the first argument to the function) */
+ ppc_lwz (buf, ppc_r3, GREGS_OFFSET, ppc_r1);
+ ppc_stw (buf, ppc_r3, G_STRUCT_OFFSET(MonoLMF, method),
ppc_r11);
ppc_stw (buf, ppc_sp, G_STRUCT_OFFSET(MonoLMF, ebp), ppc_r11);
/* save the IP (caller ip) */
if (tramp_type == MONO_TRAMPOLINE_JUMP) {
@@ -305,8 +307,8 @@
/*
* Now we're ready to call ppc_magic_trampoline ().
*/
- /* Arg 1: MonoMethod *method. It was put in r13 */
- ppc_mr (buf, ppc_r3, ppc_r13);
+ /* Arg 1: MonoMethod *method. It was put in r3 already above */
+ /*ppc_mr (buf, ppc_r3, ppc_r3);*/
/* Arg 2: code (next address to the instruction that called us)
*/
if (tramp_type == MONO_TRAMPOLINE_JUMP) {
@@ -349,7 +351,7 @@
ppc_lwz (buf, ppc_r6, G_STRUCT_OFFSET(MonoLMF, lmf_addr),
ppc_r11);
/* *(lmf_addr) = previous_lmf */
ppc_stw (buf, ppc_r5, G_STRUCT_OFFSET(MonoLMF, previous_lmf),
ppc_r6);
- /* restore iregs: this time include r13 */
+ /* restore iregs */
ppc_lmw (buf, ppc_r13, ppc_r11, G_STRUCT_OFFSET(MonoLMF,
iregs));
/* restore fregs */
for (i = 14; i < 32; i++) {
@@ -395,26 +397,23 @@
MonoJitInfo *ji;
mono_domain_lock (domain);
- code = buf = mono_code_manager_reserve (domain->code_mp, 32);
+ code = buf = mono_code_manager_reserve (domain->code_mp, 24);
mono_domain_unlock (domain);
- /* Save r13 in the place it will have in the on-stack MonoLMF */
- ppc_stw (buf, ppc_r13, -(MONO_SAVED_FREGS * 8 + MONO_SAVED_GREGS *
sizeof (gpointer)), ppc_r1);
-
/* Prepare the jump to the generic trampoline code.*/
- ppc_lis (buf, ppc_r13, (guint32) tramp >> 16);
- ppc_ori (buf, ppc_r13, ppc_r13, (guint32) tramp & 0xffff);
- ppc_mtctr (buf, ppc_r13);
+ ppc_lis (buf, ppc_r0, (guint32) tramp >> 16);
+ ppc_ori (buf, ppc_r0, ppc_r0, (guint32) tramp & 0xffff);
+ ppc_mtctr (buf, ppc_r0);
- /* And finally put 'method' in r13 and fly! */
- ppc_lis (buf, ppc_r13, (guint32) method >> 16);
- ppc_ori (buf, ppc_r13, ppc_r13, (guint32) method & 0xffff);
+ /* And finally put 'method' in r0 and fly! */
+ ppc_lis (buf, ppc_r0, (guint32) method >> 16);
+ ppc_ori (buf, ppc_r0, ppc_r0, (guint32) method & 0xffff);
ppc_bcctr (buf, 20, 0);
/* Flush instruction cache, since we've generated code */
mono_arch_flush_icache (code, buf - code);
- g_assert ((buf - code) <= 32);
+ g_assert ((buf - code) <= 24);
ji = g_new0 (MonoJitInfo, 1);
ji->method = method;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches