diff --git a/Makefile b/Makefile
index 10c83c73..b0288b4d 100644
--- a/Makefile
+++ b/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
diff --git a/doc/contact.html b/doc/contact.html
index 89c1af95..19f7d294 100644
--- a/doc/contact.html
+++ b/doc/contact.html
@@ -50,8 +50,6 @@
FAQ
-Wiki »
-
Mailing List »
diff --git a/doc/ext_buffer.html b/doc/ext_buffer.html
index 192110a7..2a82aa97 100644
--- a/doc/ext_buffer.html
+++ b/doc/ext_buffer.html
@@ -61,8 +61,6 @@
FAQ
-Wiki »
-
Mailing List »
diff --git a/doc/ext_c_api.html b/doc/ext_c_api.html
index 21dc1310..151d20b5 100644
--- a/doc/ext_c_api.html
+++ b/doc/ext_c_api.html
@@ -50,8 +50,6 @@
FAQ
-Wiki »
-
Mailing List »
diff --git a/doc/ext_ffi.html b/doc/ext_ffi.html
index b39ae314..5f1e2d7c 100644
--- a/doc/ext_ffi.html
+++ b/doc/ext_ffi.html
@@ -50,8 +50,6 @@
FAQ
-Wiki »
-
Mailing List »
diff --git a/doc/ext_ffi_api.html b/doc/ext_ffi_api.html
index b8da1c95..89ddb0d9 100644
--- a/doc/ext_ffi_api.html
+++ b/doc/ext_ffi_api.html
@@ -55,8 +55,6 @@ td.abiparam { font-weight: bold; width: 6em; }
FAQ
-Wiki »
-
Mailing List »
diff --git a/doc/ext_ffi_semantics.html b/doc/ext_ffi_semantics.html
index 22f7f17c..603f9950 100644
--- a/doc/ext_ffi_semantics.html
+++ b/doc/ext_ffi_semantics.html
@@ -55,8 +55,6 @@ td.convop { font-style: italic; width: 40%; }
FAQ
-Wiki »
-
Mailing List »
diff --git a/doc/ext_ffi_tutorial.html b/doc/ext_ffi_tutorial.html
index e0bf9040..ff0c3a9a 100644
--- a/doc/ext_ffi_tutorial.html
+++ b/doc/ext_ffi_tutorial.html
@@ -57,8 +57,6 @@ td.idiomlua b { font-weight: normal; color: #2142bf; }
FAQ
-Wiki »
-
Mailing List »
diff --git a/doc/ext_jit.html b/doc/ext_jit.html
index b8a25967..3ff5c05e 100644
--- a/doc/ext_jit.html
+++ b/doc/ext_jit.html
@@ -50,8 +50,6 @@
FAQ
-Wiki »
-
Mailing List »
diff --git a/doc/ext_profiler.html b/doc/ext_profiler.html
index b645a204..d6e26efd 100644
--- a/doc/ext_profiler.html
+++ b/doc/ext_profiler.html
@@ -50,8 +50,6 @@
FAQ
-Wiki »
-
Mailing List »
diff --git a/doc/extensions.html b/doc/extensions.html
index 040fc588..f006a6db 100644
--- a/doc/extensions.html
+++ b/doc/extensions.html
@@ -67,8 +67,6 @@ td.excinterop {
FAQ
-Wiki »
-
Mailing List »
diff --git a/doc/faq.html b/doc/faq.html
index 9effeb16..c07fd248 100644
--- a/doc/faq.html
+++ b/doc/faq.html
@@ -53,8 +53,6 @@ dd { margin-left: 1.5em; }
FAQ
-Wiki »
-
Mailing List »
@@ -65,8 +63,6 @@ dd { margin-left: 1.5em; }
- The » LuaJIT mailing list focuses on topics
related to LuaJIT.
-- The » LuaJIT wiki gathers community
-resources about LuaJIT.
- News about Lua itself can be found at the
» Lua mailing list.
The mailing list archives are worth checking out for older postings
diff --git a/doc/install.html b/doc/install.html
index 9fad31f4..d78dda3e 100644
--- a/doc/install.html
+++ b/doc/install.html
@@ -73,8 +73,6 @@ td.compatx {
-
FAQ
-
-Wiki »
-
-
Mailing List »
diff --git a/doc/luajit.html b/doc/luajit.html
index 03a29528..e3a5478d 100644
--- a/doc/luajit.html
+++ b/doc/luajit.html
@@ -135,8 +135,6 @@ table.feature small {
FAQ
-Wiki »
-
Mailing List »
diff --git a/doc/running.html b/doc/running.html
index 177e6357..9979d223 100644
--- a/doc/running.html
+++ b/doc/running.html
@@ -72,8 +72,6 @@ td.param_default {
FAQ
-Wiki »
-
Mailing List »
@@ -111,6 +109,7 @@ are accepted:
-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.
- (a single minus sign) — Use stdin as input and/or stdout as output.
diff --git a/doc/status.html b/doc/status.html
index 1c86c103..efb1e064 100644
--- a/doc/status.html
+++ b/doc/status.html
@@ -53,8 +53,6 @@ ul li { padding-bottom: 0.3em; }
FAQ
-Wiki »
-
Mailing List »
diff --git a/src/jit/bcsave.lua b/src/jit/bcsave.lua
index 43fe74e1..1ddb37c1 100644
--- a/src/jit/bcsave.lua
+++ b/src/jit/bcsave.lua
@@ -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 input == "-" then input = nil end
- local f = assert(io.open(input, "r"))
- local src = f:read("*all")
- f:close()
- return check(loadstring(src, filename))
+ 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
+ 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])
diff --git a/src/lib_buffer.c b/src/lib_buffer.c
index aad8e7eb..d6ff1346 100644
--- a/src/lib_buffer.c
+++ b/src/lib_buffer.c
@@ -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
diff --git a/src/lj_arch.h b/src/lj_arch.h
index 882c99cb..5fb798d9 100644
--- a/src/lj_arch.h
+++ b/src/lj_arch.h
@@ -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
diff --git a/src/lj_asm_arm64.h b/src/lj_asm_arm64.h
index 1f44d023..4b7066f2 100644
--- a/src/lj_asm_arm64.h
+++ b/src/lj_asm_arm64.h
@@ -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);
diff --git a/src/lj_ffrecord.c b/src/lj_ffrecord.c
index 60c1d84f..022de1aa 100644
--- a/src/lj_ffrecord.c
+++ b/src/lj_ffrecord.c
@@ -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);
diff --git a/src/lj_prng.c b/src/lj_prng.c
index 9e57505e..01935e57 100644
--- a/src/lj_prng.c
+++ b/src/lj_prng.c
@@ -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
diff --git a/src/lj_profile.c b/src/lj_profile.c
index f0af91cb..4a13537d 100644
--- a/src/lj_profile.c
+++ b/src/lj_profile.c
@@ -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);
diff --git a/src/lj_record.c b/src/lj_record.c
index 92bdbfc9..bfd41236 100644
--- a/src/lj_record.c
+++ b/src/lj_record.c
@@ -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: