I spent some time to implement dynamic FFI/callback under x86-64
and the result is in attachment. This is not very different from x86
implementation except that you have to use special registers and align
on 8/16 bytes instead of 4.
This implementation only support Linux ABI, as I don't have any access
a Win64 platform.
I'm not sure I should commit in this form, especially as the patch
platform-dependent code in internal.h and I'm not sure this is a good
There's also something I'm not sure about, not being a platform expert;
someone will have some ideas. The Linux ABI doc states that the return
of a function should be placed:
1) for integers: in the next available register of the list RAX, RDX
2) for floating-point: in the next available register of the list XMM0,
How does a caller know where the return value is actually located?
this potential stupid question)