mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 15:14:08 +00:00
Call error function on rethrow after trace exit.
This commit is contained in:
parent
12ab596997
commit
e296f56b82
@ -94,6 +94,7 @@ static BCPos debug_framepc(lua_State *L, GCfunc *fn, cTValue *nextframe)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ins = cframe_pc(cf);
|
ins = cframe_pc(cf);
|
||||||
|
if (!ins) return NO_BCPOS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pt = funcproto(fn);
|
pt = funcproto(fn);
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
_(floor) _(ceil) _(trunc) _(log) _(log10) _(exp) _(sin) _(cos) _(tan) \
|
_(floor) _(ceil) _(trunc) _(log) _(log10) _(exp) _(sin) _(cos) _(tan) \
|
||||||
_(asin) _(acos) _(atan) _(sinh) _(cosh) _(tanh) _(frexp) _(modf) _(atan2) \
|
_(asin) _(acos) _(atan) _(sinh) _(cosh) _(tanh) _(frexp) _(modf) _(atan2) \
|
||||||
_(pow) _(fmod) _(ldexp) \
|
_(pow) _(fmod) _(ldexp) \
|
||||||
_(lj_dispatch_call) _(lj_dispatch_ins) _(lj_err_throw) \
|
_(lj_dispatch_call) _(lj_dispatch_ins) _(lj_err_throw) _(lj_err_run) \
|
||||||
_(lj_ffh_coroutine_wrap_err) _(lj_func_closeuv) _(lj_func_newL_gc) \
|
_(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_gc_barrieruv) _(lj_gc_step) _(lj_gc_step_fixtop) _(lj_meta_arith) \
|
||||||
_(lj_meta_call) _(lj_meta_cat) _(lj_meta_comp) _(lj_meta_equal) \
|
_(lj_meta_call) _(lj_meta_cat) _(lj_meta_comp) _(lj_meta_equal) \
|
||||||
|
@ -546,7 +546,7 @@ static ptrdiff_t finderrfunc(lua_State *L)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Runtime error. */
|
/* 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);
|
ptrdiff_t ef = finderrfunc(L);
|
||||||
if (ef) {
|
if (ef) {
|
||||||
|
@ -23,7 +23,7 @@ LJ_DATA const char *lj_err_allmsg;
|
|||||||
LJ_FUNC GCstr *lj_err_str(lua_State *L, ErrMsg em);
|
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_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_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_msg(lua_State *L, ErrMsg em);
|
||||||
LJ_FUNC_NORET void lj_err_lex(lua_State *L, GCstr *src, const char *tok,
|
LJ_FUNC_NORET void lj_err_lex(lua_State *L, GCstr *src, const char *tok,
|
||||||
BCLine line, ErrMsg em, va_list argp);
|
BCLine line, ErrMsg em, va_list argp);
|
||||||
|
@ -700,8 +700,8 @@ typedef struct ExitDataCP {
|
|||||||
static TValue *trace_exit_cp(lua_State *L, lua_CFunction dummy, void *ud)
|
static TValue *trace_exit_cp(lua_State *L, lua_CFunction dummy, void *ud)
|
||||||
{
|
{
|
||||||
ExitDataCP *exd = (ExitDataCP *)ud;
|
ExitDataCP *exd = (ExitDataCP *)ud;
|
||||||
cframe_errfunc(L->cframe) = -1; /* Inherit error function. */
|
/* Always catch error here and don't call error function. */
|
||||||
/* Always catch error here. */
|
cframe_errfunc(L->cframe) = 0;
|
||||||
cframe_nres(L->cframe) = -2*LUAI_MAXSTACK*(int)sizeof(TValue);
|
cframe_nres(L->cframe) = -2*LUAI_MAXSTACK*(int)sizeof(TValue);
|
||||||
exd->pc = lj_snap_restore(exd->J, exd->exptr);
|
exd->pc = lj_snap_restore(exd->J, exd->exptr);
|
||||||
UNUSED(dummy);
|
UNUSED(dummy);
|
||||||
|
@ -2201,9 +2201,8 @@ static void build_subroutines(BuildCtx *ctx)
|
|||||||
| bx OP
|
| bx OP
|
||||||
|
|
|
|
||||||
|3: // Rethrow error from the right C frame.
|
|3: // Rethrow error from the right C frame.
|
||||||
| rsb CARG2, CARG1, #0
|
|
||||||
| mov CARG1, L
|
| mov CARG1, L
|
||||||
| bl extern lj_err_throw // (lua_State *L, int errcode)
|
| bl extern lj_err_run // (lua_State *L)
|
||||||
|.endif
|
|.endif
|
||||||
|
|
|
|
||||||
|//-----------------------------------------------------------------------
|
|//-----------------------------------------------------------------------
|
||||||
|
@ -2163,9 +2163,8 @@ static void build_subroutines(BuildCtx *ctx)
|
|||||||
|. addu RA, RA, BASE
|
|. addu RA, RA, BASE
|
||||||
|
|
|
|
||||||
|3: // Rethrow error from the right C frame.
|
|3: // Rethrow error from the right C frame.
|
||||||
| load_got lj_err_throw
|
| load_got lj_err_run
|
||||||
| negu CARG2, CRET1
|
| call_intern lj_err_run // (lua_State *L)
|
||||||
| call_intern lj_err_throw // (lua_State *L, int errcode)
|
|
||||||
|. move CARG1, L
|
|. move CARG1, L
|
||||||
|.endif
|
|.endif
|
||||||
|
|
|
|
||||||
|
@ -2699,9 +2699,8 @@ static void build_subroutines(BuildCtx *ctx)
|
|||||||
| bctr
|
| bctr
|
||||||
|
|
|
|
||||||
|3: // Rethrow error from the right C frame.
|
|3: // Rethrow error from the right C frame.
|
||||||
| neg CARG2, CARG1
|
|
||||||
| mr CARG1, L
|
| mr CARG1, L
|
||||||
| bl extern lj_err_throw // (lua_State *L, int errcode)
|
| bl extern lj_err_run // (lua_State *L)
|
||||||
|.endif
|
|.endif
|
||||||
|
|
|
|
||||||
|//-----------------------------------------------------------------------
|
|//-----------------------------------------------------------------------
|
||||||
|
@ -3060,10 +3060,8 @@ static void build_subroutines(BuildCtx *ctx)
|
|||||||
|.endif
|
|.endif
|
||||||
|
|
|
|
||||||
|3: // Rethrow error from the right C frame.
|
|3: // Rethrow error from the right C frame.
|
||||||
| neg RD
|
|
||||||
| mov FCARG1, L:RB
|
| mov FCARG1, L:RB
|
||||||
| mov FCARG2, RD
|
| call extern lj_err_run@4 // (lua_State *L)
|
||||||
| call extern lj_err_throw@8 // (lua_State *L, int errcode)
|
|
||||||
|.endif
|
|.endif
|
||||||
|
|
|
|
||||||
|//-----------------------------------------------------------------------
|
|//-----------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user