Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/luajit-rocks.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRonan Collobert <locronan@fb.com>2015-09-01 02:27:36 +0300
committerRonan Collobert <locronan@fb.com>2015-09-01 02:27:36 +0300
commit21269a1bc078531371d82db31a8db968befb8fc8 (patch)
tree39fac0803294ff5c45e9ba51c71e016efc42fb5a
parent0458550e6b40205b68bb484a04a6c04cca66828f (diff)
Squashed 'luajit-2.0/' changes from 8b6af89..8715ae6
8715ae6 Properly handle OOM in trace_save(). 424940f Fix NYICF error message. a5b1c4d FFI: Don't propagate qualifiers into subtypes of complex. 575bfe5 Limit number of arguments given to io.lines() and fp:lines(). 7f454ae Fix narrowing of TOBIT. 7234789 x64: Allow building without external unwinder. 69e5342 RELEASE LuaJIT-2.0.4 cd4c59f Update changelog. 9622d6b x86/x64: Fix argument check for bit shifts. 11106aa Fix stack check in narrowing optimization. a9fd686 Doc cleanup. git-subtree-dir: luajit-2.0 git-subtree-split: 8715ae65c1f70f2402b89a004b88ab04ca103625
-rw-r--r--Makefile2
-rw-r--r--README2
-rw-r--r--doc/changes.html52
-rw-r--r--doc/install.html4
-rw-r--r--doc/running.html2
-rw-r--r--doc/status.html13
-rw-r--r--etc/luajit.pc2
-rw-r--r--src/Makefile9
-rw-r--r--src/jit/bc.lua2
-rw-r--r--src/jit/bcsave.lua2
-rw-r--r--src/jit/dump.lua2
-rw-r--r--src/jit/v.lua2
-rw-r--r--src/lib_io.c15
-rw-r--r--src/lj_arch.h2
-rw-r--r--src/lj_cparse.c4
-rw-r--r--src/lj_err.c4
-rw-r--r--src/lj_frame.h4
-rw-r--r--src/lj_opt_narrow.c21
-rw-r--r--src/lj_trace.c16
-rw-r--r--src/lj_traceerr.h2
-rw-r--r--src/luaconf.h2
-rw-r--r--src/luajit.h6
-rw-r--r--src/ps4build.bat4
-rw-r--r--src/vm_x86.dasc34
24 files changed, 153 insertions, 55 deletions
diff --git a/Makefile b/Makefile
index 0891b71..0cbe741 100644
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,7 @@
MAJVER= 2
MINVER= 0
-RELVER= 3
+RELVER= 4
VERSION= $(MAJVER).$(MINVER).$(RELVER)
ABIVER= 5.1
diff --git a/README b/README
index d151bb7..44366af 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-README for LuaJIT 2.0.3
+README for LuaJIT 2.0.4
-----------------------
LuaJIT is a Just-In-Time (JIT) compiler for the Lua programming language.
diff --git a/doc/changes.html b/doc/changes.html
index 3d8f5db..d7b83ce 100644
--- a/doc/changes.html
+++ b/doc/changes.html
@@ -63,7 +63,7 @@ div.major { max-width: 600px; padding: 1em; margin: 1em 0 1em 0; }
<div id="main">
<p>
This is a list of changes between the released versions of LuaJIT.<br>
-The current <span style="color: #0000c0;">stable version</span> is <strong>LuaJIT&nbsp;2.0.3</strong>.<br>
+The current <span style="color: #0000c0;">stable version</span> is <strong>LuaJIT&nbsp;2.0.4</strong>.<br>
</p>
<p>
Please check the
@@ -72,6 +72,56 @@ to see whether newer versions are available.
</p>
<div class="major" style="background: #d0d0ff;">
+<h2 id="LuaJIT-2.0.4">LuaJIT 2.0.4 &mdash; 2015-05-14</h2>
+<ul>
+<li>Fix stack check in narrowing optimization.</li>
+<li>Fix Lua/C API typecheck error for special indexes.</li>
+<li>Fix string to number conversion.</li>
+<li>Fix lexer error for chunks without tokens.</li>
+<li>Don't compile <tt>IR_RETF</tt> after <tt>CALLT</tt> to ff with-side effects.</li>
+<li>Fix <tt>BC_UCLO</tt>/<tt>BC_JMP</tt> join optimization in Lua parser.</li>
+<li>Fix corner case in string to number conversion.</li>
+<li>Gracefully handle <tt>lua_error()</tt> for a suspended coroutine.</li>
+<li>Avoid error messages when building with Clang.</li>
+<li>Fix snapshot #0 handling for traces with a stack check on entry.</li>
+<li>Fix fused constant loads under high register pressure.</li>
+<li>Invalidate backpropagation cache after DCE.</li>
+<li>Fix ABC elimination.</li>
+<li>Fix debug info for main chunk of stripped bytecode.</li>
+<li>Fix FOLD rule for <tt>string.sub(s, ...) == k</tt>.</li>
+<li>Fix FOLD rule for <tt>STRREF</tt> of <tt>SNEW</tt>.</li>
+<li>Fix frame traversal while searching for error function.</li>
+<li>Prevent GC estimate miscalculation due to buffer growth.</li>
+<li>Prevent adding side traces for stack checks.</li>
+<li>Fix top slot calculation for snapshots with continuations.</li>
+<li>Fix check for reuse of SCEV results in <tt>FORL</tt>.</li>
+<li>Add PS Vita port.</li>
+<li>Fix compatibility issues with Illumos.</li>
+<li>Fix DragonFly build (unsupported).</li>
+<li>OpenBSD/x86: Better executable memory allocation for W^X mode.</li>
+<li>x86: Fix argument checks for <tt>ipairs()</tt> iterator.</li>
+<li>x86: <tt>lj_math_random_step()</tt> clobbers XMM regs on OSX Clang.</li>
+<li>x86: Fix code generation for unused result of <tt>math.random()</tt>.</li>
+<li>x64: Allow building with <tt>LUAJIT_USE_SYSMALLOC</tt> and <tt>LUAJIT_USE_VALGRIND</tt>.</li>
+<li>x86/x64: Fix argument check for bit shifts.</li>
+<li>x86/x64: Fix code generation for fused test/arith ops.</li>
+<li>ARM: Fix write barrier check in <tt>BC_USETS</tt>.</li>
+<li>PPC: Fix red zone overflow in machine code generation.</li>
+<li>PPC: Don't use <tt>mcrxr</tt> on PPE.</li>
+<li>Various archs: Fix excess stack growth in interpreter.</li>
+<li>FFI: Fix FOLD rule for <tt>TOBIT</tt> + <tt>CONV num.u32</tt>.</li>
+<li>FFI: Prevent DSE across <tt>ffi.string()</tt>.</li>
+<li>FFI: No meta fallback when indexing pointer to incomplete struct.</li>
+<li>FFI: Fix initialization of unions of subtypes.</li>
+<li>FFI: Fix cdata vs. non-cdata arithmetic and comparisons.</li>
+<li>FFI: Fix <tt>__index</tt>/<tt>__newindex</tt> metamethod resolution for ctypes.</li>
+<li>FFI: Fix compilation of reference field access.</li>
+<li>FFI: Fix frame traversal for backtraces with FFI callbacks.</li>
+<li>FFI: Fix recording of indexing a struct pointer ctype object itself.</li>
+<li>FFI: Allow non-scalar cdata to be compared for equality by address.</li>
+<li>FFI: Fix pseudo type conversions for type punning.</li>
+</ul>
+
<h2 id="LuaJIT-2.0.3">LuaJIT 2.0.3 &mdash; 2014-03-12</h2>
<ul>
<li>Add PS4 port.</li>
diff --git a/doc/install.html b/doc/install.html
index 7369aeb..7a878b1 100644
--- a/doc/install.html
+++ b/doc/install.html
@@ -188,8 +188,8 @@ open a terminal window and change to this directory. Now unpack the archive
and change to the newly created directory:
</p>
<pre class="code">
-tar zxf LuaJIT-2.0.3.tar.gz
-cd LuaJIT-2.0.3</pre>
+tar zxf LuaJIT-2.0.4.tar.gz
+cd LuaJIT-2.0.4</pre>
<h3>Building LuaJIT</h3>
<p>
The supplied Makefiles try to auto-detect the settings needed for your
diff --git a/doc/running.html b/doc/running.html
index c2ec511..c6e1c29 100644
--- a/doc/running.html
+++ b/doc/running.html
@@ -186,7 +186,7 @@ itself. For a description of their options and output format, please
read the comment block at the start of their source.
They can be found in the <tt>lib</tt> directory of the source
distribution or installed under the <tt>jit</tt> directory. By default
-this is <tt>/usr/local/share/luajit-2.0.3/jit</tt> on POSIX
+this is <tt>/usr/local/share/luajit-2.0.4/jit</tt> on POSIX
systems.
</p>
diff --git a/doc/status.html b/doc/status.html
index e3655d4..b4bbec7 100644
--- a/doc/status.html
+++ b/doc/status.html
@@ -1,7 +1,7 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
-<title>Status &amp; Roadmap</title>
+<title>Status</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2015, Mike Pall">
@@ -17,7 +17,7 @@ ul li { padding-bottom: 0.3em; }
<a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
</div>
<div id="head">
-<h1>Status &amp; Roadmap</h1>
+<h1>Status</h1>
</div>
<div id="nav">
<ul><li>
@@ -102,15 +102,6 @@ handled correctly. The error may fall through an on-trace
garbage collector.
</li>
</ul>
-
-<h2>Roadmap</h2>
-<p>
-Please refer to the
-<a href="http://www.freelists.org/post/luajit/LuaJIT-Roadmap-20122013"><span class="ext">&raquo;</span>&nbsp;LuaJIT Roadmap 2012/2013</a> and an
-<a href="http://www.freelists.org/post/luajit/LuaJIT-Roadmap-20122013-UPDATE"><span class="ext">&raquo;</span>&nbsp;update on release planning</a> for details.
-</p>
-<p>
-</p>
<br class="flush">
</div>
<div id="foot">
diff --git a/etc/luajit.pc b/etc/luajit.pc
index d3f0cf3..a652b40 100644
--- a/etc/luajit.pc
+++ b/etc/luajit.pc
@@ -1,7 +1,7 @@
# Package information for LuaJIT to be used by pkg-config.
majver=2
minver=0
-relver=3
+relver=4
version=${majver}.${minver}.${relver}
abiver=5.1
diff --git a/src/Makefile b/src/Makefile
index 33b0a43..5021e47 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -12,7 +12,7 @@
MAJVER= 2
MINVER= 0
-RELVER= 3
+RELVER= 4
ABIVER= 5.1
NODOTABIVER= 51
@@ -243,9 +243,6 @@ ifneq (,$(findstring LJ_TARGET_PS3 1,$(TARGET_TESTARCH)))
TARGET_ARCH+= -D__CELLOS_LV2__
TARGET_XCFLAGS+= -DLUAJIT_USE_SYSMALLOC
endif
-ifneq (,$(findstring LJ_NO_UNWIND 1,$(TARGET_TESTARCH)))
- TARGET_ARCH+= -DLUAJIT_NO_UNWIND
-endif
TARGET_XCFLAGS+= $(CCOPT_$(TARGET_LJARCH))
TARGET_ARCH+= $(patsubst %,-DLUAJIT_TARGET=LUAJIT_ARCH_%,$(TARGET_LJARCH))
@@ -397,6 +394,10 @@ ifeq (,$(findstring LJ_ABI_SOFTFP 1,$(TARGET_TESTARCH)))
else
TARGET_ARCH+= -DLJ_ABI_SOFTFP=1
endif
+ifneq (,$(findstring LJ_NO_UNWIND 1,$(TARGET_TESTARCH)))
+ DASM_AFLAGS+= -D NO_UNWIND
+ TARGET_ARCH+= -DLUAJIT_NO_UNWIND
+endif
DASM_AFLAGS+= -D VER=$(subst LJ_ARCH_VERSION_,,$(filter LJ_ARCH_VERSION_%,$(subst LJ_ARCH_VERSION ,LJ_ARCH_VERSION_,$(TARGET_TESTARCH))))
ifeq (Windows,$(TARGET_SYS))
DASM_AFLAGS+= -D WIN
diff --git a/src/jit/bc.lua b/src/jit/bc.lua
index a179d50..46a4089 100644
--- a/src/jit/bc.lua
+++ b/src/jit/bc.lua
@@ -41,7 +41,7 @@
-- Cache some library functions and objects.
local jit = require("jit")
-assert(jit.version_num == 20003, "LuaJIT core/library version mismatch")
+assert(jit.version_num == 20004, "LuaJIT core/library version mismatch")
local jutil = require("jit.util")
local vmdef = require("jit.vmdef")
local bit = require("bit")
diff --git a/src/jit/bcsave.lua b/src/jit/bcsave.lua
index 2ba234d..0319b3d 100644
--- a/src/jit/bcsave.lua
+++ b/src/jit/bcsave.lua
@@ -11,7 +11,7 @@
------------------------------------------------------------------------------
local jit = require("jit")
-assert(jit.version_num == 20003, "LuaJIT core/library version mismatch")
+assert(jit.version_num == 20004, "LuaJIT core/library version mismatch")
local bit = require("bit")
-- Symbol name prefix for LuaJIT bytecode.
diff --git a/src/jit/dump.lua b/src/jit/dump.lua
index 589543f..d15c528 100644
--- a/src/jit/dump.lua
+++ b/src/jit/dump.lua
@@ -55,7 +55,7 @@
-- Cache some library functions and objects.
local jit = require("jit")
-assert(jit.version_num == 20003, "LuaJIT core/library version mismatch")
+assert(jit.version_num == 20004, "LuaJIT core/library version mismatch")
local jutil = require("jit.util")
local vmdef = require("jit.vmdef")
local funcinfo, funcbc = jutil.funcinfo, jutil.funcbc
diff --git a/src/jit/v.lua b/src/jit/v.lua
index c622443..32666fd 100644
--- a/src/jit/v.lua
+++ b/src/jit/v.lua
@@ -59,7 +59,7 @@
-- Cache some library functions and objects.
local jit = require("jit")
-assert(jit.version_num == 20003, "LuaJIT core/library version mismatch")
+assert(jit.version_num == 20004, "LuaJIT core/library version mismatch")
local jutil = require("jit.util")
local vmdef = require("jit.vmdef")
local funcinfo, traceinfo = jutil.funcinfo, jutil.traceinfo
diff --git a/src/lib_io.c b/src/lib_io.c
index 037aa28..a502dd5 100644
--- a/src/lib_io.c
+++ b/src/lib_io.c
@@ -278,6 +278,15 @@ static int io_file_iter(lua_State *L)
return n;
}
+static int io_file_lines(lua_State *L)
+{
+ int n = (int)(L->top - L->base);
+ if (n > LJ_MAX_UPVAL)
+ lj_err_caller(L, LJ_ERR_UNPACK);
+ lua_pushcclosure(L, io_file_iter, n);
+ return 1;
+}
+
/* -- I/O file methods ---------------------------------------------------- */
#define LJLIB_MODULE_io_method
@@ -361,8 +370,7 @@ LJLIB_CF(io_method_setvbuf)
LJLIB_CF(io_method_lines)
{
io_tofile(L);
- lua_pushcclosure(L, io_file_iter, (int)(L->top - L->base));
- return 1;
+ return io_file_lines(L);
}
LJLIB_CF(io_method___gc)
@@ -492,8 +500,7 @@ LJLIB_CF(io_lines)
} else { /* io.lines() iterates over stdin. */
setudataV(L, L->base, IOSTDF_UD(L, GCROOT_IO_INPUT));
}
- lua_pushcclosure(L, io_file_iter, (int)(L->top - L->base));
- return 1;
+ return io_file_lines(L);
}
LJLIB_CF(io_type)
diff --git a/src/lj_arch.h b/src/lj_arch.h
index d3a9d57..d89d116 100644
--- a/src/lj_arch.h
+++ b/src/lj_arch.h
@@ -423,7 +423,7 @@
#define LUAJIT_NO_EXP2
#endif
-#if defined(LUAJIT_NO_UNWIND) || defined(__symbian__) || LJ_TARGET_IOS || LJ_TARGET_PS3
+#if defined(LUAJIT_NO_UNWIND) || defined(__symbian__) || LJ_TARGET_IOS || LJ_TARGET_PS3 || LJ_TARGET_PS4
#define LJ_NO_UNWIND 1
#endif
diff --git a/src/lj_cparse.c b/src/lj_cparse.c
index b9df88d..9e21361 100644
--- a/src/lj_cparse.c
+++ b/src/lj_cparse.c
@@ -798,6 +798,10 @@ static void cp_push_type(CPDecl *decl, CTypeID id)
cp_push(decl, info & ~CTMASK_CID, size); /* Copy type. */
break;
case CT_ARRAY:
+ if ((ct->info & (CTF_VECTOR|CTF_COMPLEX))) {
+ info |= (decl->attr & CTF_QUAL);
+ decl->attr &= ~CTF_QUAL;
+ }
cp_push_type(decl, ctype_cid(info)); /* Unroll. */
cp_push(decl, info & ~CTMASK_CID, size); /* Copy type. */
decl->stack[decl->pos].sib = 1; /* Mark as already checked and sized. */
diff --git a/src/lj_err.c b/src/lj_err.c
index 081bfde..11b07b5 100644
--- a/src/lj_err.c
+++ b/src/lj_err.c
@@ -57,10 +57,10 @@
** EXT cannot be enabled on WIN32 since system exceptions use code-driven SEH.
** EXT is mandatory on WIN64 since the calling convention has an abundance
** of callee-saved registers (rbx, rbp, rsi, rdi, r12-r15, xmm6-xmm15).
-** EXT is mandatory on POSIX/x64 since the interpreter doesn't save r12/r13.
+** The POSIX/x64 interpreter only saves r12/r13 for INT (e.g. PS4).
*/
-#if defined(__GNUC__) && (LJ_TARGET_X64 || defined(LUAJIT_UNWIND_EXTERNAL))
+#if defined(__GNUC__) && (LJ_TARGET_X64 || defined(LUAJIT_UNWIND_EXTERNAL)) && !LJ_NO_UNWIND
#define LJ_UNWIND_EXT 1
#elif LJ_TARGET_X64 && LJ_TARGET_WINDOWS
#define LJ_UNWIND_EXT 1
diff --git a/src/lj_frame.h b/src/lj_frame.h
index cd57be2..f981098 100644
--- a/src/lj_frame.h
+++ b/src/lj_frame.h
@@ -86,7 +86,11 @@ enum {
#define CFRAME_OFS_ERRF (5*4)
#define CFRAME_OFS_NRES (4*4)
#define CFRAME_OFS_MULTRES (1*4)
+#if LJ_NO_UNWIND
+#define CFRAME_SIZE (12*8)
+#else
#define CFRAME_SIZE (10*8)
+#endif
#define CFRAME_SIZE_JIT (CFRAME_SIZE + 16)
#define CFRAME_SHIFT_MULTRES 0
#endif
diff --git a/src/lj_opt_narrow.c b/src/lj_opt_narrow.c
index b7bd323..fb64718 100644
--- a/src/lj_opt_narrow.c
+++ b/src/lj_opt_narrow.c
@@ -205,7 +205,6 @@ typedef struct NarrowConv {
jit_State *J; /* JIT compiler state. */
NarrowIns *sp; /* Current stack pointer. */
NarrowIns *maxsp; /* Maximum stack pointer minus redzone. */
- int lim; /* Limit on the number of emitted conversions. */
IRRef mode; /* Conversion mode (IRCONV_*). */
IRType t; /* Destination type: IRT_INT or IRT_I64. */
NarrowIns stack[NARROW_MAX_STACK]; /* Stack holding stack-machine code. */
@@ -247,10 +246,16 @@ static void narrow_stripov_backprop(NarrowConv *nc, IRRef ref, int depth)
if (bp) {
ref = bp->val;
} else if (++depth < NARROW_MAX_BACKPROP && nc->sp < nc->maxsp) {
+ NarrowIns *savesp = nc->sp;
narrow_stripov_backprop(nc, ir->op1, depth);
- narrow_stripov_backprop(nc, ir->op2, depth);
- *nc->sp++ = NARROWINS(IRT(ir->o - IR_ADDOV + IR_ADD, IRT_INT), ref);
- return;
+ if (nc->sp < nc->maxsp) {
+ narrow_stripov_backprop(nc, ir->op2, depth);
+ if (nc->sp < nc->maxsp) {
+ *nc->sp++ = NARROWINS(IRT(ir->o - IR_ADDOV + IR_ADD, IRT_INT), ref);
+ return;
+ }
+ }
+ nc->sp = savesp; /* Path too deep, need to backtrack. */
}
}
*nc->sp++ = NARROWINS(NARROW_REF, ref);
@@ -263,6 +268,8 @@ static int narrow_conv_backprop(NarrowConv *nc, IRRef ref, int depth)
IRIns *ir = IR(ref);
IRRef cref;
+ if (nc->sp >= nc->maxsp) return 10; /* Path too deep. */
+
/* Check the easy cases first. */
if (ir->o == IR_CONV && (ir->op2 & IRCONV_SRCMASK) == IRT_INT) {
if ((nc->mode & IRCONV_CONVMASK) <= IRCONV_ANY)
@@ -334,7 +341,7 @@ static int narrow_conv_backprop(NarrowConv *nc, IRRef ref, int depth)
NarrowIns *savesp = nc->sp;
int count = narrow_conv_backprop(nc, ir->op1, depth);
count += narrow_conv_backprop(nc, ir->op2, depth);
- if (count <= nc->lim) { /* Limit total number of conversions. */
+ if (count <= 1) { /* Limit total number of conversions. */
*nc->sp++ = NARROWINS(IRT(ir->o, nc->t), ref);
return count;
}
@@ -406,12 +413,10 @@ TRef LJ_FASTCALL lj_opt_narrow_convert(jit_State *J)
nc.t = irt_type(fins->t);
if (fins->o == IR_TOBIT) {
nc.mode = IRCONV_TOBIT; /* Used only in the backpropagation cache. */
- nc.lim = 2; /* TOBIT can use a more optimistic rule. */
} else {
nc.mode = fins->op2;
- nc.lim = 1;
}
- if (narrow_conv_backprop(&nc, fins->op1, 0) <= nc.lim)
+ if (narrow_conv_backprop(&nc, fins->op1, 0) <= 1)
return narrow_conv_emit(J, &nc);
}
return NEXTFOLD;
diff --git a/src/lj_trace.c b/src/lj_trace.c
index e51ec54..7d1b093 100644
--- a/src/lj_trace.c
+++ b/src/lj_trace.c
@@ -117,15 +117,22 @@ static void perftools_addtrace(GCtrace *T)
}
#endif
-/* Save current trace by copying and compacting it. */
-static void trace_save(jit_State *J)
+/* Allocate space for copy of trace. */
+static GCtrace *trace_save_alloc(jit_State *J)
{
size_t sztr = ((sizeof(GCtrace)+7)&~7);
size_t szins = (J->cur.nins-J->cur.nk)*sizeof(IRIns);
size_t sz = sztr + szins +
J->cur.nsnap*sizeof(SnapShot) +
J->cur.nsnapmap*sizeof(SnapEntry);
- GCtrace *T = lj_mem_newt(J->L, (MSize)sz, GCtrace);
+ return lj_mem_newt(J->L, (MSize)sz, GCtrace);
+}
+
+/* Save current trace by copying and compacting it. */
+static void trace_save(jit_State *J, GCtrace *T)
+{
+ size_t sztr = ((sizeof(GCtrace)+7)&~7);
+ size_t szins = (J->cur.nins-J->cur.nk)*sizeof(IRIns);
char *p = (char *)T + sztr;
memcpy(T, &J->cur, sizeof(GCtrace));
setgcrefr(T->nextgc, J2G(J)->gc.root);
@@ -417,6 +424,7 @@ static void trace_stop(jit_State *J)
BCOp op = bc_op(J->cur.startins);
GCproto *pt = &gcref(J->cur.startpt)->pt;
TraceNo traceno = J->cur.traceno;
+ GCtrace *T = trace_save_alloc(J); /* Do this first. May throw OOM. */
lua_State *L;
switch (op) {
@@ -461,7 +469,7 @@ static void trace_stop(jit_State *J)
/* Commit new mcode only after all patching is done. */
lj_mcode_commit(J, J->cur.mcode);
J->postproc = LJ_POST_NONE;
- trace_save(J);
+ trace_save(J, T);
L = J->L;
lj_vmevent_send(L, TRACE,
diff --git a/src/lj_traceerr.h b/src/lj_traceerr.h
index 9bef117..150ac2d 100644
--- a/src/lj_traceerr.h
+++ b/src/lj_traceerr.h
@@ -23,7 +23,7 @@ TREDEF(BADTYPE, "bad argument type")
TREDEF(CJITOFF, "JIT compilation disabled for function")
TREDEF(CUNROLL, "call unroll limit reached")
TREDEF(DOWNREC, "down-recursion, restarting")
-TREDEF(NYICF, "NYI: C function %p")
+TREDEF(NYICF, "NYI: C function %s")
TREDEF(NYIFF, "NYI: FastFunc %s")
TREDEF(NYIFFU, "NYI: unsupported variant of FastFunc %s")
TREDEF(NYIRETL, "NYI: return to lower frame")
diff --git a/src/luaconf.h b/src/luaconf.h
index 7f57bae..84fa641 100644
--- a/src/luaconf.h
+++ b/src/luaconf.h
@@ -37,7 +37,7 @@
#endif
#define LUA_LROOT "/usr/local"
#define LUA_LUADIR "/lua/5.1/"
-#define LUA_LJDIR "/luajit-2.0.3/"
+#define LUA_LJDIR "/luajit-2.0.4/"
#ifdef LUA_ROOT
#define LUA_JROOT LUA_ROOT
diff --git a/src/luajit.h b/src/luajit.h
index 901807a..9ced18e 100644
--- a/src/luajit.h
+++ b/src/luajit.h
@@ -30,9 +30,9 @@
#include "lua.h"
-#define LUAJIT_VERSION "LuaJIT 2.0.3"
-#define LUAJIT_VERSION_NUM 20003 /* Version 2.0.3 = 02.00.03. */
-#define LUAJIT_VERSION_SYM luaJIT_version_2_0_3
+#define LUAJIT_VERSION "LuaJIT 2.0.4"
+#define LUAJIT_VERSION_NUM 20004 /* Version 2.0.4 = 02.00.04. */
+#define LUAJIT_VERSION_SYM luaJIT_version_2_0_4
#define LUAJIT_COPYRIGHT "Copyright (C) 2005-2015 Mike Pall"
#define LUAJIT_URL "http://luajit.org/"
diff --git a/src/ps4build.bat b/src/ps4build.bat
index 42fc9a6..337a44f 100644
--- a/src/ps4build.bat
+++ b/src/ps4build.bat
@@ -27,11 +27,11 @@ if exist minilua.exe.manifest^
@minilua
@if not errorlevel 8 goto :FAIL
-@set DASMFLAGS=-D P64
+@set DASMFLAGS=-D P64 -D NO_UNWIND
minilua %DASM% -LN %DASMFLAGS% -o host\buildvm_arch.h vm_x86.dasc
@if errorlevel 1 goto :BAD
-%LJCOMPILE% /I "." /I %DASMDIR% -DLUAJIT_TARGET=LUAJIT_ARCH_X64 -DLUAJIT_OS=LUAJIT_OS_OTHER -DLUAJIT_DISABLE_JIT -DLUAJIT_DISABLE_FFI host\buildvm*.c
+%LJCOMPILE% /I "." /I %DASMDIR% -DLUAJIT_TARGET=LUAJIT_ARCH_X64 -DLUAJIT_OS=LUAJIT_OS_OTHER -DLUAJIT_DISABLE_JIT -DLUAJIT_DISABLE_FFI -DLUAJIT_NO_UNWIND host\buildvm*.c
@if errorlevel 1 goto :BAD
%LJLINK% /out:buildvm.exe buildvm*.obj
@if errorlevel 1 goto :BAD
diff --git a/src/vm_x86.dasc b/src/vm_x86.dasc
index 4544a3b..129ab00 100644
--- a/src/vm_x86.dasc
+++ b/src/vm_x86.dasc
@@ -222,6 +222,9 @@
|.define CFRAME_SPACE, aword*5 // Delta for rsp (see <--).
|.macro saveregs_
| push rbx; push r15; push r14
+|.if NO_UNWIND
+| push r13; push r12
+|.endif
| sub rsp, CFRAME_SPACE
|.endmacro
|.macro saveregs
@@ -229,15 +232,28 @@
|.endmacro
|.macro restoreregs
| add rsp, CFRAME_SPACE
+|.if NO_UNWIND
+| pop r12; pop r13
+|.endif
| pop r14; pop r15; pop rbx; pop rbp
|.endmacro
|
|//----- 16 byte aligned,
+|.if NO_UNWIND
+|.define SAVE_RET, aword [rsp+aword*11] //<-- rsp entering interpreter.
+|.define SAVE_R4, aword [rsp+aword*10]
+|.define SAVE_R3, aword [rsp+aword*9]
+|.define SAVE_R2, aword [rsp+aword*8]
+|.define SAVE_R1, aword [rsp+aword*7]
+|.define SAVE_RU2, aword [rsp+aword*6]
+|.define SAVE_RU1, aword [rsp+aword*5] //<-- rsp after register saves.
+|.else
|.define SAVE_RET, aword [rsp+aword*9] //<-- rsp entering interpreter.
|.define SAVE_R4, aword [rsp+aword*8]
|.define SAVE_R3, aword [rsp+aword*7]
|.define SAVE_R2, aword [rsp+aword*6]
|.define SAVE_R1, aword [rsp+aword*5] //<-- rsp after register saves.
+|.endif
|.define SAVE_CFRAME, aword [rsp+aword*4]
|.define SAVE_PC, dword [rsp+dword*7]
|.define SAVE_L, dword [rsp+dword*6]
@@ -2564,8 +2580,8 @@ static void build_subroutines(BuildCtx *ctx)
|
|.define TOBIT_BIAS, 0x59c00000 // 2^52 + 2^51 (float, not double!).
|
- |.macro .ffunc_bit, name, kind
- | .ffunc_1 name
+ |.macro .ffunc_bit, name, kind, fdef
+ | fdef name
|.if kind == 2
|.if SSE
| sseconst_tobit xmm1, RBa
@@ -2608,6 +2624,10 @@ static void build_subroutines(BuildCtx *ctx)
|2:
|.endmacro
|
+ |.macro .ffunc_bit, name, kind
+ | .ffunc_bit name, kind, .ffunc_1
+ |.endmacro
+ |
|.ffunc_bit bit_tobit, 0
|.if DUALNUM or SSE
|.if not SSE
@@ -2681,7 +2701,7 @@ static void build_subroutines(BuildCtx *ctx)
|
|.macro .ffunc_bit_sh, name, ins
|.if DUALNUM
- | .ffunc_bit name, 1
+ | .ffunc_bit name, 1, .ffunc_2
| // Note: no inline conversion from number for 2nd argument!
| cmp dword [BASE+12], LJ_TISNUM; jne ->fff_fallback
| mov RA, dword [BASE+8]
@@ -6115,6 +6135,10 @@ static void emit_asm_debug(BuildCtx *ctx)
"\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
"\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */
"\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */
+#if LJ_NO_UNWIND
+ "\t.byte 0x8d\n\t.uleb128 0x6\n" /* offset r13 */
+ "\t.byte 0x8c\n\t.uleb128 0x7\n" /* offset r12 */
+#endif
#else
"\t.long .Lbegin\n"
"\t.long %d\n"
@@ -6150,6 +6174,7 @@ static void emit_asm_debug(BuildCtx *ctx)
"\t.align " SZPTR "\n"
".LEFDE1:\n\n", (int)ctx->codesz - fcofs);
#endif
+#if !LJ_NO_UNWIND
#if (defined(__sun__) && defined(__svr4__))
#if LJ_64
fprintf(ctx->fp, "\t.section .eh_frame,\"a\",@unwind\n");
@@ -6238,7 +6263,9 @@ static void emit_asm_debug(BuildCtx *ctx)
"\t.align " SZPTR "\n"
".LEFDE3:\n\n", (int)ctx->codesz - fcofs);
#endif
+#endif
break;
+#if !LJ_NO_UNWIND
/* Mental note: never let Apple design an assembler.
** Or a linker. Or a plastic case. But I digress.
*/
@@ -6366,6 +6393,7 @@ static void emit_asm_debug(BuildCtx *ctx)
#endif
}
break;
+#endif
default: /* Difficult for other modes. */
break;
}