diff options
Diffstat (limited to 'src/lj_err.c')
-rw-r--r-- | src/lj_err.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/lj_err.c b/src/lj_err.c index 9c6de3aa..5a6aac83 100644 --- a/src/lj_err.c +++ b/src/lj_err.c | |||
@@ -32,7 +32,7 @@ | |||
32 | ** | 32 | ** |
33 | ** - EXT requires unwind tables for *all* functions on the C stack between | 33 | ** - EXT requires unwind tables for *all* functions on the C stack between |
34 | ** the pcall/catch and the error/throw. This is the default on x64, | 34 | ** the pcall/catch and the error/throw. This is the default on x64, |
35 | ** but needs to be manually enabled on x86 for non-C++ code. | 35 | ** but needs to be manually enabled on x86/PPC for non-C++ code. |
36 | ** | 36 | ** |
37 | ** - INT is faster when actually throwing errors (but this happens rarely). | 37 | ** - INT is faster when actually throwing errors (but this happens rarely). |
38 | ** Setting up error handlers is zero-cost in any case. | 38 | ** Setting up error handlers is zero-cost in any case. |
@@ -48,9 +48,9 @@ | |||
48 | ** the wrapper function feature. Lua errors thrown through C++ frames | 48 | ** the wrapper function feature. Lua errors thrown through C++ frames |
49 | ** cannot be caught by C++ code and C++ destructors are not run. | 49 | ** cannot be caught by C++ code and C++ destructors are not run. |
50 | ** | 50 | ** |
51 | ** INT is the default on x86 systems, EXT is the default on x64 systems. | 51 | ** EXT is the default on x64 systems, INT is the default on all other systems. |
52 | ** | 52 | ** |
53 | ** EXT can only be manually enabled on POSIX/x86 systems using DWARF2 stack | 53 | ** EXT can be manually enabled on POSIX systems using GCC and DWARF2 stack |
54 | ** unwinding with -DLUAJIT_UNWIND_EXTERNAL. *All* C code must be compiled | 54 | ** unwinding with -DLUAJIT_UNWIND_EXTERNAL. *All* C code must be compiled |
55 | ** with -funwind-tables (or -fexceptions). This includes LuaJIT itself (set | 55 | ** with -funwind-tables (or -fexceptions). This includes LuaJIT itself (set |
56 | ** TARGET_CFLAGS), all of your C/Lua binding code, all loadable C modules | 56 | ** TARGET_CFLAGS), all of your C/Lua binding code, all loadable C modules |
@@ -64,11 +64,7 @@ | |||
64 | */ | 64 | */ |
65 | 65 | ||
66 | #if defined(__GNUC__) | 66 | #if defined(__GNUC__) |
67 | #if LJ_TARGET_X86 | 67 | #if LJ_TARGET_X64 || defined(LUAJIT_UNWIND_EXTERNAL) |
68 | #ifdef LUAJIT_UNWIND_EXTERNAL | ||
69 | #define LJ_UNWIND_EXT 1 | ||
70 | #endif | ||
71 | #elif LJ_TARGET_X64 | ||
72 | #define LJ_UNWIND_EXT 1 | 68 | #define LJ_UNWIND_EXT 1 |
73 | #endif | 69 | #endif |
74 | #elif defined(LUA_USE_WIN) | 70 | #elif defined(LUA_USE_WIN) |
@@ -579,15 +575,15 @@ LJ_FUNCA int lj_err_unwind_dwarf(int version, _Unwind_Action actions, | |||
579 | #if LJ_UNWIND_EXT | 575 | #if LJ_UNWIND_EXT |
580 | cf = err_unwind(L, cf, errcode); | 576 | cf = err_unwind(L, cf, errcode); |
581 | if (cf) { | 577 | if (cf) { |
582 | _Unwind_SetGR(ctx, 0, errcode); | 578 | _Unwind_SetGR(ctx, LJ_TARGET_EHRETREG, errcode); |
583 | _Unwind_SetIP(ctx, (_Unwind_Ptr)(cframe_unwind_ff(cf) ? | 579 | _Unwind_SetIP(ctx, (_Unwind_Ptr)(cframe_unwind_ff(cf) ? |
584 | lj_vm_unwind_ff_eh : | 580 | lj_vm_unwind_ff_eh : |
585 | lj_vm_unwind_c_eh)); | 581 | lj_vm_unwind_c_eh)); |
586 | return _URC_INSTALL_CONTEXT; | 582 | return _URC_INSTALL_CONTEXT; |
587 | } | 583 | } |
588 | #else | 584 | #else |
589 | /* This is not the proper way to escape from the unwinder. We get away | 585 | /* This is not the proper way to escape from the unwinder. We get away with |
590 | ** with it on x86 because the interpreter restores all callee-saved regs. | 586 | ** it on x86/PPC because the interpreter restores all callee-saved regs. |
591 | */ | 587 | */ |
592 | lj_err_throw(L, errcode); | 588 | lj_err_throw(L, errcode); |
593 | #endif | 589 | #endif |
@@ -713,8 +709,8 @@ LJ_NOINLINE void LJ_FASTCALL lj_err_throw(lua_State *L, int errcode) | |||
713 | ** unwound. We have no choice but to call the panic function and exit. | 709 | ** unwound. We have no choice but to call the panic function and exit. |
714 | ** | 710 | ** |
715 | ** Usually this is caused by a C function without unwind information. | 711 | ** Usually this is caused by a C function without unwind information. |
716 | ** This should never happen on x64, but may happen on x86 if you've | 712 | ** This should never happen on x64, but may happen if you've manually |
717 | ** manually enabled LUAJIT_UNWIND_EXTERNAL and forgot to recompile *every* | 713 | ** enabled LUAJIT_UNWIND_EXTERNAL and forgot to recompile *every* |
718 | ** non-C++ file with -funwind-tables. | 714 | ** non-C++ file with -funwind-tables. |
719 | */ | 715 | */ |
720 | if (G(L)->panic) | 716 | if (G(L)->panic) |