mirror of
https://github.com/love2d/megasource.git
synced 2026-08-12 08:30:59 +02:00
Merge branch 'main' into 12.x
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user