Folks: I was porting a small test application that was written in C# that allocated an array with a large number of elements (> 2^32). While it compiled and ran in Visual Studio's C# under WindowsXP-64bit without a hitch, when I compiled and ran it under mcs/mono (1.2.4) on the same hardware, but booted up under Fedora7-x86_64, I ran into a few problems.
Digging into it a bit, I discovered that: 1) MCS assumed that the arguments to NEWARR were always U4 or I4, which does not seem to be the case as far as ECMA-335v4. 2) MONO assumes that array lengths and bounds can always be represented as guint32's, [ like mono_array_new_specific (MonoVTable *vtable, guint32 n) ] Would folks object to a series of patches to: A) Fix mcs/expression.cs to emit OpCodes.Conv_Ovf_U/I instead of OpCodes.Conv_Ovf_U4/I4 for array size arguments, B) Modify mono/metadata/object.h to change the base type for array lengths/bounds to XXX instead of guint32, C) Change mono/metadata/object.c to change the functions that create/ access arrays to take XXX instead of guint32 length/bounds arguments. Also perhaps update some of the lower level object allocation functions to use XXX as needed. D) Modify the execution of NEWARR be able to deal with I/U native types. No doubt something in the JIT needs tweaking as well. E) Double check that array indexing not only takes native int types, but uses them right. F) Add a few new test cases for large array allocation. G) Whatever else needs to be done that I'll bump into after I try making the above changes and realize what I forgot. Warnings of known hazards gratefully accepted. My big question is what the right type for the size ought to be? I've seen int, size_t, gsize, and guint32 used in Mono. I suspect that int and guint32 are wrong from a portability perspective, but would prefer that someone more intimately involved with Mono to say if guint or gsize or size_t were preferred. I'm guessing Bug 81774 is related to this as well. BTW, is this too big for a newby to tackle? --Luis F. Ortiz Follower of the "Selfish Way" _______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list