summaryrefslogtreecommitdiff
path: root/Build/source/libs/luajit/TLpatches/patch-09
blob: d0fcf9b2946164103c88bbfa775611b9c7a4be91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
diff -bur LuaJIT-2.1.0-beta3-orig/src/lj_load.c LuaJIT-2.1.0-beta3/src/lj_load.c
--- LuaJIT-2.1.0-beta3-orig/src/lj_load.c	2017-05-01 21:05:00.000000000 +0200
+++ LuaJIT-2.1.0-beta3/src/lj_load.c	2017-06-19 18:05:35.864190001 +0200
@@ -166,3 +166,31 @@
     return 1;
 }
 
+/* -- Luajittex needs this one because it's faster than make it Lua  -- */
+LUA_API int RESERVED_lua_dump(lua_State *L, lua_Writer writer, void *data, int strip)
+{
+  cTValue *o = L->top-1;
+  api_check(L, L->top > L->base);
+  if (tvisfunc(o) && isluafunc(funcV(o)))
+    return lj_bcwrite(L, funcproto(funcV(o)), writer, data, strip);
+  else
+    return 1;
+}
+
+/* -- Luajittex needs this one because it overloads loadfile  -- */
+LUALIB_API int RESERVED_load_aux_JIT(lua_State *L, int status, int envarg)
+{
+  if (status == 0) {
+    if (tvistab(L->base+envarg-1)) {
+      GCfunc *fn = funcV(L->top-1);
+      GCtab *t = tabV(L->base+envarg-1);
+      setgcref(fn->c.env, obj2gco(t));
+      lj_gc_objbarrier(L, fn, t);
+    }
+    return 1;
+  } else {
+    setnilV(L->top-2);
+    return 2;
+  }
+}
+