[Vm-dev] 64bit FFI?
Eliot Miranda
eliot.miranda at gmail.com
Thu Feb 12 17:15:47 UTC 2009
On Thu, Feb 12, 2009 at 1:32 AM, Andreas Raab <andreas.raab at gmx.de> wrote:
>
> Folks -
>
> Has anyone tried porting the FFI to 64 bit? I'm loosely considering using a
> 64bit VM for our servers but I do need the FFI (mostly for ODBC integration)
> and I've never looked at any of the ABIs. Alternatively, is it reasonable to
> try to use 64bit libs from within a 32bit Squeak VM?
Depends on what one wants to pass through the FFI. On x86-64/EMT64
structure passing conventions are efficient and complex, distributing
structure fields across integer and floating-point registers. It is
possible to interpret such calls given a type signature for the structure to
be passed (I did it for VisualWorks) but it is not easy and it is slow. I
would counsel writing a proper ABI compiler in Smalltalk that generates e.g.
RTL that is either interpreted or compiled by the VM to make the actual
call.
In theory the use of 64-bit libs, provided one has the relevant FFI support
should work fine. Smalltalk has the ability to deal with 64-bit and 128-bit
values easily. But one does have to write all the support.
To get acquainted with the de facto standard x86-64 ABI read the
System V Application Binary Interface AMD64 Architecture Processor
Supplement <http://www.x86-64.org/documentation/abi-0.98.pdf>
pages 13 through 22 (section Function Calling Sequence) paying particular
attention to the 3 1/2 page algorithm for marshalling :)
and start going to bed earlier ;)
>
> Thanks for any info!
>
> Cheers,
> - Andreas
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20090212/1cdef070/attachment.htm
More information about the Vm-dev
mailing list