[Vm-dev] Simulating FFI Calls [was Re: VMMaker simulation - strlen, strcpy, getenv and FakeStdinStream]

Eliot Miranda eliot.miranda at gmail.com
Mon Oct 15 14:46:26 UTC 2018


Hi Ben,

> On Oct 15, 2018, at 5:28 AM, Ben Coman <btc at openinworld.com> wrote:
> 
>> On Mon, 15 Oct 2018 at 07:21, Eliot Miranda <eliot.miranda at gmail.com> wrote:
>>  
>> But too do that we would need a derived pointer type
> 
> My usual searches... "define derived pointer" and "what is derived pointer" are not being helpful.
> All results seem to be pointers to C++ derived classes, which I guess is not directly what your referring to.
> Can you educate me on this...?

By “derived” I mean a pointer to some point inside an object, not a pointer to the start of an object.  When one passes eg a ByteArray through the FFI to a reference parameter  the marshaling code ends up passing a pointer to the start of the object.  That won’t work if what we want to do is simulate passing a pointer to the start of a simulation object that actually lives at an offset inside the large ByteArray that constitutes the entire heap in the simulation.  So we need to be able to express a ByteArray, offset pair and pass that through the FFI to a reference parameter and have the marshaling code end up passing the derived a pointer that is the start of the ByteArray plus the offset, and hence end up passing a pointer to the start of the simulation object in the large ByteArray that constitutes the entire heap.

> cheers -ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20181015/888e3a0c/attachment.html>


More information about the Vm-dev mailing list