[Mono-devel-list] Re: [Mono-patches] r36936 - trunk/mono/mono/metadata

Martin Baulig martin at ximian.com
Thu Dec 2 10:49:11 EST 2004


On Thu, 2004-12-02 at 10:27 -0500, Ben Maurer wrote:
> > +        nginst = g_new0 (MonoGenericInst, 1);
> > +        nginst->type_argc = ginst->type_argc;
> > +        nginst->type_argv = g_new0 (MonoType*, nginst->type_argc);
> 
> Is there any reason not to make MonoGenericInst a variable lengh
> structure. This would avoid making two mallocs.

That's my plan.

> > +static guint
> > +mono_generic_inst_hash (gconstpointer data)
> > +{
> > +	const MonoGenericInst *ginst = (const MonoGenericInst *) data;
> > +	return ginst->type_argc | (ginst->is_open << 8);
> > +}
> 
> This hash function looks like it will have tons of conflicts. It does not
> take into account this part of equals:

I'd be happy if someone writes a better hash function .... :-)

> Who locks this?

It should only be called while already having the metadata lock, so no
need to do an additional locking.

Martin





More information about the Mono-devel-list mailing list