Universal VM for 32/64 bit images (was: [Vm-dev] 64bit FFI?)

David T. Lewis lewis at mail.msen.com
Sat Feb 14 22:44:25 UTC 2009


On Fri, Feb 13, 2009 at 09:42:10AM -0500, David T. Lewis wrote:
> On Thu, Feb 12, 2009 at 09:47:44PM -0800, Eliot Miranda wrote:
> >  
> > On Thu, Feb 12, 2009 at 7:38 PM, David T. Lewis <lewis at mail.msen.com> wrote:
> > >
> > > Actually, I think that it probably *is* possible to make a Squeak
> > > VM that will run both 32 and 64 bit images, although performance may
> > > be poor and the plugins would be problematic. The basic idea is to
> > > move BytesPerWord and BaseHeaderSize into run time variables rather
> > > than compile time macros (i.e. move them from class variables in
> > > ObjectMemory to instance variables in ObjectMemory), and set the
> > > values at image load time. Everything else should just work.
> > 
> > You'll have to change oopForPointer/pointerForOop to account for the
> > different widths of an oop.  e.g. if the heap is origined at 0 then in a
> > 64-bit image the oop 4 maps to byte address 8, but in a 32-bit image it maps
> > to byte address 4.
> > 
> > You'll have to change the readers and writers
> > (e.g. oopAtPointer/oopAtPointerPut) to test BytesPerWord and fetch/store 64
> > or 32 bits as required.
> 
> Piece o' cake. I bet you a virtual beer I can get it working without touching
> any of these ;)

Eliot,

I owe you a virtual beer.

Dave



More information about the Vm-dev mailing list