diff options
author | Mike Pall <mike> | 2020-09-22 23:37:43 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2020-09-22 23:37:43 +0200 |
commit | dd0f09f95f36caf1f2111c10fec02748116003bb (patch) | |
tree | 675a63502635201a70fda3ce4a778c17296efbb8 | |
parent | 518e8cbeb435d7c294abbaded97bc1aa897e36c7 (diff) | |
download | luajit-dd0f09f95f36caf1f2111c10fec02748116003bb.tar.gz luajit-dd0f09f95f36caf1f2111c10fec02748116003bb.tar.bz2 luajit-dd0f09f95f36caf1f2111c10fec02748116003bb.zip |
Another fix for lua_yield() from C hook.
Reported by Jason Carr.
-rw-r--r-- | src/lj_ccallback.c | 2 | ||||
-rw-r--r-- | src/lj_err.c | 2 | ||||
-rw-r--r-- | src/lj_frame.h | 2 | ||||
-rw-r--r-- | src/lj_meta.c | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/src/lj_ccallback.c b/src/lj_ccallback.c index 49775d2b..4c71f1a6 100644 --- a/src/lj_ccallback.c +++ b/src/lj_ccallback.c | |||
@@ -549,13 +549,13 @@ static void callback_conv_args(CTState *cts, lua_State *L) | |||
549 | if (LJ_FR2) { | 549 | if (LJ_FR2) { |
550 | (o++)->u64 = LJ_CONT_FFI_CALLBACK; | 550 | (o++)->u64 = LJ_CONT_FFI_CALLBACK; |
551 | (o++)->u64 = rid; | 551 | (o++)->u64 = rid; |
552 | o++; | ||
553 | } else { | 552 | } else { |
554 | o->u32.lo = LJ_CONT_FFI_CALLBACK; | 553 | o->u32.lo = LJ_CONT_FFI_CALLBACK; |
555 | o->u32.hi = rid; | 554 | o->u32.hi = rid; |
556 | o++; | 555 | o++; |
557 | } | 556 | } |
558 | setframe_gc(o, obj2gco(fn), fntp); | 557 | setframe_gc(o, obj2gco(fn), fntp); |
558 | if (LJ_FR2) o++; | ||
559 | setframe_ftsz(o, ((char *)(o+1) - (char *)L->base) + FRAME_CONT); | 559 | setframe_ftsz(o, ((char *)(o+1) - (char *)L->base) + FRAME_CONT); |
560 | L->top = L->base = ++o; | 560 | L->top = L->base = ++o; |
561 | if (!ct) | 561 | if (!ct) |
diff --git a/src/lj_err.c b/src/lj_err.c index 47f88740..656631a9 100644 --- a/src/lj_err.c +++ b/src/lj_err.c | |||
@@ -687,9 +687,9 @@ LJ_NOINLINE void lj_err_optype_call(lua_State *L, TValue *o) | |||
687 | const BCIns *pc = cframe_Lpc(L); | 687 | const BCIns *pc = cframe_Lpc(L); |
688 | if (((ptrdiff_t)pc & FRAME_TYPE) != FRAME_LUA) { | 688 | if (((ptrdiff_t)pc & FRAME_TYPE) != FRAME_LUA) { |
689 | const char *tname = lj_typename(o); | 689 | const char *tname = lj_typename(o); |
690 | setframe_gc(o, obj2gco(L), LJ_TTHREAD); | ||
690 | if (LJ_FR2) o++; | 691 | if (LJ_FR2) o++; |
691 | setframe_pc(o, pc); | 692 | setframe_pc(o, pc); |
692 | setframe_gc(o, obj2gco(L), LJ_TTHREAD); | ||
693 | L->top = L->base = o+1; | 693 | L->top = L->base = o+1; |
694 | err_msgv(L, LJ_ERR_BADCALL, tname); | 694 | err_msgv(L, LJ_ERR_BADCALL, tname); |
695 | } | 695 | } |
diff --git a/src/lj_frame.h b/src/lj_frame.h index 599a2d1c..46a5c782 100644 --- a/src/lj_frame.h +++ b/src/lj_frame.h | |||
@@ -46,7 +46,7 @@ enum { | |||
46 | #define frame_gc(f) (gcval((f)-1)) | 46 | #define frame_gc(f) (gcval((f)-1)) |
47 | #define frame_ftsz(f) ((ptrdiff_t)(f)->ftsz) | 47 | #define frame_ftsz(f) ((ptrdiff_t)(f)->ftsz) |
48 | #define frame_pc(f) ((const BCIns *)frame_ftsz(f)) | 48 | #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))) |
50 | #define setframe_ftsz(f, sz) ((f)->ftsz = (sz)) | 50 | #define setframe_ftsz(f, sz) ((f)->ftsz = (sz)) |
51 | #define setframe_pc(f, pc) ((f)->ftsz = (int64_t)(intptr_t)(pc)) | 51 | #define setframe_pc(f, pc) ((f)->ftsz = (int64_t)(intptr_t)(pc)) |
52 | #else | 52 | #else |
diff --git a/src/lj_meta.c b/src/lj_meta.c index 2cdb6a0f..f6e6d46a 100644 --- a/src/lj_meta.c +++ b/src/lj_meta.c | |||
@@ -86,8 +86,8 @@ int lj_meta_tailcall(lua_State *L, cTValue *tv) | |||
86 | else | 86 | else |
87 | top->u32.lo = LJ_CONT_TAILCALL; | 87 | top->u32.lo = LJ_CONT_TAILCALL; |
88 | setframe_pc(top++, pc); | 88 | setframe_pc(top++, pc); |
89 | if (LJ_FR2) top++; | ||
90 | setframe_gc(top, obj2gco(L), LJ_TTHREAD); /* Dummy frame object. */ | 89 | setframe_gc(top, obj2gco(L), LJ_TTHREAD); /* Dummy frame object. */ |
90 | if (LJ_FR2) top++; | ||
91 | setframe_ftsz(top, ((char *)(top+1) - (char *)base) + FRAME_CONT); | 91 | setframe_ftsz(top, ((char *)(top+1) - (char *)base) + FRAME_CONT); |
92 | L->base = L->top = top+1; | 92 | L->base = L->top = top+1; |
93 | /* | 93 | /* |