[Mono-dev] Fwd: [PATCH] Generic Type Definition / Open Instantiation mismatch patch.

Paolo Molaro lupus at ximian.com
Tue Sep 25 14:06:07 EDT 2007


On 09/21/07 Rodrigo Kumpera wrote:
> There is one finall twist on this patch, the way System.Reflection.Emit in
> mono is incompatible with .net. On mono, TypeBuilder::MakeGenericType
> returns a Type that is functional (one you can call GetConstructors). This
> means that you cannot have the same behavior that happens with types loaded
> from an assembly. To get arround this fact, either I could either "fix" gmcs
> to work with the crippled .net SRE API, or special case for TypeBuilder. I
> have choosen the later one as it makes more sense.
> 
> This mean that in mono_metadata_lookup_generic_class we check if we are
> looking up the open instantiation of a TypeBuilder and return a
> MonoGenericClass than won't be the same for the created type.

Put this as a comment near the relevant code when you commit.

> Index: metadata/class.c
> ===================================================================
> --- metadata/class.c	(revision 86148)
> +++ metadata/class.c	(working copy)
> @@ -2847,10 +2847,46 @@
>  	return class_init_ok;
>  }
>  
> +
>  /*
>   * LOCKING: this assumes the loader lock is held
>   */
>  void
> +mono_class_setup_generic_type_container (MonoClass *class, gboolean dynamic)
> +{
> +	MonoGenericContainer * container = class->generic_container;
> +	MonoGenericInst * inst;
> +	MonoGenericClass *gklass;
> +
> +	g_assert (container);
> +	g_assert (!class->generic_class);
> +
> +	if (container->gtd_class)
> +		return;
> +
> +
> +	if (container->gtd_class) {
> +		return;
> +	}

The duplicated code here as has been noted already.
The change is fine for me, but you'll need also Hari's ok to commit.
Thanks!

lupus

-- 
-----------------------------------------------------------------
lupus at debian.org                                     debian/rules
lupus at ximian.com                             Monkeys do it better



More information about the Mono-devel-list mailing list