diff options
author | Mike Pall <mike> | 2020-08-09 22:50:31 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2020-08-09 22:50:31 +0200 |
commit | e296f56b825c688c3530a981dc6b495d972f3d01 (patch) | |
tree | b36c33746eca57f360d8275821f4f25d7098da65 | |
parent | 12ab596997b9cb27846a5b254d11230c3f9c50c8 (diff) | |
download | luajit-e296f56b825c688c3530a981dc6b495d972f3d01.tar.gz luajit-e296f56b825c688c3530a981dc6b495d972f3d01.tar.bz2 luajit-e296f56b825c688c3530a981dc6b495d972f3d01.zip |
Call error function on rethrow after trace exit.
-rw-r--r-- | src/lj_debug.c | 1 | ||||
-rw-r--r-- | src/lj_dispatch.h | 2 | ||||
-rw-r--r-- | src/lj_err.c | 2 | ||||
-rw-r--r-- | src/lj_err.h | 2 | ||||
-rw-r--r-- | src/lj_trace.c | 4 | ||||
-rw-r--r-- | src/vm_arm.dasc | 3 | ||||
-rw-r--r-- | src/vm_mips.dasc | 5 | ||||
-rw-r--r-- | src/vm_ppc.dasc | 3 | ||||
-rw-r--r-- | src/vm_x86.dasc | 4 |
9 files changed, 11 insertions, 15 deletions
diff --git a/src/lj_debug.c b/src/lj_debug.c index 1d73da7e..6863cffd 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) | |||
94 | } | 94 | } |
95 | } | 95 | } |
96 | ins = cframe_pc(cf); | 96 | ins = cframe_pc(cf); |
97 | if (!ins) return NO_BCPOS; | ||
97 | } | 98 | } |
98 | } | 99 | } |
99 | pt = funcproto(fn); | 100 | pt = funcproto(fn); |
diff --git a/src/lj_dispatch.h b/src/lj_dispatch.h index 6a3bc2bd..372de014 100644 --- a/src/lj_dispatch.h +++ b/src/lj_dispatch.h | |||
@@ -29,7 +29,7 @@ | |||
29 | _(floor) _(ceil) _(trunc) _(log) _(log10) _(exp) _(sin) _(cos) _(tan) \ | 29 | _(floor) _(ceil) _(trunc) _(log) _(log10) _(exp) _(sin) _(cos) _(tan) \ |
30 | _(asin) _(acos) _(atan) _(sinh) _(cosh) _(tanh) _(frexp) _(modf) _(atan2) \ | 30 | _(asin) _(acos) _(atan) _(sinh) _(cosh) _(tanh) _(frexp) _(modf) _(atan2) \ |
31 | _(pow) _(fmod) _(ldexp) \ | 31 | _(pow) _(fmod) _(ldexp) \ |
32 | _(lj_dispatch_call) _(lj_dispatch_ins) _(lj_err_throw) \ | 32 | _(lj_dispatch_call) _(lj_dispatch_ins) _(lj_err_throw) _(lj_err_run) \ |
33 | _(lj_ffh_coroutine_wrap_err) _(lj_func_closeuv) _(lj_func_newL_gc) \ | 33 | _(lj_ffh_coroutine_wrap_err) _(lj_func_closeuv) _(lj_func_newL_gc) \ |
34 | _(lj_gc_barrieruv) _(lj_gc_step) _(lj_gc_step_fixtop) _(lj_meta_arith) \ | 34 | _(lj_gc_barrieruv) _(lj_gc_step) _(lj_gc_step_fixtop) _(lj_meta_arith) \ |
35 | _(lj_meta_call) _(lj_meta_cat) _(lj_meta_comp) _(lj_meta_equal) \ | 35 | _(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 e3e0c2eb..ad3394df 100644 --- a/src/lj_err.c +++ b/src/lj_err.c | |||
@@ -546,7 +546,7 @@ static ptrdiff_t finderrfunc(lua_State *L) | |||
546 | } | 546 | } |
547 | 547 | ||
548 | /* Runtime error. */ | 548 | /* Runtime error. */ |
549 | LJ_NOINLINE void lj_err_run(lua_State *L) | 549 | LJ_NOINLINE void LJ_FASTCALL lj_err_run(lua_State *L) |
550 | { | 550 | { |
551 | ptrdiff_t ef = finderrfunc(L); | 551 | ptrdiff_t ef = finderrfunc(L); |
552 | if (ef) { | 552 | 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; | |||
23 | LJ_FUNC GCstr *lj_err_str(lua_State *L, ErrMsg em); | 23 | LJ_FUNC GCstr *lj_err_str(lua_State *L, ErrMsg em); |
24 | LJ_FUNCA_NORET void LJ_FASTCALL lj_err_throw(lua_State *L, int errcode); | 24 | LJ_FUNCA_NORET void LJ_FASTCALL lj_err_throw(lua_State *L, int errcode); |
25 | LJ_FUNC_NORET void lj_err_mem(lua_State *L); | 25 | LJ_FUNC_NORET void lj_err_mem(lua_State *L); |
26 | LJ_FUNC_NORET void lj_err_run(lua_State *L); | 26 | LJ_FUNCA_NORET void LJ_FASTCALL lj_err_run(lua_State *L); |
27 | LJ_FUNC_NORET void lj_err_msg(lua_State *L, ErrMsg em); | 27 | LJ_FUNC_NORET void lj_err_msg(lua_State *L, ErrMsg em); |
28 | LJ_FUNC_NORET void lj_err_lex(lua_State *L, GCstr *src, const char *tok, | 28 | LJ_FUNC_NORET void lj_err_lex(lua_State *L, GCstr *src, const char *tok, |
29 | BCLine line, ErrMsg em, va_list argp); | 29 | BCLine line, ErrMsg em, va_list argp); |
diff --git a/src/lj_trace.c b/src/lj_trace.c index 123e6eb8..c7f3f52d 100644 --- a/src/lj_trace.c +++ b/src/lj_trace.c | |||
@@ -700,8 +700,8 @@ typedef struct ExitDataCP { | |||
700 | static TValue *trace_exit_cp(lua_State *L, lua_CFunction dummy, void *ud) | 700 | static TValue *trace_exit_cp(lua_State *L, lua_CFunction dummy, void *ud) |
701 | { | 701 | { |
702 | ExitDataCP *exd = (ExitDataCP *)ud; | 702 | ExitDataCP *exd = (ExitDataCP *)ud; |
703 | cframe_errfunc(L->cframe) = -1; /* Inherit error function. */ | 703 | /* Always catch error here and don't call error function. */ |
704 | /* Always catch error here. */ | 704 | cframe_errfunc(L->cframe) = 0; |
705 | cframe_nres(L->cframe) = -2*LUAI_MAXSTACK*(int)sizeof(TValue); | 705 | cframe_nres(L->cframe) = -2*LUAI_MAXSTACK*(int)sizeof(TValue); |
706 | exd->pc = lj_snap_restore(exd->J, exd->exptr); | 706 | exd->pc = lj_snap_restore(exd->J, exd->exptr); |
707 | UNUSED(dummy); | 707 | UNUSED(dummy); |
diff --git a/src/vm_arm.dasc b/src/vm_arm.dasc index c5e0498e..dcfb10b3 100644 --- a/src/vm_arm.dasc +++ b/src/vm_arm.dasc | |||
@@ -2201,9 +2201,8 @@ static void build_subroutines(BuildCtx *ctx) | |||
2201 | | bx OP | 2201 | | bx OP |
2202 | | | 2202 | | |
2203 | |3: // Rethrow error from the right C frame. | 2203 | |3: // Rethrow error from the right C frame. |
2204 | | rsb CARG2, CARG1, #0 | ||
2205 | | mov CARG1, L | 2204 | | mov CARG1, L |
2206 | | bl extern lj_err_throw // (lua_State *L, int errcode) | 2205 | | bl extern lj_err_run // (lua_State *L) |
2207 | |.endif | 2206 | |.endif |
2208 | | | 2207 | | |
2209 | |//----------------------------------------------------------------------- | 2208 | |//----------------------------------------------------------------------- |
diff --git a/src/vm_mips.dasc b/src/vm_mips.dasc index e6b53e0d..6bbad37b 100644 --- a/src/vm_mips.dasc +++ b/src/vm_mips.dasc | |||
@@ -2163,9 +2163,8 @@ static void build_subroutines(BuildCtx *ctx) | |||
2163 | |. addu RA, RA, BASE | 2163 | |. addu RA, RA, BASE |
2164 | | | 2164 | | |
2165 | |3: // Rethrow error from the right C frame. | 2165 | |3: // Rethrow error from the right C frame. |
2166 | | load_got lj_err_throw | 2166 | | load_got lj_err_run |
2167 | | negu CARG2, CRET1 | 2167 | | call_intern lj_err_run // (lua_State *L) |
2168 | | call_intern lj_err_throw // (lua_State *L, int errcode) | ||
2169 | |. move CARG1, L | 2168 | |. move CARG1, L |
2170 | |.endif | 2169 | |.endif |
2171 | | | 2170 | | |
diff --git a/src/vm_ppc.dasc b/src/vm_ppc.dasc index 6b973d4e..de44027b 100644 --- a/src/vm_ppc.dasc +++ b/src/vm_ppc.dasc | |||
@@ -2699,9 +2699,8 @@ static void build_subroutines(BuildCtx *ctx) | |||
2699 | | bctr | 2699 | | bctr |
2700 | | | 2700 | | |
2701 | |3: // Rethrow error from the right C frame. | 2701 | |3: // Rethrow error from the right C frame. |
2702 | | neg CARG2, CARG1 | ||
2703 | | mr CARG1, L | 2702 | | mr CARG1, L |
2704 | | bl extern lj_err_throw // (lua_State *L, int errcode) | 2703 | | bl extern lj_err_run // (lua_State *L) |
2705 | |.endif | 2704 | |.endif |
2706 | | | 2705 | | |
2707 | |//----------------------------------------------------------------------- | 2706 | |//----------------------------------------------------------------------- |
diff --git a/src/vm_x86.dasc b/src/vm_x86.dasc index 2ccc671f..b23d046b 100644 --- a/src/vm_x86.dasc +++ b/src/vm_x86.dasc | |||
@@ -3060,10 +3060,8 @@ static void build_subroutines(BuildCtx *ctx) | |||
3060 | |.endif | 3060 | |.endif |
3061 | | | 3061 | | |
3062 | |3: // Rethrow error from the right C frame. | 3062 | |3: // Rethrow error from the right C frame. |
3063 | | neg RD | ||
3064 | | mov FCARG1, L:RB | 3063 | | mov FCARG1, L:RB |
3065 | | mov FCARG2, RD | 3064 | | call extern lj_err_run@4 // (lua_State *L) |
3066 | | call extern lj_err_throw@8 // (lua_State *L, int errcode) | ||
3067 | |.endif | 3065 | |.endif |
3068 | | | 3066 | | |
3069 | |//----------------------------------------------------------------------- | 3067 | |//----------------------------------------------------------------------- |