[squeak-dev] 64Bit image on Squeak Cocoa 5.7.4 VM

Bert Freudenberg bert at freudenbergs.de
Mon Apr 18 15:55:14 UTC 2011


On 18.04.2011, at 17:17, David T. Lewis wrote:

> On Mon, Apr 18, 2011 at 04:55:00PM +0200, Tobias Pape wrote:
>> 
>> Am 2011-04-18 um 16:45 schrieb David T. Lewis:
>> 
>>> On Mon, Apr 18, 2011 at 12:45:51PM +0200, Tobias Pape wrote:
>>>> 
>> [?]
>>>>> 
>>>> 
>>>> Can somebody me enlighten me on this?
>>>> How shall a VM be 32bit word- but 
>>>> 64bit pointer-size?
>>>> Is there any documentation on this?
>>> 
>>> Think of the VM as a program, just like any other program. And
>>> think of the object memory as a bunch of data, either arranged
>>> as an array of 32-bit values or an array of 64-bit values. It
>>> does not matter if you compile your program with 32-bit pointers
>>> (-m32) or 64-bit pointers (-m64), in either case your program
>>> can still access its data.
>>> 
>>> Sounds like magic, but that's all there is to it :)
>> 
>> But this implies that the VM does not treat object references as
>> pointers, and I had the impression that this has been the case.
>> Am I wrong?
> 
> The terminology can be a bit confusing here if you are thinking
> only of C pointers. An object reference is a "pointer" to a location
> in the object memory in the same sense that a (char *) in the C
> language is a pointer to a location in an array of char.
> 
>> PS: By this definition, it would be ?easily? possible to
>> have a VM both execute 64 and 32 bit images, as they are
>> just other datasets.
> 
> Absolutely right, although you might not be happy with the resulting
> performance. Basically you would be dereferencing an "object pointer"
> at run time to point to the right 32 or 64 bit location. I've thought
> about trying to do this just for fun, but I'm afraid it would be a
> lot of work just to make the VM go really slow. But it would be
> interesting to try it and see how fast you could make it run.
> 
> Dave

The VM uses macros to convert from oops to addresses and vice versa. These are used throughout nowadays (thanks in large part to Dave).

For the "32 bit VM runs 64 bit image" case, it just ignores the higher 32 bits (thus limiting the image size to 4 GB).

For the "64 bit VM runs 32 bit image" case, there is a 64 bit pointer to the start of the object memory, and oops are added to that.

- Bert -





More information about the Squeak-dev mailing list