Permalink
Browse files

2008-06-23 Mark Probst <mark.probst@gmail.com>

	* mini.c: Fail sharing of a generic method if it contains an open
	catch clause (because we don't pass MRGCTXs yet).

2008-06-23  Mark Probst  <mark.probst@gmail.com>

	* generic-exceptions.2.cs: Test case for exception handlers in
	generic methods with catch clauses depending on the method type
	arguments.

	* Makefile.am: Test added.

svn path=/trunk/mono/; revision=106446
  • Loading branch information...
1 parent 602a721 commit eba9c113fd66b120309f71c45b856ac392605218 @schani schani committed Jun 23, 2008
Showing with 95 additions and 1 deletion.
  1. +5 −0 mono/mini/ChangeLog
  2. +3 −0 mono/mini/mini.c
  3. +8 −0 mono/tests/ChangeLog
  4. +3 −1 mono/tests/Makefile.am
  5. +76 −0 mono/tests/generic-exceptions.2.cs
View
@@ -1,5 +1,10 @@
2008-06-23 Mark Probst <mark.probst@gmail.com>
+ * mini.c: Fail sharing of a generic method if it contains an open
+ catch clause (because we don't pass MRGCTXs yet).
+
+2008-06-23 Mark Probst <mark.probst@gmail.com>
+
* mini.c: When compiling a method with generic sharing, insert the
method instantiated with an all-Object generic context into the
jit info table, instead of the context of the first instantiation
View
@@ -5025,6 +5025,9 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
clause->data.catch_class &&
cfg->generic_sharing_context &&
mono_class_check_context_used (clause->data.catch_class)) {
+ if (mono_method_get_context (method)->method_inst)
+ GENERIC_SHARING_FAILURE (CEE_NOP);
+
/*
* In shared generic code with catch
* clauses containing type variables
@@ -1,3 +1,11 @@
+2008-06-23 Mark Probst <mark.probst@gmail.com>
+
+ * generic-exceptions.2.cs: Test case for exception handlers in
+ generic methods with catch clauses depending on the method type
+ arguments.
+
+ * Makefile.am: Test added.
+
2008-06-20 Rodrigo Kumpera <rkumpera@novell.com>
* bug-349190.2.cs: Regression test for bug #349190.
@@ -274,6 +274,7 @@ BASE_TEST_CS_SRC= \
generic-static-methods.2.cs \
generic-null-call.2.cs \
generic-special.2.cs \
+ generic-exceptions.2.cs \
recursive-generics.2.cs \
bug-80392.2.cs \
dynamic-method-access.2.cs \
@@ -707,7 +708,8 @@ test-generic-sharing : generics-sharing.2.exe shared-generic-methods.2.exe \
generic-interface-methods.2.exe generic-array-type.2.exe \
generic-method-patching.2.exe generic-static-methods.2.exe \
generic-null-call.2.exe generic-tailcall2.2.exe \
- generic-array-exc.2.exe generic-special.2.exe
+ generic-array-exc.2.exe generic-special.2.exe \
+ generic-exceptions.2.exe
for fn in $+ ; do \
echo "Testing $$fn ..."; \
MONO_GENERIC_SHARING=all $(RUNTIME) -O=gshared $$fn || exit 1; \
@@ -0,0 +1,76 @@
+using System;
+
+public class GenExc<S,T> : Exception {
+}
+
+public delegate void ThrowDelegate ();
+
+public class Gen<T> {
+ public void catcher<S> (ThrowDelegate thrower) {
+ try {
+ thrower ();
+ }
+ catch (GenExc<S,T>) {
+ }
+ }
+
+ public static void staticCatcher<S> (ThrowDelegate thrower) {
+ try {
+ thrower ();
+ }
+ catch (GenExc<S,T>) {
+ }
+ }
+}
+
+public class main {
+ static void throwObjectObject () {
+ throw new GenExc<object, object> ();
+ }
+
+ static void throwStringObject () {
+ throw new GenExc<string, object> ();
+ }
+
+ static int Main () {
+ Gen<object> go = new Gen<object> ();
+
+ try {
+ go.catcher<object> (new ThrowDelegate (main.throwObjectObject));
+ Gen<object>.staticCatcher<object> (new ThrowDelegate (main.throwObjectObject));
+ go.catcher<string> (new ThrowDelegate (main.throwStringObject));
+ Gen<object>.staticCatcher<string> (new ThrowDelegate (main.throwStringObject));
+ }
+ catch {
+ return 1;
+ }
+
+ try {
+ go.catcher<object> (new ThrowDelegate (main.throwStringObject));
+ return 1;
+ }
+ catch {
+ }
+ try {
+ Gen<object>.staticCatcher<object> (new ThrowDelegate (main.throwStringObject));
+ return 1;
+ }
+ catch {
+ }
+
+ try {
+ go.catcher<string> (new ThrowDelegate (main.throwObjectObject));
+ return 1;
+ }
+ catch {
+ }
+ try {
+ Gen<object>.staticCatcher<string> (new ThrowDelegate (main.throwObjectObject));
+ return 1;
+ }
+ catch {
+ }
+
+ return 0;
+ }
+}

0 comments on commit eba9c11

Please sign in to comment.