Universal VM for 32/64 bit images (was: [Vm-dev] 64bit FFI?)
bryce at kampjes.demon.co.uk
bryce at kampjes.demon.co.uk
Fri Feb 13 22:23:41 UTC 2009
Eliot Miranda writes:
> On Thu, Feb 12, 2009 at 7:38 PM, David T. Lewis <lewis at mail.msen.com> wrote:
>
> >
> > On Thu, Feb 12, 2009 at 11:18:02AM -0800, Eliot Miranda wrote:
> > >
> > > 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.
> >
> > 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.
>
> At least.
>
> It won't be particularly sprightly :)
Though, for those of us working on JIT compilers the checks will
move back to compile time again.
Bryce
More information about the Vm-dev
mailing list