Project

General

Profile

Feature #240 ยป 0041-Apply-lua-5.4.6-upstream-patch-7.patch

Marko Lindqvist, 02/08/2024 04:46 AM

View differences:

dependencies/lua-5.4/Version.txt
(http://www.lua.org/ftp/lua-5.4.6.tar.gz)
Upstream bug fixes from https://www.lua.org/bugs.html applied:
1, 2, 3, 4 & 5, 6
1, 2, 3, 4 & 5, 6, 7
Not entire lua distribution directory hierarchy is included here, and
some files needed for Freeciv usage have been added.
dependencies/lua-5.4/src/ldebug.c
}
pc++; /* reference is always next instruction */
ci->u.l.savedpc = pc; /* save 'pc' */
counthook = (--L->hookcount == 0 && (mask & LUA_MASKCOUNT));
counthook = (mask & LUA_MASKCOUNT) && (--L->hookcount == 0);
if (counthook)
resethookcount(L); /* reset count */
else if (!(mask & LUA_MASKLINE))
return 1; /* no line hook and count != 0; nothing to be done now */
if (ci->callstatus & CIST_HOOKYIELD) { /* called hook last time? */
if (ci->callstatus & CIST_HOOKYIELD) { /* hook yielded last time? */
ci->callstatus &= ~CIST_HOOKYIELD; /* erase mark */
return 1; /* do not call hook again (VM yielded, so it did not move) */
}
......
if (L->status == LUA_YIELD) { /* did hook yield? */
if (counthook)
L->hookcount = 1; /* undo decrement to zero */
ci->u.l.savedpc--; /* undo increment (resume will increment it again) */
ci->callstatus |= CIST_HOOKYIELD; /* mark that it yielded */
luaD_throw(L, LUA_YIELD);
}
dependencies/lua-5.4/src/ldo.c
lua_assert(L->status == LUA_YIELD);
L->status = LUA_OK; /* mark that it is running (again) */
if (isLua(ci)) { /* yielded inside a hook? */
/* undo increment made by 'luaG_traceexec': instruction was not
executed yet */
lua_assert(ci->callstatus & CIST_HOOKYIELD);
ci->u.l.savedpc--;
L->top.p = firstArg; /* discard arguments */
luaV_execute(L, ci); /* just continue running Lua code */
}
    (1-1/1)