Author: lupus
Date: 2007-03-23 07:08:37 -0500 (Fri, 23 Mar 2007)
New Revision: 74867
Modified:
trunk/mono/mono/mini/ChangeLog
trunk/mono/mono/mini/mini-ppc.c
trunk/mono/mono/mini/mini-ppc.h
Log:
Fri Mar 23 12:53:28 CET 2007 Paolo Molaro <[EMAIL PROTECTED]>
* mini-ppc.c, mini-ppc.h: struct passing ABI fix (bug #77968).
Modified: trunk/mono/mono/mini/ChangeLog
===================================================================
--- trunk/mono/mono/mini/ChangeLog 2007-03-23 01:47:03 UTC (rev 74866)
+++ trunk/mono/mono/mini/ChangeLog 2007-03-23 12:08:37 UTC (rev 74867)
@@ -1,3 +1,8 @@
+
+Fri Mar 23 12:53:28 CET 2007 Paolo Molaro <[EMAIL PROTECTED]>
+
+ * mini-ppc.c, mini-ppc.h: struct passing ABI fix (bug #77968).
+
2007-03-22 Zoltan Varga <[EMAIL PROTECTED]>
* cfold.c (FOLD_BINOP): Cast the result to gint32 to prevent overflow
problems
Modified: trunk/mono/mono/mini/mini-ppc.c
===================================================================
--- trunk/mono/mono/mini/mini-ppc.c 2007-03-23 01:47:03 UTC (rev 74866)
+++ trunk/mono/mono/mini/mini-ppc.c 2007-03-23 12:08:37 UTC (rev 74867)
@@ -412,7 +412,7 @@
typedef struct {
gint32 offset;
- guint16 vtsize; /* in param area */
+ guint32 vtsize; /* in param area */
guint8 reg;
guint8 regtype : 4; /* 0 general, 1 basereg, 2 floating point
register, see RegType* */
guint8 size : 4; /* 1, 2, 4, 8, or regs used by RegTypeStructByVal
*/
@@ -622,6 +622,7 @@
#else
add_general (&gr, &stack_size, cinfo->args + n, TRUE);
cinfo->args [n].regtype = RegTypeStructByAddr;
+ cinfo->args [n].vtsize = size;
#endif
n++;
break;
@@ -651,6 +652,7 @@
#else
add_general (&gr, &stack_size, cinfo->args + n, TRUE);
cinfo->args [n].regtype = RegTypeStructByAddr;
+ cinfo->args [n].vtsize = size;
#endif
n++;
break;
@@ -998,7 +1000,6 @@
if (arg->type == STACK_I8)
call->used_iregs |= 1 << (ainfo->reg +
1);
} else if (ainfo->regtype == RegTypeStructByAddr) {
- /* FIXME: where si the data allocated? */
arg->backend.reg3 = ainfo->reg;
call->used_iregs |= 1 << ainfo->reg;
} else if (ainfo->regtype == RegTypeStructByVal) {
@@ -3308,9 +3309,17 @@
code = emit_memcpy (code, ainfo->vtsize
* sizeof (gpointer), inst->inst_basereg, doffset, ppc_r11, ainfo->offset +
soffset);
}
} else if (ainfo->regtype == RegTypeStructByAddr) {
+ /* if it was originally a RegTypeBase */
+ if (ainfo->offset) {
+ /* load the previous stack pointer in
r11 */
+ ppc_lwz (code, ppc_r11, 0, ppc_sp);
+ ppc_lwz (code, ppc_r11, ainfo->offset,
ppc_r11);
+ } else {
+ ppc_mr (code, ppc_r11, ainfo->reg);
+ }
g_assert (ppc_is_imm16 (inst->inst_offset));
- /* FIXME: handle overrun! with struct sizes not
multiple of 4 */
- code = emit_memcpy (code, ainfo->vtsize *
sizeof (gpointer), inst->inst_basereg, inst->inst_offset, ainfo->reg, 0);
+ code = emit_memcpy (code, ainfo->vtsize,
inst->inst_basereg, inst->inst_offset, ppc_r11, 0);
+ /*g_print ("copy in %s: %d bytes from %d to
offset: %d\n", method->name, ainfo->vtsize, ainfo->reg, inst->inst_offset);*/
} else
g_assert_not_reached ();
}
Modified: trunk/mono/mono/mini/mini-ppc.h
===================================================================
--- trunk/mono/mono/mini/mini-ppc.h 2007-03-23 01:47:03 UTC (rev 74866)
+++ trunk/mono/mono/mini/mini-ppc.h 2007-03-23 12:08:37 UTC (rev 74867)
@@ -99,8 +99,7 @@
#define PPC_LAST_ARG_REG ppc_r10
#define PPC_FIRST_FPARG_REG ppc_f1
#define PPC_LAST_FPARG_REG ppc_f8
-/* set the next to 0 once inssel-ppc.brg is updated */
-#define PPC_PASS_STRUCTS_BY_VALUE 1
+#define PPC_PASS_STRUCTS_BY_VALUE 0
#define PPC_SMALL_RET_STRUCT_IN_REG 1
#endif
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches