[Mono-devel-list] Re: [Mono-patches] r40228 - trunk/mcs/class/System.Drawing/System.Drawing

Ben Maurer bmaurer at ximian.com
Mon Feb 7 07:12:14 EST 2005

On Mon, 2005-02-07 at 08:11 +0000, Marek Safar wrote:
> >
> >I think this would be great as a compiler optimization.  (In fact, GCC
> >has something similar for move '=0' static initializers to the BSS.)
> >  
> >
> I am working on this but for instance fields only. For static fields it 
> is more complicated but possible to implement for some special cases. 
> Because you can remove hidden dependency
> of static constructors.

There was an msft blog that basically said they figured out some corner
cases where you could safely remove. I think one of the cases was `every
field is inited' to null/0/false/etc'. So that would have covered this

But this was the only really horrible case I was able to find, using
grep. I didn't measure the amount of jitted code, but it was probably
very large. It was probably:

mov eax, 0xdeadbeef
mov [eax], 0

Which is likely on the order of 12 bytes (don't quote me, I haven't
looked it up). Take that times the number of fields there. *ugh*.

-- Ben

More information about the Mono-devel-list mailing list