Author: miguel
Date: 2005-09-27 17:19:48 -0400 (Tue, 27 Sep 2005)
New Revision: 50892
Modified:
branches/mono-1-1-9/mono/mono/mini/ChangeLog
branches/mono-1-1-9/mono/mono/mini/inssel-amd64.brg
branches/mono-1-1-9/mono/mono/mini/mini-amd64.c
Log:
Backport 2005-09-27 Zoltan Varga <[EMAIL PROTECTED]>
* mini-amd64.c (mono_arch_call_opcode): Use mono_class_value_size ()
to determine the amount of memory to copy when passing valuetypes.
* inssel-amd64.brg: Remove PUSH(LDIND4) rules since they convert an
4 byte load into a 8 byte load. Fix aligning of size in OP_OUTARG_VT.
Modified: branches/mono-1-1-9/mono/mono/mini/ChangeLog
===================================================================
--- branches/mono-1-1-9/mono/mono/mini/ChangeLog 2005-09-27 21:11:14 UTC
(rev 50891)
+++ branches/mono-1-1-9/mono/mono/mini/ChangeLog 2005-09-27 21:19:48 UTC
(rev 50892)
@@ -1,4 +1,11 @@
+2005-09-27 Zoltan Varga <[EMAIL PROTECTED]>
+
+ * mini-amd64.c (mono_arch_call_opcode): Use mono_class_value_size ()
+ to determine the amount of memory to copy when passing valuetypes.
+ * inssel-amd64.brg: Remove PUSH(LDIND4) rules since they convert an
+ 4 byte load into a 8 byte load. Fix aligning of size in OP_OUTARG_VT.
+
Fri Sep 9 19:30:37 BST 2005 Paolo Molaro <[EMAIL PROTECTED]>
* cpu-arm.md, mini-arm.c: fix for dynamic code (Gtk# apps).
Modified: branches/mono-1-1-9/mono/mono/mini/inssel-amd64.brg
===================================================================
--- branches/mono-1-1-9/mono/mono/mini/inssel-amd64.brg 2005-09-27 21:11:14 UTC
(rev 50891)
+++ branches/mono-1-1-9/mono/mono/mini/inssel-amd64.brg 2005-09-27 21:19:48 UTC
(rev 50892)
@@ -284,20 +284,6 @@
mono_bblock_add_inst (s->cbb, tree);
}
-stmt: OP_OUTARG (CEE_LDIND_I4 (base)) {
- tree->opcode = OP_X86_PUSH_MEMBASE;
- tree->inst_basereg = state->left->left->tree->inst_basereg;
- tree->inst_offset = state->left->left->tree->inst_offset;
- mono_bblock_add_inst (s->cbb, tree);
-}
-
-stmt: OP_OUTARG (CEE_LDIND_U4 (base)) {
- tree->opcode = OP_X86_PUSH_MEMBASE;
- tree->inst_basereg = state->left->left->tree->inst_basereg;
- tree->inst_offset = state->left->left->tree->inst_offset;
- mono_bblock_add_inst (s->cbb, tree);
-}
-
stmt: OP_OUTARG (CEE_LDIND_I (base)) {
tree->opcode = OP_X86_PUSH_MEMBASE;
tree->inst_basereg = state->left->left->tree->inst_basereg;
@@ -380,15 +366,16 @@
if (!tree->inst_imm)
return;
- if (tree->inst_imm <= 8) {
+ if (tree->inst_imm == 8) {
+ /* Can't use this for < 8 since it does an 8 byte memory load */
tree->opcode = OP_X86_PUSH_MEMBASE;
tree->inst_basereg = vt->inst_basereg;
tree->inst_offset = vt->inst_offset;
mono_bblock_add_inst (s->cbb, tree);
} else if (tree->inst_imm <= 20) {
int sz = tree->inst_imm;
- sz += 8;
- sz &= ~8;
+ sz += 7;
+ sz &= ~7;
MONO_EMIT_NEW_BIALU_IMM (s, OP_SUB_IMM, X86_ESP, X86_ESP, sz);
mini_emit_memcpy (s, X86_ESP, 0, vt->inst_basereg,
vt->inst_offset, tree->inst_imm, 0);
} else {
Modified: branches/mono-1-1-9/mono/mono/mini/mini-amd64.c
===================================================================
--- branches/mono-1-1-9/mono/mono/mini/mini-amd64.c 2005-09-27 21:11:14 UTC
(rev 50891)
+++ branches/mono-1-1-9/mono/mono/mini/mini-amd64.c 2005-09-27 21:19:48 UTC
(rev 50892)
@@ -1090,8 +1090,15 @@
else
if (sig->pinvoke)
size = mono_type_native_stack_size
(&in->klass->byval_arg, &align);
- else
- size = mono_type_stack_size
(&in->klass->byval_arg, &align);
+ else {
+ /*
+ * Other backends use
mono_type_stack_size (), but that
+ * aligns the size to 8, which is
larger than the size of
+ * the source, leading to reads of
invalid memory if the
+ * source is at the end of address
space.
+ */
+ size = mono_class_value_size
(in->klass, &align);
+ }
if (ainfo->storage == ArgValuetypeInReg) {
if (ainfo->pair_storage [1] == ArgNone)
{
MonoInst *load;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches