[cffi-devel] protect C frames from Lisp non-local exits in callbacks
Stephen Compall
s11 at member.fsf.org
Thu Jan 5 19:10:59 UTC 2006
A brief discussion in #lisp pointed me to the EXIT-EXTENT:MINIMAL ANSI
issue[1]. The salient point is that there is no way to portably stop
all unwinding for a non-local exit at a particular point, due to this
case of undefined behavior:
;;returns 2 under MEDIUM, is error under MINIMAL
(block a
(block b
(unwind-protect (return-from a 1)
(return-from b 2))))
A CL implementation that implements MEDIUM should still be fully
compliant with the MINIMAL decision. Therefore, I would like to hear
from those with particular interest in any particular implementation
running CFFI: does implementation X implement EXIT-EXTENT:MEDIUM, and/or
does its callback definition form as exploited by cffi-sys:%defcallback
have some "magic" unwind stopping?
As an aside: would it be better for the defcallback semantics to simply
say "don't exit non-locally through a C frame"? It would probably make
callbacks (and perhaps callouts, for that matter) cheaper to call, on
those without "magic" unwind stopping anyway.
[1] http://www.lisp.org/HyperSpec/Issues/iss152.html
--
Stephen Compall
http://scompall.nocandysw.com/blog
More information about the cffi-devel
mailing list