[Mono-devel-list] Problem with System.Reflection.ConstructorInfo

Joshua Tauberer tauberer at for.net
Mon Mar 8 20:24:36 EST 2004


So I procrastinated from doing school work by tracking down this bug...

I just got Ivan Hamilton's email, but since I have my email ready to go, 
I'll send it anyway. :)  Plus, I have a slightly different take on 
fixing the bug, although I think Ivan's fix is just as good.

Etienne Boucher wrote:
> The problem seems to be with creating an array 
> from an array initilizer list of more than 6 elements.

The problem was in creating any reference-type array (except string and 
object) with more than 6 nulls.  Nulls, being a type of constant (and 
the only constant that can appear in these reference type arrays), 
tricked mcs into thinking the array could be initialized from a static 
field of values, which mcs would only do if there were more than 6 values.

Attached is a patch that I can commit if the appropriate people think 
it's ok.

While I was looking at this, two possible improvements to array creation 
came to mind.  Do null elements of arrays need to be initialized?  The 
CIL specs don't seem to say, which I guess means yes.  (Though numeric 
elements are initialized to zero.)  The other thing is that filling in 
the array elements uses a local variable to hold the array while it's 
being created.  Is there any performance boost to be gained by using 
dup's instead of ldloc's?

-- 
- Joshua Tauberer

http://taubz.for.net

** Nothing Unreal Exists **


-------------- next part --------------
A non-text attachment was scrubbed...
Name: arrayinitbug.diff
Type: text/x-patch
Size: 2471 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040308/094cf40b/attachment.bin 


More information about the Mono-devel-list mailing list