From a07f6a824197d7dc01c321599d3bc71936a2590e Mon Sep 17 00:00:00 2001 From: Roberto I Date: Fri, 28 Nov 2025 15:12:51 -0300 Subject: Functions with vararg tables don't need hidden args. Vararg functions with vararg tables don't use the arguments hidden in the stack; therfore, it doesn't need to build/keep them. --- ldebug.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ldebug.c') diff --git a/ldebug.c b/ldebug.c index abead91c..8df5f5f2 100644 --- a/ldebug.c +++ b/ldebug.c @@ -184,7 +184,7 @@ static const char *upvalname (const Proto *p, int uv) { static const char *findvararg (CallInfo *ci, int n, StkId *pos) { - if (clLvalue(s2v(ci->func.p))->p->flag & PF_ISVARARG) { + if (clLvalue(s2v(ci->func.p))->p->flag & PF_VAHID) { int nextra = ci->u.l.nextraargs; if (n >= -nextra) { /* 'n' is negative */ *pos = ci->func.p - nextra - (n + 1); @@ -304,7 +304,7 @@ static void collectvalidlines (lua_State *L, Closure *f) { int i; TValue v; setbtvalue(&v); /* boolean 'true' to be the value of all indices */ - if (!(p->flag & PF_ISVARARG)) /* regular function? */ + if (!(isvararg(p))) /* regular function? */ i = 0; /* consider all instructions */ else { /* vararg function */ lua_assert(GET_OPCODE(p->code[0]) == OP_VARARGPREP); @@ -348,7 +348,7 @@ static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar, ar->nparams = 0; } else { - ar->isvararg = (f->l.p->flag & PF_ISVARARG) ? 1 : 0; + ar->isvararg = (isvararg(f->l.p)) ? 1 : 0; ar->nparams = f->l.p->numparams; } break; @@ -912,7 +912,7 @@ int luaG_tracecall (lua_State *L) { Proto *p = ci_func(ci)->p; ci->u.l.trap = 1; /* ensure hooks will be checked */ if (ci->u.l.savedpc == p->code) { /* first instruction (not resuming)? */ - if (p->flag & PF_ISVARARG) + if (isvararg(p)) return 0; /* hooks will start at VARARGPREP instruction */ else if (!(ci->callstatus & CIST_HOOKYIELD)) /* not yielded? */ luaD_hookcall(L, ci); /* check 'call' hook */ -- cgit v1.2.3-55-g6feb