Project

General

Profile

Feature #1407 ยป 0056-Apply-patch-8-for-lua-5.4.7.patch

Marko Lindqvist, 05/18/2025 09:14 AM

View differences:

dependencies/lua-5.4/Version.txt
(http://www.lua.org/ftp/lua-5.4.7.tar.gz)
Upstream bug fixes from https://www.lua.org/bugs.html applied:
2, 3, 5, 6, 7
2, 3, 5, 6, 7, 8
Upstream bug fixes not applicable to our tree:
1
dependencies/lua-5.4/src/ldebug.c
static const char *funcnamefromcall (lua_State *L, CallInfo *ci,
const char **name);
static const char strlocal[] = "local";
static const char strupval[] = "upvalue";
static int currentpc (CallInfo *ci) {
lua_assert(isLua(ci));
......
int pc = *ppc;
*name = luaF_getlocalname(p, reg + 1, pc);
if (*name) /* is a local? */
return "local";
return strlocal;
/* else try symbolic execution */
*ppc = pc = findsetreg(p, pc, reg);
if (pc != -1) { /* could find instruction? */
......
}
case OP_GETUPVAL: {
*name = upvalname(p, GETARG_B(i));
return "upvalue";
return strupval;
}
case OP_LOADK: return kname(p, GETARG_Bx(i), name);
case OP_LOADKX: return kname(p, GETARG_Ax(p->code[pc + 1]), name);
......
/*
** Check whether table being indexed by instruction 'i' is the
** environment '_ENV'
** environment '_ENV'. If the table is an upvalue, get its name;
** otherwise, find some "name" for the table and check whether
** that name is the name of a local variable (and not, for instance,
** a string). Then check that, if there is a name, it is '_ENV'.
*/
static const char *isEnv (const Proto *p, int pc, Instruction i, int isup) {
int t = GETARG_B(i); /* table index */
const char *name; /* name of indexed variable */
if (isup) /* is 't' an upvalue? */
name = upvalname(p, t);
else /* 't' is a register */
basicgetobjname(p, &pc, t, &name);
else { /* 't' is a register */
const char *what = basicgetobjname(p, &pc, t, &name);
if (what != strlocal && what != strupval)
name = NULL; /* cannot be the variable _ENV */
}
return (name && strcmp(name, LUA_ENV) == 0) ? "global" : "field";
}
......
for (i = 0; i < c->nupvalues; i++) {
if (c->upvals[i]->v.p == o) {
*name = upvalname(c->p, i);
return "upvalue";
return strupval;
}
}
return NULL;
    (1-1/1)