Skip to content

Commit

Permalink
Build LuaJIT w/ table.pack support (#388)
Browse files Browse the repository at this point in the history
c.f., koreader/koreader-base#1535

Note that I left a couple of `{...}` constructs alone in android.lua, because some were then passing the table to `table.concat`, which *will* choke on a nil (and it gets to iterate over it in a packed vararg table).
  • Loading branch information
NiLuJe committed Oct 12, 2022
1 parent 76ba544 commit 2228f93
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
31 changes: 31 additions & 0 deletions jni/luajit/koreader-luajit-enable-table_pack.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
diff --git a/src/lib_table.c b/src/lib_table.c
index a723326a..28af227f 100644
--- a/src/lib_table.c
+++ b/src/lib_table.c
@@ -267,7 +267,6 @@ LJLIB_CF(table_sort)
return 0;
}

-#if LJ_52
LJLIB_PUSH("n")
LJLIB_CF(table_pack)
{
@@ -283,7 +282,6 @@ LJLIB_CF(table_pack)
lj_gc_check(L);
return 1;
}
-#endif

LJLIB_NOREG LJLIB_CF(table_new) LJLIB_REC(.)
{
@@ -316,10 +314,8 @@ static int luaopen_table_clear(lua_State *L)
LUALIB_API int luaopen_table(lua_State *L)
{
LJ_LIB_REG(L, LUA_TABLIBNAME, table);
-#if LJ_52
lua_getglobal(L, "unpack");
lua_setfield(L, -2, "unpack");
-#endif
lj_lib_prereg(L, LUA_TABLIBNAME ".new", luaopen_table_new, tabV(L->top-1));
lj_lib_prereg(L, LUA_TABLIBNAME ".clear", luaopen_table_clear, tabV(L->top-1));
return 1;
2 changes: 1 addition & 1 deletion jni/luajit/luajit
Submodule luajit updated 1 files
+1 −1 src/lj_asm_arm64.h
1 change: 1 addition & 0 deletions jni/luajit/mk-luajit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ function do_patch() {
}

do_patch "koreader-luajit-makefile-tweaks.patch"
do_patch "koreader-luajit-enable-table_pack.patch"
do_patch "koreader-luajit-mcode-reserve-hack.patch"

# In debug builds, we patch LuaJIT some more to grok what happens with mcode allocations
Expand Down

0 comments on commit 2228f93

Please sign in to comment.