Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

2008-11-13 Mark Probst <mark.probst@gmail.com>

	* mini-ppc.c, cpu-ppc.md: Reserve space for the parameter area in
	filters.

2008-11-13  Mark Probst  <mark.probst@gmail.com>

	* filter-stack.cs: Test whether method calls with large arguments
	work in filter clauses.

	* Makefile.am: Test added.

svn path=/trunk/mono/; revision=118728
  • Loading branch information...
commit e35b99107feb300954153f630a6ff8d9479fde79 1 parent 004f5ad
@schani schani authored
View
5 mono/mini/ChangeLog
@@ -1,3 +1,8 @@
+2008-11-13 Mark Probst <mark.probst@gmail.com>
+
+ * mini-ppc.c, cpu-ppc.md: Reserve space for the parameter area in
+ filters.
+
2008-11-13 Rodrigo Kumpera <rkumpera@novell.com>
* simd-intrinsics.c: Enable constructor intrinsics for all types.
View
6 mono/mini/cpu-ppc.md
@@ -60,8 +60,8 @@ add_ovf_carry: dest:i src1:i src2:i len:16
sub_ovf_carry: dest:i src1:i src2:i len:16
add_ovf_un_carry: dest:i src1:i src2:i len:16
sub_ovf_un_carry: dest:i src1:i src2:i len:16
-start_handler: len:16
-endfinally: len:12
+start_handler: len:32
+endfinally: len:28
ceq: dest:i len:12
cgt: dest:i len:12
cgt.un: dest:i len:12
@@ -197,7 +197,7 @@ float_clt: dest:i src1:f src2:f len:16
float_clt_un: dest:i src1:f src2:f len:20
float_conv_to_u: dest:i src1:f len:36
call_handler: len:12
-endfilter: src1:i len:16
+endfilter: src1:i len:32
aot_const: dest:i len:8
sqrt: dest:f src1:f len:4
adc: dest:i src1:i src2:i len:4
View
50 mono/mini/mini-ppc.c
@@ -2795,6 +2795,50 @@ ins_native_length (MonoCompile *cfg, MonoInst *ins)
return len;
}
+static guint8*
+emit_reserve_param_area (MonoCompile *cfg, guint8 *code)
+{
+ int size = cfg->param_area;
+
+ size += MONO_ARCH_FRAME_ALIGNMENT - 1;
+ size &= -MONO_ARCH_FRAME_ALIGNMENT;
+
+ if (!size)
+ return code;
+
+ ppc_lwz (code, ppc_r0, 0, ppc_sp);
+ if (ppc_is_imm16 (-size)) {
+ ppc_stwu (code, ppc_r0, -size, ppc_sp);
+ } else {
+ ppc_load (code, ppc_r11, -size);
+ ppc_stwux (code, ppc_r0, ppc_sp, ppc_r11);
+ }
+
+ return code;
+}
+
+static guint8*
+emit_unreserve_param_area (MonoCompile *cfg, guint8 *code)
+{
+ int size = cfg->param_area;
+
+ size += MONO_ARCH_FRAME_ALIGNMENT - 1;
+ size &= -MONO_ARCH_FRAME_ALIGNMENT;
+
+ if (!size)
+ return code;
+
+ ppc_lwz (code, ppc_r0, 0, ppc_sp);
+ if (ppc_is_imm16 (size)) {
+ ppc_stwu (code, ppc_r0, size, ppc_sp);
+ } else {
+ ppc_load (code, ppc_r11, size);
+ ppc_stwux (code, ppc_r0, ppc_sp, ppc_r11);
+ }
+
+ return code;
+}
+
void
mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
{
@@ -3455,6 +3499,8 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
}
case OP_START_HANDLER: {
MonoInst *spvar = mono_find_spvar_for_region (cfg, bb->region);
+ g_assert (spvar->inst_basereg != ppc_sp);
+ code = emit_reserve_param_area (cfg, code);
ppc_mflr (code, ppc_r0);
if (ppc_is_imm16 (spvar->inst_offset)) {
ppc_stw (code, ppc_r0, spvar->inst_offset, spvar->inst_basereg);
@@ -3466,6 +3512,8 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
}
case OP_ENDFILTER: {
MonoInst *spvar = mono_find_spvar_for_region (cfg, bb->region);
+ g_assert (spvar->inst_basereg != ppc_sp);
+ code = emit_unreserve_param_area (cfg, code);
if (ins->sreg1 != ppc_r3)
ppc_mr (code, ppc_r3, ins->sreg1);
if (ppc_is_imm16 (spvar->inst_offset)) {
@@ -3480,6 +3528,8 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
}
case OP_ENDFINALLY: {
MonoInst *spvar = mono_find_spvar_for_region (cfg, bb->region);
+ g_assert (spvar->inst_basereg != ppc_sp);
+ code = emit_unreserve_param_area (cfg, code);
ppc_lwz (code, ppc_r0, spvar->inst_offset, spvar->inst_basereg);
ppc_mtlr (code, ppc_r0);
ppc_blr (code);
View
7 mono/tests/ChangeLog
@@ -1,3 +1,10 @@
+2008-11-13 Mark Probst <mark.probst@gmail.com>
+
+ * filter-stack.cs: Test whether method calls with large arguments
+ work in filter clauses.
+
+ * Makefile.am: Test added.
+
2008-11-06 Jonathan Chambers <joncham@gmail.com>
* async_read.cs: Open file with Read access to avoid
View
3  mono/tests/Makefile.am
@@ -320,7 +320,8 @@ BASE_TEST_CS_SRC= \
bug-81673.cs \
bug-81691.cs \
bug-80307.cs \
- bug-415577.cs
+ bug-415577.cs \
+ filter-stack.cs
if AMD64
TEST_CS_SRC = $(BASE_TEST_CS_SRC) async-exc-compilation.cs
View
62 mono/tests/filter-stack.cs
@@ -0,0 +1,62 @@
+using System;
+
+public struct sa {
+ public int a;
+ public int b;
+ public int c;
+ public int d;
+}
+
+public struct sb {
+ public sa a;
+ public sa b;
+ public sa c;
+ public sa d;
+}
+
+public struct sc {
+ public sb a;
+ public sb b;
+ public sb c;
+ public sb d;
+}
+
+public struct sd {
+ public sc a;
+ public sc b;
+ public sc c;
+ public sc d;
+}
+
+public struct se {
+ public sd a;
+ public sd b;
+ public sd c;
+ public sd d;
+}
+
+public class main {
+ public static int heusl (se x) {
+ Console.WriteLine ("within");
+ return 123;
+ }
+
+ public static void thrower () {
+ try {
+ throw new Exception ();
+ } finally {
+ Console.WriteLine ("before");
+ heusl (new se ());
+ Console.WriteLine ("after");
+ }
+ }
+
+ public static int Main () {
+ try {
+ thrower ();
+ } catch {
+ Console.WriteLine ("back");
+ }
+ return 0;
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.