mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-04-19 13:33:26 +00:00
FFI: Don't touch frame in callbacks with tailcalls to fast functions.
This commit is contained in:
parent
248cf2ffa9
commit
2f396c6db7
@ -274,6 +274,7 @@ void lj_ccallback_mcode_free(CTState *cts)
|
|||||||
#elif LJ_TARGET_ARM
|
#elif LJ_TARGET_ARM
|
||||||
|
|
||||||
#define CALLBACK_HANDLE_REGARG \
|
#define CALLBACK_HANDLE_REGARG \
|
||||||
|
UNUSED(isfp); \
|
||||||
if (n > 1) ngpr = (ngpr + 1u) & ~1u; /* Align to regpair. */ \
|
if (n > 1) ngpr = (ngpr + 1u) & ~1u; /* Align to regpair. */ \
|
||||||
if (ngpr + n <= maxgpr) { \
|
if (ngpr + n <= maxgpr) { \
|
||||||
sp = &cts->cb.gpr[ngpr]; \
|
sp = &cts->cb.gpr[ngpr]; \
|
||||||
@ -455,11 +456,13 @@ void LJ_FASTCALL lj_ccallback_leave(CTState *cts, TValue *o)
|
|||||||
GCfunc *fn;
|
GCfunc *fn;
|
||||||
TValue *obase = L->base;
|
TValue *obase = L->base;
|
||||||
L->base = L->top; /* Keep continuation frame for throwing errors. */
|
L->base = L->top; /* Keep continuation frame for throwing errors. */
|
||||||
/* PC of RET* is lost. Point to last line for result conv. errors. */
|
if (o >= L->base) {
|
||||||
fn = curr_func(L);
|
/* PC of RET* is lost. Point to last line for result conv. errors. */
|
||||||
if (isluafunc(fn)) {
|
fn = curr_func(L);
|
||||||
GCproto *pt = funcproto(fn);
|
if (isluafunc(fn)) {
|
||||||
setcframe_pc(L->cframe, proto_bc(pt)+pt->sizebc+1);
|
GCproto *pt = funcproto(fn);
|
||||||
|
setcframe_pc(L->cframe, proto_bc(pt)+pt->sizebc+1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
callback_conv_result(cts, L, o);
|
callback_conv_result(cts, L, o);
|
||||||
/* Finally drop C frame and continuation frame. */
|
/* Finally drop C frame and continuation frame. */
|
||||||
|
Loading…
Reference in New Issue
Block a user