Debian Codegraph @

libs/luajit/TLpatches/patch-lj_load

raw
1 diff -bu a/source/libs/luajit/LuaJIT-src/src/lj_load.c b/source/libs/luajit/LuaJIT-src/src/lj_load.c
2 --- a/source/libs/luajit/LuaJIT-src/src/lj_load.c
3 +++ b/source/libs/luajit/LuaJIT-src/src/lj_load.c
4 @@ -182,3 +182,32 @@
5 return 1;
6 }
7
8 +/* -- Luajittex needs this one because it's faster than make it with Lua -- */
9 +LUA_API int RESERVED_lua_dump(lua_State *L, lua_Writer writer, void *data, int strip)
10 +{
11 + cTValue *o = L->top-1;
12 + lj_checkapi(L->top > L->base, "top slot empty");
13 + if (tvisfunc(o) && isluafunc(funcV(o)))
14 + return lj_bcwrite(L, funcproto(funcV(o)), writer, data, strip);
15 + else
16 + return 1;
17 +}
18 +
19 +/* -- Luajittex needs this one because it overloads loadfile -- */
20 +LUALIB_API int RESERVED_load_aux_JIT(lua_State *L, int status, int envarg)
21 +{
22 + if (status == 0) {
23 + if (tvistab(L->base+envarg-1)) {
24 + GCfunc *fn = funcV(L->top-1);
25 + GCtab *t = tabV(L->base+envarg-1);
26 + setgcref(fn->c.env, obj2gco(t));
27 + lj_gc_objbarrier(L, fn, t);
28 + }
29 + return 1;
30 + } else {
31 + setnilV(L->top-2);
32 + return 2;
33 + }
34 +}
35 +
36 +