diff --git a/CMakeLists.txt b/CMakeLists.txt index 09a446e7..0e00fc85 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -201,7 +201,7 @@ endif() set(MEGA_ZLIB_VER "1.2.11") set(MEGA_LUA51_VER "5.1.5") -set(MEGA_LUAJIT_VER "2.1.0-f3c8569") +set(MEGA_LUAJIT_VER "2.1.0-a91d0d9") set(MEGA_LIBOGG_VER "1.3.2") set(MEGA_LIBVORBIS_VER "1.3.5") set(MEGA_LIBTHEORA_VER "1.1.1") diff --git a/libs/LuaJIT/src/jit/bcsave.lua b/libs/LuaJIT/src/jit/bcsave.lua index ab13667a..bc959327 100644 --- a/libs/LuaJIT/src/jit/bcsave.lua +++ b/libs/LuaJIT/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/libs/LuaJIT/src/lj_opt_fold.c b/libs/LuaJIT/src/lj_opt_fold.c index 2f903e27..bdaa0e4f 100644 --- a/libs/LuaJIT/src/lj_opt_fold.c +++ b/libs/LuaJIT/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