[Vm-dev] 64bit FFI?

Eliot Miranda eliot.miranda at gmail.com
Thu Feb 12 19:18:02 UTC 2009

On Thu, Feb 12, 2009 at 11:07 AM, Andreas Raab <andreas.raab at gmx.de> wrote:

> Eliot Miranda wrote:
>> I'm assuming that in-memory the 64-bit VM has 64-bit oops, right?  So the
>> VM has to swizzle 32-bit pointers to 64-bit.  I haven't come across this
>> swizzling code yet.  I thought that the swizzling was done by the system
>> tracer.  Where is the in-VM code to swizzle pointers to 64-bits?
> oopForPointer/pointerForOop translate between OOPs and pointers. So you can
> translate from a 32bit Oop into a 64bit pointer by adding a base address and
> vice versa.

AFAICT you can produce a 64-bit VM that runs a 32-bit image with this
technique, but you can't get a VM that runs both.

- If one fetches 64-bits when converting an oop to an address one can load a
64-bit oop but not a 32-it one, because in fetching 64-bits one will fetch
two oops, right?

- if one fetches 32-bits when converting an oop to an address one can load a
32-bit oop but not a 64-it one, because in fetching 32-bits one will
incorrectly ignore the upper 32-bits of the oop, right?  (Unless of course
the upper 32-bits of all oops are zero, but that's not a 64-bit image,
that's a 32-bit image masquerading as a waste of space).

So I don't see how this allows one to have a 64-bit VM that can run true
64-bit images.  What am I missing?

On the other hand, start-up code that reads a 32-bit image and swizzles it
to a full 64-bit image is perfectly sensible and quite easy in the Squeak
context because (IIRC) the 64-bit format doesn't do things like widen the
SmallInteger range, implement immediate Floats, etc.  Its simply a matter of
reading the data, writing two words for each oop and scaling each
non-SmallInteger oop appropriately.  But as I said I don't see this code

David, since you've been working on this perhaps you could clear-up the

> Cheers,
>  - Andreas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20090212/98edad5b/attachment-0001.htm

More information about the Vm-dev mailing list