diff --git a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/bcsave.lua b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/bcsave.lua index ab13667a..bc959327 100644 --- a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/bcsave.lua +++ b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/bcsave.lua @@ -60,6 +60,11 @@ local function savefile(name, mode) return check(io.open(name, mode)) end +local function set_stdout_binary(ffi) + ffi.cdef[[int _setmode(int fd, int mode);]] + ffi.C._setmode(1, 0x8000) +end + ------------------------------------------------------------------------------ local map_type = { @@ -125,6 +130,11 @@ local function bcsave_tail(fp, output, s) end local function bcsave_raw(output, s) + if output == "-" and jit.os == "Windows" then + local ok, ffi = pcall(require, "ffi") + check(ok, "FFI library required to write binary file to stdout") + set_stdout_binary(ffi) + end local fp = savefile(output, "wb") bcsave_tail(fp, output, s) end @@ -568,6 +578,9 @@ end local function bcsave_obj(ctx, output, s) local ok, ffi = pcall(require, "ffi") check(ok, "FFI library required to write this file type") + if output == "-" and jit.os == "Windows" then + set_stdout_binary(ffi) + end if ctx.os == "windows" then return bcsave_peobj(ctx, output, s, ffi) elseif ctx.os == "osx" then diff --git a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/libluajit.a b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/libluajit.a index d9dd4fef..11850655 100644 Binary files a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/libluajit.a and b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/libluajit.a differ diff --git a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/bcsave.lua b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/bcsave.lua index ab13667a..bc959327 100644 --- a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/bcsave.lua +++ b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/bcsave.lua @@ -60,6 +60,11 @@ local function savefile(name, mode) return check(io.open(name, mode)) end +local function set_stdout_binary(ffi) + ffi.cdef[[int _setmode(int fd, int mode);]] + ffi.C._setmode(1, 0x8000) +end + ------------------------------------------------------------------------------ local map_type = { @@ -125,6 +130,11 @@ local function bcsave_tail(fp, output, s) end local function bcsave_raw(output, s) + if output == "-" and jit.os == "Windows" then + local ok, ffi = pcall(require, "ffi") + check(ok, "FFI library required to write binary file to stdout") + set_stdout_binary(ffi) + end local fp = savefile(output, "wb") bcsave_tail(fp, output, s) end @@ -568,6 +578,9 @@ end local function bcsave_obj(ctx, output, s) local ok, ffi = pcall(require, "ffi") check(ok, "FFI library required to write this file type") + if output == "-" and jit.os == "Windows" then + set_stdout_binary(ffi) + end if ctx.os == "windows" then return bcsave_peobj(ctx, output, s, ffi) elseif ctx.os == "osx" then diff --git a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/libluajit.a b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/libluajit.a index 54b75396..9bd4a7b3 100644 Binary files a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/libluajit.a and b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/libluajit.a differ diff --git a/love/src/jni/LuaJIT-2.1/android/x86/jit/bcsave.lua b/love/src/jni/LuaJIT-2.1/android/x86/jit/bcsave.lua index ab13667a..bc959327 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86/jit/bcsave.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86/jit/bcsave.lua @@ -60,6 +60,11 @@ local function savefile(name, mode) return check(io.open(name, mode)) end +local function set_stdout_binary(ffi) + ffi.cdef[[int _setmode(int fd, int mode);]] + ffi.C._setmode(1, 0x8000) +end + ------------------------------------------------------------------------------ local map_type = { @@ -125,6 +130,11 @@ local function bcsave_tail(fp, output, s) end local function bcsave_raw(output, s) + if output == "-" and jit.os == "Windows" then + local ok, ffi = pcall(require, "ffi") + check(ok, "FFI library required to write binary file to stdout") + set_stdout_binary(ffi) + end local fp = savefile(output, "wb") bcsave_tail(fp, output, s) end @@ -568,6 +578,9 @@ end local function bcsave_obj(ctx, output, s) local ok, ffi = pcall(require, "ffi") check(ok, "FFI library required to write this file type") + if output == "-" and jit.os == "Windows" then + set_stdout_binary(ffi) + end if ctx.os == "windows" then return bcsave_peobj(ctx, output, s, ffi) elseif ctx.os == "osx" then diff --git a/love/src/jni/LuaJIT-2.1/android/x86/libluajit.a b/love/src/jni/LuaJIT-2.1/android/x86/libluajit.a index aea69707..905fe541 100644 Binary files a/love/src/jni/LuaJIT-2.1/android/x86/libluajit.a and b/love/src/jni/LuaJIT-2.1/android/x86/libluajit.a differ diff --git a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/bcsave.lua b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/bcsave.lua index ab13667a..bc959327 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/bcsave.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/bcsave.lua @@ -60,6 +60,11 @@ local function savefile(name, mode) return check(io.open(name, mode)) end +local function set_stdout_binary(ffi) + ffi.cdef[[int _setmode(int fd, int mode);]] + ffi.C._setmode(1, 0x8000) +end + ------------------------------------------------------------------------------ local map_type = { @@ -125,6 +130,11 @@ local function bcsave_tail(fp, output, s) end local function bcsave_raw(output, s) + if output == "-" and jit.os == "Windows" then + local ok, ffi = pcall(require, "ffi") + check(ok, "FFI library required to write binary file to stdout") + set_stdout_binary(ffi) + end local fp = savefile(output, "wb") bcsave_tail(fp, output, s) end @@ -568,6 +578,9 @@ end local function bcsave_obj(ctx, output, s) local ok, ffi = pcall(require, "ffi") check(ok, "FFI library required to write this file type") + if output == "-" and jit.os == "Windows" then + set_stdout_binary(ffi) + end if ctx.os == "windows" then return bcsave_peobj(ctx, output, s, ffi) elseif ctx.os == "osx" then diff --git a/love/src/jni/LuaJIT-2.1/android/x86_64/libluajit.a b/love/src/jni/LuaJIT-2.1/android/x86_64/libluajit.a index 3275e35c..1ad8eac3 100644 Binary files a/love/src/jni/LuaJIT-2.1/android/x86_64/libluajit.a and b/love/src/jni/LuaJIT-2.1/android/x86_64/libluajit.a differ diff --git a/love/src/jni/LuaJIT-2.1/build_instructions.bat b/love/src/jni/LuaJIT-2.1/build_instructions.bat index c3003340..8e42dba3 100644 --- a/love/src/jni/LuaJIT-2.1/build_instructions.bat +++ b/love/src/jni/LuaJIT-2.1/build_instructions.bat @@ -1,10 +1,8 @@ rem Build instruction assume using WSL + Clang for Windows (with MSVC x86+x64 toolset for -m32 switch) rem This assume NDK r19 or later. See https://github.com/LuaJIT/LuaJIT/issues/477 for more information. -rem Make sure LuaJIT and the prebuilt is already in your PATH environment variable. -rem As of commit 384d6d5 in LuaJIT v2.1 repository, lj_ircall.h.patch is no longer needed. - -rem If you're confused which one should be added your path: +rem Make sure LuaJIT (yes, you need LuaJIT interpreter) and the NDK toolchain binaries is already in +rem your PATH environment variable. If you're confused which part of the NDK should be added your path: rem \toolchains\llvm\prebuilt\windows-x86_64\bin mkdir android\arm64-v8a diff --git a/love/src/jni/LuaJIT-2.1/doc/install.html b/love/src/jni/LuaJIT-2.1/doc/install.html index e4af9dde..3cce786c 100644 --- a/love/src/jni/LuaJIT-2.1/doc/install.html +++ b/love/src/jni/LuaJIT-2.1/doc/install.html @@ -411,7 +411,8 @@ NDKCROSS=$NDKBIN/aarch64-linux-android- NDKCC=$NDKBIN/aarch64-linux-android21-clang make CROSS=$NDKCROSS \ STATIC_CC=$NDKCC DYNAMIC_CC="$NDKCC -fPIC" \ - TARGET_LD=$NDKCC + TARGET_LD=$NDKCC TARGET_AR=$NDKBIN/llvm-ar + TARGET_STRIP=$NDKBIN/llvm-strip # Android/ARM, armeabi-v7a (ARMv7 VFP), Android 4.1+ (JB) NDKDIR=/opt/android/ndk @@ -420,7 +421,8 @@ NDKCROSS=$NDKBIN/arm-linux-androideabi- NDKCC=$NDKBIN/armv7a-linux-androideabi16-clang make HOST_CC="gcc -m32" CROSS=$NDKCROSS \ STATIC_CC=$NDKCC DYNAMIC_CC="$NDKCC -fPIC" \ - TARGET_LD=$NDKCC + TARGET_LD=$NDKCC TARGET_AR=$NDKBIN/llvm-ar + TARGET_STRIP=$NDKBIN/llvm-strip

You can cross-compile for iOS 3.0+ (iPhone/iPad) using the » iOS SDK: diff --git a/love/src/jni/LuaJIT-2.1/src/jit/bcsave.lua b/love/src/jni/LuaJIT-2.1/src/jit/bcsave.lua index ab13667a..bc959327 100644 --- a/love/src/jni/LuaJIT-2.1/src/jit/bcsave.lua +++ b/love/src/jni/LuaJIT-2.1/src/jit/bcsave.lua @@ -60,6 +60,11 @@ local function savefile(name, mode) return check(io.open(name, mode)) end +local function set_stdout_binary(ffi) + ffi.cdef[[int _setmode(int fd, int mode);]] + ffi.C._setmode(1, 0x8000) +end + ------------------------------------------------------------------------------ local map_type = { @@ -125,6 +130,11 @@ local function bcsave_tail(fp, output, s) end local function bcsave_raw(output, s) + if output == "-" and jit.os == "Windows" then + local ok, ffi = pcall(require, "ffi") + check(ok, "FFI library required to write binary file to stdout") + set_stdout_binary(ffi) + end local fp = savefile(output, "wb") bcsave_tail(fp, output, s) end @@ -568,6 +578,9 @@ end local function bcsave_obj(ctx, output, s) local ok, ffi = pcall(require, "ffi") check(ok, "FFI library required to write this file type") + if output == "-" and jit.os == "Windows" then + set_stdout_binary(ffi) + end if ctx.os == "windows" then return bcsave_peobj(ctx, output, s, ffi) elseif ctx.os == "osx" then diff --git a/love/src/jni/LuaJIT-2.1/src/lj_opt_fold.c b/love/src/jni/LuaJIT-2.1/src/lj_opt_fold.c index 2f903e27..bdaa0e4f 100644 --- a/love/src/jni/LuaJIT-2.1/src/lj_opt_fold.c +++ b/love/src/jni/LuaJIT-2.1/src/lj_opt_fold.c @@ -1037,8 +1037,7 @@ LJFOLDF(simplify_numadd_xneg) LJFOLD(SUB any KNUM) LJFOLDF(simplify_numsub_k) { - lua_Number n = knumright; - if (n == 0.0) /* x - (+-0) ==> x */ + if (ir_knum(fright)->u64 == 0) /* x - (+0) ==> x */ return LEFTFOLD; return NEXTFOLD; } @@ -2412,6 +2411,17 @@ LJFOLDF(xload_kptr) LJFOLD(XLOAD any any) LJFOLDX(lj_opt_fwd_xload) +/* -- Frame handling ------------------------------------------------------ */ + +/* Prevent CSE of a REF_BASE operand across IR_RETF. */ +LJFOLD(SUB any BASE) +LJFOLD(SUB BASE any) +LJFOLD(EQ any BASE) +LJFOLDF(fold_base) +{ + return lj_opt_cselim(J, J->chain[IR_RETF]); +} + /* -- Write barriers ------------------------------------------------------ */ /* Write barriers are amenable to CSE, but not across any incremental