[gambit-list] C FFI calls recap

Adam adam.mlmb at gmail.com
Wed Jun 5 01:24:47 EDT 2019


Hi Marc and list,

Can you help me recap the speed aspect of C FFI use in C-compiled Scheme
files:

"Trampoline" in Gambit means specifically inter-module calls between
C-compiled Scheme files, as well as call between binary backend-compiled
code and C-compiled code, right.

When you make a call to the C world from a C-compiled Scheme file, or vice
versa when you call the Scheme world from the C world within a C-compiled
Scheme file, I recall a bit of work takes place. This is not called a
"trampoline" right, per above.

It's called "continuation serialization", and which includes some Scheme
stack and heap overflow checks?

This work is an implied part of all the standard C FFI code forms
|c-lambda| |c-define| |c-initialize| isn't it, also this is independent of
compile mode e.g. (declare (not safe)), yes?

About how heavy is it, per call?


For even-higher-speed C access, such as doing tons of C or C++
acquire/release operations inlined in Scheme code, given acceptance of
constraints on what my code does (to not overflow the Scheme stack/heap),
can I use a C FFI form that does not do that?

If so, which one is it - |##c-code|?

Please clarify what I cannot do in |##c-code|.

Thanks,
Adam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20190605/b826bd3e/attachment.htm>


More information about the Gambit-list mailing list