Fix lua_yield() from C hook.

Reported by Jason Carr.
This commit is contained in:
Mike Pall 2020-09-15 01:02:24 +02:00
parent cc44642cf8
commit dd5032ed84

View File

@ -1210,11 +1210,12 @@ LUA_API int lua_yield(lua_State *L, int nresults)
setcont(top, lj_cont_hook);
if (LJ_FR2) top++;
setframe_pc(top, cframe_pc(cf)-1);
if (LJ_FR2) top++;
top++;
setframe_gc(top, obj2gco(L), LJ_TTHREAD);
if (LJ_FR2) top++;
setframe_ftsz(top, ((char *)(top+1)-(char *)L->base)+FRAME_CONT);
L->top = L->base = top+1;
#if LJ_TARGET_X64
#if ((defined(__GNUC__) || defined(__clang__)) && (LJ_TARGET_X64 || defined(LUAJIT_UNWIND_EXTERNAL)) && !LJ_NO_UNWIND) || LJ_TARGET_WINDOWS
lj_err_throw(L, LUA_YIELD);
#else
L->cframe = NULL;