Follow up: for returning struct by value, we use a fake SixteenByteReturn struct {sqInt a; sqInt b;} Unfortunately, this only works for fields returned via integer registers ($RAX ...) not via float registers ($XMM0 ...)
We would need 4 different return cases sqInt-sqInt sqInt-double double-sqInt double-double
For passing struct by value, I just corrected a bug in VMMaker slang about floatType & doubleType check of struct members. But it ain't gonna work in all cases. https://source.squeak.org/VMMaker/VMMaker.oscog-nice.2677.diff
I will also push more FFI tests for some tricky cases.
I have prototyped a method that enumerate the fields and re-compute the alignment, but it does not sound good, this job/information is already done at image side...