[Mono-dev] JIT: MonoReg to replace gssize for registers

Andreas Färber andreas.faerber at web.de
Sat Dec 13 15:27:20 EST 2008


Hi,

On ppc there is a similar feature, SPE, which allows some 64-bit ops  
on a 32-bit machine.

There, the general-purpose registers appear to be all 64-bit but  
regular instructions only access the lower 32 bits. Special  
instructions are used to access full 64-bit registers, similar to  
Altivec instructions using (separate) 128-bit registers on an  
otherwise 32- or 64-bit system.

 From that point of view, technically the MonoReg distinction makes  
sense, to allow sizeof(MonoReg) >= sizeof(gssize).

But as pointed out below, changing the variable type is only a start.  
Should anyone want to make Mono use SPE on ppc, probably all places  
that save and restore registers would need to be reworked, introducing  
a special code path for those systems that support it. The only Mono  
feature benefitting would probably be System.Int64, so I'm not sure if  
this is really needed.

Andreas

Am 13.12.2008 um 19:55 schrieb Mark Mason:

> Hello,
>
> Not ... necessarily.  The mips/n32 abi is one example.  Code runs in a
> 32-bit address space (so pointers, and sizeof(void *) are 32-bits),
> but with 64-bit registers and 64-bit operations available.
>
> This is distinct from n64, which does have 64-bit pointers.
>
> /Mark
>
> On Dec 13, 2008, at 7:01 AM, Zoltan Varga wrote:
>
>> Hi,
>>
>> gssize is the size needed to hold a memory address, if the machine
>> has 64 bit registers,
>> this is 64 bits. On that mips machine, this is 32 bits ?
>>
>>                 Zoltan
>>
>> On Thu, Dec 11, 2008 at 8:40 PM, Mark Mason
>> <mmason at upwardaccess.com> wrote:
>>> Hello all,
>>>
>>> Along the same lines as the SIZEOF_VOID_P change, I'd like to offer
>>> the
>>> following new type to replace to use of 'gssize' when referring to a
>>> machine register. 'gssize' comes from glib, and simply represents  
>>> the
>>> size of an integer -- which is not necessarily always the same as  
>>> the
>>> size of the underlying integer registers.
>>>
>>> There are some other uses of gssize in mini/ that will need to be
>>> updated as well, but this is a start.
>>>
>>> Comments most welcome.
>>>
>>> Thanks in advance,
>>> Mark
>>>
>>> Index: mini.h
>>> ===================================================================
>>> --- mini.h      (revision 121269)
>>> +++ mini.h      (working copy)
>>> @@ -400,6 +400,13 @@
>>>      int size, align;
>>> } MonoMemcpyArgs;
>>>
>>> +/* C type matching the size of a machine register. Not always the
>>> same
>>> as 'int' */
>>> +#if SIZEOF_REGISTER == 4
>>> +typedef gint32 MonoReg;
>>> +#elif SIZEOF_REGISTER == 8
>>> +typedef gint64 MonoReg;
>>> +#endif
>>> +
>>> struct MonoInst {
>>>      guint16 opcode;
>>>      guint8  type; /* stack type */
>>> @@ -415,7 +422,7 @@
>>>              union {
>>>                      MonoInst *src;
>>>                      MonoMethodVar *var;
>>> -                       gssize const_val;
>>> +                       MonoReg const_val;
>>>                      gpointer p;
>>>                      MonoMethod *method;
>>>                      MonoMethodSignature *signature;
>>>
>>>
>>> _______________________________________________
>>> Mono-devel-list mailing list
>>> Mono-devel-list at lists.ximian.com
>>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>>
>
> _______________________________________________
> 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