mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-04-20 22:13:25 +00:00
Merge remote-tracking branch 'upstream/v2.1' into v2.1
This commit is contained in:
commit
3a272e5e51
6
Makefile
6
Makefile
@ -33,7 +33,8 @@ DPREFIX= $(DESTDIR)$(PREFIX)
|
||||
INSTALL_BIN= $(DPREFIX)/bin
|
||||
INSTALL_LIB= $(DPREFIX)/$(MULTILIB)
|
||||
INSTALL_SHARE= $(DPREFIX)/share
|
||||
INSTALL_INC= $(DPREFIX)/include/luajit-$(MAJVER).$(MINVER)
|
||||
INSTALL_DEFINC= $(DPREFIX)/include/luajit-$(MAJVER).$(MINVER)
|
||||
INSTALL_INC= $(INSTALL_DEFINC)
|
||||
|
||||
INSTALL_LJLIBD= $(INSTALL_SHARE)/luajit-$(VERSION)
|
||||
INSTALL_JITLIB= $(INSTALL_LJLIBD)/jit
|
||||
@ -78,6 +79,9 @@ UNINSTALL= $(RM)
|
||||
LDCONFIG= ldconfig -n 2>/dev/null
|
||||
SED_PC= sed -e "s|^prefix=.*|prefix=$(PREFIX)|" \
|
||||
-e "s|^multilib=.*|multilib=$(MULTILIB)|"
|
||||
ifneq ($(INSTALL_DEFINC),$(INSTALL_INC))
|
||||
SED_PC+= -e "s|^includedir=.*|includedir=$(INSTALL_INC)|"
|
||||
endif
|
||||
|
||||
FILE_T= luajit
|
||||
FILE_A= libluajit.a
|
||||
|
@ -50,8 +50,6 @@
|
||||
</li><li>
|
||||
<a href="faq.html">FAQ</a>
|
||||
</li><li>
|
||||
<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a>
|
||||
</li><li>
|
||||
<a href="https://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
|
||||
</li></ul>
|
||||
</div>
|
||||
|
@ -61,8 +61,6 @@
|
||||
</li><li>
|
||||
<a href="faq.html">FAQ</a>
|
||||
</li><li>
|
||||
<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a>
|
||||
</li><li>
|
||||
<a href="https://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
|
||||
</li></ul>
|
||||
</div>
|
||||
|
@ -50,8 +50,6 @@
|
||||
</li><li>
|
||||
<a href="faq.html">FAQ</a>
|
||||
</li><li>
|
||||
<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a>
|
||||
</li><li>
|
||||
<a href="https://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
|
||||
</li></ul>
|
||||
</div>
|
||||
|
@ -50,8 +50,6 @@
|
||||
</li><li>
|
||||
<a href="faq.html">FAQ</a>
|
||||
</li><li>
|
||||
<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a>
|
||||
</li><li>
|
||||
<a href="https://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
|
||||
</li></ul>
|
||||
</div>
|
||||
|
@ -55,8 +55,6 @@ td.abiparam { font-weight: bold; width: 6em; }
|
||||
</li><li>
|
||||
<a href="faq.html">FAQ</a>
|
||||
</li><li>
|
||||
<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a>
|
||||
</li><li>
|
||||
<a href="https://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
|
||||
</li></ul>
|
||||
</div>
|
||||
|
@ -55,8 +55,6 @@ td.convop { font-style: italic; width: 40%; }
|
||||
</li><li>
|
||||
<a href="faq.html">FAQ</a>
|
||||
</li><li>
|
||||
<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a>
|
||||
</li><li>
|
||||
<a href="https://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
|
||||
</li></ul>
|
||||
</div>
|
||||
|
@ -57,8 +57,6 @@ td.idiomlua b { font-weight: normal; color: #2142bf; }
|
||||
</li><li>
|
||||
<a href="faq.html">FAQ</a>
|
||||
</li><li>
|
||||
<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a>
|
||||
</li><li>
|
||||
<a href="https://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
|
||||
</li></ul>
|
||||
</div>
|
||||
|
@ -50,8 +50,6 @@
|
||||
</li><li>
|
||||
<a href="faq.html">FAQ</a>
|
||||
</li><li>
|
||||
<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a>
|
||||
</li><li>
|
||||
<a href="https://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
|
||||
</li></ul>
|
||||
</div>
|
||||
|
@ -50,8 +50,6 @@
|
||||
</li><li>
|
||||
<a href="faq.html">FAQ</a>
|
||||
</li><li>
|
||||
<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a>
|
||||
</li><li>
|
||||
<a href="https://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
|
||||
</li></ul>
|
||||
</div>
|
||||
|
@ -67,8 +67,6 @@ td.excinterop {
|
||||
</li><li>
|
||||
<a href="faq.html">FAQ</a>
|
||||
</li><li>
|
||||
<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a>
|
||||
</li><li>
|
||||
<a href="https://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
|
||||
</li></ul>
|
||||
</div>
|
||||
|
@ -53,8 +53,6 @@ dd { margin-left: 1.5em; }
|
||||
</li><li>
|
||||
<a class="current" href="faq.html">FAQ</a>
|
||||
</li><li>
|
||||
<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a>
|
||||
</li><li>
|
||||
<a href="https://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
|
||||
</li></ul>
|
||||
</div>
|
||||
@ -65,8 +63,6 @@ dd { margin-left: 1.5em; }
|
||||
<ul style="padding: 0;">
|
||||
<li>The <a href="https://luajit.org/list.html"><span class="ext">»</span> LuaJIT mailing list</a> focuses on topics
|
||||
related to LuaJIT.</li>
|
||||
<li>The <a href="http://wiki.luajit.org/"><span class="ext">»</span> LuaJIT wiki</a> gathers community
|
||||
resources about LuaJIT.</li>
|
||||
<li>News about Lua itself can be found at the
|
||||
<a href="https://www.lua.org/lua-l.html"><span class="ext">»</span> Lua mailing list</a>.
|
||||
The mailing list archives are worth checking out for older postings
|
||||
|
@ -73,8 +73,6 @@ td.compatx {
|
||||
</li><li>
|
||||
<a href="faq.html">FAQ</a>
|
||||
</li><li>
|
||||
<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a>
|
||||
</li><li>
|
||||
<a href="https://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
|
||||
</li></ul>
|
||||
</div>
|
||||
|
@ -135,8 +135,6 @@ table.feature small {
|
||||
</li><li>
|
||||
<a href="faq.html">FAQ</a>
|
||||
</li><li>
|
||||
<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a>
|
||||
</li><li>
|
||||
<a href="https://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
|
||||
</li></ul>
|
||||
</div>
|
||||
|
@ -72,8 +72,6 @@ td.param_default {
|
||||
</li><li>
|
||||
<a href="faq.html">FAQ</a>
|
||||
</li><li>
|
||||
<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a>
|
||||
</li><li>
|
||||
<a href="https://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
|
||||
</li></ul>
|
||||
</div>
|
||||
@ -111,6 +109,7 @@ are accepted:
|
||||
<li><tt>-t type</tt> — Set output file type (default: auto-detect from output name).</li>
|
||||
<li><tt>-a arch</tt> — Override architecture for object files (default: native).</li>
|
||||
<li><tt>-o os</tt> — Override OS for object files (default: native).</li>
|
||||
<li><tt>-F name</tt> — Override filename (default: input filename).</li>
|
||||
<li><tt>-e chunk</tt> — Use chunk string as input.</li>
|
||||
<li><tt>-</tt> (a single minus sign) — Use stdin as input and/or stdout as output.</li>
|
||||
</ul>
|
||||
|
@ -53,8 +53,6 @@ ul li { padding-bottom: 0.3em; }
|
||||
</li><li>
|
||||
<a href="faq.html">FAQ</a>
|
||||
</li><li>
|
||||
<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a>
|
||||
</li><li>
|
||||
<a href="https://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
|
||||
</li></ul>
|
||||
</div>
|
||||
|
@ -34,6 +34,7 @@ Save LuaJIT bytecode: luajit -b[options] input output
|
||||
-t type Set output file type (default: auto-detect from output name).
|
||||
-a arch Override architecture for object files (default: native).
|
||||
-o os Override OS for object files (default: native).
|
||||
-F name Override filename (default: input filename).
|
||||
-e chunk Use chunk string as input.
|
||||
-- Stop handling options.
|
||||
- Use stdin as input and/or stdout as output.
|
||||
@ -50,13 +51,22 @@ local function check(ok, ...)
|
||||
os.exit(1)
|
||||
end
|
||||
|
||||
local function readfile(input, filename)
|
||||
local function readfile(ctx, input)
|
||||
if type(input) == "function" then return input end
|
||||
if ctx.filename then
|
||||
local data
|
||||
if input == "-" then
|
||||
data = io.stdin:read("*a")
|
||||
else
|
||||
local fp = assert(io.open(input, "rb"))
|
||||
data = assert(fp:read("*a"))
|
||||
assert(fp:close())
|
||||
end
|
||||
return check(load(data, ctx.filename))
|
||||
else
|
||||
if input == "-" then input = nil end
|
||||
local f = assert(io.open(input, "r"))
|
||||
local src = f:read("*all")
|
||||
f:close()
|
||||
return check(loadstring(src, filename))
|
||||
return check(loadfile(input))
|
||||
end
|
||||
end
|
||||
|
||||
local function savefile(name, mode)
|
||||
@ -608,13 +618,13 @@ end
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
local function bclist(input, output, filename)
|
||||
local f = readfile(input, filename)
|
||||
local function bclist(ctx, input, output)
|
||||
local f = readfile(ctx, input)
|
||||
require("jit.bc").dump(f, savefile(output, "w"), true)
|
||||
end
|
||||
|
||||
local function bcsave(ctx, input, output, filename)
|
||||
local f = readfile(input, filename)
|
||||
local function bcsave(ctx, input, output)
|
||||
local f = readfile(ctx, input)
|
||||
local s = string.dump(f, ctx.strip)
|
||||
local t = ctx.type
|
||||
if not t then
|
||||
@ -668,8 +678,8 @@ local function docmd(...)
|
||||
ctx.arch = checkarg(tremove(arg, n), map_arch, "architecture")
|
||||
elseif opt == "o" then
|
||||
ctx.os = checkarg(tremove(arg, n), map_os, "OS name")
|
||||
elseif opt == "f" then
|
||||
filename = tremove(arg, n)
|
||||
elseif opt == "F" then
|
||||
ctx.filename = "@"..tremove(arg, n)
|
||||
else
|
||||
usage()
|
||||
end
|
||||
@ -681,7 +691,7 @@ local function docmd(...)
|
||||
end
|
||||
if list then
|
||||
if #arg == 0 or #arg > 2 then usage() end
|
||||
bclist(arg[1], arg[2] or "-", filename or arg[1])
|
||||
bclist(ctx, arg[1], arg[2] or "-")
|
||||
else
|
||||
if #arg ~= 2 then usage() end
|
||||
bcsave(ctx, arg[1], arg[2], filename or arg[1])
|
||||
|
@ -128,7 +128,7 @@ LJLIB_CF(buffer_method_put) LJLIB_REC(.)
|
||||
lj_strfmt_putfnum((SBuf *)sbx, STRFMT_G14, numV(o));
|
||||
} else if (tvisbuf(o)) {
|
||||
SBufExt *sbx2 = bufV(o);
|
||||
if (sbx2 == sbx) lj_err_arg(L, arg+1, LJ_ERR_BUFFER_SELF);
|
||||
if (sbx2 == sbx) lj_err_arg(L, (int)(arg+1), LJ_ERR_BUFFER_SELF);
|
||||
lj_buf_putmem((SBuf *)sbx, sbx2->r, sbufxlen(sbx2));
|
||||
} else if (!mo && !tvisnil(mo = lj_meta_lookup(L, o, MM_tostring))) {
|
||||
/* Call __tostring metamethod inline. */
|
||||
@ -140,7 +140,7 @@ LJLIB_CF(buffer_method_put) LJLIB_REC(.)
|
||||
L->top = L->base + narg;
|
||||
goto retry; /* Retry with the result. */
|
||||
} else {
|
||||
lj_err_argtype(L, arg+1, "string/number/__tostring");
|
||||
lj_err_argtype(L, (int)(arg+1), "string/number/__tostring");
|
||||
}
|
||||
/* Probably not useful to inline other __tostring MMs, e.g. FFI numbers. */
|
||||
}
|
||||
@ -169,7 +169,7 @@ LJLIB_CF(buffer_method_get) LJLIB_REC(.)
|
||||
for (arg = 1; arg < narg; arg++) {
|
||||
TValue *o = &L->base[arg];
|
||||
MSize n = tvisnil(o) ? LJ_MAX_BUF :
|
||||
(MSize) lj_lib_checkintrange(L, arg+1, 0, LJ_MAX_BUF);
|
||||
(MSize) lj_lib_checkintrange(L, (int)(arg+1), 0, LJ_MAX_BUF);
|
||||
MSize len = sbufxlen(sbx);
|
||||
if (n > len) n = len;
|
||||
setstrV(L, o, lj_str_new(L, sbx->r, n));
|
||||
@ -177,7 +177,7 @@ LJLIB_CF(buffer_method_get) LJLIB_REC(.)
|
||||
}
|
||||
if (sbx->r == sbx->w && !sbufiscow(sbx)) sbx->r = sbx->w = sbx->b;
|
||||
lj_gc_check(L);
|
||||
return narg-1;
|
||||
return (int)(narg-1);
|
||||
}
|
||||
|
||||
#if LJ_HASFFI
|
||||
|
@ -93,6 +93,9 @@
|
||||
#elif defined(__CYGWIN__)
|
||||
#define LJ_TARGET_CYGWIN 1
|
||||
#define LUAJIT_OS LUAJIT_OS_POSIX
|
||||
#elif defined(__QNX__)
|
||||
#define LJ_TARGET_QNX 1
|
||||
#define LUAJIT_OS LUAJIT_OS_POSIX
|
||||
#else
|
||||
#define LUAJIT_OS LUAJIT_OS_OTHER
|
||||
#endif
|
||||
|
@ -1201,7 +1201,7 @@ dotypecheck:
|
||||
tmp = ra_scratch(as, allow);
|
||||
rset_clear(allow, tmp);
|
||||
}
|
||||
if (irt_isnum(t) && !(ir->op2 & IRSLOAD_CONVERT))
|
||||
if (ra_hasreg(dest) && irt_isnum(t) && !(ir->op2 & IRSLOAD_CONVERT))
|
||||
emit_dn(as, A64I_FMOV_D_R, (dest & 31), tmp);
|
||||
/* Need type check, even if the load result is unused. */
|
||||
asm_guardcc(as, irt_isnum(t) ? CC_LS : CC_NE);
|
||||
|
@ -1117,7 +1117,7 @@ static LJ_AINLINE TRef recff_sbufx_len(jit_State *J, TRef trr, TRef trw)
|
||||
}
|
||||
|
||||
/* Emit typecheck for string buffer. */
|
||||
static TRef recff_sbufx_check(jit_State *J, RecordFFData *rd, int arg)
|
||||
static TRef recff_sbufx_check(jit_State *J, RecordFFData *rd, ptrdiff_t arg)
|
||||
{
|
||||
TRef trtype, ud = J->base[arg];
|
||||
if (!tvisbuf(&rd->argv[arg])) lj_trace_err(J, LJ_TRERR_BADTYPE);
|
||||
@ -1135,7 +1135,7 @@ static TRef recff_sbufx_write(jit_State *J, TRef ud)
|
||||
}
|
||||
|
||||
/* Check for integer in range for the buffer API. */
|
||||
static TRef recff_sbufx_checkint(jit_State *J, RecordFFData *rd, int arg)
|
||||
static TRef recff_sbufx_checkint(jit_State *J, RecordFFData *rd, ptrdiff_t arg)
|
||||
{
|
||||
TRef tr = J->base[arg];
|
||||
TRef trlim = lj_ir_kint(J, LJ_MAX_BUF);
|
||||
|
@ -125,7 +125,7 @@ static PRGR libfunc_rgr;
|
||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
|
||||
#define LJ_TARGET_HAS_GETENTROPY 1
|
||||
#endif
|
||||
#elif (LJ_TARGET_BSD && !defined(__NetBSD__)) || LJ_TARGET_SOLARIS || LJ_TARGET_CYGWIN
|
||||
#elif (LJ_TARGET_BSD && !defined(__NetBSD__)) || LJ_TARGET_SOLARIS || LJ_TARGET_CYGWIN || LJ_TARGET_QNX
|
||||
#define LJ_TARGET_HAS_GETENTROPY 1
|
||||
#endif
|
||||
|
||||
|
@ -185,7 +185,11 @@ static void profile_timer_start(ProfileState *ps)
|
||||
tm.it_value.tv_sec = tm.it_interval.tv_sec = interval / 1000;
|
||||
tm.it_value.tv_usec = tm.it_interval.tv_usec = (interval % 1000) * 1000;
|
||||
setitimer(ITIMER_PROF, &tm, NULL);
|
||||
#if LJ_TARGET_QNX
|
||||
sa.sa_flags = 0;
|
||||
#else
|
||||
sa.sa_flags = SA_RESTART;
|
||||
#endif
|
||||
sa.sa_handler = profile_signal;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sigaction(SIGPROF, &sa, &ps->oldsa);
|
||||
|
@ -1964,7 +1964,7 @@ static void rec_varg(jit_State *J, BCReg dst, ptrdiff_t nresults)
|
||||
vbase = emitir(IRT(IR_ADD, IRT_PGC), vbase, lj_ir_kint(J, frofs-8*(1+LJ_FR2)));
|
||||
for (i = 0; i < nload; i++) {
|
||||
IRType t = itype2irt(&J->L->base[i-1-LJ_FR2-nvararg]);
|
||||
J->base[dst+i] = lj_record_vload(J, vbase, i, t);
|
||||
J->base[dst+i] = lj_record_vload(J, vbase, (MSize)i, t);
|
||||
}
|
||||
} else {
|
||||
emitir(IRTGI(IR_LE), fr, lj_ir_kint(J, frofs));
|
||||
@ -2572,7 +2572,8 @@ void lj_record_ins(jit_State *J)
|
||||
break;
|
||||
case BC_JLOOP:
|
||||
rec_loop_jit(J, rc, rec_loop(J, ra,
|
||||
!bc_isret(bc_op(traceref(J, rc)->startins))));
|
||||
!bc_isret(bc_op(traceref(J, rc)->startins)) &&
|
||||
bc_op(traceref(J, rc)->startins) != BC_ITERN));
|
||||
break;
|
||||
|
||||
case BC_IFORL:
|
||||
|
Loading…
Reference in New Issue
Block a user