[Vm-dev] Status of FFI/Alien for X64 Win64

Esteban Lorenzano estebanlm at gmail.com
Sun Aug 21 10:51:47 UTC 2016


> On 21 Aug 2016, at 12:21, Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com> wrote:
> 
> Hi,
> here are my findings:
> 
> FFI works on Win64 X64 squeak.stack.spur IF AND ONLY IF compiled with clang.
> gcc 4.9.3 omit to reserve 32-bytes space for saving the four parameters passed by register, this might be a gcc bug.
> 
> Basic Alien tests work, but beware, use the unsplit Alien package from Eliot which contains essential changes for X64.
> The ConfigurationOfAlien for Pharo based on split packages does not have these important changes and will crash the VM.

but Pharo contains Alien in his latest version… no need to load it. Why are you trying?

For older Pharos (4.0 and older), you can always use “ConfigurationOfOldAlien”, but this is not maintained anymore. 

> Callback does not work yet. We got an incorrect thunkp passed back in the callbackContext...
> thunkEntry does not receive the correct value for thunkp.
> I think the problem is located in FFICallbackThunk initializeX64. For Win64 ABI, caller has to reserve the 32bytes on top of stack for saving the registers parameters.
> So we are going to need initializeX64Win64, and a CallbackX64Win64 abi ^ 'X64Win64'...
> 
> That's my understanding so far...
> 
> This should not require VM changes, but only Alien image side changes.
> However:
> 1) I don't feel like generating the binary machine code for initializeX64Win64
> 2) I'm not even sure that it's possible in 64 bytes.
> 
> So, I will send the X64 Win64 squeak.stack.spur VM to Marcel and commit a LLP64_v2 branch on github containing all the necessary source to generate it.
> 
> cheers



More information about the Vm-dev mailing list