summaryrefslogtreecommitdiff
path: root/Build/source/libs/luajit/TLPATCHES
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-02-13 18:43:14 +0000
committerKarl Berry <karl@freefriends.org>2017-02-13 18:43:14 +0000
commit5ef2fb04a27cd5ef7c85fbefec889b2503259290 (patch)
tree5d213e7091d68bc4226e68d6ad83ffc774dfe370 /Build/source/libs/luajit/TLPATCHES
parentcdedcff919defc8bac478adf4411c495e08ccd25 (diff)
rename foo/foo-PATCHES to foo/TLPATCHES for better completion
git-svn-id: svn://tug.org/texlive/trunk@43212 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/luajit/TLPATCHES')
-rw-r--r--Build/source/libs/luajit/TLPATCHES/ChangeLog68
-rw-r--r--Build/source/libs/luajit/TLPATCHES/patch-01-LuaJITTeX221
-rw-r--r--Build/source/libs/luajit/TLPATCHES/patch-05-LuaJITTeX86
-rw-r--r--Build/source/libs/luajit/TLPATCHES/patch-06-ppc-darwin25
-rw-r--r--Build/source/libs/luajit/TLPATCHES/patch-07-x86_64-cygwin12
5 files changed, 412 insertions, 0 deletions
diff --git a/Build/source/libs/luajit/TLPATCHES/ChangeLog b/Build/source/libs/luajit/TLPATCHES/ChangeLog
new file mode 100644
index 00000000000..b74ee1d6be4
--- /dev/null
+++ b/Build/source/libs/luajit/TLPATCHES/ChangeLog
@@ -0,0 +1,68 @@
+2016-03-07 Luigi Scarso <luigi.scarso@gmail.com>
+ Luajit-2.1.0-beta2
+
+2016-03-04 Luigi Scarso <luigi.scarso@gmail.com>
+
+ * added RESERVED_load_aux_JIT needed to Luajittex loadfile
+
+2015-09-27 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * patch-07-x86_64-cygwin (new): Backport from upstream git.
+
+2015-09-07 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ Import LuaJIT-2.1.0-beta1.
+
+ * patch-01-LuaJITTeX: Adapted.
+ * patch-05-LuaJITTeX: Adapted.
+ * patch-06-ppc-darwin: Adapted.
+
+2015-06-12 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ Import LuaJIT-2.0.4.
+
+ * patch-01-LuaJITTeX: Adapted.
+ * patch-05-LuaJITTeX: Adapted.
+ * patch-06-ppc-darwin: Adapted.
+
+2015-01-19 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * patch-06-ppc-darwin (new): Build fix for PPC OS X.
+ From http://permalink.gmane.org/gmane.comp.lang.lua.luajit/5936.
+
+2014-06-01 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * patch-05-LuaJITTeX (lj_str_new): Replace '6' by LUAI_HASHLIMIT
+ and use '#define LUAI_HASHLIMIT 5' as default as in
+ ../../libs/lua52/lua-5.2.3/src/lstring.c.
+
+2014-03-14 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ Import LuaJIT-2.0.3.
+
+ * patch-01-LuaJITTeX: Adapted.
+ * patch-05-LuaJITTeX (new): More changes from Luigi and Taco.
+
+ * patch-02-unwind, patch-03-OSX-build, patch-04-NetBSD64-build
+ (removed): Now in distribution.
+
+2014-02-23 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * patch-04-NetBSD64-build (new): Fix NetBSD/amd64 build from
+ Marc Baudoin <babafou.eu.org>.
+
+2014-02-07 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * patch-03-OSX-build (new): Backport from upstream git.
+ Fix OSX build issue by Mike Pall.
+
+2014-02-06 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * patch-02-unwind (new): Bug fix.
+
+2014-02-05 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ Import LuaJIT-2.0.2.
+
+ * patch-01-LuaJITTeX (new): Adapt for use in LuaJITTeX.
+
diff --git a/Build/source/libs/luajit/TLPATCHES/patch-01-LuaJITTeX b/Build/source/libs/luajit/TLPATCHES/patch-01-LuaJITTeX
new file mode 100644
index 00000000000..2e8220e0c36
--- /dev/null
+++ b/Build/source/libs/luajit/TLPATCHES/patch-01-LuaJITTeX
@@ -0,0 +1,221 @@
+diff -bur LuaJIT-src-orig/src/lauxlib.h LuaJIT-src/src/lauxlib.h
+--- LuaJIT-src-orig/src/lauxlib.h 2016-03-07 09:43:42.708069718 +0100
++++ LuaJIT-src/src/lauxlib.h 2016-03-04 16:52:23.000000000 +0100
+@@ -86,6 +86,32 @@
+ int level);
+
+
++
++/*
++** {======================================================
++** File handles for IO library
++** =======================================================
++*/
++
++/*
++** A file handle is a userdata with metatable 'LUA_FILEHANDLE' and
++** initial structure 'luaL_Stream' (it may contain other fields
++** after that initial structure).
++*/
++
++#define LUA_FILEHANDLE "FILE*"
++
++
++typedef struct luaL_Stream {
++ FILE *f; /* stream (NULL for incompletely created streams) */
++ lua_CFunction closef; /* to close stream (NULL for closed streams) */
++} luaL_Stream;
++
++/* }====================================================== */
++
++
++
++
+ /*
+ ** ===============================================================
+ ** some useful macros
+@@ -144,6 +170,8 @@
+ LUALIB_API void (luaL_addvalue) (luaL_Buffer *B);
+ LUALIB_API void (luaL_pushresult) (luaL_Buffer *B);
+
++/* Luajittex needs this one because it overloads loadfile */
++LUALIB_API int (RESERVED_load_aux_JIT) (lua_State *L, int status, int envarg);
+
+ /* }====================================================== */
+
+diff -bur LuaJIT-src-orig/src/lib_init.c LuaJIT-src/src/lib_init.c
+--- LuaJIT-src-orig/src/lib_init.c 2016-03-07 09:43:42.720069718 +0100
++++ LuaJIT-src/src/lib_init.c 2016-03-07 11:47:15.847946480 +0100
+@@ -26,6 +26,7 @@
+ { LUA_DBLIBNAME, luaopen_debug },
+ { LUA_BITLIBNAME, luaopen_bit },
+ { LUA_JITLIBNAME, luaopen_jit },
++ { LUA_BITLIBNAME_32, luaopen_bit32 },
+ { NULL, NULL }
+ };
+
+diff -bur LuaJIT-src-orig/src/lib_package.c LuaJIT-src/src/lib_package.c
+--- LuaJIT-src-orig/src/lib_package.c 2016-03-07 09:43:42.712069718 +0100
++++ LuaJIT-src/src/lib_package.c 2016-03-07 11:49:15.655944489 +0100
+@@ -362,6 +362,29 @@
+ return 1; /* library loaded successfully */
+ }
+
++#define LUA_POF "luaopen_"
++#define LUA_OFSEP "_"
++#define POF LUA_POF
++
++static const char *mkfuncname (lua_State *L, const char *modname) {
++ const char *funcname;
++ const char *mark = strchr(modname, *LUA_IGMARK);
++ if (mark) modname = mark + 1;
++ funcname = luaL_gsub(L, modname, ".", LUA_OFSEP);
++ funcname = lua_pushfstring(L, POF"%s", funcname);
++ lua_remove(L, -2); /* remove 'gsub' result */
++ return funcname;
++}
++
++
++int loader_C_luatex (lua_State *L, const char *name, const char *filename) {
++ const char *funcname;
++ funcname = mkfuncname(L, name);
++ if (ll_loadfunc(L, filename, funcname,0) != 0)
++ loaderror(L, filename);
++ return 1; /* library loaded successfully */
++}
++
+ static int lj_cf_package_loader_croot(lua_State *L)
+ {
+ const char *filename;
+@@ -381,6 +404,21 @@
+ return 1;
+ }
+
++int loader_Call_luatex (lua_State *L, const char *name, const char *filename) {
++ const char *funcname;
++ int stat;
++ if (filename == NULL) return 1; /* root not found */
++ funcname = mkfuncname(L, name);
++ if ((stat = ll_loadfunc(L, filename, funcname,0)) != 0) {
++ if (stat != PACKAGE_ERR_FUNC) loaderror(L, filename); /* real error */
++ lua_pushfstring(L, "\n\tno module " LUA_QS " in file " LUA_QS,
++ name, filename);
++ return 1; /* function not found */
++ }
++ return 1; /* library loaded successfully */
++}
++
++
+ static int lj_cf_package_loader_preload(lua_State *L)
+ {
+ const char *name = luaL_checkstring(L, 1);
+
+diff -bur LuaJIT-src-orig/src/lj_load.c LuaJIT-src/src/lj_load.c
+--- LuaJIT-src-orig/src/lj_load.c 2016-03-07 09:43:42.716069718 +0100
++++ LuaJIT-src/src/lj_load.c 2016-03-07 12:09:10.771924621 +0100
+@@ -166,3 +166,19 @@
+ 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;
++ }
++}
+
+diff -bur LuaJIT-src-orig/src/lua.h LuaJIT-src/src/lua.h
+--- LuaJIT-src-orig/src/lua.h 2016-03-07 09:43:42.716069718 +0100
++++ LuaJIT-src/src/lua.h 2016-03-07 11:56:24.855937353 +0100
+@@ -103,6 +103,9 @@
+ typedef LUA_INTEGER lua_Integer;
+
+
++/* communication with LuaJiTTeX */
++LUA_API int luajittex_choose_hash_function;
++
+
+ /*
+ ** state manipulation
+@@ -349,6 +352,16 @@
+ const char *chunkname, const char *mode);
+
+
++#define LUA_OPEQ 0
++#define LUA_OPLT 1
++#define LUA_OPLE 2
++#define LUA_OK 0
++
++/* see http://comments.gmane.org/gmane.comp.programming.swig/18673 */
++# define lua_rawlen lua_objlen
++
++
++
+ struct lua_Debug {
+ int event;
+ const char *name; /* (n) */
+
+diff -bur LuaJIT-src-orig/src/lualib.h LuaJIT-src/src/lualib.h
+--- LuaJIT-src-orig/src/lualib.h 2016-03-07 09:43:42.724069718 +0100
++++ LuaJIT-src/src/lualib.h 2016-03-07 11:58:19.151935453 +0100
+@@ -22,6 +22,8 @@
+ #define LUA_JITLIBNAME "jit"
+ #define LUA_FFILIBNAME "ffi"
+
++#define LUA_BITLIBNAME_32 "bit32"
++
+ LUALIB_API int luaopen_base(lua_State *L);
+ LUALIB_API int luaopen_math(lua_State *L);
+ LUALIB_API int luaopen_string(lua_State *L);
+@@ -34,6 +36,8 @@
+ LUALIB_API int luaopen_jit(lua_State *L);
+ LUALIB_API int luaopen_ffi(lua_State *L);
+
++LUALIB_API int luaopen_bit32(lua_State *L);
++
+ LUALIB_API void luaL_openlibs(lua_State *L);
+
+ #ifndef lua_assert
+
+diff -bur LuaJIT-src-orig/src/Makefile LuaJIT-src/src/Makefile
+--- LuaJIT-src-orig/src/Makefile 2016-03-07 09:43:42.716069718 +0100
++++ LuaJIT-src/src/Makefile 2016-03-07 12:02:42.319931078 +0100
+@@ -99,7 +99,7 @@
+ # enabled by default. Some other features that *might* break some existing
+ # code (e.g. __pairs or os.execute() return values) can be enabled here.
+ # Note: this does not provide full compatibility with Lua 5.2 at this time.
+-#XCFLAGS+= -DLUAJIT_ENABLE_LUA52COMPAT
++XCFLAGS+= -DLUAJIT_ENABLE_LUA52COMPAT
+ #
+ # Disable the JIT compiler, i.e. turn LuaJIT into a pure interpreter.
+ #XCFLAGS+= -DLUAJIT_DISABLE_JIT
+@@ -471,7 +471,7 @@
+ LJVM_BOUT= $(LJVM_S)
+ LJVM_MODE= elfasm
+
+-LJLIB_O= lib_base.o lib_math.o lib_bit.o lib_string.o lib_table.o \
++LJLIB_O= lib_base.o lib_math.o lbitlib.o lib_bit.o lib_string.o lib_table.o \
+ lib_io.o lib_os.o lib_package.o lib_debug.o lib_jit.o lib_ffi.o
+ LJLIB_C= $(LJLIB_O:.o=.c)
+
+diff -bur LuaJIT-src-orig/src/Makefile.dep LuaJIT-src/src/Makefile.dep
+--- LuaJIT-src-orig/src/Makefile.dep 2016-03-07 09:43:42.696069718 +0100
++++ LuaJIT-src/src/Makefile.dep 2016-03-07 12:05:19.343928468 +0100
+@@ -6,6 +6,7 @@
+ lj_tab.h lj_meta.h lj_state.h lj_ctype.h lj_cconv.h lj_bc.h lj_ff.h \
+ lj_ffdef.h lj_dispatch.h lj_jit.h lj_ir.h lj_char.h lj_strscan.h \
+ lj_strfmt.h lj_lib.h lj_libdef.h
++lbitlib.o: lbitlib.c lua.h luaconf.h lauxlib.h lualib.h
+ lib_bit.o: lib_bit.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h lj_def.h \
+ lj_arch.h lj_err.h lj_errmsg.h lj_buf.h lj_gc.h lj_str.h lj_strscan.h \
+ lj_strfmt.h lj_ctype.h lj_cdata.h lj_cconv.h lj_carith.h lj_ff.h \
diff --git a/Build/source/libs/luajit/TLPATCHES/patch-05-LuaJITTeX b/Build/source/libs/luajit/TLPATCHES/patch-05-LuaJITTeX
new file mode 100644
index 00000000000..884d3392bf7
--- /dev/null
+++ b/Build/source/libs/luajit/TLPATCHES/patch-05-LuaJITTeX
@@ -0,0 +1,86 @@
+diff -bur LuaJIT-src-orig/src/lj_def.h LuaJIT-src/src/lj_def.h
+--- LuaJIT-src-orig/src/lj_def.h 2016-03-07 09:43:42.728069718 +0100
++++ LuaJIT-src/src/lj_def.h 2016-03-07 12:23:43.327910115 +0100
+@@ -66,7 +66,7 @@
+ #define LJ_MAX_BCINS (1<<26) /* Max. # of bytecode instructions. */
+ #define LJ_MAX_SLOTS 250 /* Max. # of slots in a Lua func. */
+ #define LJ_MAX_LOCVAR 200 /* Max. # of local variables. */
+-#define LJ_MAX_UPVAL 60 /* Max. # of upvalues. */
++#define LJ_MAX_UPVAL 249 /* Max. # of upvalues. */
+
+ #define LJ_MAX_IDXCHAIN 100 /* __index/__newindex chain limit. */
+ #define LJ_STACK_EXTRA (5+2*LJ_FR2) /* Extra stack space (metamethods). */
+
+diff -bur LuaJIT-src-orig/src/lj_str.c LuaJIT-src/src/lj_str.c
+--- LuaJIT-src-orig/src/lj_str.c 2016-03-07 09:43:42.696069718 +0100
++++ LuaJIT-src/src/lj_str.c 2016-03-07 12:25:22.031908474 +0100
+@@ -118,6 +118,16 @@
+ g->strhash = newhash;
+ }
+
++/*
++** Lua will use at most ~(2^LUAI_HASHLIMIT) bytes from a string to
++** compute its hash
++*/
++#if !defined(LUAI_HASHLIMIT)
++#define LUAI_HASHLIMIT 5
++#endif
++
++#define cast(t, exp) ((t)(exp))
++int luajittex_choose_hash_function = 0 ;
+ /* Intern a string and return string object. */
+ GCstr *lj_str_new(lua_State *L, const char *str, size_t lenx)
+ {
+@@ -126,9 +136,22 @@
+ GCobj *o;
+ MSize len = (MSize)lenx;
+ MSize a, b, h = len;
++ size_t step ;
++ size_t l1 ;
+ if (lenx >= LJ_MAX_STR)
+ lj_err_msg(L, LJ_ERR_STROV);
+ g = G(L);
++
++ if (len==0)
++ return &g->strempty;
++ if (luajittex_choose_hash_function==0) {
++ /* Lua 5.1.5 hash function */
++ /* for 5.2 max methods we also need to patch the vm eq */
++ step = (len>>LUAI_HASHLIMIT)+1; /* if string is too long, don't hash all its chars */
++ for (l1=len; l1>=step; l1-=step) /* compute hash */
++ h = h ^ ((h<<5)+(h>>2)+cast(unsigned char, str[l1-1]));
++ } else {
++ /* LuaJIT 2.0.2 hash function */
+ /* Compute string hash. Constants taken from lookup3 hash by Bob Jenkins. */
+ if (len >= 4) { /* Caveat: unaligned access! */
+ a = lj_getu32(str);
+@@ -142,11 +165,15 @@
+ b = *(const uint8_t *)(str+(len>>1));
+ h ^= b; h -= lj_rol(b, 14);
+ } else {
++ /* Already done, kept for reference */
+ return &g->strempty;
+ }
+ a ^= h; a -= lj_rol(h, 11);
+ b ^= a; b -= lj_rol(a, 25);
+ h ^= b; h -= lj_rol(b, 16);
++ }
++
++
+ /* Check if the string has already been interned. */
+ o = gcref(g->strhash[h & g->strmask]);
+ if (LJ_LIKELY((((uintptr_t)str+len-1) & (LJ_PAGESIZE-1)) <= LJ_PAGESIZE-4)) {
+
+diff -bur LuaJIT-src-orig/src/lj_err.c LuaJIT-src/src/lj_err.c
+--- LuaJIT-src-orig/src/lj_err.c 2016-03-15 12:06:56.844436191 +0100
++++ LuaJIT-src/src/lj_err.c 2016-03-15 11:58:30.000000000 +0100
+@@ -310,7 +310,6 @@
+ #define _US_FORCE_UNWIND 8
+
+ typedef struct _Unwind_Control_Block _Unwind_Control_Block;
+-typedef struct _Unwind_Context _Unwind_Context;
+
+ struct _Unwind_Control_Block {
+ uint64_t exclass;
+
+
diff --git a/Build/source/libs/luajit/TLPATCHES/patch-06-ppc-darwin b/Build/source/libs/luajit/TLPATCHES/patch-06-ppc-darwin
new file mode 100644
index 00000000000..cc4855ea8de
--- /dev/null
+++ b/Build/source/libs/luajit/TLPATCHES/patch-06-ppc-darwin
@@ -0,0 +1,25 @@
+diff -bur LuaJIT-src-orig/src/host/buildvm.c LuaJIT-src/src/host/buildvm.c
+--- LuaJIT-src-orig/src/host/buildvm.c 2016-03-07 09:43:42.728069718 +0100
++++ LuaJIT-src/src/host/buildvm.c 2016-03-07 12:29:03.891904786 +0100
+@@ -113,7 +113,7 @@
+ name[0] = '@';
+ else
+ *p = '\0';
+-#elif LJ_TARGET_PPC && !LJ_TARGET_CONSOLE
++#elif LJ_TARGET_PPC && !LJ_TARGET_OSX && !LJ_TARGET_CONSOLE
+ /* Keep @plt etc. */
+ #else
+ *p = '\0';
+
+diff -bur LuaJIT-src-orig/src/lj_arch.h LuaJIT-src/src/lj_arch.h
+--- LuaJIT-src-orig/src/lj_arch.h 2016-03-07 09:43:42.712069718 +0100
++++ LuaJIT-src/src/lj_arch.h 2016-03-07 12:31:33.351902301 +0100
+@@ -350,7 +350,7 @@
+ #if __GNUC__ < 4
+ #error "Need at least GCC 4.0 or newer"
+ #endif
+-#elif LJ_TARGET_ARM
++#elif LJ_TARGET_ARM || LJ_TARGET_PPC
+ #if (__GNUC__ < 4) || ((__GNUC__ == 4) && __GNUC_MINOR__ < 2)
+ #error "Need at least GCC 4.2 or newer"
+ #endif
diff --git a/Build/source/libs/luajit/TLPATCHES/patch-07-x86_64-cygwin b/Build/source/libs/luajit/TLPATCHES/patch-07-x86_64-cygwin
new file mode 100644
index 00000000000..4b278dd2c99
--- /dev/null
+++ b/Build/source/libs/luajit/TLPATCHES/patch-07-x86_64-cygwin
@@ -0,0 +1,12 @@
+diff -bur LuaJIT-src-orig/src/lj_arch.h LuaJIT-src/src/lj_arch.h
+--- LuaJIT-src-orig/src/lj_arch.h 2016-03-07 09:43:42.712069718 +0100
++++ LuaJIT-src/src/lj_arch.h 2016-03-07 12:31:33.351902301 +0100
+@@ -350,7 +350,7 @@
+ #if __GNUC__ < 4
+ #error "Need at least GCC 4.0 or newer"
+ #endif
+-#elif LJ_TARGET_ARM
++#elif LJ_TARGET_ARM || LJ_TARGET_PPC
+ #if (__GNUC__ < 4) || ((__GNUC__ == 4) && __GNUC_MINOR__ < 2)
+ #error "Need at least GCC 4.2 or newer"
+ #endif