Field 'Proto.is_vararg' uses only one bit

So that the other bits can be used for other purposes.
This commit is contained in:
Roberto Ierusalimschy
2023-08-30 10:44:28 -03:00
parent 0554581605
commit 96f7714237
8 changed files with 20 additions and 13 deletions

View File

@@ -1849,7 +1849,7 @@ void luaK_finish (FuncState *fs) {
lua_assert(i == 0 || isOT(*(pc - 1)) == isIT(*pc));
switch (GET_OPCODE(*pc)) {
case OP_RETURN0: case OP_RETURN1: {
if (!(fs->needclose || p->is_vararg))
if (!(fs->needclose || (p->flag & PF_ISVARARG)))
break; /* no extra work */
/* else use OP_RETURN to do the extra work */
SET_OPCODE(*pc, OP_RETURN);
@@ -1857,7 +1857,7 @@ void luaK_finish (FuncState *fs) {
case OP_RETURN: case OP_TAILCALL: {
if (fs->needclose)
SETARG_k(*pc, 1); /* signal that it needs to close */
if (p->is_vararg)
if (p->flag & PF_ISVARARG)
SETARG_C(*pc, p->numparams + 1); /* signal that it is vararg */
break;
}