Skip to content

Commit dd0f09f

Browse files
author
Mike Pall
committedSep 22, 2020
Another fix for lua_yield() from C hook.
Reported by Jason Carr.
1 parent 518e8cb commit dd0f09f

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed
 

‎src/lj_ccallback.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -549,13 +549,13 @@ static void callback_conv_args(CTState *cts, lua_State *L)
549549
if (LJ_FR2) {
550550
(o++)->u64 = LJ_CONT_FFI_CALLBACK;
551551
(o++)->u64 = rid;
552-
o++;
553552
} else {
554553
o->u32.lo = LJ_CONT_FFI_CALLBACK;
555554
o->u32.hi = rid;
556555
o++;
557556
}
558557
setframe_gc(o, obj2gco(fn), fntp);
558+
if (LJ_FR2) o++;
559559
setframe_ftsz(o, ((char *)(o+1) - (char *)L->base) + FRAME_CONT);
560560
L->top = L->base = ++o;
561561
if (!ct)

‎src/lj_err.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -687,9 +687,9 @@ LJ_NOINLINE void lj_err_optype_call(lua_State *L, TValue *o)
687687
const BCIns *pc = cframe_Lpc(L);
688688
if (((ptrdiff_t)pc & FRAME_TYPE) != FRAME_LUA) {
689689
const char *tname = lj_typename(o);
690+
setframe_gc(o, obj2gco(L), LJ_TTHREAD);
690691
if (LJ_FR2) o++;
691692
setframe_pc(o, pc);
692-
setframe_gc(o, obj2gco(L), LJ_TTHREAD);
693693
L->top = L->base = o+1;
694694
err_msgv(L, LJ_ERR_BADCALL, tname);
695695
}

‎src/lj_frame.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ enum {
4646
#define frame_gc(f) (gcval((f)-1))
4747
#define frame_ftsz(f) ((ptrdiff_t)(f)->ftsz)
4848
#define frame_pc(f) ((const BCIns *)frame_ftsz(f))
49-
#define setframe_gc(f, p, tp) (setgcVraw((f)-1, (p), (tp)))
49+
#define setframe_gc(f, p, tp) (setgcVraw((f), (p), (tp)))
5050
#define setframe_ftsz(f, sz) ((f)->ftsz = (sz))
5151
#define setframe_pc(f, pc) ((f)->ftsz = (int64_t)(intptr_t)(pc))
5252
#else

‎src/lj_meta.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ int lj_meta_tailcall(lua_State *L, cTValue *tv)
8686
else
8787
top->u32.lo = LJ_CONT_TAILCALL;
8888
setframe_pc(top++, pc);
89-
if (LJ_FR2) top++;
9089
setframe_gc(top, obj2gco(L), LJ_TTHREAD); /* Dummy frame object. */
90+
if (LJ_FR2) top++;
9191
setframe_ftsz(top, ((char *)(top+1) - (char *)base) + FRAME_CONT);
9292
L->base = L->top = top+1;
9393
/*

0 commit comments

Comments
 (0)
Please sign in to comment.