mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-08 07:34:07 +00:00
Another fix for lua_yield() from C hook.
Reported by Jason Carr.
This commit is contained in:
parent
518e8cbeb4
commit
dd0f09f95f
@ -549,13 +549,13 @@ static void callback_conv_args(CTState *cts, lua_State *L)
|
|||||||
if (LJ_FR2) {
|
if (LJ_FR2) {
|
||||||
(o++)->u64 = LJ_CONT_FFI_CALLBACK;
|
(o++)->u64 = LJ_CONT_FFI_CALLBACK;
|
||||||
(o++)->u64 = rid;
|
(o++)->u64 = rid;
|
||||||
o++;
|
|
||||||
} else {
|
} else {
|
||||||
o->u32.lo = LJ_CONT_FFI_CALLBACK;
|
o->u32.lo = LJ_CONT_FFI_CALLBACK;
|
||||||
o->u32.hi = rid;
|
o->u32.hi = rid;
|
||||||
o++;
|
o++;
|
||||||
}
|
}
|
||||||
setframe_gc(o, obj2gco(fn), fntp);
|
setframe_gc(o, obj2gco(fn), fntp);
|
||||||
|
if (LJ_FR2) o++;
|
||||||
setframe_ftsz(o, ((char *)(o+1) - (char *)L->base) + FRAME_CONT);
|
setframe_ftsz(o, ((char *)(o+1) - (char *)L->base) + FRAME_CONT);
|
||||||
L->top = L->base = ++o;
|
L->top = L->base = ++o;
|
||||||
if (!ct)
|
if (!ct)
|
||||||
|
@ -687,9 +687,9 @@ LJ_NOINLINE void lj_err_optype_call(lua_State *L, TValue *o)
|
|||||||
const BCIns *pc = cframe_Lpc(L);
|
const BCIns *pc = cframe_Lpc(L);
|
||||||
if (((ptrdiff_t)pc & FRAME_TYPE) != FRAME_LUA) {
|
if (((ptrdiff_t)pc & FRAME_TYPE) != FRAME_LUA) {
|
||||||
const char *tname = lj_typename(o);
|
const char *tname = lj_typename(o);
|
||||||
|
setframe_gc(o, obj2gco(L), LJ_TTHREAD);
|
||||||
if (LJ_FR2) o++;
|
if (LJ_FR2) o++;
|
||||||
setframe_pc(o, pc);
|
setframe_pc(o, pc);
|
||||||
setframe_gc(o, obj2gco(L), LJ_TTHREAD);
|
|
||||||
L->top = L->base = o+1;
|
L->top = L->base = o+1;
|
||||||
err_msgv(L, LJ_ERR_BADCALL, tname);
|
err_msgv(L, LJ_ERR_BADCALL, tname);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ enum {
|
|||||||
#define frame_gc(f) (gcval((f)-1))
|
#define frame_gc(f) (gcval((f)-1))
|
||||||
#define frame_ftsz(f) ((ptrdiff_t)(f)->ftsz)
|
#define frame_ftsz(f) ((ptrdiff_t)(f)->ftsz)
|
||||||
#define frame_pc(f) ((const BCIns *)frame_ftsz(f))
|
#define frame_pc(f) ((const BCIns *)frame_ftsz(f))
|
||||||
#define setframe_gc(f, p, tp) (setgcVraw((f)-1, (p), (tp)))
|
#define setframe_gc(f, p, tp) (setgcVraw((f), (p), (tp)))
|
||||||
#define setframe_ftsz(f, sz) ((f)->ftsz = (sz))
|
#define setframe_ftsz(f, sz) ((f)->ftsz = (sz))
|
||||||
#define setframe_pc(f, pc) ((f)->ftsz = (int64_t)(intptr_t)(pc))
|
#define setframe_pc(f, pc) ((f)->ftsz = (int64_t)(intptr_t)(pc))
|
||||||
#else
|
#else
|
||||||
|
@ -86,8 +86,8 @@ int lj_meta_tailcall(lua_State *L, cTValue *tv)
|
|||||||
else
|
else
|
||||||
top->u32.lo = LJ_CONT_TAILCALL;
|
top->u32.lo = LJ_CONT_TAILCALL;
|
||||||
setframe_pc(top++, pc);
|
setframe_pc(top++, pc);
|
||||||
if (LJ_FR2) top++;
|
|
||||||
setframe_gc(top, obj2gco(L), LJ_TTHREAD); /* Dummy frame object. */
|
setframe_gc(top, obj2gco(L), LJ_TTHREAD); /* Dummy frame object. */
|
||||||
|
if (LJ_FR2) top++;
|
||||||
setframe_ftsz(top, ((char *)(top+1) - (char *)base) + FRAME_CONT);
|
setframe_ftsz(top, ((char *)(top+1) - (char *)base) + FRAME_CONT);
|
||||||
L->base = L->top = top+1;
|
L->base = L->top = top+1;
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user