Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package luajit2 for openSUSE:Leap:16.0 checked in at 2025-07-15 06:49:22 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Leap:16.0/luajit2 (Old) and /work/SRC/openSUSE:Leap:16.0/.luajit2.new.7373 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "luajit2" Tue Jul 15 06:49:22 2025 rev:4 rq:1292250 version:2.1.20250529 Changes: -------- --- /work/SRC/openSUSE:Leap:16.0/luajit2/luajit2.changes 2025-03-19 11:50:38.643580823 +0100 +++ /work/SRC/openSUSE:Leap:16.0/.luajit2.new.7373/luajit2.changes 2025-07-15 06:49:25.303032096 +0200 @@ -1,0 +2,6 @@ +Fri Jul 11 14:07:00 UTC 2025 - Илья Индиго <i...@ilya.top> + +- Updated to 2.1.20250529 (1748495995). + * https://github.com/openresty/luajit2/compare/v2.1-20250117...v2.1-20250529 + +------------------------------------------------------------------- Old: ---- luajit2-2.1-20250117.tar.gz New: ---- _scmsync.obsinfo build.specials.obscpio luajit2-2.1-20250529.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ luajit2.spec ++++++ --- /var/tmp/diff_new_pack.m6XHGn/_old 2025-07-15 06:49:25.619045152 +0200 +++ /var/tmp/diff_new_pack.m6XHGn/_new 2025-07-15 06:49:25.619045152 +0200 @@ -20,8 +20,8 @@ %define so_ver 2 %define lib_ver 5_1-%{so_ver} %define major 2.1 -%define minor 20250117 -%define upstream 1737090214 +%define minor 20250529 +%define upstream 1748495995 Name: luajit2 Version: %{major}.%{minor} Release: 0 @@ -75,8 +75,7 @@ PREFIX=%{_prefix} \ MULTILIB=%{_lib} -%post -n lib%{name}-%{lib_ver} -p /sbin/ldconfig -%postun -n lib%{name}-%{lib_ver} -p /sbin/ldconfig +%ldconfig_scriptlets -n lib%{name}-%{lib_ver} %files %{_bindir}/%{name} ++++++ _scmsync.obsinfo ++++++ mtime: 1752242912 commit: 1c7789ada1180affc99cc239891329b0b884c125c0ceccbf232c712cf17656fb url: https://src.opensuse.org/lua/luajit2.git revision: 1c7789ada1180affc99cc239891329b0b884c125c0ceccbf232c712cf17656fb projectscmsync: https://src.opensuse.org/lua/_ObsPrj.git ++++++ luajit2-2.1-20250117.tar.gz -> luajit2-2.1-20250529.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luajit2-2.1-20250117/.relver new/luajit2-2.1-20250529/.relver --- old/luajit2-2.1-20250117/.relver 2025-01-17 06:03:34.000000000 +0100 +++ new/luajit2-2.1-20250529/.relver 2025-05-29 07:19:55.000000000 +0200 @@ -1 +1 @@ -1737090214 +1748495995 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luajit2-2.1-20250117/.travis.yml new/luajit2-2.1-20250529/.travis.yml --- old/luajit2-2.1-20250117/.travis.yml 2025-01-17 06:03:34.000000000 +0100 +++ new/luajit2-2.1-20250529/.travis.yml 2025-05-29 07:19:55.000000000 +0200 @@ -1,5 +1,5 @@ sudo: required -dist: bionic +dist: focal branches: only: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luajit2-2.1-20250117/Makefile new/luajit2-2.1-20250529/Makefile --- old/luajit2-2.1-20250117/Makefile 2025-01-17 06:03:34.000000000 +0100 +++ new/luajit2-2.1-20250529/Makefile 2025-05-29 07:19:55.000000000 +0200 @@ -110,7 +110,7 @@ endif TARGET_SYS?= $(HOST_SYS) -ifeq (Darwin,$(TARGET_SYS)) +ifneq (,$(filter $(TARGET_SYS),Darwin iOS)) INSTALL_SONAME= $(INSTALL_DYLIBNAME) INSTALL_SOSHORT1= $(INSTALL_DYLIBSHORT1) INSTALL_SOSHORT2= $(INSTALL_DYLIBSHORT2) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luajit2-2.1-20250117/doc/install.html new/luajit2-2.1-20250529/doc/install.html --- old/luajit2-2.1-20250117/doc/install.html 2025-01-17 06:03:34.000000000 +0100 +++ new/luajit2-2.1-20250529/doc/install.html 2025-05-29 07:19:55.000000000 +0200 @@ -117,7 +117,7 @@ <li><tt>Makefile</tt> has settings for <b>installing</b> LuaJIT (POSIX only).</li> <li><tt>src/Makefile</tt> has settings for <b>compiling</b> LuaJIT -under POSIX, MinGW or Cygwin.</li> +under POSIX or MinGW.</li> <li><tt>src/msvcbuild.bat</tt> has settings for compiling LuaJIT with MSVC (Visual Studio).</li> </ul> @@ -195,10 +195,8 @@ <h2 id="windows">Windows Systems</h2> <h3>Prerequisites</h3> <p> -Either install one of the open source SDKs -(<a href="http://mingw.org/"><span class="ext">»</span> MinGW</a> or -<a href="https://www.cygwin.com/"><span class="ext">»</span> Cygwin</a>), which come with a modified -GCC plus the required development headers. +Either install the open source SDK <a href="http://mingw.org/"><span class="ext">»</span> MinGW</a>, +which comes with a modified GCC plus the required development headers. Or install Microsoft's Visual Studio (MSVC). </p> <h3>Building with MSVC</h3> @@ -217,9 +215,9 @@ <p> For an x64 to ARM64 cross-build run this first: <tt>vcvarsall.bat x64_arm64</tt> </p> -<h3>Building with MinGW or Cygwin</h3> +<h3>Building with MinGW</h3> <p> -Open a command prompt window and make sure the MinGW or Cygwin programs +Open a command prompt window and make sure the MinGW programs are in your path. Then <tt>cd</tt> to the directory of the git repository. Then run this command for MinGW: </p> @@ -227,12 +225,6 @@ mingw32-make </pre> <p> -Or this command for Cygwin: -</p> -<pre class="code"> -make -</pre> -<p> Then follow the installation instructions below. </p> <h3>Installing LuaJIT</h3> @@ -249,6 +241,19 @@ directory where <tt>luajit.exe</tt> is installed (see <tt>src/luaconf.h</tt>). </p> +<p> +The final directory layout should look like this: +</p> +<pre class="code"> +├── luajit.exe +├── lua51.dll +├── <- put your own classic Lua/C API modules (*.dll) here +└── lua + ├── <- put your own Lua modules (*.lua) here + └── jit + ├── bc.lua + └── (etc …) +</pre> <h2 id="cross">Cross-compiling LuaJIT</h2> <p> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luajit2-2.1-20250117/src/Makefile new/luajit2-2.1-20250529/src/Makefile --- old/luajit2-2.1-20250117/src/Makefile 2025-01-17 06:03:34.000000000 +0100 +++ new/luajit2-2.1-20250529/src/Makefile 2025-05-29 07:19:55.000000000 +0200 @@ -306,6 +306,9 @@ ifneq (,$(INSTALL_LJLIBD)) TARGET_XCFLAGS+= -DLUA_LJDIR=\"$(INSTALL_LJLIBD)\" endif +ifeq (,$(shell $(TARGET_CC) -o /dev/null -c -x c /dev/null -fno-strict-float-cast-overflow 2>/dev/null || echo 1)) + TARGET_XCFLAGS+= -fno-strict-float-cast-overflow +endif ############################################################################## # Target system detection. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luajit2-2.1-20250117/src/Makefile.dep new/luajit2-2.1-20250529/src/Makefile.dep --- old/luajit2-2.1-20250117/src/Makefile.dep 2025-01-17 06:03:34.000000000 +0100 +++ new/luajit2-2.1-20250529/src/Makefile.dep 2025-05-29 07:19:55.000000000 +0200 @@ -25,7 +25,7 @@ lib_init.o: lib_init.c lua.h luaconf.h lauxlib.h lualib.h lj_arch.h lib_io.o: lib_io.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h lj_def.h \ lj_arch.h lj_gc.h lj_err.h lj_errmsg.h lj_buf.h lj_str.h lj_state.h \ - lj_strfmt.h lj_ff.h lj_ffdef.h lj_lib.h lj_libdef.h + lj_strfmt.h lj_ff.h lj_ffdef.h lj_lib.h lj_strscan.h lj_libdef.h lib_jit.o: lib_jit.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h lj_def.h \ lj_arch.h lj_gc.h lj_err.h lj_errmsg.h lj_debug.h lj_str.h lj_tab.h \ lj_state.h lj_bc.h lj_ctype.h lj_ir.h lj_jit.h lj_ircall.h lj_iropt.h \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luajit2-2.1-20250117/src/lib_io.c new/luajit2-2.1-20250529/src/lib_io.c --- old/luajit2-2.1-20250117/src/lib_io.c 2025-01-17 06:03:34.000000000 +0100 +++ new/luajit2-2.1-20250529/src/lib_io.c 2025-05-29 07:19:55.000000000 +0200 @@ -25,6 +25,7 @@ #include "lj_strfmt.h" #include "lj_ff.h" #include "lj_lib.h" +#include "lj_strscan.h" /* Userdata payload for I/O file. */ typedef struct IOFileUD { @@ -323,13 +324,14 @@ FILE *fp = io_tofile(L)->fp; int opt = lj_lib_checkopt(L, 2, 1, "\3set\3cur\3end"); int64_t ofs = 0; - cTValue *o; + TValue *o; int res; if (opt == 0) opt = SEEK_SET; else if (opt == 1) opt = SEEK_CUR; else if (opt == 2) opt = SEEK_END; o = L->base+2; if (o < L->top) { + if (tvisstr(o)) lj_strscan_num(strV(o), o); if (tvisint(o)) ofs = (int64_t)intV(o); else if (tvisnum(o)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luajit2-2.1-20250117/src/lib_table.c new/luajit2-2.1-20250529/src/lib_table.c --- old/luajit2-2.1-20250117/src/lib_table.c 2025-01-17 06:03:34.000000000 +0100 +++ new/luajit2-2.1-20250529/src/lib_table.c 2025-05-29 07:19:55.000000000 +0200 @@ -172,7 +172,7 @@ LJLIB_NOREG LJLIB_CF(table_clone) LJLIB_REC(.) { GCtab *src = lj_lib_checktab(L, 1); - GCtab *dup = lj_tab_dup(L, src); + GCtab *dup = lj_tab_dup_helper(L, src, 1); settabV(L, L->base, dup); L->top = L->base+1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luajit2-2.1-20250117/src/lj_asm_arm.h new/luajit2-2.1-20250529/src/lj_asm_arm.h --- old/luajit2-2.1-20250117/src/lj_asm_arm.h 2025-01-17 06:03:34.000000000 +0100 +++ new/luajit2-2.1-20250529/src/lj_asm_arm.h 2025-05-29 07:19:55.000000000 +0200 @@ -1927,7 +1927,7 @@ } else if ((ir-1)->o == IR_MIN || (ir-1)->o == IR_MAX) { as->curins--; /* Always skip the loword min/max. */ if (uselo || usehi) - asm_sfpmin_max(as, ir-1, (ir-1)->o == IR_MIN ? CC_PL : CC_LE); + asm_sfpmin_max(as, ir-1, (ir-1)->o == IR_MIN ? CC_HS : CC_LS); return; #elif LJ_HASFFI } else if ((ir-1)->o == IR_CONV) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luajit2-2.1-20250117/src/lj_bc.h new/luajit2-2.1-20250529/src/lj_bc.h --- old/luajit2-2.1-20250117/src/lj_bc.h 2025-01-17 06:03:34.000000000 +0100 +++ new/luajit2-2.1-20250529/src/lj_bc.h 2025-05-29 07:19:55.000000000 +0200 @@ -259,6 +259,11 @@ return (op == BC_RETM || op == BC_RET || op == BC_RET0 || op == BC_RET1); } +static LJ_AINLINE int bc_isret_or_tail(BCOp op) +{ + return (op == BC_CALLMT || op == BC_CALLT || bc_isret(op)); +} + LJ_DATA const uint16_t lj_bc_mode[]; LJ_DATA const uint16_t lj_bc_ofs[]; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luajit2-2.1-20250117/src/lj_bcread.c new/luajit2-2.1-20250529/src/lj_bcread.c --- old/luajit2-2.1-20250117/src/lj_bcread.c 2025-01-17 06:03:34.000000000 +0100 +++ new/luajit2-2.1-20250529/src/lj_bcread.c 2025-05-29 07:19:55.000000000 +0200 @@ -179,7 +179,7 @@ } /* Read a single constant key/value of a template table. */ -static void bcread_ktabk(LexState *ls, TValue *o) +static void bcread_ktabk(LexState *ls, TValue *o, GCtab *t) { MSize tp = bcread_uleb128(ls); if (tp >= BCDUMP_KTAB_STR) { @@ -191,6 +191,8 @@ } else if (tp == BCDUMP_KTAB_NUM) { o->u32.lo = bcread_uleb128(ls); o->u32.hi = bcread_uleb128(ls); + } else if (t && tp == BCDUMP_KTAB_NIL) { /* Restore nil value marker. */ + settabV(ls->L, o, t); } else { lj_assertLS(tp <= BCDUMP_KTAB_TRUE, "bad constant type %d", tp); setpriV(o, ~tp); @@ -207,15 +209,15 @@ MSize i; TValue *o = tvref(t->array); for (i = 0; i < narray; i++, o++) - bcread_ktabk(ls, o); + bcread_ktabk(ls, o, NULL); } if (nhash) { /* Read hash entries. */ MSize i; for (i = 0; i < nhash; i++) { TValue key; - bcread_ktabk(ls, &key); + bcread_ktabk(ls, &key, NULL); lj_assertLS(!tvisnil(&key), "nil key"); - bcread_ktabk(ls, lj_tab_set(ls->L, t, &key)); + bcread_ktabk(ls, lj_tab_set(ls->L, t, &key), t); } } return t; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luajit2-2.1-20250117/src/lj_bcwrite.c new/luajit2-2.1-20250529/src/lj_bcwrite.c --- old/luajit2-2.1-20250117/src/lj_bcwrite.c 2025-01-17 06:03:34.000000000 +0100 +++ new/luajit2-2.1-20250529/src/lj_bcwrite.c 2025-05-29 07:19:55.000000000 +0200 @@ -71,6 +71,8 @@ *p++ = BCDUMP_KTAB_NUM; p = lj_strfmt_wuleb128(p, o->u32.lo); p = lj_strfmt_wuleb128(p, o->u32.hi); + } else if (tvistab(o)) { /* Write the nil value marker as a nil. */ + *p++ = BCDUMP_KTAB_NIL; } else { lj_assertBCW(tvispri(o), "unhandled type %d", itype(o)); *p++ = BCDUMP_KTAB_NIL+~itype(o); @@ -133,7 +135,7 @@ TValue **heap = ctx->heap; MSize i = nhash; for (;; node--) { /* Build heap. */ - if (!tvisnil(&node->key)) { + if (!tvisnil(&node->val)) { bcwrite_ktabk_heap_insert(heap, --i, nhash, &node->key); if (i == 0) break; } @@ -163,7 +165,7 @@ MSize i, hmask = t->hmask; Node *node = noderef(t->node); for (i = 0; i <= hmask; i++) - nhash += !tvisnil(&node[i].key); + nhash += !tvisnil(&node[i].val); } /* Write number of array slots and hash slots. */ p = lj_strfmt_wuleb128(p, narray); @@ -184,7 +186,7 @@ } else { MSize i = nhash; for (;; node--) - if (!tvisnil(&node->key)) { + if (!tvisnil(&node->val)) { bcwrite_ktabk(ctx, &node->key, 0); bcwrite_ktabk(ctx, &node->val, 1); if (--i == 0) break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luajit2-2.1-20250117/src/lj_ccall.c new/luajit2-2.1-20250529/src/lj_ccall.c --- old/luajit2-2.1-20250117/src/lj_ccall.c 2025-01-17 06:03:34.000000000 +0100 +++ new/luajit2-2.1-20250529/src/lj_ccall.c 2025-05-29 07:19:55.000000000 +0200 @@ -893,17 +893,24 @@ { CTSize sz = ct->size; unsigned int r = 0, n = 0, isu = (ct->info & CTF_UNION); - while (ct->sib) { + while (ct->sib && n <= 4) { + unsigned int m = 1; CType *sct; ct = ctype_get(cts, ct->sib); if (ctype_isfield(ct->info)) { sct = ctype_rawchild(cts, ct); + if (ctype_isarray(sct->info)) { + CType *cct = ctype_rawchild(cts, sct); + if (!cct->size) continue; + m = sct->size / cct->size; + sct = cct; + } if (ctype_isfp(sct->info)) { r |= sct->size; - if (!isu) n++; else if (n == 0) n = 1; + if (!isu) n += m; else if (n < m) n = m; } else if (ctype_iscomplex(sct->info)) { r |= (sct->size >> 1); - if (!isu) n += 2; else if (n < 2) n = 2; + if (!isu) n += 2*m; else if (n < 2*m) n = 2*m; } else if (ctype_isstruct(sct->info)) { goto substruct; } else { @@ -915,10 +922,11 @@ sct = ctype_rawchild(cts, ct); substruct: if (sct->size > 0) { - unsigned int s = ccall_classify_struct(cts, sct); + unsigned int s = ccall_classify_struct(cts, sct), sn; if (s <= 1) goto noth; r |= (s & 255); - if (!isu) n += (s >> 8); else if (n < (s >>8)) n = (s >> 8); + sn = (s >> 8) * m; + if (!isu) n += sn; else if (n < sn) n = sn; } } } @@ -1049,7 +1057,9 @@ /* -- Common C call handling ---------------------------------------------- */ -/* Infer the destination CTypeID for a vararg argument. */ +/* Infer the destination CTypeID for a vararg argument. +** Note: may reallocate cts->tab and invalidate CType pointers. +*/ CTypeID lj_ccall_ctid_vararg(CTState *cts, cTValue *o) { if (tvisnumber(o)) { @@ -1077,13 +1087,16 @@ } } -/* Setup arguments for C call. */ +/* Setup arguments for C call. +** Note: may reallocate cts->tab and invalidate CType pointers. +*/ static int ccall_set_args(lua_State *L, CTState *cts, CType *ct, CCallState *cc) { int gcsteps = 0; TValue *o, *top = L->top; CTypeID fid; + CTInfo info = ct->info; /* lj_ccall_ctid_vararg may invalidate ct pointer. */ CType *ctr; MSize maxgpr, ngpr = 0, nsp = 0, narg; #if CCALL_NARG_FPR @@ -1102,7 +1115,7 @@ #if LJ_TARGET_X86 /* x86 has several different calling conventions. */ cc->resx87 = 0; - switch (ctype_cconv(ct->info)) { + switch (ctype_cconv(info)) { case CTCC_FASTCALL: maxgpr = 2; break; case CTCC_THISCALL: maxgpr = 1; break; default: maxgpr = 0; break; @@ -1119,7 +1132,7 @@ } else if (ctype_iscomplex(ctr->info) || ctype_isstruct(ctr->info)) { /* Preallocate cdata object and anchor it after arguments. */ CTSize sz = ctr->size; - GCcdata *cd = lj_cdata_new(cts, ctype_cid(ct->info), sz); + GCcdata *cd = lj_cdata_new(cts, ctype_cid(info), sz); void *dp = cdataptr(cd); setcdataV(L, L->top++, cd); if (ctype_isstruct(ctr->info)) { @@ -1142,7 +1155,7 @@ } #if LJ_TARGET_ARM64 && LJ_ABI_WIN - if ((ct->info & CTF_VARARG)) { + if ((info & CTF_VARARG)) { nsp -= maxgpr * CTSIZE_PTR; /* May end up with negative nsp. */ ngpr = maxgpr; nfpr = CCALL_NARG_FPR; @@ -1170,7 +1183,7 @@ lj_assertL(ctype_isfield(ctf->info), "field expected"); did = ctype_cid(ctf->info); } else { - if (!(ct->info & CTF_VARARG)) + if (!(info & CTF_VARARG)) lj_err_caller(L, LJ_ERR_FFI_NUMARG); /* Too many arguments. */ did = lj_ccall_ctid_vararg(cts, o); /* Infer vararg type. */ isva = 1; @@ -1393,11 +1406,11 @@ ct = ctype_rawchild(cts, ct); } if (ctype_isfunc(ct->info)) { - CCallState cc = {0}; + CTypeID id = ctype_typeid(cts, ct); + CCallState cc; int gcsteps, ret; cc.func = (void (*)(void))cdata_getptr(cdataptr(cd), sz); gcsteps = ccall_set_args(L, cts, ct, &cc); - ct = (CType *)((intptr_t)ct-(intptr_t)cts->tab); cts->cb.slot = ~0u; lj_vm_ffi_call(&cc); if (cts->cb.slot != ~0u) { /* Blacklist function that called a callback. */ @@ -1405,7 +1418,7 @@ 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. */ + ct = ctype_get(cts, id); /* Table may have been reallocated. */ gcsteps += ccall_get_results(L, cts, ct, &cc, &ret); #if LJ_TARGET_X86 && LJ_ABI_WIN /* Automatically detect __stdcall and fix up C function declaration. */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luajit2-2.1-20250117/src/lj_ccallback.c new/luajit2-2.1-20250529/src/lj_ccallback.c --- old/luajit2-2.1-20250117/src/lj_ccallback.c 2025-01-17 06:03:34.000000000 +0100 +++ new/luajit2-2.1-20250529/src/lj_ccallback.c 2025-05-29 07:19:55.000000000 +0200 @@ -317,6 +317,14 @@ #define CCPROT_CREATE 0 #endif +/* Check for macOS hardened runtime. */ +#if defined(LUAJIT_ENABLE_OSX_HRT) && LUAJIT_SECURITY_MCODE != 0 && defined(MAP_JIT) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 110000 +#include <pthread.h> +#define CCMAP_CREATE MAP_JIT +#else +#define CCMAP_CREATE 0 +#endif + #endif /* Allocate and initialize area for callback function pointers. */ @@ -331,10 +339,13 @@ if (!p) lj_err_caller(cts->L, LJ_ERR_FFI_CBACKOV); #elif LJ_TARGET_POSIX - p = mmap(NULL, sz, (PROT_READ|PROT_WRITE|CCPROT_CREATE), MAP_PRIVATE|MAP_ANONYMOUS, - -1, 0); + p = mmap(NULL, sz, PROT_READ|PROT_WRITE|CCPROT_CREATE, + MAP_PRIVATE|MAP_ANONYMOUS|CCMAP_CREATE, -1, 0); if (p == MAP_FAILED) lj_err_caller(cts->L, LJ_ERR_FFI_CBACKOV); +#if CCMAP_CREATE + pthread_jit_write_protect_np(0); +#endif #else /* Fallback allocator. Fails if memory is not executable by default. */ p = lj_mem_new(cts->L, sz); @@ -351,8 +362,12 @@ LJ_WIN_VPROTECT(p, sz, PAGE_EXECUTE_READ, &oprot); } #elif LJ_TARGET_POSIX +#if CCMAP_CREATE + pthread_jit_write_protect_np(1); +#else mprotect(p, sz, (PROT_READ|PROT_EXEC)); #endif +#endif } /* Free area for callback function pointers. */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luajit2-2.1-20250117/src/lj_crecord.c new/luajit2-2.1-20250529/src/lj_crecord.c --- old/luajit2-2.1-20250117/src/lj_crecord.c 2025-01-17 06:03:34.000000000 +0100 +++ new/luajit2-2.1-20250529/src/lj_crecord.c 2025-05-29 07:19:55.000000000 +0200 @@ -1101,12 +1101,15 @@ crec_finalizer(J, trcd, 0, fin); } -/* Record argument conversions. */ +/* Record argument conversions. +** Note: may reallocate cts->tab and invalidate CType pointers. +*/ static TRef crec_call_args(jit_State *J, RecordFFData *rd, CTState *cts, CType *ct) { TRef args[CCI_NARGS_MAX]; CTypeID fid; + CTInfo info = ct->info; /* lj_ccall_ctid_vararg may invalidate ct pointer. */ MSize i, n; TRef tr, *base; cTValue *o; @@ -1115,9 +1118,9 @@ TRef *arg0 = NULL, *arg1 = NULL; #endif int ngpr = 0; - if (ctype_cconv(ct->info) == CTCC_THISCALL) + if (ctype_cconv(info) == CTCC_THISCALL) ngpr = 1; - else if (ctype_cconv(ct->info) == CTCC_FASTCALL) + else if (ctype_cconv(info) == CTCC_FASTCALL) ngpr = 2; #elif LJ_TARGET_ARM64 && LJ_TARGET_OSX int ngpr = CCALL_NARG_GPR; @@ -1144,7 +1147,7 @@ lj_assertJ(ctype_isfield(ctf->info), "field expected"); did = ctype_cid(ctf->info); } else { - if (!(ct->info & CTF_VARARG)) + if (!(info & CTF_VARARG)) lj_trace_err(J, LJ_TRERR_NYICALL); /* Too many arguments. */ #if LJ_TARGET_ARM64 && LJ_TARGET_OSX if (ngpr >= 0) { @@ -1248,12 +1251,14 @@ { CTState *cts = ctype_ctsG(J2G(J)); CType *ct = ctype_raw(cts, cd->ctypeid); + CTInfo info; IRType tp = IRT_PTR; if (ctype_isptr(ct->info)) { tp = (LJ_64 && ct->size == 8) ? IRT_P64 : IRT_P32; ct = ctype_rawchild(cts, ct); } - if (ctype_isfunc(ct->info)) { + info = ct->info; /* crec_call_args may invalidate ct pointer. */ + if (ctype_isfunc(info)) { TRef func = emitir(IRT(IR_FLOAD, tp), J->base[0], IRFL_CDATA_PTR); CType *ctr = ctype_rawchild(cts, ct); IRType t = crec_ct2irt(cts, ctr); @@ -1270,9 +1275,9 @@ ctype_isenum(ctr->info)) || t == IRT_CDATA) { lj_trace_err(J, LJ_TRERR_NYICALL); } - if ((ct->info & CTF_VARARG) + if ((info & CTF_VARARG) #if LJ_TARGET_X86 - || ctype_cconv(ct->info) != CTCC_CDECL + || ctype_cconv(info) != CTCC_CDECL #endif ) func = emitir(IRT(IR_CARG, IRT_NIL), func, @@ -1295,7 +1300,7 @@ } } else if (t == IRT_PTR || (LJ_64 && t == IRT_P32) || t == IRT_I64 || t == IRT_U64 || ctype_isenum(ctr->info)) { - TRef trid = lj_ir_kint(J, ctype_cid(ct->info)); + TRef trid = lj_ir_kint(J, ctype_cid(info)); tr = emitir(IRTG(IR_CNEWI, IRT_CDATA), trid, tr); if (t == IRT_I64 || t == IRT_U64) lj_needsplit(J); } else if (t == IRT_FLOAT || t == IRT_U32) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luajit2-2.1-20250117/src/lj_ctype.c new/luajit2-2.1-20250529/src/lj_ctype.c --- old/luajit2-2.1-20250117/src/lj_ctype.c 2025-01-17 06:03:34.000000000 +0100 +++ new/luajit2-2.1-20250529/src/lj_ctype.c 2025-05-29 07:19:55.000000000 +0200 @@ -33,10 +33,12 @@ _("int16_t", INT16) \ _("int32_t", INT32) \ _("int64_t", INT64) \ + _("int128_t", INT128) \ _("uint8_t", UINT8) \ _("uint16_t", UINT16) \ _("uint32_t", UINT32) \ _("uint64_t", UINT64) \ + _("uint128_t", UINT128) \ _("intptr_t", INT_PSZ) \ _("uintptr_t", UINT_PSZ) \ /* From POSIX. */ \ @@ -55,6 +57,7 @@ _("__int16", 2, CTOK_INT) \ _("__int32", 4, CTOK_INT) \ _("__int64", 8, CTOK_INT) \ + _("__int128", 16, CTOK_INT) \ _("float", 4, CTOK_FP) \ _("double", 8, CTOK_FP) \ _("long", 0, CTOK_LONG) \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luajit2-2.1-20250117/src/lj_ctype.h new/luajit2-2.1-20250529/src/lj_ctype.h --- old/luajit2-2.1-20250117/src/lj_ctype.h 2025-01-17 06:03:34.000000000 +0100 +++ new/luajit2-2.1-20250529/src/lj_ctype.h 2025-05-29 07:19:55.000000000 +0200 @@ -292,6 +292,8 @@ _(UINT32, 4, CT_NUM, CTF_UNSIGNED|CTALIGN(2)) \ _(INT64, 8, CT_NUM, CTF_LONG_IF8|CTALIGN(3)) \ _(UINT64, 8, CT_NUM, CTF_UNSIGNED|CTF_LONG_IF8|CTALIGN(3)) \ + _(INT128, 16, CT_NUM, CTALIGN(4)) \ + _(UINT128, 16, CT_NUM, CTF_UNSIGNED|CTALIGN(4)) \ _(FLOAT, 4, CT_NUM, CTF_FP|CTALIGN(2)) \ _(DOUBLE, 8, CT_NUM, CTF_FP|CTALIGN(3)) \ _(COMPLEX_FLOAT, 8, CT_ARRAY, CTF_COMPLEX|CTALIGN(2)|CTID_FLOAT) \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luajit2-2.1-20250117/src/lj_load.c new/luajit2-2.1-20250529/src/lj_load.c --- old/luajit2-2.1-20250117/src/lj_load.c 2025-01-17 06:03:34.000000000 +0100 +++ new/luajit2-2.1-20250529/src/lj_load.c 2025-05-29 07:19:55.000000000 +0200 @@ -122,8 +122,9 @@ copyTV(L, L->top-1, L->top); } if (err) { + const char *fname = filename ? filename : "stdin"; L->top--; - lua_pushfstring(L, "cannot read %s: %s", chunkname+1, strerror(err)); + lua_pushfstring(L, "cannot read %s: %s", fname, strerror(err)); return LUA_ERRFILE; } return status; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luajit2-2.1-20250117/src/lj_mcode.c new/luajit2-2.1-20250529/src/lj_mcode.c --- old/luajit2-2.1-20250117/src/lj_mcode.c 2025-01-17 06:03:34.000000000 +0100 +++ new/luajit2-2.1-20250529/src/lj_mcode.c 2025-05-29 07:19:55.000000000 +0200 @@ -98,21 +98,35 @@ #define MAP_ANONYMOUS MAP_ANON #endif +/* Check for macOS hardened runtime. */ +#if defined(LUAJIT_ENABLE_OSX_HRT) && LUAJIT_SECURITY_MCODE != 0 && defined(MAP_JIT) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 110000 +#include <pthread.h> +#define MCMAP_CREATE MAP_JIT +#else +#define MCMAP_CREATE 0 +#endif + #define MCPROT_RW (PROT_READ|PROT_WRITE) #define MCPROT_RX (PROT_READ|PROT_EXEC) #define MCPROT_RWX (PROT_READ|PROT_WRITE|PROT_EXEC) #ifdef PROT_MPROTECT #define MCPROT_CREATE (PROT_MPROTECT(MCPROT_RWX)) +#elif MCMAP_CREATE +#define MCPROT_CREATE PROT_EXEC #else #define MCPROT_CREATE 0 #endif static void *mcode_alloc_at(jit_State *J, uintptr_t hint, size_t sz, int prot) { - void *p = mmap((void *)hint, sz, prot|MCPROT_CREATE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); + void *p = mmap((void *)hint, sz, prot|MCPROT_CREATE, MAP_PRIVATE|MAP_ANONYMOUS|MCMAP_CREATE, -1, 0); if (p == MAP_FAILED) { if (!hint) lj_trace_err(J, LJ_TRERR_MCODEAL); p = NULL; +#if MCMAP_CREATE + } else { + pthread_jit_write_protect_np(0); +#endif } return p; } @@ -125,7 +139,12 @@ static int mcode_setprot(void *p, size_t sz, int prot) { +#if MCMAP_CREATE + pthread_jit_write_protect_np((prot & PROT_EXEC)); + return 0; +#else return mprotect(p, sz, prot); +#endif } #else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luajit2-2.1-20250117/src/lj_opt_fold.c new/luajit2-2.1-20250529/src/lj_opt_fold.c --- old/luajit2-2.1-20250117/src/lj_opt_fold.c 2025-01-17 06:03:34.000000000 +0100 +++ new/luajit2-2.1-20250529/src/lj_opt_fold.c 2025-05-29 07:19:55.000000000 +0200 @@ -2217,9 +2217,11 @@ LJFOLDF(fwd_href_tdup) { TValue keyv; + cTValue *val; lj_ir_kvalue(J->L, &keyv, fright); - if (lj_tab_get(J->L, ir_ktab(IR(fleft->op1)), &keyv) == niltvg(J2G(J)) && - lj_opt_fwd_href_nokey(J)) + val = lj_tab_get(J->L, ir_ktab(IR(fleft->op1)), &keyv); + /* Check for either nil or the nil value marker in the template table. */ + if ((tvisnil(val) || tvistab(val)) && lj_opt_fwd_href_nokey(J)) return lj_ir_kkptr(J, niltvg(J2G(J))); return NEXTFOLD; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luajit2-2.1-20250117/src/lj_opt_mem.c new/luajit2-2.1-20250529/src/lj_opt_mem.c --- old/luajit2-2.1-20250117/src/lj_opt_mem.c 2025-01-17 06:03:34.000000000 +0100 +++ new/luajit2-2.1-20250529/src/lj_opt_mem.c 2025-05-29 07:19:55.000000000 +0200 @@ -233,7 +233,9 @@ return lj_ir_knum_u64(J, tv->u64); else if (tvisint(tv)) return lj_ir_kint(J, intV(tv)); - else if (tvisgcv(tv)) + else if (tvistab(tv)) /* Template table nil value marker. */ + return TREF_NIL; + else if (tvisstr(tv)) return lj_ir_kstr(J, strV(tv)); } /* Othwerwise: don't intern as a constant. */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luajit2-2.1-20250117/src/lj_parse.c new/luajit2-2.1-20250529/src/lj_parse.c --- old/luajit2-2.1-20250117/src/lj_parse.c 2025-01-17 06:03:34.000000000 +0100 +++ new/luajit2-2.1-20250529/src/lj_parse.c 2025-05-29 07:19:55.000000000 +0200 @@ -1517,23 +1517,11 @@ #endif -/* Check if bytecode op returns. */ -static int bcopisret(BCOp op) -{ - switch (op) { - case BC_CALLMT: case BC_CALLT: - case BC_RETM: case BC_RET: case BC_RET0: case BC_RET1: - return 1; - default: - return 0; - } -} - /* Fixup return instruction for prototype. */ static void fs_fixup_ret(FuncState *fs) { BCPos lastpc = fs->pc; - if (lastpc <= fs->lasttarget || !bcopisret(bc_op(fs->bcbase[lastpc-1].ins))) { + if (lastpc <= fs->lasttarget || !bc_isret_or_tail(bc_op(fs->bcbase[lastpc-1].ins))) { if ((fs->bl->flags & FSCOPE_UPVAL)) bcemit_AJ(fs, BC_UCLO, 0, 0); bcemit_AD(fs, BC_RET0, 0, 1); /* Need final return. */ @@ -1725,7 +1713,7 @@ FuncState *fs = ls->fs; BCLine line = ls->linenumber; GCtab *t = NULL; - int vcall = 0, needarr = 0, fixt = 0; + int vcall = 0, needarr = 0; uint32_t narr = 1; /* First array index. */ uint32_t nhash = 0; /* Number of hash entries. */ BCReg freg = fs->freereg; @@ -1770,9 +1758,10 @@ lj_gc_anybarriert(fs->L, t); if (expr_isk_nojump(&val)) { /* Add const key/value to template table. */ expr_kvalue(fs, v, &val); - } else { /* Otherwise create dummy string key (avoids lj_tab_newkey). */ - settabV(fs->L, v, t); /* Preserve key with table itself as value. */ - fixt = 1; /* Fix this later, after all resizes. */ + /* Mark nil value with table value itself to preserve the key. */ + if (key.k == VKSTR && tvisnil(v)) settabV(fs->L, v, t); + } else { /* Preserve the key for the following non-const store. */ + settabV(fs->L, v, t); goto nonconst; } } else { @@ -1814,17 +1803,6 @@ } else { if (needarr && t->asize < narr) lj_tab_reasize(fs->L, t, narr-1); - if (fixt) { /* Fix value for dummy keys in template table. */ - Node *node = noderef(t->node); - uint32_t i, hmask = t->hmask; - for (i = 0; i <= hmask; i++) { - Node *n = &node[i]; - if (tvistab(&n->val)) { - lj_assertFS(tabV(&n->val) == t, "bad dummy key in template table"); - setnilV(&n->val); /* Turn value into nil. */ - } - } - } lj_gc_check(fs->L); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luajit2-2.1-20250117/src/lj_record.c new/luajit2-2.1-20250529/src/lj_record.c --- old/luajit2-2.1-20250117/src/lj_record.c 2025-01-17 06:03:34.000000000 +0100 +++ new/luajit2-2.1-20250529/src/lj_record.c 2025-05-29 07:19:55.000000000 +0200 @@ -973,7 +973,8 @@ lj_trace_err(J, LJ_TRERR_LLEAVE); } else if (J->needsnap) { /* Tailcalled to ff with side-effects. */ lj_trace_err(J, LJ_TRERR_NYIRETL); /* No way to insert snapshot here. */ - } else if (1 + pt->framesize >= LJ_MAX_JSLOTS) { + } else if (1 + pt->framesize >= LJ_MAX_JSLOTS || + J->baseslot + J->maxslot >= LJ_MAX_JSLOTS) { lj_trace_err(J, LJ_TRERR_STACKOV); } else { /* Return to lower frame. Guard for the target we return to. */ TRef trpt = lj_ir_kgc(J, obj2gco(pt), IRT_PROTO); @@ -1107,7 +1108,10 @@ return 0; /* No metamethod. */ } /* The cdata metatable is treated as immutable. */ - if (LJ_HASFFI && tref_iscdata(ix->tab)) goto immutable_mt; + if (LJ_HASFFI && tref_iscdata(ix->tab)) { + mix.tab = TREF_NIL; + goto immutable_mt; + } ix->mt = mix.tab = lj_ir_ggfload(J, IRT_TAB, GG_OFS(g.gcroot[GCROOT_BASEMT+itypemap(&ix->tabv)])); goto nocheck; @@ -2079,6 +2083,7 @@ /* -- Concatenation ------------------------------------------------------- */ typedef struct RecCatDataCP { + TValue savetv[5+LJ_FR2]; jit_State *J; BCReg baseslot, topslot; TRef tr; @@ -2119,7 +2124,9 @@ return NULL; } /* Pass partial result. */ - topslot = J->maxslot--; + rcd->topslot = topslot = J->maxslot--; + /* Save updated range of slots. */ + memcpy(rcd->savetv, &L->base[topslot-1], sizeof(rcd->savetv)); *xbase = tr; top = xbase; setstrV(J->L, &ix.keyv, &J2G(J)->strempty); /* Simulate string result. */ @@ -2139,16 +2146,18 @@ { lua_State *L = J->L; ptrdiff_t delta = L->top - L->base; - TValue savetv[5+LJ_FR2], errobj; + TValue errobj; RecCatDataCP rcd; int errcode; rcd.J = J; rcd.baseslot = baseslot; rcd.topslot = topslot; - memcpy(savetv, &L->base[topslot-1], sizeof(savetv)); /* Save slots. */ + /* Save slots. */ + memcpy(rcd.savetv, &L->base[topslot-1], sizeof(rcd.savetv)); errcode = lj_vm_cpcall(L, NULL, &rcd, rec_mm_concat_cp); if (errcode) copyTV(L, &errobj, L->top-1); - memcpy(&L->base[topslot-1], savetv, sizeof(savetv)); /* Restore slots. */ + /* Restore slots. */ + memcpy(&L->base[rcd.topslot-1], rcd.savetv, sizeof(rcd.savetv)); if (errcode) { L->top = L->base + delta; copyTV(L, L->top++, &errobj); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luajit2-2.1-20250117/src/lj_snap.c new/luajit2-2.1-20250529/src/lj_snap.c --- old/luajit2-2.1-20250117/src/lj_snap.c 2025-01-17 06:03:34.000000000 +0100 +++ new/luajit2-2.1-20250529/src/lj_snap.c 2025-05-29 07:19:55.000000000 +0200 @@ -956,8 +956,10 @@ const BCIns *pc = snap_pc(&map[nent]); lua_State *L = J->L; - /* Set interpreter PC to the next PC to get correct error messages. */ - setcframe_pc(L->cframe, pc+1); + /* Set interpreter PC to the next PC to get correct error messages. + ** But not for returns or tail calls, since pc+1 may be out-of-range. + */ + setcframe_pc(L->cframe, bc_isret_or_tail(bc_op(*pc)) ? pc : pc+1); setcframe_pc(cframe_raw(cframe_prev(L->cframe)), pc); /* Make sure the stack is big enough for the slots from the snapshot. */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luajit2-2.1-20250117/src/lj_tab.c new/luajit2-2.1-20250529/src/lj_tab.c --- old/luajit2-2.1-20250117/src/lj_tab.c 2025-01-17 06:03:34.000000000 +0100 +++ new/luajit2-2.1-20250529/src/lj_tab.c 2025-05-29 07:19:55.000000000 +0200 @@ -163,7 +163,7 @@ #endif /* Duplicate a table. */ -GCtab * LJ_FASTCALL lj_tab_dup(lua_State *L, const GCtab *kt) +GCtab * lj_tab_dup_helper(lua_State *L, const GCtab *kt, int is_tab_clone) { GCtab *t; uint32_t asize, hmask; @@ -196,12 +196,18 @@ Node *next = nextnode(kn); /* Don't use copyTV here, since it asserts on a copy of a dead key. */ n->val = kn->val; n->key = kn->key; + if (!is_tab_clone && tvistab(&n->val)) setnilV(&n->val); /* Replace nil value marker. */ setmref(n->next, next == NULL? next : (Node *)((char *)next + d)); } } return t; } +GCtab * LJ_FASTCALL lj_tab_dup(lua_State *L, const GCtab *kt) +{ + return lj_tab_dup_helper(L, kt, 0); +} + /* Clear a table. */ void LJ_FASTCALL lj_tab_clear(GCtab *t) { @@ -689,7 +695,7 @@ GCtab * LJ_FASTCALL lj_tab_clone(lua_State *L, const GCtab *src) { - return lj_tab_dup(L, src); + return lj_tab_dup_helper(L, src, 1); } int LJ_FASTCALL lj_tab_isarray(const GCtab *src) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luajit2-2.1-20250117/src/lj_tab.h new/luajit2-2.1-20250529/src/lj_tab.h --- old/luajit2-2.1-20250117/src/lj_tab.h 2025-01-17 06:03:34.000000000 +0100 +++ new/luajit2-2.1-20250529/src/lj_tab.h 2025-05-29 07:19:55.000000000 +0200 @@ -57,6 +57,7 @@ #if LJ_HASJIT LJ_FUNC GCtab * LJ_FASTCALL lj_tab_new1(lua_State *L, uint32_t ahsize); #endif +LJ_FUNCA GCtab * lj_tab_dup_helper(lua_State *L, const GCtab *kt, int is_tab_clone); LJ_FUNCA GCtab * LJ_FASTCALL lj_tab_dup(lua_State *L, const GCtab *kt); LJ_FUNC void LJ_FASTCALL lj_tab_clear(GCtab *t); LJ_FUNC void LJ_FASTCALL lj_tab_free(global_State *g, GCtab *t); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luajit2-2.1-20250117/src/lj_trace.c new/luajit2-2.1-20250529/src/lj_trace.c --- old/luajit2-2.1-20250117/src/lj_trace.c 2025-01-17 06:03:34.000000000 +0100 +++ new/luajit2-2.1-20250529/src/lj_trace.c 2025-05-29 07:19:55.000000000 +0200 @@ -222,14 +222,6 @@ bc_isret(op), "bad original bytecode %d", op); *pc = T->startins; break; - case BC_JMP: - lj_assertJ(op == BC_ITERL, "bad original bytecode %d", op); - pc += bc_j(*pc)+2; - if (bc_op(*pc) == BC_JITERL) { - lj_assertJ(traceref(J, bc_d(*pc)) == T, "JITERL references other trace"); - *pc = T->startins; - } - break; case BC_JFUNCF: lj_assertJ(op == BC_FUNCF, "bad original bytecode %d", op); *pc = T->startins; @@ -245,18 +237,19 @@ GCproto *pt = &gcref(T->startpt)->pt; lj_assertJ(T->root == 0, "not a root trace"); lj_assertJ(pt != NULL, "trace has no prototype"); - /* First unpatch any modified bytecode. */ - trace_unpatch(J, T); /* Unlink root trace from chain anchored in prototype. */ if (pt->trace == T->traceno) { /* Trace is first in chain. Easy. */ pt->trace = T->nextroot; +unpatch: + /* Unpatch modified bytecode only if the trace has not been flushed. */ + trace_unpatch(J, T); } else if (pt->trace) { /* Otherwise search in chain of root traces. */ GCtrace *T2 = traceref(J, pt->trace); if (T2) { for (; T2->nextroot; T2 = traceref(J, T2->nextroot)) if (T2->nextroot == T->traceno) { T2->nextroot = T->nextroot; /* Unlink from chain. */ - break; + goto unpatch; } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luajit2-2.1-20250117/src/luajit.c new/luajit2-2.1-20250529/src/luajit.c --- old/luajit2-2.1-20250117/src/luajit.c 2025-01-17 06:03:34.000000000 +0100 +++ new/luajit2-2.1-20250529/src/luajit.c 2025-05-29 07:19:55.000000000 +0200 @@ -35,6 +35,21 @@ #if !LJ_TARGET_CONSOLE #include <signal.h> + +#if LJ_TARGET_POSIX +/* Improve signal handling on POSIX. Try CTRL-C on: luajit -e 'io.read()' */ +static void signal_set(int sig, void (*h)(int)) +{ + struct sigaction sa; + memset(&sa, 0, sizeof(sa)); + sa.sa_handler = h; + sigemptyset(&sa.sa_mask); + sigaction(sig, &sa, NULL); +} +#else +#define signal_set signal +#endif + #endif static lua_State *globalL = NULL; @@ -54,8 +69,8 @@ static void laction(int i) { - signal(i, SIG_DFL); /* if another SIGINT happens before lstop, - terminate process (default action) */ + /* Terminate process if another SIGINT happens (double CTRL-C). */ + signal_set(i, SIG_DFL); lua_sethook(globalL, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1); } #endif @@ -117,11 +132,11 @@ lua_pushcfunction(L, traceback); /* push traceback function */ lua_insert(L, base); /* put it under chunk and args */ #if !LJ_TARGET_CONSOLE - signal(SIGINT, laction); + signal_set(SIGINT, laction); #endif status = lua_pcall(L, narg, (clear ? 0 : LUA_MULTRET), base); #if !LJ_TARGET_CONSOLE - signal(SIGINT, SIG_DFL); + signal_set(SIGINT, SIG_DFL); #endif lua_remove(L, base); /* remove traceback function */ /* force a complete garbage collection in case of errors */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luajit2-2.1-20250117/src/msvcbuild.bat new/luajit2-2.1-20250529/src/msvcbuild.bat --- old/luajit2-2.1-20250117/src/msvcbuild.bat 2025-01-17 06:03:34.000000000 +0100 +++ new/luajit2-2.1-20250529/src/msvcbuild.bat 2025-05-29 07:19:55.000000000 +0200 @@ -8,7 +8,8 @@ @rem nogc64 disable LJ_GC64 mode for x64 @rem debug emit debug symbols @rem amalg amalgamated build -@rem static static linkage +@rem static create static lib to statically link into your project +@rem mixed create static lib to build a DLL in your project @if not defined INCLUDE goto :FAIL @@ -106,12 +107,14 @@ @if "%1"=="static" goto :STATIC %LJCOMPILE% %LJDYNBUILD% lj_*.c lib_*.c @if errorlevel 1 goto :BAD +@if "%1"=="mixed" goto :STATICLIB %LJLINK% /DLL /OUT:%LJDLLNAME% lj_*.obj lib_*.obj @if errorlevel 1 goto :BAD @goto :MTDLL :STATIC %LJCOMPILE% lj_*.c lib_*.c @if errorlevel 1 goto :BAD +:STATICLIB %LJLIB% /OUT:%LJLIBNAME% lj_*.obj lib_*.obj @if errorlevel 1 goto :BAD @goto :MTDLL @@ -119,13 +122,15 @@ @if "%2"=="static" goto :AMALGSTATIC %LJCOMPILE% %LJDYNBUILD% ljamalg.c @if errorlevel 1 goto :BAD +@if "%2"=="mixed" goto :AMALGSTATICLIB %LJLINK% /DLL /OUT:%LJDLLNAME% ljamalg.obj lj_vm.obj @if errorlevel 1 goto :BAD @goto :MTDLL :AMALGSTATIC %LJCOMPILE% ljamalg.c @if errorlevel 1 goto :BAD -%LJLINK% /OUT:%LJDLLNAME% ljamalg.obj lj_vm.obj +:AMALGSTATICLIB +%LJLIB% /OUT:%LJLIBNAME% ljamalg.obj lj_vm.obj @if errorlevel 1 goto :BAD :MTDLL if exist %LJDLLNAME%.manifest^ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luajit2-2.1-20250117/src/vm_arm.dasc new/luajit2-2.1-20250529/src/vm_arm.dasc --- old/luajit2-2.1-20250117/src/vm_arm.dasc 2025-01-17 06:03:34.000000000 +0100 +++ new/luajit2-2.1-20250529/src/vm_arm.dasc 2025-05-29 07:19:55.000000000 +0200 @@ -1717,8 +1717,8 @@ |.endif |.endmacro | - | math_minmax math_min, gt, pl - | math_minmax math_max, lt, le + | math_minmax math_min, gt, hs + | math_minmax math_max, lt, ls | |//-- String library ----------------------------------------------------- | diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luajit2-2.1-20250117/t/iter.t new/luajit2-2.1-20250529/t/iter.t --- old/luajit2-2.1-20250117/t/iter.t 2025-01-17 06:03:34.000000000 +0100 +++ new/luajit2-2.1-20250529/t/iter.t 2025-05-29 07:19:55.000000000 +0200 @@ -32,6 +32,7 @@ \E)?#ms + === TEST 2: explicit next() in loops --- jv --- lua diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luajit2-2.1-20250117/t/table-clone.t new/luajit2-2.1-20250529/t/table-clone.t --- old/luajit2-2.1-20250117/t/table-clone.t 1970-01-01 01:00:00.000000000 +0100 +++ new/luajit2-2.1-20250529/t/table-clone.t 2025-05-29 07:19:55.000000000 +0200 @@ -0,0 +1,56 @@ +# vim:ft= + +use lib '.'; +use t::TestLJ; + +plan tests => 3 * blocks(); + +run_tests(); + +__DATA__ + +=== TEST 1: clone table +--- lua +jit.off() +local clone = require "table.clone" +local t = { + k = { + a = 1, + b = 2, + }, +} + +local t1 = clone(t) +assert(type(t1.k) == "table") +print("ok") + +--- jv +--- out +ok +--- err + + + +=== TEST 2: empty tables - JIT +--- lua +jit.on() +require "jit.opt".start("hotloop=3") +local clone = require "table.clone" +local t = { + k = { + a = 1, + b = 2, + }, +} + +for i = 1, 10 do + local t1 = clone(t) + assert(type(t1) == "table") +end +print("ok") + +--- jv +--- out +ok +--- err +[TRACE 1 test.lua:11 loop]