[Vm-dev] FFI-Tests initialization problem

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Sun Jan 26 23:17:16 UTC 2020


Hi Eliot,
yes, in the meantime I have published
https://source.squeak.org/FFI/FFI-Tests-nice.12.diff with a postscript
workaround.

Le dim. 26 janv. 2020 à 23:39, Eliot Miranda <eliot.miranda at gmail.com> a
écrit :

>
> Hi Nicolas,
>
>     I can't reproduce this because FFITestSfd  & FFITestSsSfd et al are
> not yet in FFI_Tests.  Can you co bit them to FFI_Tests?  You can put it in
> FFIinbox if you don't feel comfortable putting it straight in FFI.
>
> On Sun, Jan 26, 2020 at 1:38 PM Nicolas Cellier <
> nicolas.cellier.aka.nice at gmail.com> wrote:
>
>>
>> Hi all,
>> I defined new FFI-Tests with struct inside struct.
>> I wanted to check for correct alignment (this works as it should thanks
>> to Ronie!).
>>
>> But when I reload the package into a new image, there is an
>> initialization order problem.
>> It seems that the struct FFITestSfd is created AFTER the struct
>> FFITestSsSfd.
>> But struct FFITestSsSfd depends on struct FFITestSfd (it is just struct
>> {short s1; struct FFITestSfd sfd2;}
>> Consequently, FFITestSsSfd DOES not get correctly initialized...
>> It simply ignore the missing FFITestSfd definition, and believes that it
>> has a single field (short s1) and that it is of size 2...
>>
>> When we execute the FFIPluginTests testSuite, this can badly crash the
>> image because the FFI is allocating a ByteArray handle of size 2 for
>> returning the FFITestSsSfd by value, and the test function writes a struct
>> of size 12 into it...
>>
>> We can't live long with such hanging sword above our heads and should
>> urgently fix it.
>> At least, you are warned, don't execute new FFI tests blindly.
>>
>
>
> --
> _,,,^..^,,,_
> best, Eliot
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20200127/96388bb4/attachment.html>


More information about the Vm-dev mailing list