feat: 适配 Lua 5.5.1 最新版 (lua_5.5.1 分支)

- lib/lua 替换为 Lua 5.5.1 官方源码(2026-07 发布, 当前最新)
- luaconf.h LUA_EXTRASPACE 扩为 272 字节(与 5.4.8 同方案)
- C API 完全兼容, 桥接层零改动
- PackagePathConfig 测试沿用跨版本语义断言(5.4+ require 返回 loader data 路径)
- 验证: GTest 44/44 通过
This commit is contained in:
JianFeeeee
2026-08-25 10:07:07 +08:00
parent 4af121c1f3
commit 80880edbce
65 changed files with 6094 additions and 3791 deletions

26
lib/lua/luac.c Executable file → Normal file
View File

@ -18,6 +18,7 @@
#include "lua.h"
#include "lauxlib.h"
#include "lapi.h"
#include "ldebug.h"
#include "lobject.h"
#include "lopcodes.h"
@ -346,6 +347,8 @@ static void PrintCode(const Proto* f)
int bx=GETARG_Bx(i);
int sb=GETARG_sB(i);
int sc=GETARG_sC(i);
int vb=GETARG_vB(i);
int vc=GETARG_vC(i);
int sbx=GETARG_sBx(i);
int isk=GETARG_k(i);
int line=luaG_getfuncline(f,pc);
@ -427,8 +430,8 @@ static void PrintCode(const Proto* f)
if (isk) { printf(" "); PrintConstant(f,c); }
break;
case OP_NEWTABLE:
printf("%d %d %d",a,b,c);
printf(COMMENT "%d",c+EXTRAARGC);
printf("%d %d %d%s",a,vb,vc,ISK);
printf(COMMENT "%d",vc+EXTRAARGC);
break;
case OP_SELF:
printf("%d %d %d%s",a,b,c,ISK);
@ -477,10 +480,10 @@ static void PrintCode(const Proto* f)
printf("%d %d %d",a,b,c);
printf(COMMENT); PrintConstant(f,c);
break;
case OP_SHRI:
case OP_SHLI:
printf("%d %d %d",a,b,sc);
break;
case OP_SHLI:
case OP_SHRI:
printf("%d %d %d",a,b,sc);
break;
case OP_ADD:
@ -632,7 +635,7 @@ static void PrintCode(const Proto* f)
printf(COMMENT "to %d",pc-bx+2);
break;
case OP_SETLIST:
printf("%d %d %d",a,b,c);
printf("%d %d %d%s",a,vb,vc,ISK);
if (isk) printf(COMMENT "%d",c+EXTRAARGC);
break;
case OP_CLOSURE:
@ -640,10 +643,18 @@ static void PrintCode(const Proto* f)
printf(COMMENT "%p",VOID(f->p[bx]));
break;
case OP_VARARG:
printf("%d %d",a,c);
printf("%d %d %d%s",a,b,c,ISK);
printf(COMMENT);
if (c==0) printf("all out"); else printf("%d out",c-1);
break;
case OP_GETVARG:
printf("%d %d %d",a,b,c);
break;
case OP_ERRNNIL:
printf("%d %d",a,bx);
printf(COMMENT);
if (bx==0) printf("?"); else PrintConstant(f,bx-1);
break;
case OP_VARARGPREP:
printf("%d",a);
break;
@ -661,7 +672,6 @@ static void PrintCode(const Proto* f)
}
}
#define SS(x) ((x==1)?"":"s")
#define S(x) (int)(x),SS(x)
@ -679,7 +689,7 @@ static void PrintHeader(const Proto* f)
f->linedefined,f->lastlinedefined,
S(f->sizecode),VOID(f));
printf("%d%s param%s, %d slot%s, %d upvalue%s, ",
(int)(f->numparams),f->is_vararg?"+":"",SS(f->numparams),
(int)(f->numparams),isvararg(f)?"+":"",SS(f->numparams),
S(f->maxstacksize),S(f->sizeupvalues));
printf("%d local%s, %d constant%s, %d function%s\n",
S(f->sizelocvars),S(f->sizek),S(f->sizep));