* [PR PATCH] LuaJIT: update to git v2.1 branch
@ 2022-04-21 0:48 CameronNemo
2022-04-21 4:04 ` q66
` (17 more replies)
0 siblings, 18 replies; 19+ messages in thread
From: CameronNemo @ 2022-04-21 0:48 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1278 bytes --]
There is a new pull request by CameronNemo against master on the void-packages repository
https://github.com/CameronNemo/void-packages luajit
https://github.com/void-linux/void-packages/pull/36790
LuaJIT: update to git v2.1 branch
CC: @q66
The LuaJIT maintainer has not published a new version in 5 years, but he
has steadily added commits to the "2.1" branch, linked below.
https://repo.or.cz/luajit-2.0.git/shortlog/refs/heads/v2.1
Projects like neovim build against this branch or master due to the lack
of a recent release.
Furthermore, distributions such as Arch Linux and Debian Sid are
building from a commit rather than a release.
https://github.com/archlinux/svntogit-community/commit/11473c3c786593b2438a865519d407c7a84ce0a1
https://salsa.debian.org/lua-team/luajit/-/commit/e06cbc6d2a61b253056214f5ed3f03ce661e31f9
The LuaJIT upstream maintainer has declined to cut a release, reasoning
"Releases are an antiquated concept".
https://github.com/LuaJIT/LuaJIT/issues/665#issuecomment-784452583
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**, on x86_64 and aarch64
A patch file from https://github.com/void-linux/void-packages/pull/36790.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-luajit-36790.patch --]
[-- Type: text/x-diff, Size: 38617 bytes --]
From dd052a4092ddaad1ab447e8c01583aba2a59bcea Mon Sep 17 00:00:00 2001
From: Cameron Nemo <cnemo@tutanota.com>
Date: Wed, 20 Apr 2022 16:43:31 -0700
Subject: [PATCH] LuaJIT: update to git v2.1 branch
The LuaJIT maintainer has not published a new version in 5 years, but he
has steadily added commits to the "2.1" branch, linked below.
https://repo.or.cz/luajit-2.0.git/shortlog/refs/heads/v2.1
Projects like neovim build against this branch or master due to the lack
of a recent release.
Furthermore, distributions such as Arch Linux and Debian Sid are
building from a commit rather than a release.
https://github.com/archlinux/svntogit-community/commit/11473c3c786593b2438a865519d407c7a84ce0a1
https://salsa.debian.org/lua-team/luajit/-/commit/e06cbc6d2a61b253056214f5ed3f03ce661e31f9
The LuaJIT upstream maintainer has declined to cut a release, reasoning
"Releases are an antiquated concept".
https://github.com/LuaJIT/LuaJIT/issues/665#issuecomment-784452583
---
..._VERSION_SYM-that-changes-ABI-on-ev.patch} | 16 +-
.../aarch64-Fix-exit-stub-patching.patch | 231 -------
.../aarch64-register-allocation-bug-fix.patch | 29 -
...1abec542e6f9851ff2368e7f196b6382a44c.patch | 562 ------------------
srcpkgs/LuaJIT/patches/fix-bcsave-ppc64.patch | 44 +-
.../patches/unpollute-global-namespace.patch | 21 -
srcpkgs/LuaJIT/template | 13 +-
7 files changed, 26 insertions(+), 890 deletions(-)
rename srcpkgs/LuaJIT/patches/{get-rid-of-luajit-version-sym.patch => 0003-Get-rid-of-LUAJIT_VERSION_SYM-that-changes-ABI-on-ev.patch} (84%)
delete mode 100644 srcpkgs/LuaJIT/patches/aarch64-Fix-exit-stub-patching.patch
delete mode 100644 srcpkgs/LuaJIT/patches/aarch64-register-allocation-bug-fix.patch
delete mode 100644 srcpkgs/LuaJIT/patches/e9af1abec542e6f9851ff2368e7f196b6382a44c.patch
delete mode 100644 srcpkgs/LuaJIT/patches/unpollute-global-namespace.patch
diff --git a/srcpkgs/LuaJIT/patches/get-rid-of-luajit-version-sym.patch b/srcpkgs/LuaJIT/patches/0003-Get-rid-of-LUAJIT_VERSION_SYM-that-changes-ABI-on-ev.patch
similarity index 84%
rename from srcpkgs/LuaJIT/patches/get-rid-of-luajit-version-sym.patch
rename to srcpkgs/LuaJIT/patches/0003-Get-rid-of-LUAJIT_VERSION_SYM-that-changes-ABI-on-ev.patch
index 59e1ee72fcbb..7d02896a7840 100644
--- a/srcpkgs/LuaJIT/patches/get-rid-of-luajit-version-sym.patch
+++ b/srcpkgs/LuaJIT/patches/0003-Get-rid-of-LUAJIT_VERSION_SYM-that-changes-ABI-on-ev.patch
@@ -8,7 +8,7 @@ Subject: Get rid of LUAJIT_VERSION_SYM that changes ABI on every patch release
src/luajit.h | 3 ---
3 files changed, 10 deletions(-)
-diff --git src/lj_dispatch.c src/lj_dispatch.c
+diff --git a/src/lj_dispatch.c b/src/lj_dispatch.c
index 5d6795f..e865a78 100644
--- a/src/lj_dispatch.c
+++ b/src/lj_dispatch.c
@@ -24,20 +24,20 @@ index 5d6795f..e865a78 100644
/* -- Hooks --------------------------------------------------------------- */
/* This function can be called asynchronously (e.g. during a signal). */
-diff --git src/luajit.c src/luajit.c
+diff --git a/src/luajit.c b/src/luajit.c
index 1ca2430..ccf425e 100644
--- a/src/luajit.c
+++ b/src/luajit.c
-@@ -516,8 +516,6 @@ static int pmain(lua_State *L)
+@@ -515,7 +515,6 @@
+ int argn;
+ int flags = 0;
globalL = L;
- if (argv[0] && argv[0][0]) progname = argv[0];
-
- LUAJIT_VERSION_SYM(); /* Linker-enforced version check. */
--
+
argn = collectargs(argv, &flags);
if (argn < 0) { /* Invalid args? */
- print_usage();
-diff --git src/luajit.h src/luajit.h
+
+diff --git a/src/luajit.h b/src/luajit.h
index 708a5a1..35ae02c 100644
--- a/src/luajit.h
+++ b/src/luajit.h
diff --git a/srcpkgs/LuaJIT/patches/aarch64-Fix-exit-stub-patching.patch b/srcpkgs/LuaJIT/patches/aarch64-Fix-exit-stub-patching.patch
deleted file mode 100644
index 487a1cd1ca78..000000000000
--- a/srcpkgs/LuaJIT/patches/aarch64-Fix-exit-stub-patching.patch
+++ /dev/null
@@ -1,231 +0,0 @@
-commit 9da06535092d6d9dec442641a26c64bce5574322
-Author: Mike Pall <mike>
-Date: Sun Jun 24 14:08:59 2018 +0200
-
- ARM64: Fix exit stub patching.
-
- Contributed by Javier Guerra Giraldez.
-
-diff --git a/src/lj_asm_arm64.h b/src/lj_asm_arm64.h
-index cbb186d3..baafa21a 100644
---- a/src/lj_asm_arm64.h
-+++ b/src/lj_asm_arm64.h
-@@ -56,11 +56,11 @@ static void asm_exitstub_setup(ASMState *as, ExitNo nexits)
- asm_mclimit(as);
- /* 1: str lr,[sp]; bl ->vm_exit_handler; movz w0,traceno; bl <1; bl <1; ... */
- for (i = nexits-1; (int32_t)i >= 0; i--)
-- *--mxp = A64I_LE(A64I_BL|((-3-i)&0x03ffffffu));
-- *--mxp = A64I_LE(A64I_MOVZw|A64F_U16(as->T->traceno));
-+ *--mxp = A64I_LE(A64I_BL | A64F_S26(-3-i));
-+ *--mxp = A64I_LE(A64I_MOVZw | A64F_U16(as->T->traceno));
- mxp--;
-- *mxp = A64I_LE(A64I_BL|(((MCode *)(void *)lj_vm_exit_handler-mxp)&0x03ffffffu));
-- *--mxp = A64I_LE(A64I_STRx|A64F_D(RID_LR)|A64F_N(RID_SP));
-+ *mxp = A64I_LE(A64I_BL | A64F_S26(((MCode *)(void *)lj_vm_exit_handler-mxp)));
-+ *--mxp = A64I_LE(A64I_STRx | A64F_D(RID_LR) | A64F_N(RID_SP));
- as->mctop = mxp;
- }
-
-@@ -77,7 +77,7 @@ static void asm_guardcc(ASMState *as, A64CC cc)
- MCode *p = as->mcp;
- if (LJ_UNLIKELY(p == as->invmcp)) {
- as->loopinv = 1;
-- *p = A64I_B | ((target-p) & 0x03ffffffu);
-+ *p = A64I_B | A64F_S26(target-p);
- emit_cond_branch(as, cc^1, p-1);
- return;
- }
-@@ -91,7 +91,7 @@ static void asm_guardtnb(ASMState *as, A64Ins ai, Reg r, uint32_t bit)
- MCode *p = as->mcp;
- if (LJ_UNLIKELY(p == as->invmcp)) {
- as->loopinv = 1;
-- *p = A64I_B | ((target-p) & 0x03ffffffu);
-+ *p = A64I_B | A64F_S26(target-p);
- emit_tnb(as, ai^0x01000000u, r, bit, p-1);
- return;
- }
-@@ -105,7 +105,7 @@ static void asm_guardcnb(ASMState *as, A64Ins ai, Reg r)
- MCode *p = as->mcp;
- if (LJ_UNLIKELY(p == as->invmcp)) {
- as->loopinv = 1;
-- *p = A64I_B | ((target-p) & 0x03ffffffu);
-+ *p = A64I_B | A64F_S26(target-p);
- emit_cnb(as, ai^0x01000000u, r, p-1);
- return;
- }
-@@ -1850,7 +1850,7 @@ static void asm_loop_fixup(ASMState *as)
- p[-2] |= ((uint32_t)delta & mask) << 5;
- } else {
- ptrdiff_t delta = target - (p - 1);
-- p[-1] = A64I_B | ((uint32_t)(delta) & 0x03ffffffu);
-+ p[-1] = A64I_B | A64F_S26(delta);
- }
- }
-
-@@ -1919,7 +1919,7 @@ static void asm_tail_fixup(ASMState *as, TraceNo lnk)
- }
- /* Patch exit branch. */
- target = lnk ? traceref(as->J, lnk)->mcode : (MCode *)lj_vm_exit_interp;
-- p[-1] = A64I_B | (((target-p)+1)&0x03ffffffu);
-+ p[-1] = A64I_B | A64F_S26((target-p)+1);
- }
-
- /* Prepare tail of code. */
-@@ -1982,40 +1982,50 @@ void lj_asm_patchexit(jit_State *J, GCtrace *T, ExitNo exitno, MCode *target)
- {
- MCode *p = T->mcode;
- MCode *pe = (MCode *)((char *)p + T->szmcode);
-- MCode *cstart = NULL, *cend = p;
-+ MCode *cstart = NULL;
- MCode *mcarea = lj_mcode_patch(J, p, 0);
- MCode *px = exitstub_trace_addr(T, exitno);
-+ /* Note: this assumes a trace exit is only ever patched once. */
- for (; p < pe; p++) {
- /* Look for exitstub branch, replace with branch to target. */
-+ ptrdiff_t delta = target - p;
- MCode ins = A64I_LE(*p);
- if ((ins & 0xff000000u) == 0x54000000u &&
- ((ins ^ ((px-p)<<5)) & 0x00ffffe0u) == 0) {
-- /* Patch bcc exitstub. */
-- *p = A64I_LE((ins & 0xff00001fu) | (((target-p)<<5) & 0x00ffffe0u));
-- cend = p+1;
-- if (!cstart) cstart = p;
-+ /* Patch bcc, if within range. */
-+ if (A64F_S_OK(delta, 19)) {
-+ *p = A64I_LE((ins & 0xff00001fu) | A64F_S19(delta));
-+ if (!cstart) cstart = p;
-+ }
- } else if ((ins & 0xfc000000u) == 0x14000000u &&
- ((ins ^ (px-p)) & 0x03ffffffu) == 0) {
-- /* Patch b exitstub. */
-- *p = A64I_LE((ins & 0xfc000000u) | ((target-p) & 0x03ffffffu));
-- cend = p+1;
-+ /* Patch b. */
-+ lua_assert(A64F_S_OK(delta, 26));
-+ *p = A64I_LE((ins & 0xfc000000u) | A64F_S26(delta));
- if (!cstart) cstart = p;
- } else if ((ins & 0x7e000000u) == 0x34000000u &&
- ((ins ^ ((px-p)<<5)) & 0x00ffffe0u) == 0) {
-- /* Patch cbz/cbnz exitstub. */
-- *p = A64I_LE((ins & 0xff00001f) | (((target-p)<<5) & 0x00ffffe0u));
-- cend = p+1;
-- if (!cstart) cstart = p;
-+ /* Patch cbz/cbnz, if within range. */
-+ if (A64F_S_OK(delta, 19)) {
-+ *p = A64I_LE((ins & 0xff00001fu) | A64F_S19(delta));
-+ if (!cstart) cstart = p;
-+ }
- } else if ((ins & 0x7e000000u) == 0x36000000u &&
- ((ins ^ ((px-p)<<5)) & 0x0007ffe0u) == 0) {
-- /* Patch tbz/tbnz exitstub. */
-- *p = A64I_LE((ins & 0xfff8001fu) | (((target-p)<<5) & 0x0007ffe0u));
-- cend = p+1;
-- if (!cstart) cstart = p;
-+ /* Patch tbz/tbnz, if within range. */
-+ if (A64F_S_OK(delta, 14)) {
-+ *p = A64I_LE((ins & 0xfff8001fu) | A64F_S14(delta));
-+ if (!cstart) cstart = p;
-+ }
- }
- }
-- lua_assert(cstart != NULL);
-- lj_mcode_sync(cstart, cend);
-+ { /* Always patch long-range branch in exit stub itself. */
-+ ptrdiff_t delta = target - px;
-+ lua_assert(A64F_S_OK(delta, 26));
-+ *px = A64I_B | A64F_S26(delta);
-+ if (!cstart) cstart = px;
-+ }
-+ lj_mcode_sync(cstart, px+1);
- lj_mcode_patch(J, mcarea, 1);
- }
-
-diff --git a/src/lj_emit_arm64.h b/src/lj_emit_arm64.h
-index 6da4c7d4..1001b1d8 100644
---- a/src/lj_emit_arm64.h
-+++ b/src/lj_emit_arm64.h
-@@ -241,7 +241,7 @@ static void emit_loadk(ASMState *as, Reg rd, uint64_t u64, int is64)
- #define mcpofs(as, k) \
- ((intptr_t)((uintptr_t)(k) - (uintptr_t)(as->mcp - 1)))
- #define checkmcpofs(as, k) \
-- ((((mcpofs(as, k)>>2) + 0x00040000) >> 19) == 0)
-+ (A64F_S_OK(mcpofs(as, k)>>2, 19))
-
- static Reg ra_allock(ASMState *as, intptr_t k, RegSet allow);
-
-@@ -312,7 +312,7 @@ static void emit_cond_branch(ASMState *as, A64CC cond, MCode *target)
- {
- MCode *p = --as->mcp;
- ptrdiff_t delta = target - p;
-- lua_assert(((delta + 0x40000) >> 19) == 0);
-+ lua_assert(A64F_S_OK(delta, 19));
- *p = A64I_BCC | A64F_S19(delta) | cond;
- }
-
-@@ -320,24 +320,24 @@ static void emit_branch(ASMState *as, A64Ins ai, MCode *target)
- {
- MCode *p = --as->mcp;
- ptrdiff_t delta = target - p;
-- lua_assert(((delta + 0x02000000) >> 26) == 0);
-- *p = ai | ((uint32_t)delta & 0x03ffffffu);
-+ lua_assert(A64F_S_OK(delta, 26));
-+ *p = ai | A64F_S26(delta);
- }
-
- static void emit_tnb(ASMState *as, A64Ins ai, Reg r, uint32_t bit, MCode *target)
- {
- MCode *p = --as->mcp;
- ptrdiff_t delta = target - p;
-- lua_assert(bit < 63 && ((delta + 0x2000) >> 14) == 0);
-+ lua_assert(bit < 63 && A64F_S_OK(delta, 14));
- if (bit > 31) ai |= A64I_X;
-- *p = ai | A64F_BIT(bit & 31) | A64F_S14((uint32_t)delta & 0x3fffu) | r;
-+ *p = ai | A64F_BIT(bit & 31) | A64F_S14(delta) | r;
- }
-
- static void emit_cnb(ASMState *as, A64Ins ai, Reg r, MCode *target)
- {
- MCode *p = --as->mcp;
- ptrdiff_t delta = target - p;
-- lua_assert(((delta + 0x40000) >> 19) == 0);
-+ lua_assert(A64F_S_OK(delta, 19));
- *p = ai | A64F_S19(delta) | r;
- }
-
-@@ -347,8 +347,8 @@ static void emit_call(ASMState *as, void *target)
- {
- MCode *p = --as->mcp;
- ptrdiff_t delta = (char *)target - (char *)p;
-- if ((((delta>>2) + 0x02000000) >> 26) == 0) {
-- *p = A64I_BL | ((uint32_t)(delta>>2) & 0x03ffffffu);
-+ if (A64F_S_OK(delta>>2, 26)) {
-+ *p = A64I_BL | A64F_S26(delta>>2);
- } else { /* Target out of range: need indirect call. But don't use R0-R7. */
- Reg r = ra_allock(as, i64ptr(target),
- RSET_RANGE(RID_X8, RID_MAX_GPR)-RSET_FIXED);
-diff --git a/src/lj_target_arm64.h b/src/lj_target_arm64.h
-index 520023ae..a207a2ba 100644
---- a/src/lj_target_arm64.h
-+++ b/src/lj_target_arm64.h
-@@ -132,9 +132,9 @@ static LJ_AINLINE uint32_t *exitstub_trace_addr_(uint32_t *p, uint32_t exitno)
- #define A64F_IMMR(x) ((x) << 16)
- #define A64F_U16(x) ((x) << 5)
- #define A64F_U12(x) ((x) << 10)
--#define A64F_S26(x) (x)
-+#define A64F_S26(x) (((uint32_t)(x) & 0x03ffffffu))
- #define A64F_S19(x) (((uint32_t)(x) & 0x7ffffu) << 5)
--#define A64F_S14(x) ((x) << 5)
-+#define A64F_S14(x) (((uint32_t)(x) & 0x3fffu) << 5)
- #define A64F_S9(x) ((x) << 12)
- #define A64F_BIT(x) ((x) << 19)
- #define A64F_SH(sh, x) (((sh) << 22) | ((x) << 10))
-@@ -145,6 +145,9 @@ static LJ_AINLINE uint32_t *exitstub_trace_addr_(uint32_t *p, uint32_t exitno)
- #define A64F_LSL16(x) (((x) / 16) << 21)
- #define A64F_BSH(sh) ((sh) << 10)
-
-+/* Check for valid field range. */
-+#define A64F_S_OK(x, b) ((((x) + (1 << (b-1))) >> (b)) == 0)
-+
- typedef enum A64Ins {
- A64I_S = 0x20000000,
- A64I_X = 0x80000000,
diff --git a/srcpkgs/LuaJIT/patches/aarch64-register-allocation-bug-fix.patch b/srcpkgs/LuaJIT/patches/aarch64-register-allocation-bug-fix.patch
deleted file mode 100644
index c30264786755..000000000000
--- a/srcpkgs/LuaJIT/patches/aarch64-register-allocation-bug-fix.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From: Jason Teplitz <jason@tensyr.com>
-Date: Mon, 9 Oct 2017 23:03:09 +0000
-Subject: Fix register allocation bug in arm64
-
----
- src/lj_asm_arm64.h | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
-diff --git src/lj_asm_arm64.h src/lj_asm_arm64.h
-index 8fd92e7..549f8a6 100644
---- a/src/lj_asm_arm64.h
-+++ b/src/lj_asm_arm64.h
-@@ -871,7 +871,7 @@ static void asm_hrefk(ASMState *as, IRIns *ir)
- int bigofs = !emit_checkofs(A64I_LDRx, ofs);
- RegSet allow = RSET_GPR;
- Reg dest = (ra_used(ir) || bigofs) ? ra_dest(as, ir, RSET_GPR) : RID_NONE;
-- Reg node = ra_alloc1(as, ir->op1, allow);
-+ Reg node = ra_alloc1(as, ir->op1, ra_hasreg(dest) ? rset_clear(allow, dest) : allow);
- Reg key = ra_scratch(as, rset_clear(allow, node));
- Reg idx = node;
- uint64_t k;
-@@ -879,7 +879,6 @@ static void asm_hrefk(ASMState *as, IRIns *ir)
- rset_clear(allow, key);
- if (bigofs) {
- idx = dest;
-- rset_clear(allow, dest);
- kofs = (int32_t)offsetof(Node, key);
- } else if (ra_hasreg(dest)) {
- emit_opk(as, A64I_ADDx, dest, node, ofs, allow);
diff --git a/srcpkgs/LuaJIT/patches/e9af1abec542e6f9851ff2368e7f196b6382a44c.patch b/srcpkgs/LuaJIT/patches/e9af1abec542e6f9851ff2368e7f196b6382a44c.patch
deleted file mode 100644
index a217866c392c..000000000000
--- a/srcpkgs/LuaJIT/patches/e9af1abec542e6f9851ff2368e7f196b6382a44c.patch
+++ /dev/null
@@ -1,562 +0,0 @@
-From e9af1abec542e6f9851ff2368e7f196b6382a44c Mon Sep 17 00:00:00 2001
-From: Mike Pall <mike>
-Date: Wed, 30 Sep 2020 01:31:27 +0200
-Subject: [PATCH] Add support for full-range 64 bit lightuserdata.
-
----
- doc/status.html | 11 ---------
- src/jit/dump.lua | 4 +++-
- src/lib_debug.c | 12 +++++-----
- src/lib_jit.c | 14 ++++++------
- src/lib_package.c | 8 +++----
- src/lib_string.c | 2 +-
- src/lj_api.c | 40 +++++++++++++++++++++++++++++----
- src/lj_ccall.c | 2 +-
- src/lj_cconv.c | 2 +-
- src/lj_crecord.c | 6 ++---
- src/lj_dispatch.c | 2 +-
- src/lj_ir.c | 6 +++--
- src/lj_obj.c | 5 +++--
- src/lj_obj.h | 57 ++++++++++++++++++++++++++++++-----------------
- src/lj_snap.c | 9 +++++++-
- src/lj_state.c | 6 +++++
- src/lj_strfmt.c | 2 +-
- 17 files changed, 121 insertions(+), 67 deletions(-)
-
-#diff --git a/doc/status.html b/doc/status.html
-#index 0aafe13a2..fd0ae8bae 100644
-#--- a/doc/status.html
-#+++ b/doc/status.html
-#@@ -91,17 +91,6 @@ <h2>Current Status</h2>
-# <tt>lua_atpanic</tt> on x64. This issue will be fixed with the new
-# garbage collector.
-# </li>
-#-<li>
-#-LuaJIT on 64 bit systems provides a <b>limited range</b> of 47 bits for the
-#-<b>legacy <tt>lightuserdata</tt></b> data type.
-#-This is only relevant on x64 systems which use the negative part of the
-#-virtual address space in user mode, e.g. Solaris/x64, and on ARM64 systems
-#-configured with a 48 bit or 52 bit VA.
-#-Avoid using <tt>lightuserdata</tt> to hold pointers that may point outside
-#-of that range, e.g. variables on the stack. In general, avoid this data
-#-type for new code and replace it with (much more performant) FFI bindings.
-#-FFI cdata pointers can address the full 64 bit range.
-#-</li>
-# </ul>
-# <br class="flush">
-# </div>
-Index: luajit/src/jit/dump.lua
-===================================================================
---- luajit.orig/src/jit/dump.lua
-+++ luajit/src/jit/dump.lua
-@@ -315,7 +315,9 @@
- local tn = type(k)
- local s
- if tn == "number" then
-- if band(sn or 0, 0x30000) ~= 0 then
-+ if t < 12 then
-+ s = k == 0 and "NULL" or format("[0x%08x]", k)
-+ elseif band(sn or 0, 0x30000) ~= 0 then
- s = band(sn, 0x20000) ~= 0 and "contpc" or "ftsz"
- elseif k == 2^52+2^51 then
- s = "bias"
-Index: luajit/src/lib_debug.c
-===================================================================
---- luajit.orig/src/lib_debug.c
-+++ luajit/src/lib_debug.c
-@@ -231,8 +231,8 @@
- int32_t n = lj_lib_checkint(L, 2) - 1;
- if ((uint32_t)n >= fn->l.nupvalues)
- lj_err_arg(L, 2, LJ_ERR_IDXRNG);
-- setlightudV(L->top-1, isluafunc(fn) ? (void *)gcref(fn->l.uvptr[n]) :
-- (void *)&fn->c.upvalue[n]);
-+ lua_pushlightuserdata(L, isluafunc(fn) ? (void *)gcref(fn->l.uvptr[n]) :
-+ (void *)&fn->c.upvalue[n]);
- return 1;
- }
-
-@@ -283,13 +283,13 @@
-
- /* ------------------------------------------------------------------------ */
-
--#define KEY_HOOK ((void *)0x3004)
-+#define KEY_HOOK (U64x(80000000,00000000)|'h')
-
- static void hookf(lua_State *L, lua_Debug *ar)
- {
- static const char *const hooknames[] =
- {"call", "return", "line", "count", "tail return"};
-- lua_pushlightuserdata(L, KEY_HOOK);
-+ (L->top++)->u64 = KEY_HOOK;
- lua_rawget(L, LUA_REGISTRYINDEX);
- if (lua_isfunction(L, -1)) {
- lua_pushstring(L, hooknames[(int)ar->event]);
-@@ -334,7 +334,7 @@
- count = luaL_optint(L, arg+3, 0);
- func = hookf; mask = makemask(smask, count);
- }
-- lua_pushlightuserdata(L, KEY_HOOK);
-+ (L->top++)->u64 = KEY_HOOK;
- lua_pushvalue(L, arg+1);
- lua_rawset(L, LUA_REGISTRYINDEX);
- lua_sethook(L, func, mask, count);
-@@ -349,7 +349,7 @@
- if (hook != NULL && hook != hookf) { /* external hook? */
- lua_pushliteral(L, "external hook");
- } else {
-- lua_pushlightuserdata(L, KEY_HOOK);
-+ (L->top++)->u64 = KEY_HOOK;
- lua_rawget(L, LUA_REGISTRYINDEX); /* get hook */
- }
- lua_pushstring(L, unmakemask(mask, buff));
-Index: luajit/src/lib_jit.c
-===================================================================
---- luajit.orig/src/lib_jit.c
-+++ luajit/src/lib_jit.c
-@@ -540,15 +540,15 @@
-
- /* Not loaded by default, use: local profile = require("jit.profile") */
-
--static const char KEY_PROFILE_THREAD = 't';
--static const char KEY_PROFILE_FUNC = 'f';
-+#define KEY_PROFILE_THREAD (U64x(80000000,00000000)|'t')
-+#define KEY_PROFILE_FUNC (U64x(80000000,00000000)|'f')
-
- static void jit_profile_callback(lua_State *L2, lua_State *L, int samples,
- int vmstate)
- {
- TValue key;
- cTValue *tv;
-- setlightudV(&key, (void *)&KEY_PROFILE_FUNC);
-+ key.u64 = KEY_PROFILE_FUNC;
- tv = lj_tab_get(L, tabV(registry(L)), &key);
- if (tvisfunc(tv)) {
- char vmst = (char)vmstate;
-@@ -575,9 +575,9 @@
- lua_State *L2 = lua_newthread(L); /* Thread that runs profiler callback. */
- TValue key;
- /* Anchor thread and function in registry. */
-- setlightudV(&key, (void *)&KEY_PROFILE_THREAD);
-+ key.u64 = KEY_PROFILE_THREAD;
- setthreadV(L, lj_tab_set(L, registry, &key), L2);
-- setlightudV(&key, (void *)&KEY_PROFILE_FUNC);
-+ key.u64 = KEY_PROFILE_FUNC;
- setfuncV(L, lj_tab_set(L, registry, &key), func);
- lj_gc_anybarriert(L, registry);
- luaJIT_profile_start(L, mode ? strdata(mode) : "",
-@@ -592,9 +592,9 @@
- TValue key;
- luaJIT_profile_stop(L);
- registry = tabV(registry(L));
-- setlightudV(&key, (void *)&KEY_PROFILE_THREAD);
-+ key.u64 = KEY_PROFILE_THREAD;
- setnilV(lj_tab_set(L, registry, &key));
-- setlightudV(&key, (void *)&KEY_PROFILE_FUNC);
-+ key.u64 = KEY_PROFILE_FUNC;
- setnilV(lj_tab_set(L, registry, &key));
- lj_gc_anybarriert(L, registry);
- return 0;
-Index: luajit/src/lib_package.c
-===================================================================
---- luajit.orig/src/lib_package.c
-+++ luajit/src/lib_package.c
-@@ -398,7 +398,7 @@
-
- /* ------------------------------------------------------------------------ */
-
--#define sentinel ((void *)0x4004)
-+#define KEY_SENTINEL (U64x(80000000,00000000)|'s')
-
- static int lj_cf_package_require(lua_State *L)
- {
-@@ -408,7 +408,7 @@
- lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED");
- lua_getfield(L, 2, name);
- if (lua_toboolean(L, -1)) { /* is it there? */
-- if (lua_touserdata(L, -1) == sentinel) /* check loops */
-+ if ((L->top-1)->u64 == KEY_SENTINEL) /* check loops */
- luaL_error(L, "loop or previous error loading module " LUA_QS, name);
- return 1; /* package is already loaded */
- }
-@@ -431,14 +431,14 @@
- else
- lua_pop(L, 1);
- }
-- lua_pushlightuserdata(L, sentinel);
-+ (L->top++)->u64 = KEY_SENTINEL;
- lua_setfield(L, 2, name); /* _LOADED[name] = sentinel */
- lua_pushstring(L, name); /* pass name as argument to module */
- lua_call(L, 1, 1); /* run loaded module */
- if (!lua_isnil(L, -1)) /* non-nil return? */
- lua_setfield(L, 2, name); /* _LOADED[name] = returned value */
- lua_getfield(L, 2, name);
-- if (lua_touserdata(L, -1) == sentinel) { /* module did not set a value? */
-+ if ((L->top-1)->u64 == KEY_SENTINEL) { /* module did not set a value? */
- lua_pushboolean(L, 1); /* use true as result */
- lua_pushvalue(L, -1); /* extra copy to be returned */
- lua_setfield(L, 2, name); /* _LOADED[name] = true */
-Index: luajit/src/lib_string.c
-===================================================================
---- luajit.orig/src/lib_string.c
-+++ luajit/src/lib_string.c
-@@ -714,7 +714,7 @@
- lj_strfmt_putfchar(sb, sf, lj_lib_checkint(L, arg));
- break;
- case STRFMT_PTR: /* No formatting. */
-- lj_strfmt_putptr(sb, lj_obj_ptr(L->base+arg-1));
-+ lj_strfmt_putptr(sb, lj_obj_ptr(G(L), L->base+arg-1));
- break;
- default:
- lua_assert(0);
-Index: luajit/src/lj_api.c
-===================================================================
---- luajit.orig/src/lj_api.c
-+++ luajit/src/lj_api.c
-@@ -595,7 +595,7 @@
- if (tvisudata(o))
- return uddata(udataV(o));
- else if (tvislightud(o))
-- return lightudV(o);
-+ return lightudV(G(L), o);
- else
- return NULL;
- }
-@@ -608,7 +608,7 @@
-
- LUA_API const void *lua_topointer(lua_State *L, int idx)
- {
-- return lj_obj_ptr(index2adr(L, idx));
-+ return lj_obj_ptr(G(L), index2adr(L, idx));
- }
-
- /* -- Stack setters (object creation) ------------------------------------- */
-@@ -694,9 +694,38 @@
- incr_top(L);
- }
-
-+#if LJ_64
-+static void *lightud_intern(lua_State *L, void *p)
-+{
-+ global_State *g = G(L);
-+ uint64_t u = (uint64_t)p;
-+ uint32_t up = lightudup(u);
-+ uint32_t *segmap = mref(g->gc.lightudseg, uint32_t);
-+ MSize segnum = g->gc.lightudnum;
-+ if (segmap) {
-+ MSize seg;
-+ for (seg = 0; seg <= segnum; seg++)
-+ if (segmap[seg] == up) /* Fast path. */
-+ return (void *)(((uint64_t)seg << LJ_LIGHTUD_BITS_LO) | lightudlo(u));
-+ segnum++;
-+ }
-+ if (!((segnum-1) & segnum) && segnum != 1) {
-+ if (segnum >= (1 << LJ_LIGHTUD_BITS_SEG)) lj_err_msg(L, LJ_ERR_BADLU);
-+ lj_mem_reallocvec(L, segmap, segnum, segnum ? 2*segnum : 2u, uint32_t);
-+ setmref(g->gc.lightudseg, segmap);
-+ }
-+ g->gc.lightudnum = segnum;
-+ segmap[segnum] = up;
-+ return (void *)(((uint64_t)segnum << LJ_LIGHTUD_BITS_LO) | lightudlo(u));
-+}
-+#endif
-+
- LUA_API void lua_pushlightuserdata(lua_State *L, void *p)
- {
-- setlightudV(L->top, checklightudptr(L, p));
-+#if LJ_64
-+ p = lightud_intern(L, p);
-+#endif
-+ setrawlightudV(L->top, p);
- incr_top(L);
- }
-
-@@ -1138,7 +1167,10 @@
- fn->c.f = func;
- setfuncV(L, top++, fn);
- if (LJ_FR2) setnilV(top++);
-- setlightudV(top++, checklightudptr(L, ud));
-+#if LJ_64
-+ ud = lightud_intern(L, ud);
-+#endif
-+ setrawlightudV(top++, ud);
- cframe_nres(L->cframe) = 1+0; /* Zero results. */
- L->top = top;
- return top-1; /* Now call the newly allocated C function. */
-Index: luajit/src/lj_ccall.c
-===================================================================
---- luajit.orig/src/lj_ccall.c
-+++ luajit/src/lj_ccall.c
-@@ -1314,7 +1314,7 @@
- lj_vm_ffi_call(&cc);
- if (cts->cb.slot != ~0u) { /* Blacklist function that called a callback. */
- TValue tv;
-- setlightudV(&tv, (void *)cc.func);
-+ tv.u64 = ((uintptr_t)(void *)cc.func >> 2) | U64x(800000000, 00000000);
- setboolV(lj_tab_set(L, cts->miscmap, &tv), 1);
- }
- ct = (CType *)((intptr_t)ct+(intptr_t)cts->tab); /* May be reallocated. */
-Index: luajit/src/lj_cconv.c
-===================================================================
---- luajit.orig/src/lj_cconv.c
-+++ luajit/src/lj_cconv.c
-@@ -611,7 +611,7 @@
- if (ud->udtype == UDTYPE_IO_FILE)
- tmpptr = *(void **)tmpptr;
- } else if (tvislightud(o)) {
-- tmpptr = lightudV(o);
-+ tmpptr = lightudV(cts->g, o);
- } else if (tvisfunc(o)) {
- void *p = lj_ccallback_new(cts, d, funcV(o));
- if (p) {
-Index: luajit/src/lj_crecord.c
-===================================================================
---- luajit.orig/src/lj_crecord.c
-+++ luajit/src/lj_crecord.c
-@@ -643,8 +643,7 @@
- }
- } else if (tref_islightud(sp)) {
- #if LJ_64
-- sp = emitir(IRT(IR_BAND, IRT_P64), sp,
-- lj_ir_kint64(J, U64x(00007fff,ffffffff)));
-+ lj_trace_err(J, LJ_TRERR_NYICONV);
- #endif
- } else { /* NYI: tref_istab(sp). */
- IRType t;
-@@ -1209,8 +1208,7 @@
- TRef tr;
- TValue tv;
- /* Check for blacklisted C functions that might call a callback. */
-- setlightudV(&tv,
-- cdata_getptr(cdataptr(cd), (LJ_64 && tp == IRT_P64) ? 8 : 4));
-+ tv.u64 = ((uintptr_t)cdata_getptr(cdataptr(cd), (LJ_64 && tp == IRT_P64) ? 8 : 4) >> 2) | U64x(800000000, 00000000);
- if (tvistrue(lj_tab_get(J->L, cts->miscmap, &tv)))
- lj_trace_err(J, LJ_TRERR_BLACKL);
- if (ctype_isvoid(ctr->info)) {
-Index: luajit/src/lj_dispatch.c
-===================================================================
---- luajit.orig/src/lj_dispatch.c
-+++ luajit/src/lj_dispatch.c
-@@ -302,7 +302,7 @@
- if (idx != 0) {
- cTValue *tv = idx > 0 ? L->base + (idx-1) : L->top + idx;
- if (tvislightud(tv))
-- g->wrapf = (lua_CFunction)lightudV(tv);
-+ g->wrapf = (lua_CFunction)lightudV(g, tv);
- else
- return 0; /* Failed. */
- } else {
-Index: luajit/src/lj_ir.c
-===================================================================
---- luajit.orig/src/lj_ir.c
-+++ luajit/src/lj_ir.c
-@@ -386,8 +386,10 @@
- case IR_KPRI: setpriV(tv, irt_toitype(ir->t)); break;
- case IR_KINT: setintV(tv, ir->i); break;
- case IR_KGC: setgcV(L, tv, ir_kgc(ir), irt_toitype(ir->t)); break;
-- case IR_KPTR: case IR_KKPTR: setlightudV(tv, ir_kptr(ir)); break;
-- case IR_KNULL: setlightudV(tv, NULL); break;
-+ case IR_KPTR: case IR_KKPTR:
-+ setnumV(tv, (lua_Number)(uintptr_t)ir_kptr(ir));
-+ break;
-+ case IR_KNULL: setintV(tv, 0); break;
- case IR_KNUM: setnumV(tv, ir_knum(ir)->n); break;
- #if LJ_HASFFI
- case IR_KINT64: {
-Index: luajit/src/lj_obj.c
-===================================================================
---- luajit.orig/src/lj_obj.c
-+++ luajit/src/lj_obj.c
-@@ -34,12 +34,13 @@
- }
-
- /* Return pointer to object or its object data. */
--const void * LJ_FASTCALL lj_obj_ptr(cTValue *o)
-+const void * LJ_FASTCALL lj_obj_ptr(global_State *g, cTValue *o)
- {
-+ UNUSED(g);
- if (tvisudata(o))
- return uddata(udataV(o));
- else if (tvislightud(o))
-- return lightudV(o);
-+ return lightudV(g, o);
- else if (LJ_HASFFI && tviscdata(o))
- return cdataptr(cdataV(o));
- else if (tvisgcv(o))
-Index: luajit/src/lj_obj.h
-===================================================================
---- luajit.orig/src/lj_obj.h
-+++ luajit/src/lj_obj.h
-@@ -232,7 +232,7 @@
- ** ---MSW---.---LSW---
- ** primitive types | itype | |
- ** lightuserdata | itype | void * | (32 bit platforms)
--** lightuserdata |ffff| void * | (64 bit platforms, 47 bit pointers)
-+** lightuserdata |ffff|seg| ofs | (64 bit platforms)
- ** GC objects | itype | GCRef |
- ** int (LJ_DUALNUM)| itype | int |
- ** number -------double------
-@@ -245,7 +245,8 @@
- **
- ** ------MSW------.------LSW------
- ** primitive types |1..1|itype|1..................1|
--** GC objects/lightud |1..1|itype|-------GCRef--------|
-+** GC objects |1..1|itype|-------GCRef--------|
-+** lightuserdata |1..1|itype|seg|------ofs-------|
- ** int (LJ_DUALNUM) |1..1|itype|0..0|-----int-------|
- ** number ------------double-------------
- **
-@@ -285,6 +286,12 @@
- #define LJ_GCVMASK (((uint64_t)1 << 47) - 1)
- #endif
-
-+#if LJ_64
-+/* To stay within 47 bits, lightuserdata is segmented. */
-+#define LJ_LIGHTUD_BITS_SEG 8
-+#define LJ_LIGHTUD_BITS_LO (47 - LJ_LIGHTUD_BITS_SEG)
-+#endif
-+
- /* -- String object ------------------------------------------------------- */
-
- /* String object header. String payload follows. */
-@@ -576,7 +583,11 @@
- uint8_t currentwhite; /* Current white color. */
- uint8_t state; /* GC state. */
- uint8_t nocdatafin; /* No cdata finalizer called. */
-- uint8_t unused2;
-+#if LJ_64
-+ uint8_t lightudnum; /* Number of lightuserdata segments - 1. */
-+#else
-+ uint8_t unused1;
-+#endif
- MSize sweepstr; /* Sweep position in string table. */
- GCRef root; /* List of all collectable objects. */
- MRef sweep; /* Sweep position in root list. */
-@@ -588,6 +599,9 @@
- GCSize estimate; /* Estimate of memory actually in use. */
- MSize stepmul; /* Incremental GC step granularity. */
- MSize pause; /* Pause between successive GC cycles. */
-+#if LJ_64
-+ MRef lightudseg; /* Upper bits of lightuserdata segments. */
-+#endif
- } GCState;
-
- /* Global state, shared by all threads of a Lua universe. */
-@@ -795,10 +809,23 @@
- #endif
- #define boolV(o) check_exp(tvisbool(o), (LJ_TFALSE - itype(o)))
- #if LJ_64
--#define lightudV(o) \
-- check_exp(tvislightud(o), (void *)((o)->u64 & U64x(00007fff,ffffffff)))
-+#define lightudseg(u) \
-+ (((u) >> LJ_LIGHTUD_BITS_LO) & ((1 << LJ_LIGHTUD_BITS_SEG)-1))
-+#define lightudlo(u) \
-+ ((u) & (((uint64_t)1 << LJ_LIGHTUD_BITS_LO) - 1))
-+#define lightudup(p) \
-+ ((uint32_t)(((p) >> LJ_LIGHTUD_BITS_LO) << (LJ_LIGHTUD_BITS_LO-32)))
-+static LJ_AINLINE void *lightudV(global_State *g, cTValue *o)
-+{
-+ uint64_t u = o->u64;
-+ uint64_t seg = lightudseg(u);
-+ uint32_t *segmap = mref(g->gc.lightudseg, uint32_t);
-+ lua_assert(tvislightud(o));
-+ lua_assert(seg <= g->gc.lightudnum);
-+ return (void *)(((uint64_t)segmap[seg] << 32) | lightudlo(u));
-+}
- #else
--#define lightudV(o) check_exp(tvislightud(o), gcrefp((o)->gcr, void))
-+#define lightudV(g, o) check_exp(tvislightud(o), gcrefp((o)->gcr, void))
- #endif
- #define gcV(o) check_exp(tvisgcv(o), gcval(o))
- #define strV(o) check_exp(tvisstr(o), &gcval(o)->str)
-@@ -824,7 +851,7 @@
- #define setpriV(o, i) (setitype((o), (i)))
- #endif
-
--static LJ_AINLINE void setlightudV(TValue *o, void *p)
-+static LJ_AINLINE void setrawlightudV(TValue *o, void *p)
- {
- #if LJ_GC64
- o->u64 = (uint64_t)p | (((uint64_t)LJ_TLIGHTUD) << 47);
-@@ -835,24 +862,14 @@
- #endif
- }
-
--#if LJ_64
--#define checklightudptr(L, p) \
-- (((uint64_t)(p) >> 47) ? (lj_err_msg(L, LJ_ERR_BADLU), NULL) : (p))
--#else
--#define checklightudptr(L, p) (p)
--#endif
--
--#if LJ_FR2
-+#if LJ_FR2 || LJ_32
- #define contptr(f) ((void *)(f))
- #define setcont(o, f) ((o)->u64 = (uint64_t)(uintptr_t)contptr(f))
--#elif LJ_64
-+#else
- #define contptr(f) \
- ((void *)(uintptr_t)(uint32_t)((intptr_t)(f) - (intptr_t)lj_vm_asm_begin))
- #define setcont(o, f) \
- ((o)->u64 = (uint64_t)(void *)(f) - (uint64_t)lj_vm_asm_begin)
--#else
--#define contptr(f) ((void *)(f))
--#define setcont(o, f) setlightudV((o), contptr(f))
- #endif
-
- #define tvchecklive(L, o) \
-@@ -978,6 +995,6 @@
-
- /* Compare two objects without calling metamethods. */
- LJ_FUNC int LJ_FASTCALL lj_obj_equal(cTValue *o1, cTValue *o2);
--LJ_FUNC const void * LJ_FASTCALL lj_obj_ptr(cTValue *o);
-+LJ_FUNC const void * LJ_FASTCALL lj_obj_ptr(global_State *g, cTValue *o);
-
- #endif
-Index: luajit/src/lj_snap.c
-===================================================================
---- luajit.orig/src/lj_snap.c
-+++ luajit/src/lj_snap.c
-@@ -626,7 +626,12 @@
- IRType1 t = ir->t;
- RegSP rs = ir->prev;
- if (irref_isk(ref)) { /* Restore constant slot. */
-- lj_ir_kvalue(J->L, o, ir);
-+ if (ir->o == IR_KPTR) {
-+ o->u64 = (uint64_t)(uintptr_t)ir_kptr(ir);
-+ } else {
-+ lua_assert(!(ir->o == IR_KKPTR || ir->o == IR_KNULL));
-+ lj_ir_kvalue(J->L, o, ir);
-+ }
- return;
- }
- if (LJ_UNLIKELY(bloomtest(rfilt, ref)))
-Index: luajit/src/lj_state.c
-===================================================================
---- luajit.orig/src/lj_state.c
-+++ luajit/src/lj_state.c
-@@ -171,6 +171,12 @@
- lj_mem_freevec(g, g->strhash, g->strmask+1, GCRef);
- lj_buf_free(g, &g->tmpbuf);
- lj_mem_freevec(g, tvref(L->stack), L->stacksize, TValue);
-+#if LJ_64
-+ if (mref(g->gc.lightudseg, uint32_t)) {
-+ MSize segnum = g->gc.lightudnum ? (2 << lj_fls(g->gc.lightudnum)) : 2;
-+ lj_mem_freevec(g, mref(g->gc.lightudseg, uint32_t), segnum, uint32_t);
-+ }
-+#endif
- lua_assert(g->gc.total == sizeof(GG_State));
- #ifndef LUAJIT_USE_SYSMALLOC
- if (g->allocf == lj_alloc_f)
-Index: luajit/src/lj_strfmt.c
-===================================================================
---- luajit.orig/src/lj_strfmt.c
-+++ luajit/src/lj_strfmt.c
-@@ -393,7 +393,7 @@
- p = lj_buf_wmem(p, "builtin#", 8);
- p = lj_strfmt_wint(p, funcV(o)->c.ffid);
- } else {
-- p = lj_strfmt_wptr(p, lj_obj_ptr(o));
-+ p = lj_strfmt_wptr(p, lj_obj_ptr(G(L), o));
- }
- return lj_str_new(L, buf, (size_t)(p - buf));
- }
diff --git a/srcpkgs/LuaJIT/patches/fix-bcsave-ppc64.patch b/srcpkgs/LuaJIT/patches/fix-bcsave-ppc64.patch
index f53e21107106..c0b44815e3a5 100644
--- a/srcpkgs/LuaJIT/patches/fix-bcsave-ppc64.patch
+++ b/srcpkgs/LuaJIT/patches/fix-bcsave-ppc64.patch
@@ -1,33 +1,11 @@
---- a/src/jit/bcsave.lua 2018-12-17 19:06:27.215042417 +0100
-+++ b/src/jit/bcsave.lua 2018-12-17 19:17:12.982477945 +0100
-@@ -64,7 +64,7 @@
-
- local map_arch = {
- x86 = true, x64 = true, arm = true, arm64 = true, arm64be = true,
-- ppc = true, mips = true, mipsel = true,
-+ ppc = true, ppc64 = true, ppc64le = true, mips = true, mipsel = true,
- }
-
- local map_os = {
-@@ -200,9 +200,10 @@
- ]]
- local symname = LJBC_PREFIX..ctx.modname
- local is64, isbe = false, false
-- if ctx.arch == "x64" or ctx.arch == "arm64" or ctx.arch == "arm64be" then
-+ if ctx.arch == "x64" or ctx.arch == "arm64" or ctx.arch == "arm64be" or ctx.arch == "ppc64" or ctx.arch == "ppc64le" then
- is64 = true
-- elseif ctx.arch == "ppc" or ctx.arch == "mips" then
-+ end
-+ if ctx.arch == "ppc" or ctx.arch == "ppc64" or ctx.arch == "mips" then
- isbe = true
- end
-
-@@ -237,7 +238,7 @@
- hdr.eendian = isbe and 2 or 1
- hdr.eversion = 1
- hdr.type = f16(1)
-- hdr.machine = f16(({ x86=3, x64=62, arm=40, arm64=183, arm64be=183, ppc=20, mips=8, mipsel=8 })[ctx.arch])
-+ hdr.machine = f16(({ x86=3, x64=62, arm=40, arm64=183, arm64be=183, ppc=20, ppc64=21, ppc64le=21, mips=8, mipsel=8 })[ctx.arch])
- if ctx.arch == "mips" or ctx.arch == "mipsel" then
- hdr.flags = f32(0x50001006)
- end
+--- a/src/jit/bcsave.lua 2022-04-20 17:31:21.608466489 -0700
++++ b/src/jit/bcsave.lua 2022-04-20 17:33:50.395164410 -0700
+@@ -78,6 +78,8 @@
+ arm64 = { e = "le", b = 64, m = 183, p = 0xaa64, },
+ arm64be = { e = "be", b = 64, m = 183, },
+ ppc = { e = "be", b = 32, m = 20, },
++ ppc64 = { e = "be", b = 64, m = 21, },
++ ppc64le = { e = "le", b = 64, m = 21, },
+ mips = { e = "be", b = 32, m = 8, f = 0x50001006, },
+ mipsel = { e = "le", b = 32, m = 8, f = 0x50001006, },
+ mips64 = { e = "be", b = 64, m = 8, f = 0x80000007, },
diff --git a/srcpkgs/LuaJIT/patches/unpollute-global-namespace.patch b/srcpkgs/LuaJIT/patches/unpollute-global-namespace.patch
deleted file mode 100644
index aedaacbaaea4..000000000000
--- a/srcpkgs/LuaJIT/patches/unpollute-global-namespace.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-From: =?utf-8?q?Ond=C5=99ej_Sur=C3=BD?= <ondrej@sury.org>
-Date: Wed, 11 Oct 2017 08:42:41 +0000
-Subject: Make ccall_copy_struct static to unpollute global library namespace
-
----
- src/lj_ccall.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git src/lj_ccall.c src/lj_ccall.c
-index b891591..a7dcc1b 100644
---- a/src/lj_ccall.c
-+++ b/src/lj_ccall.c
-@@ -960,7 +960,7 @@ noth: /* Not a homogeneous float/double aggregate. */
- return 0; /* Struct is in GPRs. */
- }
-
--void ccall_copy_struct(CCallState *cc, CType *ctr, void *dp, void *sp, int ft)
-+static void ccall_copy_struct(CCallState *cc, CType *ctr, void *dp, void *sp, int ft)
- {
- if (LJ_ABI_SOFTFP ? ft :
- ((ft & 3) == FTYPE_FLOAT || (ft >> 2) == FTYPE_FLOAT)) {
diff --git a/srcpkgs/LuaJIT/template b/srcpkgs/LuaJIT/template
index 778a8df0e593..af12f230be2c 100644
--- a/srcpkgs/LuaJIT/template
+++ b/srcpkgs/LuaJIT/template
@@ -1,17 +1,18 @@
# Template file for 'LuaJIT'
pkgname=LuaJIT
version=2.1.0beta3
-revision=2
+revision=3
_so_version=2.1.0
-_dist_version=${_so_version}-beta3
-wrksrc="${pkgname}-${_dist_version}"
+_short_commit=f2b37f5
+_commit=f2b37f51f69ba7e9f8defd05e5aca648121f0fe6
+wrksrc="luajit-2.0-${_short_commit}"
hostmakedepends="lua52-BitOp"
short_desc="Just-In-Time Compiler for Lua"
maintainer="q66 <daniel@octaforge.org>"
license="MIT"
-homepage="http://www.luajit.org"
-distfiles="http://luajit.org/download/${pkgname}-${_dist_version}.tar.gz"
-checksum=1ad2e34b111c802f9d0cdf019e986909123237a28c746b21295b63c9e785d9c3
+homepage="https://www.luajit.org"
+distfiles="https://repo.or.cz/luajit-2.0.git/snapshot/${_commit}.tar.gz"
+checksum=f1b5f81ca3d5cc077865e77796fd7b17e1c29bf3cfe1eb2ed45c82d2ec7ce2b0
build_options="lua52compat"
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: LuaJIT: update to git v2.1 branch
2022-04-21 0:48 [PR PATCH] LuaJIT: update to git v2.1 branch CameronNemo
@ 2022-04-21 4:04 ` q66
2022-04-21 4:06 ` q66
` (16 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: q66 @ 2022-04-21 4:04 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 452 bytes --]
New comment by q66 on void-packages repository
https://github.com/void-linux/void-packages/pull/36790#issuecomment-1104684758
Comment:
i think that packages should be switched from luajit to regular lua where possible
for years luajit has been nothing but a poorly portable liability with a bus factor of 1, and we should do away with it where we can
neovim can use standard lua, as can a lot of things that are currently built against luajit
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: LuaJIT: update to git v2.1 branch
2022-04-21 0:48 [PR PATCH] LuaJIT: update to git v2.1 branch CameronNemo
2022-04-21 4:04 ` q66
@ 2022-04-21 4:06 ` q66
2022-04-21 4:08 ` q66
` (15 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: q66 @ 2022-04-21 4:06 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 494 bytes --]
New comment by q66 on void-packages repository
https://github.com/void-linux/void-packages/pull/36790#issuecomment-1104684758
Comment:
i think that packages should be switched from luajit to regular lua where possible
for years luajit has been nothing but a poorly portable liability with a bus factor of 1 (go look at the code and you'll know why), and we should do away with it where we can
neovim can use standard lua, as can a lot of things that are currently built against luajit
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: LuaJIT: update to git v2.1 branch
2022-04-21 0:48 [PR PATCH] LuaJIT: update to git v2.1 branch CameronNemo
2022-04-21 4:04 ` q66
2022-04-21 4:06 ` q66
@ 2022-04-21 4:08 ` q66
2022-04-21 4:13 ` CameronNemo
` (14 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: q66 @ 2022-04-21 4:08 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 228 bytes --]
New comment by q66 on void-packages repository
https://github.com/void-linux/void-packages/pull/36790#issuecomment-1104686520
Comment:
also I'm like 90% sure the ppc64le patch does not apply anymore as I don't see it updated
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: LuaJIT: update to git v2.1 branch
2022-04-21 0:48 [PR PATCH] LuaJIT: update to git v2.1 branch CameronNemo
` (2 preceding siblings ...)
2022-04-21 4:08 ` q66
@ 2022-04-21 4:13 ` CameronNemo
2022-04-21 4:15 ` CameronNemo
` (13 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: CameronNemo @ 2022-04-21 4:13 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 608 bytes --]
New comment by CameronNemo on void-packages repository
https://github.com/void-linux/void-packages/pull/36790#issuecomment-1104688643
Comment:
>neovim can use standard lua
Maybe it can, but the devs don't seem to want to support such a setup:
>Neovim should not be built against PUC Lua, and certainly not Lua 5.4 (which is incompatible with Lua 5.1, which Neovim targets).
https://github.com/neovim/neovim/issues/18169
>also I'm like 90% sure the ppc64le patch does not apply anymore as I don't see it updated
Would you be willing to update it? I have no ppc(64)(le) hardware to test with.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: LuaJIT: update to git v2.1 branch
2022-04-21 0:48 [PR PATCH] LuaJIT: update to git v2.1 branch CameronNemo
` (3 preceding siblings ...)
2022-04-21 4:13 ` CameronNemo
@ 2022-04-21 4:15 ` CameronNemo
2022-04-21 11:53 ` mhmdanas
` (12 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: CameronNemo @ 2022-04-21 4:15 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 780 bytes --]
New comment by CameronNemo on void-packages repository
https://github.com/void-linux/void-packages/pull/36790#issuecomment-1104688643
Comment:
>neovim can use standard lua
Maybe it can, but the devs don't seem to want to support such a setup:
>Neovim should not be built against PUC Lua, and certainly not Lua 5.4 (which is incompatible with Lua 5.1, which Neovim targets).
https://github.com/neovim/neovim/issues/18169
>also I'm like 90% sure the ppc64le patch does not apply anymore as I don't see it updated
Would you be willing to update it? I have no ppc(64)(le) hardware to test with. Debian appears to be using this patch: https://salsa.debian.org/lua-team/luajit/-/blob/master/debian/patches/0004-Add-ppc64-support-based-on-koriakin-GitHub-patchset.patch
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: LuaJIT: update to git v2.1 branch
2022-04-21 0:48 [PR PATCH] LuaJIT: update to git v2.1 branch CameronNemo
` (4 preceding siblings ...)
2022-04-21 4:15 ` CameronNemo
@ 2022-04-21 11:53 ` mhmdanas
2022-04-21 16:02 ` gbrlsnchs
` (11 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: mhmdanas @ 2022-04-21 11:53 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 282 bytes --]
New comment by mhmdanas on void-packages repository
https://github.com/void-linux/void-packages/pull/36790#issuecomment-1105108232
Comment:
How about https://github.com/openresty/luajit2, which does have releases and is used by e.g. Homebrew as a replacement for upstream LuaJIT?
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: LuaJIT: update to git v2.1 branch
2022-04-21 0:48 [PR PATCH] LuaJIT: update to git v2.1 branch CameronNemo
` (5 preceding siblings ...)
2022-04-21 11:53 ` mhmdanas
@ 2022-04-21 16:02 ` gbrlsnchs
2022-04-22 11:43 ` Idesmi
` (10 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: gbrlsnchs @ 2022-04-21 16:02 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 353 bytes --]
New comment by gbrlsnchs on void-packages repository
https://github.com/void-linux/void-packages/pull/36790#issuecomment-1105417234
Comment:
> How about https://github.com/openresty/luajit2, which does have releases and is used by e.g. Homebrew as a replacement for upstream LuaJIT?
That would solve the "bus factor" issue, at least. :sweat_smile:
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: LuaJIT: update to git v2.1 branch
2022-04-21 0:48 [PR PATCH] LuaJIT: update to git v2.1 branch CameronNemo
` (6 preceding siblings ...)
2022-04-21 16:02 ` gbrlsnchs
@ 2022-04-22 11:43 ` Idesmi
2022-04-23 7:27 ` kartikynwa
` (9 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Idesmi @ 2022-04-22 11:43 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 190 bytes --]
New comment by Idesmi on void-packages repository
https://github.com/void-linux/void-packages/pull/36790#issuecomment-1106432477
Comment:
Alpine builds on OpenResty's tag release as well.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: LuaJIT: update to git v2.1 branch
2022-04-21 0:48 [PR PATCH] LuaJIT: update to git v2.1 branch CameronNemo
` (7 preceding siblings ...)
2022-04-22 11:43 ` Idesmi
@ 2022-04-23 7:27 ` kartikynwa
2022-04-23 12:05 ` LinArcX
` (8 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: kartikynwa @ 2022-04-23 7:27 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 302 bytes --]
New comment by kartikynwa on void-packages repository
https://github.com/void-linux/void-packages/pull/36790#issuecomment-1107411286
Comment:
> How about https://github.com/openresty/luajit2, which does have releases and is used by e.g. Homebrew as a replacement for upstream LuaJIT?
this is dope
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: LuaJIT: update to git v2.1 branch
2022-04-21 0:48 [PR PATCH] LuaJIT: update to git v2.1 branch CameronNemo
` (8 preceding siblings ...)
2022-04-23 7:27 ` kartikynwa
@ 2022-04-23 12:05 ` LinArcX
2022-04-23 12:44 ` q66
` (7 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: LinArcX @ 2022-04-23 12:05 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 601 bytes --]
New comment by LinArcX on void-packages repository
https://github.com/void-linux/void-packages/pull/36790#issuecomment-1107460624
Comment:
I have void-linux for more than 3 years, but recently i'm thinking more to switch to another distro,(that let me do whatever i want without any stupid limitations).
The main reason is that i still don't understand why maintainers of void insist on release versions of applications.
In my opinion, there's no single direction between "no-bug" and "high-quality" software with having "releases".
Stop this annoying policy and let people be more free.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: LuaJIT: update to git v2.1 branch
2022-04-21 0:48 [PR PATCH] LuaJIT: update to git v2.1 branch CameronNemo
` (9 preceding siblings ...)
2022-04-23 12:05 ` LinArcX
@ 2022-04-23 12:44 ` q66
2022-04-23 12:54 ` Idesmi
` (6 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: q66 @ 2022-04-23 12:44 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 601 bytes --]
New comment by LinArcX on void-packages repository
https://github.com/void-linux/void-packages/pull/36790#issuecomment-1107460624
Comment:
I have void-linux for more than 3 years, but recently i'm thinking more to switch to another distro,(that let me do whatever i want without any stupid limitations).
The main reason is that i still don't understand why maintainers of void insist on release versions of applications.
In my opinion, there's no single direction between "no-bug" and "high-quality" software with having "releases".
Stop this annoying policy and let people be more free.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: LuaJIT: update to git v2.1 branch
2022-04-21 0:48 [PR PATCH] LuaJIT: update to git v2.1 branch CameronNemo
` (10 preceding siblings ...)
2022-04-23 12:44 ` q66
@ 2022-04-23 12:54 ` Idesmi
2022-04-23 13:38 ` q66
` (5 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Idesmi @ 2022-04-23 12:54 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 308 bytes --]
New comment by Idesmi on void-packages repository
https://github.com/void-linux/void-packages/pull/36790#issuecomment-1107467237
Comment:
> I still don't understand why maintainers of void insist on release versions of applications.
I believe it's meant to relieve considerable burden from the project.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: LuaJIT: update to git v2.1 branch
2022-04-21 0:48 [PR PATCH] LuaJIT: update to git v2.1 branch CameronNemo
` (11 preceding siblings ...)
2022-04-23 12:54 ` Idesmi
@ 2022-04-23 13:38 ` q66
2022-04-23 13:38 ` q66
` (4 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: q66 @ 2022-04-23 13:38 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 257 bytes --]
New comment by q66 on void-packages repository
https://github.com/void-linux/void-packages/pull/36790#issuecomment-1107473587
Comment:
I would be okay with taking the openresty fork by the way, though we would need to test if ppc32 is still broken there
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: LuaJIT: update to git v2.1 branch
2022-04-21 0:48 [PR PATCH] LuaJIT: update to git v2.1 branch CameronNemo
` (12 preceding siblings ...)
2022-04-23 13:38 ` q66
@ 2022-04-23 13:38 ` q66
2022-05-02 5:03 ` kartikynwa
` (3 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: q66 @ 2022-04-23 13:38 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 277 bytes --]
New comment by q66 on void-packages repository
https://github.com/void-linux/void-packages/pull/36790#issuecomment-1107473587
Comment:
I would be okay with taking the openresty fork by the way, though we would need to test if ppc32 is still broken there (or i could drop it)
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: LuaJIT: update to git v2.1 branch
2022-04-21 0:48 [PR PATCH] LuaJIT: update to git v2.1 branch CameronNemo
` (13 preceding siblings ...)
2022-04-23 13:38 ` q66
@ 2022-05-02 5:03 ` kartikynwa
2022-05-03 6:24 ` CameronNemo
` (2 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: kartikynwa @ 2022-05-02 5:03 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 189 bytes --]
New comment by kartikynwa on void-packages repository
https://github.com/void-linux/void-packages/pull/36790#issuecomment-1114499384
Comment:
Any update on the discussion regarding this?
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: LuaJIT: update to git v2.1 branch
2022-04-21 0:48 [PR PATCH] LuaJIT: update to git v2.1 branch CameronNemo
` (14 preceding siblings ...)
2022-05-02 5:03 ` kartikynwa
@ 2022-05-03 6:24 ` CameronNemo
2022-05-06 9:38 ` mitinarseny
2022-05-27 20:04 ` [PR PATCH] [Closed]: " CameronNemo
17 siblings, 0 replies; 19+ messages in thread
From: CameronNemo @ 2022-05-03 6:24 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 207 bytes --]
New comment by CameronNemo on void-packages repository
https://github.com/void-linux/void-packages/pull/36790#issuecomment-1115776216
Comment:
I think the consensus is to switch to the openresty upstream.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: LuaJIT: update to git v2.1 branch
2022-04-21 0:48 [PR PATCH] LuaJIT: update to git v2.1 branch CameronNemo
` (15 preceding siblings ...)
2022-05-03 6:24 ` CameronNemo
@ 2022-05-06 9:38 ` mitinarseny
2022-05-27 20:04 ` [PR PATCH] [Closed]: " CameronNemo
17 siblings, 0 replies; 19+ messages in thread
From: mitinarseny @ 2022-05-06 9:38 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 205 bytes --]
New comment by mitinarseny on void-packages repository
https://github.com/void-linux/void-packages/pull/36790#issuecomment-1119435190
Comment:
also related: https://github.com/neovim/neovim/issues/17562
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PR PATCH] [Closed]: LuaJIT: update to git v2.1 branch
2022-04-21 0:48 [PR PATCH] LuaJIT: update to git v2.1 branch CameronNemo
` (16 preceding siblings ...)
2022-05-06 9:38 ` mitinarseny
@ 2022-05-27 20:04 ` CameronNemo
17 siblings, 0 replies; 19+ messages in thread
From: CameronNemo @ 2022-05-27 20:04 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1120 bytes --]
There's a closed pull request on the void-packages repository
LuaJIT: update to git v2.1 branch
https://github.com/void-linux/void-packages/pull/36790
Description:
CC: @q66
The LuaJIT maintainer has not published a new version in 5 years, but he
has steadily added commits to the "2.1" branch, linked below.
https://repo.or.cz/luajit-2.0.git/shortlog/refs/heads/v2.1
Projects like neovim build against this branch or master due to the lack
of a recent release.
Furthermore, distributions such as Arch Linux and Debian Sid are
building from a commit rather than a release.
https://github.com/archlinux/svntogit-community/commit/11473c3c786593b2438a865519d407c7a84ce0a1
https://salsa.debian.org/lua-team/luajit/-/commit/e06cbc6d2a61b253056214f5ed3f03ce661e31f9
The LuaJIT upstream maintainer has declined to cut a release, reasoning
"Releases are an antiquated concept".
https://github.com/LuaJIT/LuaJIT/issues/665#issuecomment-784452583
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**, on x86_64 and aarch64
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2022-05-27 20:04 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-21 0:48 [PR PATCH] LuaJIT: update to git v2.1 branch CameronNemo
2022-04-21 4:04 ` q66
2022-04-21 4:06 ` q66
2022-04-21 4:08 ` q66
2022-04-21 4:13 ` CameronNemo
2022-04-21 4:15 ` CameronNemo
2022-04-21 11:53 ` mhmdanas
2022-04-21 16:02 ` gbrlsnchs
2022-04-22 11:43 ` Idesmi
2022-04-23 7:27 ` kartikynwa
2022-04-23 12:05 ` LinArcX
2022-04-23 12:44 ` q66
2022-04-23 12:54 ` Idesmi
2022-04-23 13:38 ` q66
2022-04-23 13:38 ` q66
2022-05-02 5:03 ` kartikynwa
2022-05-03 6:24 ` CameronNemo
2022-05-06 9:38 ` mitinarseny
2022-05-27 20:04 ` [PR PATCH] [Closed]: " CameronNemo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).