[Vm-dev] [OpenSmalltalk/opensmalltalk-vm] passing struct by value does not respect x86_64 SysV ABI (#443)

Eliot Miranda notifications at github.com
Fri Nov 15 19:41:51 UTC 2019


Hi Nicolas, Hi All,

this is an issue of funding the correct specification.  I fond this one:
[http://people.freebsd.org/~obrien/amd64-elf-abi.pdf]
and it states:
```
The classification of aggregate (structures and arrays) and union types works as follows:
1. If the size of an object is larger than two eightbytes, or in C++, is a non- POD 10 structure or union type, or contains unaligned fields, it has class MEMORY.
```
This is far simpler than the alternatives.  So at least what we have may be correct on FreeBSD ;-)

Can someone find out what version of the standard is operative on linux and macOS?  

The spec that splits struct fields across available registers is horribly complex but doable.  I did implement that spec for the VisualWorks FFI.  We're in a much better position than the VisualWorks FFI because Andreas designed and implemented signature type information correctly in his (our) FFI.  In his/our FFI, a function's type specification is associated with the function itself.  In VisualWorks, what is associated with a function is a very simplified reduction of types, and rich type information is only available attached to actual parameters, so pass in a C object with the wrong type information in VW and it will be marshaled incorrectly.

So while this is work to do, I'm sure we can do it quite straight-forwardly.  The key issue is to determine the right versions of ABI specification to use before we start implementation.  As I showed above I took the easy route; I found a version of the spec that had simple semantics and implemented it.  Mea culpa.

-- 
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/443#issuecomment-554500616
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20191115/b4bfcc2d/attachment.html>


More information about the Vm-dev mailing list