diff --git a/src/lj_debug.c b/src/lj_debug.c index c1f0f314..273dd078 100644 --- a/src/lj_debug.c +++ b/src/lj_debug.c @@ -94,6 +94,7 @@ static BCPos debug_framepc(lua_State *L, GCfunc *fn, cTValue *nextframe) } } ins = cframe_pc(cf); + if (!ins) return NO_BCPOS; } } pt = funcproto(fn); diff --git a/src/lj_dispatch.h b/src/lj_dispatch.h index 58ddff51..187bd5ca 100644 --- a/src/lj_dispatch.h +++ b/src/lj_dispatch.h @@ -46,7 +46,7 @@ extern double __divdf3(double a, double b); _(asin) _(acos) _(atan) _(sinh) _(cosh) _(tanh) _(frexp) _(modf) _(atan2) \ _(pow) _(fmod) _(ldexp) _(lj_vm_modi) \ _(lj_dispatch_call) _(lj_dispatch_ins) _(lj_dispatch_stitch) \ - _(lj_dispatch_profile) _(lj_err_throw) \ + _(lj_dispatch_profile) _(lj_err_throw) _(lj_err_run) \ _(lj_ffh_coroutine_wrap_err) _(lj_func_closeuv) _(lj_func_newL_gc) \ _(lj_gc_barrieruv) _(lj_gc_step) _(lj_gc_step_fixtop) _(lj_meta_arith) \ _(lj_meta_call) _(lj_meta_cat) _(lj_meta_comp) _(lj_meta_equal) \ diff --git a/src/lj_err.c b/src/lj_err.c index 3de19a0b..47f88740 100644 --- a/src/lj_err.c +++ b/src/lj_err.c @@ -598,7 +598,7 @@ static ptrdiff_t finderrfunc(lua_State *L) } /* Runtime error. */ -LJ_NOINLINE void lj_err_run(lua_State *L) +LJ_NOINLINE void LJ_FASTCALL lj_err_run(lua_State *L) { ptrdiff_t ef = finderrfunc(L); if (ef) { diff --git a/src/lj_err.h b/src/lj_err.h index ed148d79..4ae637d4 100644 --- a/src/lj_err.h +++ b/src/lj_err.h @@ -23,7 +23,7 @@ LJ_DATA const char *lj_err_allmsg; LJ_FUNC GCstr *lj_err_str(lua_State *L, ErrMsg em); LJ_FUNCA_NORET void LJ_FASTCALL lj_err_throw(lua_State *L, int errcode); LJ_FUNC_NORET void lj_err_mem(lua_State *L); -LJ_FUNC_NORET void lj_err_run(lua_State *L); +LJ_FUNCA_NORET void LJ_FASTCALL lj_err_run(lua_State *L); LJ_FUNC_NORET void lj_err_msg(lua_State *L, ErrMsg em); LJ_FUNC_NORET void lj_err_lex(lua_State *L, GCstr *src, const char *tok, BCLine line, ErrMsg em, va_list argp); diff --git a/src/lj_trace.c b/src/lj_trace.c index 60da7fcd..a3980891 100644 --- a/src/lj_trace.c +++ b/src/lj_trace.c @@ -789,8 +789,8 @@ typedef struct ExitDataCP { static TValue *trace_exit_cp(lua_State *L, lua_CFunction dummy, void *ud) { ExitDataCP *exd = (ExitDataCP *)ud; - cframe_errfunc(L->cframe) = -1; /* Inherit error function. */ - /* Always catch error here. */ + /* Always catch error here and don't call error function. */ + cframe_errfunc(L->cframe) = 0; cframe_nres(L->cframe) = -2*LUAI_MAXSTACK*(int)sizeof(TValue); exd->pc = lj_snap_restore(exd->J, exd->exptr); UNUSED(dummy); diff --git a/src/vm_arm.dasc b/src/vm_arm.dasc index 770a8e21..6b5572b7 100644 --- a/src/vm_arm.dasc +++ b/src/vm_arm.dasc @@ -2245,9 +2245,8 @@ static void build_subroutines(BuildCtx *ctx) | b <2 | |9: // Rethrow error from the right C frame. - | rsb CARG2, CARG1, #0 | mov CARG1, L - | bl extern lj_err_throw // (lua_State *L, int errcode) + | bl extern lj_err_run // (lua_State *L) |.endif | |//----------------------------------------------------------------------- diff --git a/src/vm_arm64.dasc b/src/vm_arm64.dasc index 4a729f65..1dc4d78e 100644 --- a/src/vm_arm64.dasc +++ b/src/vm_arm64.dasc @@ -2035,9 +2035,8 @@ static void build_subroutines(BuildCtx *ctx) | b <2 | |9: // Rethrow error from the right C frame. - | neg CARG2, CARG1 | mov CARG1, L - | bl extern lj_err_throw // (lua_State *L, int errcode) + | bl extern lj_err_run // (lua_State *L) |.endif | |//----------------------------------------------------------------------- diff --git a/src/vm_mips.dasc b/src/vm_mips.dasc index 91de4b5c..1cb94785 100644 --- a/src/vm_mips.dasc +++ b/src/vm_mips.dasc @@ -2520,9 +2520,8 @@ static void build_subroutines(BuildCtx *ctx) |. addu RA, RA, BASE | |9: // Rethrow error from the right C frame. - | load_got lj_err_throw - | negu CARG2, CRET1 - | call_intern lj_err_throw // (lua_State *L, int errcode) + | load_got lj_err_run + | call_intern lj_err_run // (lua_State *L) |. move CARG1, L |.endif | diff --git a/src/vm_mips64.dasc b/src/vm_mips64.dasc index 71acf9ed..8e71f362 100644 --- a/src/vm_mips64.dasc +++ b/src/vm_mips64.dasc @@ -2622,9 +2622,8 @@ static void build_subroutines(BuildCtx *ctx) |. daddu RA, RA, BASE | |9: // Rethrow error from the right C frame. - | load_got lj_err_throw - | negu CARG2, CRET1 - | call_intern lj_err_throw // (lua_State *L, int errcode) + | load_got lj_err_run + | call_intern lj_err_run // (lua_State *L) |. move CARG1, L |.endif | diff --git a/src/vm_ppc.dasc b/src/vm_ppc.dasc index 18fc6f93..3070d86e 100644 --- a/src/vm_ppc.dasc +++ b/src/vm_ppc.dasc @@ -3090,9 +3090,8 @@ static void build_subroutines(BuildCtx *ctx) | bctr | |9: // Rethrow error from the right C frame. - | neg CARG2, CARG1 | mr CARG1, L - | bl extern lj_err_throw // (lua_State *L, int errcode) + | bl extern lj_err_run // (lua_State *L) |.endif | |//----------------------------------------------------------------------- diff --git a/src/vm_x64.dasc b/src/vm_x64.dasc index 14a54e34..7cace399 100644 --- a/src/vm_x64.dasc +++ b/src/vm_x64.dasc @@ -2509,10 +2509,8 @@ static void build_subroutines(BuildCtx *ctx) | jmp <2 | |9: // Rethrow error from the right C frame. - | neg RD | mov CARG1, L:RB - | mov CARG2, RD - | call extern lj_err_throw // (lua_State *L, int errcode) + | call extern lj_err_run // (lua_State *L) |.endif | |//----------------------------------------------------------------------- diff --git a/src/vm_x86.dasc b/src/vm_x86.dasc index f9bea426..b26cde4f 100644 --- a/src/vm_x86.dasc +++ b/src/vm_x86.dasc @@ -2960,10 +2960,8 @@ static void build_subroutines(BuildCtx *ctx) | jmp <2 | |9: // Rethrow error from the right C frame. - | neg RD | mov FCARG1, L:RB - | mov FCARG2, RD - | call extern lj_err_throw@8 // (lua_State *L, int errcode) + | call extern lj_err_run@4 // (lua_State *L) |.endif | |//-----------------------------------------------------------------------