short pointers (32 bit) in 64 bit apps

Ian Lance Taylor iant@google.com
Wed May 19 08:27:00 GMT 2010


Reza Roboubi <reza@parvan.net> writes:

> Ian Lance Taylor wrote:
>> Reza Roboubi <reza@parvan.net> writes:
>>
>>> Is there support for "short" pointers in 64 bit applications?  As
>>> struct members, these short pointers would save space, but when
>>> accessed, they would automatically be treated as 64 bit pointers into
>>> the "current" 4GB space (namely where the containing struct resides.)
>>
>> No.
>>
>> Sorry.
>>
>> Ian
>
> Do you know what it takes to do it?  How much work for a newcomer to
> get up to speed with gcc?  (Maybe this should go to the developer
> list?)

At first glance the proposed optimization seems clearly unsafe.  There
is nothing which limits a pointer to pointing into any particular 4GB
space.

If you want to limit this to struct members, you would essentially
want to rewrite struct fields with pointer type to have some different
type instead.  You would need to automatically convert values on load
and store.  It seems doable to me.  You would probably want to change
the handling of fields in stor-layout.c and change the way that
COMPONENT_REF trees are geneated.

gcc is a complex program, and some newcomers do have difficulty
understanding it.

Ian



More information about the Gcc-help mailing list