Merge pull request #3 from LuaJIT/master

Merge
This commit is contained in:
Brandon Carrington 2018-08-27 12:19:46 -05:00 committed by GitHub
commit 3e8532fd43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 75 additions and 54 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2004-2017 Mike Pall.
/* Copyright (C) 2004-2018 Mike Pall.
*
* You are welcome to use the general ideas of this design for your own sites.
* But please do not steal the stylesheet, the layout or the color scheme.

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2004-2017 Mike Pall.
/* Copyright (C) 2004-2018 Mike Pall.
*
* You are welcome to use the general ideas of this design for your own sites.
* But please do not steal the stylesheet, the layout or the color scheme.

View File

@ -3,8 +3,7 @@
<head>
<title>LuaJIT Change History</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-2017, Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2018">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@ -1010,7 +1009,7 @@ This is the initial non-public release of LuaJIT.
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2017 Mike Pall
Copyright &copy; 2005-2018
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View File

@ -3,8 +3,7 @@
<head>
<title>Contact</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-2017, Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2018">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@ -91,7 +90,7 @@ xD("fyZKB8xv\"FJytmz8.KAB0u52D")
<h2>Copyright</h2>
<p>
All documentation is
Copyright &copy; 2005-2017 Mike Pall.
Copyright &copy; 2005-2018 Mike Pall.
</p>
@ -99,7 +98,7 @@ Copyright &copy; 2005-2017 Mike Pall.
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2017 Mike Pall
Copyright &copy; 2005-2018
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View File

@ -3,8 +3,7 @@
<head>
<title>Lua/C API Extensions</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-2017, Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2018">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@ -177,7 +176,7 @@ Also note that this mechanism is not without overhead.
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2017 Mike Pall
Copyright &copy; 2005-2018
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View File

@ -3,8 +3,7 @@
<head>
<title>FFI Library</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-2017, Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2018">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@ -320,7 +319,7 @@ without undue conversion penalties.
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2017 Mike Pall
Copyright &copy; 2005-2018
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View File

@ -3,8 +3,7 @@
<head>
<title>ffi.* API Functions</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-2017, Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2018">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@ -556,7 +555,7 @@ named <tt>i</tt>.
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2017 Mike Pall
Copyright &copy; 2005-2018
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View File

@ -3,8 +3,7 @@
<head>
<title>FFI Semantics</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-2017, Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2018">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@ -1235,7 +1234,7 @@ compiled.</li>
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2017 Mike Pall
Copyright &copy; 2005-2018
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View File

@ -3,8 +3,7 @@
<head>
<title>FFI Tutorial</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-2017, Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2018">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@ -591,7 +590,7 @@ it to a local variable in the function scope is unnecessary.
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2017 Mike Pall
Copyright &copy; 2005-2018
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View File

@ -3,8 +3,7 @@
<head>
<title>jit.* Library</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-2017, Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2018">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@ -189,7 +188,7 @@ if you want to know more.
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2017 Mike Pall
Copyright &copy; 2005-2018
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View File

@ -3,8 +3,7 @@
<head>
<title>Extensions</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-2017, Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2018">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@ -398,7 +397,7 @@ lead to the termination of the process.</li>
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2017 Mike Pall
Copyright &copy; 2005-2018
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View File

@ -3,8 +3,7 @@
<head>
<title>Frequently Asked Questions (FAQ)</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-2017, Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2018">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@ -174,7 +173,7 @@ the development of certain features, if they are important to you.
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2017 Mike Pall
Copyright &copy; 2005-2018
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View File

@ -3,8 +3,7 @@
<head>
<title>Installation</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-2017, Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2018">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@ -636,7 +635,7 @@ to me (the upstream) and not you (the package maintainer), anyway.
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2017 Mike Pall
Copyright &copy; 2005-2018
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View File

@ -3,8 +3,7 @@
<head>
<title>LuaJIT</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-2017, Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2018">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@ -150,7 +149,7 @@ Lua is a powerful, dynamic and light-weight programming language.
It may be embedded or used as a general-purpose, stand-alone language.
</p>
<p>
LuaJIT is Copyright &copy; 2005-2017 Mike Pall, released under the
LuaJIT is Copyright &copy; 2005-2018 Mike Pall, released under the
<a href="http://www.opensource.org/licenses/mit-license.php"><span class="ext">&raquo;</span>&nbsp;MIT open source license</a>.
</p>
<p>
@ -224,7 +223,7 @@ Please select a sub-topic in the navigation bar to learn more about LuaJIT.
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2017 Mike Pall
Copyright &copy; 2005-2018
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View File

@ -3,8 +3,7 @@
<head>
<title>Running LuaJIT</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-2017, Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2018">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@ -296,7 +295,7 @@ Here are the parameters and their default settings:
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2017 Mike Pall
Copyright &copy; 2005-2018
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View File

@ -3,8 +3,7 @@
<head>
<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-2017, Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2018">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@ -100,7 +99,7 @@ garbage collector.
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2017 Mike Pall
Copyright &copy; 2005-2018
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View File

@ -339,7 +339,7 @@
#if defined(_SOFT_FLOAT) || defined(_SOFT_DOUBLE)
#error "No support for PowerPC CPUs without double-precision FPU"
#endif
#if defined(_LITTLE_ENDIAN)
#if defined(_LITTLE_ENDIAN) && (!defined(_BYTE_ORDER) || (_BYTE_ORDER == _LITTLE_ENDIAN))
#error "No support for little-endian PowerPC"
#endif
#if defined(_LP64)

View File

@ -1661,6 +1661,8 @@ void LJ_FASTCALL lj_crecord_tonumber(jit_State *J, RecordFFData *rd)
d = ctype_get(cts, CTID_DOUBLE);
J->base[0] = crec_ct_tv(J, d, 0, J->base[0], &rd->argv[0]);
} else {
/* Specialize to the ctype that couldn't be converted. */
argv2cdata(J, J->base[0], &rd->argv[0]);
J->base[0] = TREF_NIL;
}
}

View File

@ -268,10 +268,12 @@ static void emit_movmroi(ASMState *as, Reg base, int32_t ofs, int32_t i)
/* mov r, i / xor r, r */
static void emit_loadi(ASMState *as, Reg r, int32_t i)
{
/* XOR r,r is shorter, but modifies the flags. This is bad for HIOP. */
/* XOR r,r is shorter, but modifies the flags. This is bad for HIOP/jcc. */
if (i == 0 && !(LJ_32 && (IR(as->curins)->o == IR_HIOP ||
(as->curins+1 < as->T->nins &&
IR(as->curins+1)->o == IR_HIOP)))) {
IR(as->curins+1)->o == IR_HIOP))) &&
!((*as->mcp == 0x0f && (as->mcp[1] & 0xf0) == XI_JCCn) ||
(*as->mcp & 0xf0) == XI_JCCs)) {
emit_rr(as, XO_ARITH(XOg_XOR), r, r);
} else {
MCode *p = as->mcp;

View File

@ -816,14 +816,22 @@ static LJ_AINLINE int32_t lj_num2bit(lua_Number n)
#define lj_num2int(n) ((int32_t)(n))
#endif
/*
** This must match the JIT backend behavior. In particular for archs
** that don't have a common hardware instruction for this conversion.
** Note that signed FP to unsigned int conversions have an undefined
** result and should never be relied upon in portable FFI code.
** See also: C99 or C11 standard, 6.3.1.4, footnote of (1).
*/
static LJ_AINLINE uint64_t lj_num2u64(lua_Number n)
{
#ifdef _MSC_VER
if (n >= 9223372036854775808.0) /* They think it's a feature. */
return (uint64_t)(int64_t)(n - 18446744073709551616.0);
else
#endif
#if LJ_TARGET_X86ORX64 || LJ_TARGET_MIPS
int64_t i = (int64_t)n;
if (i < 0) i = (int64_t)(n - 18446744073709551616.0);
return (uint64_t)i;
#else
return (uint64_t)n;
#endif
}
static LJ_AINLINE int32_t numberVint(cTValue *o)

View File

@ -457,6 +457,29 @@ TValue *lj_tab_newkey(lua_State *L, GCtab *t, cTValue *key)
freenode->next = nn->next;
nn->next = n->next;
setmref(n->next, nn);
/*
** Rechaining a resurrected string key creates a new dilemma:
** Another string key may have originally been resurrected via
** _any_ of the previous nodes as a chain anchor. Including
** a node that had to be moved, which makes them unreachable.
** It's not feasible to check for all previous nodes, so rechain
** any string key that's currently in a non-main positions.
*/
while ((nn = nextnode(freenode))) {
if (tvisstr(&nn->key) && !tvisnil(&nn->val)) {
Node *mn = hashstr(t, strV(&nn->key));
if (mn != freenode) {
freenode->next = nn->next;
nn->next = mn->next;
setmref(mn->next, nn);
} else {
freenode = nn;
}
} else {
freenode = nn;
}
}
break;
} else {
freenode = nn;
}