Tom Lord <xxxxxx@emf.net> writes:
> This hypothesis, that you're making a mistake, is reinforced by an
> experiment that jivera (Matthew Dempsky) carried out. He thought:
> "Suppose I have a Scheme implementation that uses a
> Sperber/Kelsey-style FFI. And further suppose that I now want that
> implementation to have a Pika-style FFI. How hard is that?" About
> 2-3 pages of trivial code later, and disregarding for the moment
> the issues we haven't taken up yet about error handling and
> non-local exits, he had 95% of an implementation. The only
> sticking point was on the exact syntax of GCPROtect-family macros:
> it would take some tweaks to reconcile those in Pika with those in
> the draft. We would need to make a trivial addition to the Pika
> macros to complete the job.
For those interested: http://www.flame.org/~jivera/pika/srfi-50.h
Regarding the current SCM_PROTECT_FRAME macro, even gcc without any
compiler optimization flags is able to use constant folding to reduce
the switch case to just a single function call for common cases of
having a fixed number of local variables.
(I haven't actually worked with S48 or SCSH's FFI so I don't know that
it works -- I wrote it entirely based on what I could understand from
the draft SRFI.)
-jivera