[Mono-dev] How To Convince Mono To Allocate Big Arrays

Rodrigo Kumpera kumpera at gmail.com
Thu May 8 12:55:49 EDT 2008


On Thu, May 8, 2008 at 1:40 PM, Luis F. Ortiz <LuisOrtiz at verizon.net> wrote:

> On May 7, 2008, at 10:50 PM, Rodrigo Kumpera wrote:
>
>> Hi Luis,
>>
>> To have your patch integrated, some changes are needed. First, we want to
>> default to 32bits sized arrays on 64bits machines, so your changes must be
>> conditionally compiled. To help with that some changed to your patch are
>> due. Next are some comments about it:
>>
>> Instead of replacing guint32 for gsize, it's better to create a new type,
>> let's say array_size_t. This would reduce conditional compilation to fewer
>> places.
>>
>
> Rodrigo:
>        Permit me to reply to your message in parts, so that I clear on what
> needs to be done, from your point of view.
>
> 1) Add support for a new configuration argument to configure.in(AC_ARG_ENABLE(big-arrays,[ --enable-bug-arrays Enable allocation and
> indexing of arrays > 31 bits in size.],...))
> 2) Add a compile time define (AC_DEFINE(BIG_ARRAYS,1,[Enable allocation and
> indexing of arrays > 31 bits in size.]))
> 3) Use said compile time define to typedef array_size_t to either guint32
> or guint64 depending on the state of BIG_ARRAYS in object.h
> 4) Use array_size_t where I used gsize in my patch.
>
> Questions:
>
> A) Do you agree then that the correct size types are either guint32 or
> guint64?
>   Or would gint32 and gint64 be better choices as they would agree with the
> input arguments to ves_icall_System_Array_CreateInstanceImpl functions and
> the usage in socket-io.c?
>

Arrays must be fully indexable using signed integers. This means max sizes
must be  2^31 - 1 or 1^63 - 1. All math is done using unsigned integers to
avoid overflow issues..


>
> B) Should the CreateInstanceImpl64 method definition in icall-def.h exist
> if BIG_ARRAYS is not defined.
>

On this case it's a matter if we want conditional compilation over
BIG_ARRAYS to happen over the classlib as well. I'm prefer on doing all
conditional compilation on unmanaged code only, but we rather listen to more
opinions on this subject.


>
> C) In the case where BIG_ARRAYS is not defined,  should
> ves_icall_System_Array_CreateInstanceImpl64() still exist and make sure all
> arguments fit into the small guint32?
>

I favor this path of doing all conditional compilation on the unmanaged
side.


>
> D) mono_array_size_t or array_size_t?   Without the mono prefix, i fear
> that some third-party library might also use the obvious name.  Should the
> BIG_ARRAYS definition also use a MONO_ prefix?
>

Using mono prefix for both is the way to go.


>
> /Ortiz/Luis
>
>
>
Cheers,
Rodrigo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080508/863192a2/attachment.html 


More information about the Mono-devel-list mailing list