Re: LuaJIT crashes on C++ exceptions in Visual Studio 32 bit mode

  • From: Peter Cawley <corsix@xxxxxxxxxx>
  • To: "luajit@xxxxxxxxxxxxx" <luajit@xxxxxxxxxxxxx>
  • Date: Tue, 26 Apr 2016 02:43:30 +0100

For reference, what I had in mind as a first-order improvement was saving
fs[0] during cframe setup and restoring it on cframe tear down (i.e. treat
fs[0] as an extra register in need of saving and restoring). This wouldn't
give rich exception interoperability, but I suspect it would ablate the
clause in question.

On Tuesday, 26 April 2016, Daurnimator <quae@xxxxxxxxxxxxxxx> wrote:

On 26 April 2016 at 09:47, Peter Cawley <corsix@xxxxxxxxxx <javascript:;>>
wrote:
In short, the following clause from http://luajit.org/extensions.html
is relevant:

Additionally, on Windows/x86 with SEH-based C++ exceptions: it's not
safe to throw a Lua error across any frames containing a C++ function
with any try/catch construct or using variables with (implicit)
destructors. This also applies to any functions which may be inlined
in such a function. It doesn't matter whether lua_error() is called
inside or outside of a try/catch or whether any object actually needs
to be destroyed: the SEH chain is corrupted and this will eventually
lead to the termination of the process.

This is a disappointing clause, and it seems ever so alluring that it
should be possible for this clause to be removed.

It is! Previously we couldn't cause of the patent on x86 SEH. But that
expired in 2014.

See http://article.gmane.org/gmane.comp.lang.lua.luajit/5448 for Mike's
reply.


Other related posts: