[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LuaJIT FFI callbacks
- From: Mike Pall <mikelu-1112@...>
- Date: Tue, 27 Dec 2011 21:16:48 +0100
Florian Weimer wrote:
> Let me phrase this a bit differently. I think you need to fake a side
> exit if a callback into Lua happens while a compiled trace is running
> because the preconditions for that trace are no longer necessarily
Any C call that triggers a callback is blacklisted by the
interpreter. This prevents later inlining of such a call as part
of a trace. Even if the blacklisting heuristic fails, an error is
raised if a 'trace -> C -> callback' call-chain is detected during
> The following segfaults for me without -joff using git HEAD.
> (I somewhat expected it would print "0".)
You can always carefully craft an example where any blacklisting
heuristic fails. But it usually works very well.
It crashes on x64 because the external unwinder can't deal with an
exception thrown across JIT-compiled code (and I can't do much
about that). On x86 and all other platforms you'll get a 'bad
callback' error. This should prompt you to modify your code, e.g.
move the callback-calling code to a function and use jit.off(func).