diff options
author | Mark Probst <mark.probst@gmail.com> | 2008-12-19 13:39:22 +0300 |
---|---|---|
committer | Mark Probst <mark.probst@gmail.com> | 2008-12-19 13:39:22 +0300 |
commit | 7e7c65d58f79155fd21775e9d59109b2f0d1e1dd (patch) | |
tree | b7cabfff8d7c2e84f856c6079044497207d0bf42 | |
parent | 4bf06608d3af5e87872bc3ab4580f8fc3c5acf4b (diff) |
2008-12-19 Mark Probst <mark.probst@gmail.com>
Backport of r121292.
* method-to-ir.c: Removed an unnecessary assertion.
2008-12-19 Mark Probst <mark.probst@gmail.com>
Backport of r121292.
* metadata/generic-sharing.c: Look for constraints in all type
arguments, not just the first one.
2008-12-19 Mark Probst <mark.probst@gmail.com>
Backport of r121292.
* generic-marshalbyref.2.cs: Test for calls to marshal-by-ref
objects.
* Makefile.am: Test added.
svn path=/branches/mono-2-2/mono/; revision=121836
-rw-r--r-- | mono/metadata/ChangeLog | 7 | ||||
-rw-r--r-- | mono/metadata/generic-sharing.c | 23 | ||||
-rw-r--r-- | mono/mini/ChangeLog | 6 | ||||
-rw-r--r-- | mono/mini/method-to-ir.c | 2 | ||||
-rw-r--r-- | mono/tests/ChangeLog | 9 | ||||
-rw-r--r-- | mono/tests/Makefile.am | 4 | ||||
-rw-r--r-- | mono/tests/generic-marshalbyref.2.cs | 39 |
7 files changed, 81 insertions, 9 deletions
diff --git a/mono/metadata/ChangeLog b/mono/metadata/ChangeLog index c1e0d900b74..e4cccbcef81 100644 --- a/mono/metadata/ChangeLog +++ b/mono/metadata/ChangeLog @@ -1,3 +1,10 @@ +2008-12-19 Mark Probst <mark.probst@gmail.com> + + Backport of r121292. + + * metadata/generic-sharing.c: Look for constraints in all type + arguments, not just the first one. + 2008-12-17 Geoff Norton <gnorton@novell.com> * threadpool.c: Ensure that the io_queue_lock is initialized diff --git a/mono/metadata/generic-sharing.c b/mono/metadata/generic-sharing.c index 42361d2cb81..a341c64af55 100644 --- a/mono/metadata/generic-sharing.c +++ b/mono/metadata/generic-sharing.c @@ -1347,6 +1347,20 @@ mono_method_is_generic_impl (MonoMethod *method) return FALSE; } +static gboolean +has_constraints (MonoGenericContainer *container) +{ + int i; + + g_assert (container->type_argc > 0); + g_assert (container->type_params); + + for (i = 0; i < container->type_argc; ++i) + if (container->type_params [i].constraints) + return TRUE; + return FALSE; +} + /* * mono_method_is_generic_sharable_impl: * @method: a method @@ -1372,9 +1386,7 @@ mono_method_is_generic_sharable_impl (MonoMethod *method, gboolean allow_type_va g_assert (inflated->declaring); if (inflated->declaring->is_generic) { - g_assert (mono_method_get_generic_container (inflated->declaring)->type_params); - - if (mono_method_get_generic_container (inflated->declaring)->type_params->constraints) + if (has_constraints (mono_method_get_generic_container (inflated->declaring))) return FALSE; } } @@ -1384,10 +1396,9 @@ mono_method_is_generic_sharable_impl (MonoMethod *method, gboolean allow_type_va return FALSE; g_assert (method->klass->generic_class->container_class && - method->klass->generic_class->container_class->generic_container && - method->klass->generic_class->container_class->generic_container->type_params); + method->klass->generic_class->container_class->generic_container); - if (method->klass->generic_class->container_class->generic_container->type_params->constraints) + if (has_constraints (method->klass->generic_class->container_class->generic_container)) return FALSE; } diff --git a/mono/mini/ChangeLog b/mono/mini/ChangeLog index 86961528e97..cd0ac1e59de 100644 --- a/mono/mini/ChangeLog +++ b/mono/mini/ChangeLog @@ -1,3 +1,9 @@ +2008-12-19 Mark Probst <mark.probst@gmail.com> + + Backport of r121292. + + * method-to-ir.c: Removed an unnecessary assertion. + 2008-12-16 Martin Baulig <martin@ximian.com> Backport of r120438. diff --git a/mono/mini/method-to-ir.c b/mono/mini/method-to-ir.c index 4a4205f84c2..f7bd0a609b0 100644 --- a/mono/mini/method-to-ir.c +++ b/mono/mini/method-to-ir.c @@ -7305,8 +7305,6 @@ mono_method_to_ir2 (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_ !mono_class_generic_sharing_enabled (cmethod->klass))) { MonoInst *cmethod_addr; - g_assert (!callvirt_this_arg); - cmethod_addr = emit_get_rgctx_method (cfg, context_used, cmethod, MONO_RGCTX_INFO_GENERIC_METHOD_CODE); diff --git a/mono/tests/ChangeLog b/mono/tests/ChangeLog index a8164070316..183c44d10d2 100644 --- a/mono/tests/ChangeLog +++ b/mono/tests/ChangeLog @@ -1,3 +1,12 @@ +2008-12-19 Mark Probst <mark.probst@gmail.com> + + Backport of r121292. + + * generic-marshalbyref.2.cs: Test for calls to marshal-by-ref + objects. + + * Makefile.am: Test added. + 2008-12-08 Rodrigo Kumpera <rkumpera@novell.com> * bug457574.il: New regression test. diff --git a/mono/tests/Makefile.am b/mono/tests/Makefile.am index b45b30ea8ee..502165a9b10 100644 --- a/mono/tests/Makefile.am +++ b/mono/tests/Makefile.am @@ -288,6 +288,7 @@ BASE_TEST_CS_SRC= \ generic-delegate-ctor.2.cs \ generic-array-iface-set.2.cs \ generic-typedef.2.cs \ + generic-marshalbyref.2.cs \ bug-431413.2.cs \ generic-virtual-invoke.2.cs \ recursive-generics.2.cs \ @@ -717,7 +718,8 @@ test-generic-sharing : generics-sharing.2.exe shared-generic-methods.2.exe \ generic-getgenericarguments.2.exe generic-type-builder.2.exe \ generic-synchronized.2.exe generic-delegate-ctor.2.exe \ generic-constrained.2.exe bug-431413.2.exe \ - generic-virtual-invoke.2.exe generic-typedef.2.exe + generic-virtual-invoke.2.exe generic-typedef.2.exe \ + generic-marshalbyref.2.exe @for fn in $+ ; do \ echo "Testing $$fn ..."; \ MONO_GENERIC_SHARING=all $(RUNTIME) -O=gshared $$fn > $$fn.stdout || exit 1; \ diff --git a/mono/tests/generic-marshalbyref.2.cs b/mono/tests/generic-marshalbyref.2.cs new file mode 100644 index 00000000000..1576b37c99a --- /dev/null +++ b/mono/tests/generic-marshalbyref.2.cs @@ -0,0 +1,39 @@ +using System; + +static class Program +{ + static int Main() + { + DocumentForm<object> browseForm = new DocumentForm<object> (); + if (browseForm.DoInit () != 124) + return 1; + return 0; + } +} + +public abstract class EntityBase +{ +} + +public class GenEntity<T> : EntityBase +{ +} + +class DocumentForm<T> +{ + internal int DoInit() + { + var g = new Grid1<GenEntity<T>>(123); + return g.num; + } +} + +public class Grid1<TEntity> : MarshalByRefObject where TEntity : EntityBase, new() +{ + public int num; + + public Grid1 (int i) + { + num = i + 1; + } +} |