[Vm-dev] FFIExternalStructureReferenceHandle and pushing it to the stack

Eliot Miranda eliot.miranda at gmail.com
Thu Apr 4 16:20:42 UTC 2019

Hi Holger,

On Thu, Apr 4, 2019 at 12:36 AM Holger Freyther <holger at freyther.de> wrote:

>  In addition to my mail from yesterday to vm-dev I want to share the
> following example to illustrate the problem.  I have taken StructA and
> StructNested from the FFIExternalStructureReferenceHandle class comment and
> put it into Unclassified.st that is attached to this mail. I am also making
> a call to LibC's getpid and try to push StructNested to the stack. The
> ffiCall is failing before getpid is called (Bad argument to external
> function).
> The reproducer is:
>         StructA new theNest anyCall.

This is not answering the question I need answering :-).  Can you answer
the Qs I asked on vm-dev yesterday about the signature of the callback
etc?  Can you reply there?  AdvThnaksance

> StructA has a ByteArray handle of the full struct. theNest returns an
> instance of StructNested with a FFIExternalStructureReferenceHandle. This
> makes sense as well. It can't be a copy of the ByteArray (or else updates
> would be invisible to the outer struct) and it can't be an ExternalAddress
> as StructA's handle might move in the Smalltalk heap.
> I am not entirely sure how this is should work but what do you think of:
> 1st) Extending ExternalStructure class comment to list
> FFIExternalStructureReferenceHandle as possible handle type? I think we
> would only describe the reality.
> 2nd) ThreadedFFIPlugin>>#ffiPushStructureContentsOf: should be aware of
> FFIExternalStructureReferenceHandle and know how to reach the handle. Or
> should there be something in the image converting this to a ByteArray when
> being pushed as value in a ffiCall?
> comments/ideas?

best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20190404/57c69f8b/attachment.html>

More information about the Vm-dev mailing list