diff options
author | Mike Pall <mike> | 2023-04-16 18:13:48 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2023-04-16 18:13:48 +0200 |
commit | 1c279127050e86e99970100e9c42e0f09cd54ab7 (patch) | |
tree | efdc67dab9c461e3122b8bf99a13157be5daf02e /src/lj_vmevent.h | |
parent | 8bbd58e534522a7e1ab9ee2c0d7fb723741dd089 (diff) | |
download | luajit-1c279127050e86e99970100e9c42e0f09cd54ab7.tar.gz luajit-1c279127050e86e99970100e9c42e0f09cd54ab7.tar.bz2 luajit-1c279127050e86e99970100e9c42e0f09cd54ab7.zip |
Print errors from __gc finalizers instead of rethrowing them.
Finalizers are not supposed to throw errors -- this is undefined behavior.
Lua 5.1 - 5.3 and (previously) LuaJIT rethrow the error. This randomly
breaks some unrelated code that just happens to do an allocation. Bad.
Lua 5.4 catches the error and emits a warning instead. But warnings are
not enabled by default, so it fails silently. Even worse.
LuaJIT (now) catches the error and emits a VM event. The default event
handler function prints "ERROR in finalizer: ...".
Set a custom handler function with: jit.attach(handler, "errfin")
Diffstat (limited to 'src/lj_vmevent.h')
-rw-r--r-- | src/lj_vmevent.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lj_vmevent.h b/src/lj_vmevent.h index 40f9c631..c08a26dc 100644 --- a/src/lj_vmevent.h +++ b/src/lj_vmevent.h | |||
@@ -24,9 +24,10 @@ | |||
24 | /* VM event IDs. */ | 24 | /* VM event IDs. */ |
25 | typedef enum { | 25 | typedef enum { |
26 | VMEVENT_DEF(BC, 0x00003883), | 26 | VMEVENT_DEF(BC, 0x00003883), |
27 | VMEVENT_DEF(TRACE, 0xb2d91467), | 27 | VMEVENT_DEF(TRACE, 0x12d91467), |
28 | VMEVENT_DEF(RECORD, 0x9284bf4f), | 28 | VMEVENT_DEF(RECORD, 0x1284bf4f), |
29 | VMEVENT_DEF(TEXIT, 0xb29df2b0), | 29 | VMEVENT_DEF(TEXIT, 0x129df2b0), |
30 | VMEVENT_DEF(ERRFIN, 0x12d93888), | ||
30 | LJ_VMEVENT__MAX | 31 | LJ_VMEVENT__MAX |
31 | } VMEvent; | 32 | } VMEvent; |
32 | 33 | ||