[Mono-devel-list] sharing generic instantitions

Martin Baulig martin at ximian.com
Sat Jul 2 11:03:45 EDT 2005


Hello,

I know about that - it's one big outstanding task regarding generics.
This'll be implemented in Mono at some point - but since it's very
difficult and time intensive, I can't say for sure how long that'll
take.

It's just just about sharing code, we're currently also using several
expensive operations in the runtime which have to be optimized away.

My original plan regarding shared code was doing this in small pieces,
but so far I was just too busy to start with it at all.  However, now
that GMCS is getting more and more bug-free, I think I can start having
a look at some of these runtime optimizations - they're also required
for implementing shared code later on.

Martin

On Sat, 2005-07-02 at 14:50 +0200, Michal Moskal wrote:
> Hello,
> 
> As far as I know the MS implementation of generics uses sharing of
> code in certain situations. For example if we have a method foo<T>()
> the code for foo<object>() and foo<string>() will be shared. However
> the code for foo<int>() and foo<double>() will probably not be shared,
> because the sizes of int and double are different.
> 
> There is a problem, when you use the type parameter, for instance
> foo<T> () { ... new Hashtable <T,int> () ... }. You need to know its
> value, so it has to be actually passed, just like a regular parameter.
> 
> This is explained in more detail here:
> 
>   http://blogs.msdn.com/joelpob/archive/2004/11/17/259224.aspx
> 
> Is this feature planned in Mono?
> 
> This is mostly a performance issue. I don't know how bad could be the
> impact of lack of this feature, because of:
> 
>   http://bugzilla.ximian.com/show_bug.cgi?id=75444
> 
> but as far as I can see in the Nemerle compiler, using highly generic code
> the amount of generated code is 3x as big as with version using boxing
> everything to object.
> 
> --
>    Michal Moskal,
>    http://nemerle.org/~malekith/
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 




More information about the Mono-devel-list mailing list