[Vm-dev] understanding slang inlining
Nicolas Cellier
nicolas.cellier.aka.nice at gmail.com
Tue Jan 28 22:55:16 UTC 2020
Hi all,
I have practically solved
https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/443 for
passing/returning struct by value on X64SysV FFI.
I still have a few cases of packed struct or union to handle, but I know
how to handle them and finish the job.
Practically, but not yet... There is an issue that I can't easily solve:
slang inlining.
The generated code works on fast VM, but not debug nor assert...
It does not work because #ffiCalloutTo:SpecOnStack:in: is not inlined.
Since it uses sender's alloca as stack pointer (where FFI argVector was
marshalled), it obviously will mess the stack if not inlined!
The code is not inlined because a sub-function sends a recursive message .
Unfortunately I have to check struct alignment for correctly determining
the type of 8-byte registers, and algorithm for checking struct alignment
is recursive because we must first check alignment of sub-struct....
Having a recursive function should not be a problem, just don't inline it,
but invoke it.
Unfortunately, our strategy is to inline only sends that can be completely
inlined (and recursively for every sub-send).
So I'm currently blocked...
I'd like to specify to not inquire further sends that explicitely refuse to
be inlined, maybe in the unless block in checkForCompletenessIn:
parseTree
nodesDo:
[:node|
...snip...]
unless:
[:node|
node isSend
and: [node selector == #cCode:inSmalltalk:
* or: [node explicitelyRefuseToBeInlined*
or: [aCodeGen isAssertSelector: node selector]]]].
Thoughts?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20200128/360f59b7/attachment.html>
More information about the Vm-dev
mailing list