lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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
> valid.

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
callback invocation.

> 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).

--Mike