<br><br><div class="gmail_quote">On Thu, Feb 12, 2009 at 1:32 AM, Andreas Raab <span dir="ltr">&lt;<a href="mailto:andreas.raab@gmx.de">andreas.raab@gmx.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Folks -<br>
<br>
Has anyone tried porting the FFI to 64 bit? I&#39;m loosely considering using a 64bit VM for our servers but I do need the FFI (mostly for ODBC integration) and I&#39;ve never looked at any of the ABIs. Alternatively, is it reasonable to try to use 64bit libs from within a 32bit Squeak VM?</blockquote>
<div><br></div><div>Depends on what one wants to pass through the FFI. &nbsp;On x86-64/EMT64 structure passing conventions are efficient and complex, distributing structure fields across integer and floating-point registers. &nbsp;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. &nbsp;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.</div>
<div><br></div><div>In theory the use of 64-bit libs, provided one has the relevant FFI support should work fine. &nbsp;Smalltalk has the ability to deal with 64-bit and 128-bit values easily. &nbsp;But one does have to write all the support.</div>
<div><br></div><div>To get acquainted with the de facto standard x86-64 ABI read the</div><div><span class="Apple-style-span" style="border-collapse: collapse; white-space: pre; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><a href="http://www.x86-64.org/documentation/abi-0.98.pdf"><span class="Apple-style-span" style="font-family: arial, helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: small;">System V Application Binary Interface AMD64 Architecture Processor Supplement</span></span></a><span class="Apple-style-span" style="font-family: arial, helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: small;">&nbsp;</span></span></span><span class="Apple-style-span" style="font-family: arial, helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br>
</span></span></div><div><span class="Apple-style-span" style="border-collapse: collapse; white-space: pre; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><span class="Apple-style-span" style="font-family: arial, helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: small;">pages 13 through 22 (section Function Calling Sequence) paying particular attention to the 3 1/2 page algorithm for marshalling :)</span></span></span></div>
<div><span class="Apple-style-span" style="border-collapse: collapse; white-space: pre; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><span class="Apple-style-span" style="font-family: arial, helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br>
</span></span></span></div><div><span class="Apple-style-span" style="font-family: arial, helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: small;">and start going to bed earlier ;)</span></span></div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
<br>
Thanks for any info!<br>
<br>
Cheers,<br><font color="#888888">
 &nbsp;- Andreas<br>
</font></blockquote></div><br>