mirror of
https://github.com/love2d/megasource.git
synced 2026-08-20 12:40:06 +02:00
Update LuaJIT to LuaJIT/LuaJIT@d0e8893
This commit is contained in:
+1
-1
@@ -167,7 +167,7 @@ endif()
|
|||||||
|
|
||||||
set(MEGA_ZLIB_VER "1.2.12")
|
set(MEGA_ZLIB_VER "1.2.12")
|
||||||
set(MEGA_LUA51_VER "5.1.5")
|
set(MEGA_LUA51_VER "5.1.5")
|
||||||
set(MEGA_LUAJIT_VER "2.1.0-7306ba7")
|
set(MEGA_LUAJIT_VER "2.1.0-d0e8893")
|
||||||
set(MEGA_LIBOGG_VER "1.3.2")
|
set(MEGA_LIBOGG_VER "1.3.2")
|
||||||
set(MEGA_LIBVORBIS_VER "1.3.5")
|
set(MEGA_LIBVORBIS_VER "1.3.5")
|
||||||
set(MEGA_LIBTHEORA_VER "1.1.1")
|
set(MEGA_LIBTHEORA_VER "1.1.1")
|
||||||
|
|||||||
@@ -50,8 +50,6 @@
|
|||||||
</li><li>
|
</li><li>
|
||||||
<a href="faq.html">FAQ</a>
|
<a href="faq.html">FAQ</a>
|
||||||
</li><li>
|
</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>
|
<a href="https://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
|
||||||
</li></ul>
|
</li></ul>
|
||||||
</div>
|
</div>
|
||||||
@@ -86,6 +84,13 @@ xD("fyZKB8xv\"FJytmz8.KAB0u52D")
|
|||||||
</p>
|
</p>
|
||||||
</noscript>
|
</noscript>
|
||||||
|
|
||||||
|
<p><i>
|
||||||
|
Note: I cannot reply to GMail, Google Workplace, Outlook or Office365
|
||||||
|
mail addresses, since they prefer to mindlessly filter out mails sent
|
||||||
|
from small domains using independent mail servers, such as mine. If you
|
||||||
|
don't like that, please complain to Google or Microsoft, not me.
|
||||||
|
</i></p>
|
||||||
|
|
||||||
<h2>Copyright</h2>
|
<h2>Copyright</h2>
|
||||||
<p>
|
<p>
|
||||||
All documentation is
|
All documentation is
|
||||||
|
|||||||
@@ -61,8 +61,6 @@
|
|||||||
</li><li>
|
</li><li>
|
||||||
<a href="faq.html">FAQ</a>
|
<a href="faq.html">FAQ</a>
|
||||||
</li><li>
|
</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>
|
<a href="https://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
|
||||||
</li></ul>
|
</li></ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -50,8 +50,6 @@
|
|||||||
</li><li>
|
</li><li>
|
||||||
<a href="faq.html">FAQ</a>
|
<a href="faq.html">FAQ</a>
|
||||||
</li><li>
|
</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>
|
<a href="https://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
|
||||||
</li></ul>
|
</li></ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -50,8 +50,6 @@
|
|||||||
</li><li>
|
</li><li>
|
||||||
<a href="faq.html">FAQ</a>
|
<a href="faq.html">FAQ</a>
|
||||||
</li><li>
|
</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>
|
<a href="https://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
|
||||||
</li></ul>
|
</li></ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -55,8 +55,6 @@ td.abiparam { font-weight: bold; width: 6em; }
|
|||||||
</li><li>
|
</li><li>
|
||||||
<a href="faq.html">FAQ</a>
|
<a href="faq.html">FAQ</a>
|
||||||
</li><li>
|
</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>
|
<a href="https://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
|
||||||
</li></ul>
|
</li></ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -55,8 +55,6 @@ td.convop { font-style: italic; width: 40%; }
|
|||||||
</li><li>
|
</li><li>
|
||||||
<a href="faq.html">FAQ</a>
|
<a href="faq.html">FAQ</a>
|
||||||
</li><li>
|
</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>
|
<a href="https://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
|
||||||
</li></ul>
|
</li></ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -57,8 +57,6 @@ td.idiomlua b { font-weight: normal; color: #2142bf; }
|
|||||||
</li><li>
|
</li><li>
|
||||||
<a href="faq.html">FAQ</a>
|
<a href="faq.html">FAQ</a>
|
||||||
</li><li>
|
</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>
|
<a href="https://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
|
||||||
</li></ul>
|
</li></ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -50,8 +50,6 @@
|
|||||||
</li><li>
|
</li><li>
|
||||||
<a href="faq.html">FAQ</a>
|
<a href="faq.html">FAQ</a>
|
||||||
</li><li>
|
</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>
|
<a href="https://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
|
||||||
</li></ul>
|
</li></ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -50,8 +50,6 @@
|
|||||||
</li><li>
|
</li><li>
|
||||||
<a href="faq.html">FAQ</a>
|
<a href="faq.html">FAQ</a>
|
||||||
</li><li>
|
</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>
|
<a href="https://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
|
||||||
</li></ul>
|
</li></ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -67,8 +67,6 @@ td.excinterop {
|
|||||||
</li><li>
|
</li><li>
|
||||||
<a href="faq.html">FAQ</a>
|
<a href="faq.html">FAQ</a>
|
||||||
</li><li>
|
</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>
|
<a href="https://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
|
||||||
</li></ul>
|
</li></ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -53,8 +53,6 @@ dd { margin-left: 1.5em; }
|
|||||||
</li><li>
|
</li><li>
|
||||||
<a class="current" href="faq.html">FAQ</a>
|
<a class="current" href="faq.html">FAQ</a>
|
||||||
</li><li>
|
</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>
|
<a href="https://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
|
||||||
</li></ul>
|
</li></ul>
|
||||||
</div>
|
</div>
|
||||||
@@ -65,8 +63,6 @@ dd { margin-left: 1.5em; }
|
|||||||
<ul style="padding: 0;">
|
<ul style="padding: 0;">
|
||||||
<li>The <a href="https://luajit.org/list.html"><span class="ext">»</span> LuaJIT mailing list</a> focuses on topics
|
<li>The <a href="https://luajit.org/list.html"><span class="ext">»</span> LuaJIT mailing list</a> focuses on topics
|
||||||
related to LuaJIT.</li>
|
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
|
<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>.
|
<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
|
The mailing list archives are worth checking out for older postings
|
||||||
|
|||||||
@@ -73,8 +73,6 @@ td.compatx {
|
|||||||
</li><li>
|
</li><li>
|
||||||
<a href="faq.html">FAQ</a>
|
<a href="faq.html">FAQ</a>
|
||||||
</li><li>
|
</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>
|
<a href="https://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
|
||||||
</li></ul>
|
</li></ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -135,8 +135,6 @@ table.feature small {
|
|||||||
</li><li>
|
</li><li>
|
||||||
<a href="faq.html">FAQ</a>
|
<a href="faq.html">FAQ</a>
|
||||||
</li><li>
|
</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>
|
<a href="https://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
|
||||||
</li></ul>
|
</li></ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -72,8 +72,6 @@ td.param_default {
|
|||||||
</li><li>
|
</li><li>
|
||||||
<a href="faq.html">FAQ</a>
|
<a href="faq.html">FAQ</a>
|
||||||
</li><li>
|
</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>
|
<a href="https://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
|
||||||
</li></ul>
|
</li></ul>
|
||||||
</div>
|
</div>
|
||||||
@@ -222,6 +220,12 @@ mix the three forms, but note that setting an optimization level
|
|||||||
overrides all earlier flags.
|
overrides all earlier flags.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
|
Note that <tt>-Ofma</tt> is not enabled by default at any level,
|
||||||
|
because it affects floating-point result accuracy. Only enable this,
|
||||||
|
if you fully understand the trade-offs of FMA for performance (higher),
|
||||||
|
determinism (lower) and numerical accuracy (higher).
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
Here are the available flags and at what optimization levels they
|
Here are the available flags and at what optimization levels they
|
||||||
are enabled:
|
are enabled:
|
||||||
</p>
|
</p>
|
||||||
@@ -253,6 +257,8 @@ are enabled:
|
|||||||
<td class="flag_name">sink</td><td class="flag_level"> </td><td class="flag_level"> </td><td class="flag_level">•</td><td class="flag_desc">Allocation/Store Sinking</td></tr>
|
<td class="flag_name">sink</td><td class="flag_level"> </td><td class="flag_level"> </td><td class="flag_level">•</td><td class="flag_desc">Allocation/Store Sinking</td></tr>
|
||||||
<tr class="even">
|
<tr class="even">
|
||||||
<td class="flag_name">fuse</td><td class="flag_level"> </td><td class="flag_level"> </td><td class="flag_level">•</td><td class="flag_desc">Fusion of operands into instructions</td></tr>
|
<td class="flag_name">fuse</td><td class="flag_level"> </td><td class="flag_level"> </td><td class="flag_level">•</td><td class="flag_desc">Fusion of operands into instructions</td></tr>
|
||||||
|
<tr class="odd">
|
||||||
|
<td class="flag_name">fma </td><td class="flag_level"> </td><td class="flag_level"> </td><td class="flag_level"> </td><td class="flag_desc">Fused multiply-add</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<p>
|
<p>
|
||||||
Here are the parameters and their default settings:
|
Here are the parameters and their default settings:
|
||||||
|
|||||||
@@ -53,8 +53,6 @@ ul li { padding-bottom: 0.3em; }
|
|||||||
</li><li>
|
</li><li>
|
||||||
<a href="faq.html">FAQ</a>
|
<a href="faq.html">FAQ</a>
|
||||||
</li><li>
|
</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>
|
<a href="https://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
|
||||||
</li></ul>
|
</li></ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -303,7 +303,7 @@ LJLIB_ASM(tonumber) LJLIB_REC(.)
|
|||||||
while (lj_char_isspace((unsigned char)(*ep))) ep++;
|
while (lj_char_isspace((unsigned char)(*ep))) ep++;
|
||||||
if (*ep == '\0') {
|
if (*ep == '\0') {
|
||||||
if (LJ_DUALNUM && LJ_LIKELY(ul < 0x80000000u+neg)) {
|
if (LJ_DUALNUM && LJ_LIKELY(ul < 0x80000000u+neg)) {
|
||||||
if (neg) ul = (unsigned long)-(long)ul;
|
if (neg) ul = ~ul+1u;
|
||||||
setintV(L->base-1-LJ_FR2, (int32_t)ul);
|
setintV(L->base-1-LJ_FR2, (int32_t)ul);
|
||||||
} else {
|
} else {
|
||||||
lua_Number n = (lua_Number)ul;
|
lua_Number n = (lua_Number)ul;
|
||||||
|
|||||||
@@ -155,7 +155,8 @@ LJLIB_CF(bit_tohex) LJLIB_REC(.)
|
|||||||
#endif
|
#endif
|
||||||
SBuf *sb = lj_buf_tmp_(L);
|
SBuf *sb = lj_buf_tmp_(L);
|
||||||
SFormat sf = (STRFMT_UINT|STRFMT_T_HEX);
|
SFormat sf = (STRFMT_UINT|STRFMT_T_HEX);
|
||||||
if (n < 0) { n = -n; sf |= STRFMT_F_UPPER; }
|
if (n < 0) { n = (int32_t)(~(uint32_t)n+1u); sf |= STRFMT_F_UPPER; }
|
||||||
|
if ((uint32_t)n > 254) n = 254;
|
||||||
sf |= ((SFormat)((n+1)&255) << STRFMT_SH_PREC);
|
sf |= ((SFormat)((n+1)&255) << STRFMT_SH_PREC);
|
||||||
#if LJ_HASFFI
|
#if LJ_HASFFI
|
||||||
if (n < 16) b &= ((uint64_t)1 << 4*n)-1;
|
if (n < 16) b &= ((uint64_t)1 << 4*n)-1;
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ LJLIB_CF(buffer_method_put) LJLIB_REC(.)
|
|||||||
lj_strfmt_putfnum((SBuf *)sbx, STRFMT_G14, numV(o));
|
lj_strfmt_putfnum((SBuf *)sbx, STRFMT_G14, numV(o));
|
||||||
} else if (tvisbuf(o)) {
|
} else if (tvisbuf(o)) {
|
||||||
SBufExt *sbx2 = bufV(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));
|
lj_buf_putmem((SBuf *)sbx, sbx2->r, sbufxlen(sbx2));
|
||||||
} else if (!mo && !tvisnil(mo = lj_meta_lookup(L, o, MM_tostring))) {
|
} else if (!mo && !tvisnil(mo = lj_meta_lookup(L, o, MM_tostring))) {
|
||||||
/* Call __tostring metamethod inline. */
|
/* Call __tostring metamethod inline. */
|
||||||
@@ -140,7 +140,7 @@ LJLIB_CF(buffer_method_put) LJLIB_REC(.)
|
|||||||
L->top = L->base + narg;
|
L->top = L->base + narg;
|
||||||
goto retry; /* Retry with the result. */
|
goto retry; /* Retry with the result. */
|
||||||
} else {
|
} 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. */
|
/* 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++) {
|
for (arg = 1; arg < narg; arg++) {
|
||||||
TValue *o = &L->base[arg];
|
TValue *o = &L->base[arg];
|
||||||
MSize n = tvisnil(o) ? LJ_MAX_BUF :
|
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);
|
MSize len = sbufxlen(sbx);
|
||||||
if (n > len) n = len;
|
if (n > len) n = len;
|
||||||
setstrV(L, o, lj_str_new(L, sbx->r, n));
|
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;
|
if (sbx->r == sbx->w && !sbufiscow(sbx)) sbx->r = sbx->w = sbx->b;
|
||||||
lj_gc_check(L);
|
lj_gc_check(L);
|
||||||
return narg-1;
|
return (int)(narg-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LJ_HASFFI
|
#if LJ_HASFFI
|
||||||
|
|||||||
@@ -93,6 +93,9 @@
|
|||||||
#elif defined(__CYGWIN__)
|
#elif defined(__CYGWIN__)
|
||||||
#define LJ_TARGET_CYGWIN 1
|
#define LJ_TARGET_CYGWIN 1
|
||||||
#define LUAJIT_OS LUAJIT_OS_POSIX
|
#define LUAJIT_OS LUAJIT_OS_POSIX
|
||||||
|
#elif defined(__QNX__)
|
||||||
|
#define LJ_TARGET_QNX 1
|
||||||
|
#define LUAJIT_OS LUAJIT_OS_POSIX
|
||||||
#else
|
#else
|
||||||
#define LUAJIT_OS LUAJIT_OS_OTHER
|
#define LUAJIT_OS LUAJIT_OS_OTHER
|
||||||
#endif
|
#endif
|
||||||
@@ -463,11 +466,17 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#elif !LJ_TARGET_PS3
|
#elif !LJ_TARGET_PS3
|
||||||
|
#if __clang__
|
||||||
|
#if ((__clang_major__ < 3) || ((__clang_major__ == 3) && __clang_minor__ < 5))
|
||||||
|
#error "Need at least Clang 3.5 or newer"
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
#if (__GNUC__ < 4) || ((__GNUC__ == 4) && __GNUC_MINOR__ < 3)
|
#if (__GNUC__ < 4) || ((__GNUC__ == 4) && __GNUC_MINOR__ < 3)
|
||||||
#error "Need at least GCC 4.3 or newer"
|
#error "Need at least GCC 4.3 or newer"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Check target-specific constraints. */
|
/* Check target-specific constraints. */
|
||||||
#ifndef _BUILDVM_H
|
#ifndef _BUILDVM_H
|
||||||
|
|||||||
@@ -313,7 +313,11 @@ static void asm_fusexref(ASMState *as, ARMIns ai, Reg rd, IRRef ref,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if !LJ_SOFTFP
|
#if !LJ_SOFTFP
|
||||||
/* Fuse to multiply-add/sub instruction. */
|
/*
|
||||||
|
** Fuse to multiply-add/sub instruction.
|
||||||
|
** VMLA rounds twice (UMA, not FMA) -- no need to check for JIT_F_OPT_FMA.
|
||||||
|
** VFMA needs VFPv4, which is uncommon on the remaining ARM32 targets.
|
||||||
|
*/
|
||||||
static int asm_fusemadd(ASMState *as, IRIns *ir, ARMIns ai, ARMIns air)
|
static int asm_fusemadd(ASMState *as, IRIns *ir, ARMIns ai, ARMIns air)
|
||||||
{
|
{
|
||||||
IRRef lref = ir->op1, rref = ir->op2;
|
IRRef lref = ir->op1, rref = ir->op2;
|
||||||
|
|||||||
@@ -337,7 +337,8 @@ static int asm_fusemadd(ASMState *as, IRIns *ir, A64Ins ai, A64Ins air)
|
|||||||
{
|
{
|
||||||
IRRef lref = ir->op1, rref = ir->op2;
|
IRRef lref = ir->op1, rref = ir->op2;
|
||||||
IRIns *irm;
|
IRIns *irm;
|
||||||
if (lref != rref &&
|
if ((as->flags & JIT_F_OPT_FMA) &&
|
||||||
|
lref != rref &&
|
||||||
((mayfuse(as, lref) && (irm = IR(lref), irm->o == IR_MUL) &&
|
((mayfuse(as, lref) && (irm = IR(lref), irm->o == IR_MUL) &&
|
||||||
ra_noreg(irm->r)) ||
|
ra_noreg(irm->r)) ||
|
||||||
(mayfuse(as, rref) && (irm = IR(rref), irm->o == IR_MUL) &&
|
(mayfuse(as, rref) && (irm = IR(rref), irm->o == IR_MUL) &&
|
||||||
@@ -1201,7 +1202,7 @@ dotypecheck:
|
|||||||
tmp = ra_scratch(as, allow);
|
tmp = ra_scratch(as, allow);
|
||||||
rset_clear(allow, tmp);
|
rset_clear(allow, tmp);
|
||||||
}
|
}
|
||||||
if (irt_isnum(t) && !(ir->op2 & IRSLOAD_CONVERT))
|
if (ra_hasreg(dest) && tmp != dest)
|
||||||
emit_dn(as, A64I_FMOV_D_R, (dest & 31), tmp);
|
emit_dn(as, A64I_FMOV_D_R, (dest & 31), tmp);
|
||||||
/* Need type check, even if the load result is unused. */
|
/* Need type check, even if the load result is unused. */
|
||||||
asm_guardcc(as, irt_isnum(t) ? CC_LS : CC_NE);
|
asm_guardcc(as, irt_isnum(t) ? CC_LS : CC_NE);
|
||||||
|
|||||||
@@ -1894,7 +1894,7 @@ static void asm_arithov(ASMState *as, IRIns *ir)
|
|||||||
lj_assertA(!irt_is64(ir->t), "bad usage");
|
lj_assertA(!irt_is64(ir->t), "bad usage");
|
||||||
if (irref_isk(ir->op2)) {
|
if (irref_isk(ir->op2)) {
|
||||||
int k = IR(ir->op2)->i;
|
int k = IR(ir->op2)->i;
|
||||||
if (ir->o == IR_SUBOV) k = -k;
|
if (ir->o == IR_SUBOV) k = (int)(~(unsigned int)k+1u);
|
||||||
if (checki16(k)) { /* (dest < left) == (k >= 0 ? 1 : 0) */
|
if (checki16(k)) { /* (dest < left) == (k >= 0 ? 1 : 0) */
|
||||||
left = ra_alloc1(as, ir->op1, RSET_GPR);
|
left = ra_alloc1(as, ir->op1, RSET_GPR);
|
||||||
asm_guard(as, k >= 0 ? MIPSI_BNE : MIPSI_BEQ, RID_TMP, RID_ZERO);
|
asm_guard(as, k >= 0 ? MIPSI_BNE : MIPSI_BEQ, RID_TMP, RID_ZERO);
|
||||||
|
|||||||
@@ -235,7 +235,8 @@ static int asm_fusemadd(ASMState *as, IRIns *ir, PPCIns pi, PPCIns pir)
|
|||||||
{
|
{
|
||||||
IRRef lref = ir->op1, rref = ir->op2;
|
IRRef lref = ir->op1, rref = ir->op2;
|
||||||
IRIns *irm;
|
IRIns *irm;
|
||||||
if (lref != rref &&
|
if ((as->flags & JIT_F_OPT_FMA) &&
|
||||||
|
lref != rref &&
|
||||||
((mayfuse(as, lref) && (irm = IR(lref), irm->o == IR_MUL) &&
|
((mayfuse(as, lref) && (irm = IR(lref), irm->o == IR_MUL) &&
|
||||||
ra_noreg(irm->r)) ||
|
ra_noreg(irm->r)) ||
|
||||||
(mayfuse(as, rref) && (irm = IR(rref), irm->o == IR_MUL) &&
|
(mayfuse(as, rref) && (irm = IR(rref), irm->o == IR_MUL) &&
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ static int carith_int64(lua_State *L, CTState *cts, CDArith *ca, MMS mm)
|
|||||||
else
|
else
|
||||||
*up = lj_carith_powu64(u0, u1);
|
*up = lj_carith_powu64(u0, u1);
|
||||||
break;
|
break;
|
||||||
case MM_unm: *up = (uint64_t)-(int64_t)u0; break;
|
case MM_unm: *up = ~u0+1u; break;
|
||||||
default:
|
default:
|
||||||
lj_assertL(0, "bad metamethod %d", mm);
|
lj_assertL(0, "bad metamethod %d", mm);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -488,7 +488,7 @@ static void cp_expr_prefix(CPState *cp, CPValue *k)
|
|||||||
} else if (cp_opt(cp, '+')) {
|
} else if (cp_opt(cp, '+')) {
|
||||||
cp_expr_unary(cp, k); /* Nothing to do (well, integer promotion). */
|
cp_expr_unary(cp, k); /* Nothing to do (well, integer promotion). */
|
||||||
} else if (cp_opt(cp, '-')) {
|
} else if (cp_opt(cp, '-')) {
|
||||||
cp_expr_unary(cp, k); k->i32 = -k->i32;
|
cp_expr_unary(cp, k); k->i32 = (int32_t)(~(uint32_t)k->i32+1);
|
||||||
} else if (cp_opt(cp, '~')) {
|
} else if (cp_opt(cp, '~')) {
|
||||||
cp_expr_unary(cp, k); k->i32 = ~k->i32;
|
cp_expr_unary(cp, k); k->i32 = ~k->i32;
|
||||||
} else if (cp_opt(cp, '!')) {
|
} else if (cp_opt(cp, '!')) {
|
||||||
|
|||||||
@@ -1504,9 +1504,13 @@ void LJ_FASTCALL recff_cdata_arith(jit_State *J, RecordFFData *rd)
|
|||||||
if (ctype_isenum(ct->info)) ct = ctype_child(cts, ct);
|
if (ctype_isenum(ct->info)) ct = ctype_child(cts, ct);
|
||||||
goto ok;
|
goto ok;
|
||||||
} else if (ctype_isfunc(ct->info)) {
|
} else if (ctype_isfunc(ct->info)) {
|
||||||
|
CTypeID id0 = i ? ctype_typeid(cts, s[0]) : 0;
|
||||||
tr = emitir(IRT(IR_FLOAD, IRT_PTR), tr, IRFL_CDATA_PTR);
|
tr = emitir(IRT(IR_FLOAD, IRT_PTR), tr, IRFL_CDATA_PTR);
|
||||||
ct = ctype_get(cts,
|
ct = ctype_get(cts,
|
||||||
lj_ctype_intern(cts, CTINFO(CT_PTR, CTALIGN_PTR|id), CTSIZE_PTR));
|
lj_ctype_intern(cts, CTINFO(CT_PTR, CTALIGN_PTR|id), CTSIZE_PTR));
|
||||||
|
if (i) {
|
||||||
|
s[0] = ctype_get(cts, id0); /* cts->tab may have been reallocated. */
|
||||||
|
}
|
||||||
goto ok;
|
goto ok;
|
||||||
} else {
|
} else {
|
||||||
tr = emitir(IRT(IR_ADD, IRT_PTR), tr, lj_ir_kintp(J, sizeof(GCcdata)));
|
tr = emitir(IRT(IR_ADD, IRT_PTR), tr, lj_ir_kintp(J, sizeof(GCcdata)));
|
||||||
@@ -1875,7 +1879,8 @@ TRef recff_bit64_tohex(jit_State *J, RecordFFData *rd, TRef hdr)
|
|||||||
} else {
|
} else {
|
||||||
n = id ? 16 : 8;
|
n = id ? 16 : 8;
|
||||||
}
|
}
|
||||||
if (n < 0) { n = -n; sf |= STRFMT_F_UPPER; }
|
if (n < 0) { n = (int32_t)(~n+1u); sf |= STRFMT_F_UPPER; }
|
||||||
|
if ((uint32_t)n > 254) n = 254;
|
||||||
sf |= ((SFormat)((n+1)&255) << STRFMT_SH_PREC);
|
sf |= ((SFormat)((n+1)&255) << STRFMT_SH_PREC);
|
||||||
if (id) {
|
if (id) {
|
||||||
tr = crec_ct_tv(J, ctype_get(cts, id), 0, J->base[0], &rd->argv[0]);
|
tr = crec_ct_tv(J, ctype_get(cts, id), 0, J->base[0], &rd->argv[0]);
|
||||||
|
|||||||
@@ -191,8 +191,20 @@ CTypeID lj_ctype_intern(CTState *cts, CTInfo info, CTSize size)
|
|||||||
}
|
}
|
||||||
id = cts->top;
|
id = cts->top;
|
||||||
if (LJ_UNLIKELY(id >= cts->sizetab)) {
|
if (LJ_UNLIKELY(id >= cts->sizetab)) {
|
||||||
|
#ifdef LUAJIT_CTYPE_CHECK_ANCHOR
|
||||||
|
CType *ct;
|
||||||
|
#endif
|
||||||
if (id >= CTID_MAX) lj_err_msg(cts->L, LJ_ERR_TABOV);
|
if (id >= CTID_MAX) lj_err_msg(cts->L, LJ_ERR_TABOV);
|
||||||
|
#ifdef LUAJIT_CTYPE_CHECK_ANCHOR
|
||||||
|
ct = lj_mem_newvec(cts->L, id+1, CType);
|
||||||
|
memcpy(ct, cts->tab, id*sizeof(CType));
|
||||||
|
memset(cts->tab, 0, id*sizeof(CType));
|
||||||
|
lj_mem_freevec(cts->g, cts->tab, cts->sizetab, CType);
|
||||||
|
cts->tab = ct;
|
||||||
|
cts->sizetab = id+1;
|
||||||
|
#else
|
||||||
lj_mem_growvec(cts->L, cts->tab, cts->sizetab, CTID_MAX, CType);
|
lj_mem_growvec(cts->L, cts->tab, cts->sizetab, CTID_MAX, CType);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
cts->top = id+1;
|
cts->top = id+1;
|
||||||
cts->tab[id].info = info;
|
cts->tab[id].info = info;
|
||||||
@@ -570,7 +582,7 @@ GCstr *lj_ctype_repr_int64(lua_State *L, uint64_t n, int isunsigned)
|
|||||||
if (isunsigned) {
|
if (isunsigned) {
|
||||||
*--p = 'U';
|
*--p = 'U';
|
||||||
} else if ((int64_t)n < 0) {
|
} else if ((int64_t)n < 0) {
|
||||||
n = (uint64_t)-(int64_t)n;
|
n = ~n+1u;
|
||||||
sign = 1;
|
sign = 1;
|
||||||
}
|
}
|
||||||
do { *--p = (char)('0' + n % 10); } while (n /= 10);
|
do { *--p = (char)('0' + n % 10); } while (n /= 10);
|
||||||
|
|||||||
@@ -101,9 +101,12 @@ static BCPos debug_framepc(lua_State *L, GCfunc *fn, cTValue *nextframe)
|
|||||||
pos = proto_bcpos(pt, ins) - 1;
|
pos = proto_bcpos(pt, ins) - 1;
|
||||||
#if LJ_HASJIT
|
#if LJ_HASJIT
|
||||||
if (pos > pt->sizebc) { /* Undo the effects of lj_trace_exit for JLOOP. */
|
if (pos > pt->sizebc) { /* Undo the effects of lj_trace_exit for JLOOP. */
|
||||||
GCtrace *T = (GCtrace *)((char *)(ins-1) - offsetof(GCtrace, startins));
|
if (bc_isret(bc_op(ins[-1]))) {
|
||||||
lj_assertL(bc_isret(bc_op(ins[-1])), "return bytecode expected");
|
GCtrace *T = (GCtrace *)((char *)(ins-1) - offsetof(GCtrace, startins));
|
||||||
pos = proto_bcpos(pt, mref(T->startpc, const BCIns));
|
pos = proto_bcpos(pt, mref(T->startpc, const BCIns));
|
||||||
|
} else {
|
||||||
|
pos = NO_BCPOS; /* Punt in case of stack overflow for stitched trace. */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return pos;
|
return pos;
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ static int emit_kdelta2(ASMState *as, Reg rd, int32_t i)
|
|||||||
if (other) {
|
if (other) {
|
||||||
int32_t delta = i - other;
|
int32_t delta = i - other;
|
||||||
uint32_t sh, inv = 0, k2, k;
|
uint32_t sh, inv = 0, k2, k;
|
||||||
if (delta < 0) { delta = -delta; inv = ARMI_ADD^ARMI_SUB; }
|
if (delta < 0) { delta = (int32_t)(~(uint32_t)delta+1u); inv = ARMI_ADD^ARMI_SUB; }
|
||||||
sh = lj_ffs(delta) & ~1;
|
sh = lj_ffs(delta) & ~1;
|
||||||
k2 = emit_isk12(0, delta & (255 << sh));
|
k2 = emit_isk12(0, delta & (255 << sh));
|
||||||
k = emit_isk12(0, delta & ~(255 << sh));
|
k = emit_isk12(0, delta & ~(255 << sh));
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ static uint64_t get_k64val(ASMState *as, IRRef ref)
|
|||||||
/* Encode constant in K12 format for data processing instructions. */
|
/* Encode constant in K12 format for data processing instructions. */
|
||||||
static uint32_t emit_isk12(int64_t n)
|
static uint32_t emit_isk12(int64_t n)
|
||||||
{
|
{
|
||||||
uint64_t k = (n < 0) ? -n : n;
|
uint64_t k = n < 0 ? ~(uint64_t)n+1u : (uint64_t)n;
|
||||||
uint32_t m = (n < 0) ? 0x40000000 : 0;
|
uint32_t m = n < 0 ? 0x40000000 : 0;
|
||||||
if (k < 0x1000) {
|
if (k < 0x1000) {
|
||||||
return A64I_K12|m|A64F_U12(k);
|
return A64I_K12|m|A64F_U12(k);
|
||||||
} else if ((k & 0xfff000) == k) {
|
} else if ((k & 0xfff000) == k) {
|
||||||
@@ -177,7 +177,7 @@ static int emit_kdelta(ASMState *as, Reg rd, uint64_t k, int lim)
|
|||||||
emit_dm(as, A64I_MOVx, rd, r);
|
emit_dm(as, A64I_MOVx, rd, r);
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
uint32_t k12 = emit_isk12(delta < 0 ? -delta : delta);
|
uint32_t k12 = emit_isk12(delta < 0 ? (int64_t)(~(uint64_t)delta+1u) : delta);
|
||||||
if (k12) {
|
if (k12) {
|
||||||
emit_dn(as, (delta < 0 ? A64I_SUBx : A64I_ADDx)^k12, rd, r);
|
emit_dn(as, (delta < 0 ? A64I_SUBx : A64I_ADDx)^k12, rd, r);
|
||||||
return 1;
|
return 1;
|
||||||
@@ -417,7 +417,8 @@ static void emit_addptr(ASMState *as, Reg r, int32_t ofs)
|
|||||||
{
|
{
|
||||||
if (ofs)
|
if (ofs)
|
||||||
emit_opk(as, ofs < 0 ? A64I_SUBx : A64I_ADDx, r, r,
|
emit_opk(as, ofs < 0 ? A64I_SUBx : A64I_ADDx, r, r,
|
||||||
ofs < 0 ? -ofs : ofs, rset_exclude(RSET_GPR, r));
|
ofs < 0 ? (int32_t)(~(uint32_t)ofs+1u) : ofs,
|
||||||
|
rset_exclude(RSET_GPR, r));
|
||||||
}
|
}
|
||||||
|
|
||||||
#define emit_spsub(as, ofs) emit_addptr(as, RID_SP, -(ofs))
|
#define emit_spsub(as, ofs) emit_addptr(as, RID_SP, -(ofs))
|
||||||
|
|||||||
@@ -329,12 +329,12 @@ static void err_unwind_win_jit(global_State *g, int errcode)
|
|||||||
memset(&hist, 0, sizeof(hist));
|
memset(&hist, 0, sizeof(hist));
|
||||||
RtlCaptureContext(&ctx);
|
RtlCaptureContext(&ctx);
|
||||||
while (1) {
|
while (1) {
|
||||||
uintptr_t frame, base, addr = ctx.CONTEXT_REG_PC;
|
DWORD64 frame, base, addr = ctx.CONTEXT_REG_PC;
|
||||||
void *hdata;
|
void *hdata;
|
||||||
PRUNTIME_FUNCTION func = RtlLookupFunctionEntry(addr, &base, &hist);
|
PRUNTIME_FUNCTION func = RtlLookupFunctionEntry(addr, &base, &hist);
|
||||||
if (!func) { /* Found frame without .pdata: must be JIT-compiled code. */
|
if (!func) { /* Found frame without .pdata: must be JIT-compiled code. */
|
||||||
ExitNo exitno;
|
ExitNo exitno;
|
||||||
uintptr_t stub = lj_trace_unwind(G2J(g), addr - sizeof(MCode), &exitno);
|
uintptr_t stub = lj_trace_unwind(G2J(g), (uintptr_t)(addr - sizeof(MCode)), &exitno);
|
||||||
if (stub) { /* Jump to side exit to unwind the trace. */
|
if (stub) { /* Jump to side exit to unwind the trace. */
|
||||||
ctx.CONTEXT_REG_PC = stub;
|
ctx.CONTEXT_REG_PC = stub;
|
||||||
G2J(g)->exitcode = errcode;
|
G2J(g)->exitcode = errcode;
|
||||||
@@ -777,6 +777,7 @@ LJ_NOINLINE void lj_err_mem(lua_State *L)
|
|||||||
{
|
{
|
||||||
if (L->status == LUA_ERRERR+1) /* Don't touch the stack during lua_open. */
|
if (L->status == LUA_ERRERR+1) /* Don't touch the stack during lua_open. */
|
||||||
lj_vm_unwind_c(L->cframe, LUA_ERRMEM);
|
lj_vm_unwind_c(L->cframe, LUA_ERRMEM);
|
||||||
|
if (curr_funcisL(L)) L->top = curr_topL(L);
|
||||||
setstrV(L, L->top++, lj_err_str(L, LJ_ERR_ERRMEM));
|
setstrV(L, L->top++, lj_err_str(L, LJ_ERR_ERRMEM));
|
||||||
lj_err_throw(L, LUA_ERRMEM);
|
lj_err_throw(L, LUA_ERRMEM);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1117,7 +1117,7 @@ static LJ_AINLINE TRef recff_sbufx_len(jit_State *J, TRef trr, TRef trw)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Emit typecheck for string buffer. */
|
/* 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];
|
TRef trtype, ud = J->base[arg];
|
||||||
if (!tvisbuf(&rd->argv[arg])) lj_trace_err(J, LJ_TRERR_BADTYPE);
|
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. */
|
/* 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 tr = J->base[arg];
|
||||||
TRef trlim = lj_ir_kint(J, LJ_MAX_BUF);
|
TRef trlim = lj_ir_kint(J, LJ_MAX_BUF);
|
||||||
|
|||||||
@@ -87,10 +87,11 @@
|
|||||||
#define JIT_F_OPT_ABC (JIT_F_OPT << 7)
|
#define JIT_F_OPT_ABC (JIT_F_OPT << 7)
|
||||||
#define JIT_F_OPT_SINK (JIT_F_OPT << 8)
|
#define JIT_F_OPT_SINK (JIT_F_OPT << 8)
|
||||||
#define JIT_F_OPT_FUSE (JIT_F_OPT << 9)
|
#define JIT_F_OPT_FUSE (JIT_F_OPT << 9)
|
||||||
|
#define JIT_F_OPT_FMA (JIT_F_OPT << 10)
|
||||||
|
|
||||||
/* Optimizations names for -O. Must match the order above. */
|
/* Optimizations names for -O. Must match the order above. */
|
||||||
#define JIT_F_OPTSTRING \
|
#define JIT_F_OPTSTRING \
|
||||||
"\4fold\3cse\3dce\3fwd\3dse\6narrow\4loop\3abc\4sink\4fuse"
|
"\4fold\3cse\3dce\3fwd\3dse\6narrow\4loop\3abc\4sink\4fuse\3fma"
|
||||||
|
|
||||||
/* Optimization levels set a fixed combination of flags. */
|
/* Optimization levels set a fixed combination of flags. */
|
||||||
#define JIT_F_OPT_0 0
|
#define JIT_F_OPT_0 0
|
||||||
@@ -99,6 +100,7 @@
|
|||||||
#define JIT_F_OPT_3 (JIT_F_OPT_2|\
|
#define JIT_F_OPT_3 (JIT_F_OPT_2|\
|
||||||
JIT_F_OPT_FWD|JIT_F_OPT_DSE|JIT_F_OPT_ABC|JIT_F_OPT_SINK|JIT_F_OPT_FUSE)
|
JIT_F_OPT_FWD|JIT_F_OPT_DSE|JIT_F_OPT_ABC|JIT_F_OPT_SINK|JIT_F_OPT_FUSE)
|
||||||
#define JIT_F_OPT_DEFAULT JIT_F_OPT_3
|
#define JIT_F_OPT_DEFAULT JIT_F_OPT_3
|
||||||
|
/* Note: FMA is not set by default. */
|
||||||
|
|
||||||
/* -- JIT engine parameters ----------------------------------------------- */
|
/* -- JIT engine parameters ----------------------------------------------- */
|
||||||
|
|
||||||
|
|||||||
@@ -413,7 +413,7 @@ typedef struct GCproto {
|
|||||||
#define PROTO_UV_IMMUTABLE 0x4000 /* Immutable upvalue. */
|
#define PROTO_UV_IMMUTABLE 0x4000 /* Immutable upvalue. */
|
||||||
|
|
||||||
#define proto_kgc(pt, idx) \
|
#define proto_kgc(pt, idx) \
|
||||||
check_exp((uintptr_t)(intptr_t)(idx) >= (uintptr_t)-(intptr_t)(pt)->sizekgc, \
|
check_exp((uintptr_t)(intptr_t)(idx) >= ~(uintptr_t)(pt)->sizekgc+1u, \
|
||||||
gcref(mref((pt)->k, GCRef)[(idx)]))
|
gcref(mref((pt)->k, GCRef)[(idx)]))
|
||||||
#define proto_knumtv(pt, idx) \
|
#define proto_knumtv(pt, idx) \
|
||||||
check_exp((uintptr_t)(idx) < (pt)->sizekn, &mref((pt)->k, TValue)[(idx)])
|
check_exp((uintptr_t)(idx) < (pt)->sizekn, &mref((pt)->k, TValue)[(idx)])
|
||||||
|
|||||||
@@ -267,7 +267,7 @@ static int32_t kfold_intop(int32_t k1, int32_t k2, IROp op)
|
|||||||
case IR_SUB: k1 -= k2; break;
|
case IR_SUB: k1 -= k2; break;
|
||||||
case IR_MUL: k1 *= k2; break;
|
case IR_MUL: k1 *= k2; break;
|
||||||
case IR_MOD: k1 = lj_vm_modi(k1, k2); break;
|
case IR_MOD: k1 = lj_vm_modi(k1, k2); break;
|
||||||
case IR_NEG: k1 = -k1; break;
|
case IR_NEG: k1 = (int32_t)(~(uint32_t)k1+1u); break;
|
||||||
case IR_BAND: k1 &= k2; break;
|
case IR_BAND: k1 &= k2; break;
|
||||||
case IR_BOR: k1 |= k2; break;
|
case IR_BOR: k1 |= k2; break;
|
||||||
case IR_BXOR: k1 ^= k2; break;
|
case IR_BXOR: k1 ^= k2; break;
|
||||||
@@ -1366,7 +1366,7 @@ LJFOLDF(simplify_intsub_k)
|
|||||||
if (fright->i == 0) /* i - 0 ==> i */
|
if (fright->i == 0) /* i - 0 ==> i */
|
||||||
return LEFTFOLD;
|
return LEFTFOLD;
|
||||||
fins->o = IR_ADD; /* i - k ==> i + (-k) */
|
fins->o = IR_ADD; /* i - k ==> i + (-k) */
|
||||||
fins->op2 = (IRRef1)lj_ir_kint(J, -fright->i); /* Overflow for -2^31 ok. */
|
fins->op2 = (IRRef1)lj_ir_kint(J, (int32_t)(~(uint32_t)fright->i+1u)); /* Overflow for -2^31 ok. */
|
||||||
return RETRYFOLD;
|
return RETRYFOLD;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1397,7 +1397,7 @@ LJFOLDF(simplify_intsub_k64)
|
|||||||
if (k == 0) /* i - 0 ==> i */
|
if (k == 0) /* i - 0 ==> i */
|
||||||
return LEFTFOLD;
|
return LEFTFOLD;
|
||||||
fins->o = IR_ADD; /* i - k ==> i + (-k) */
|
fins->o = IR_ADD; /* i - k ==> i + (-k) */
|
||||||
fins->op2 = (IRRef1)lj_ir_kint64(J, (uint64_t)-(int64_t)k);
|
fins->op2 = (IRRef1)lj_ir_kint64(J, ~k+1u);
|
||||||
return RETRYFOLD;
|
return RETRYFOLD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -964,22 +964,22 @@ static void bcemit_unop(FuncState *fs, BCOp op, ExpDesc *e)
|
|||||||
#if LJ_HASFFI
|
#if LJ_HASFFI
|
||||||
if (e->k == VKCDATA) { /* Fold in-place since cdata is not interned. */
|
if (e->k == VKCDATA) { /* Fold in-place since cdata is not interned. */
|
||||||
GCcdata *cd = cdataV(&e->u.nval);
|
GCcdata *cd = cdataV(&e->u.nval);
|
||||||
int64_t *p = (int64_t *)cdataptr(cd);
|
uint64_t *p = (uint64_t *)cdataptr(cd);
|
||||||
if (cd->ctypeid == CTID_COMPLEX_DOUBLE)
|
if (cd->ctypeid == CTID_COMPLEX_DOUBLE)
|
||||||
p[1] ^= (int64_t)U64x(80000000,00000000);
|
p[1] ^= U64x(80000000,00000000);
|
||||||
else
|
else
|
||||||
*p = -*p;
|
*p = ~*p+1u;
|
||||||
return;
|
return;
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
if (expr_isnumk(e) && !expr_numiszero(e)) { /* Avoid folding to -0. */
|
if (expr_isnumk(e) && !expr_numiszero(e)) { /* Avoid folding to -0. */
|
||||||
TValue *o = expr_numtv(e);
|
TValue *o = expr_numtv(e);
|
||||||
if (tvisint(o)) {
|
if (tvisint(o)) {
|
||||||
int32_t k = intV(o);
|
int32_t k = intV(o), negk = (int32_t)(~(uint32_t)k+1u);
|
||||||
if (k == -k)
|
if (k == negk)
|
||||||
setnumV(o, -(lua_Number)k);
|
setnumV(o, -(lua_Number)k);
|
||||||
else
|
else
|
||||||
setintV(o, -k);
|
setintV(o, negk);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
o->u64 ^= U64x(80000000,00000000);
|
o->u64 ^= U64x(80000000,00000000);
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ static PRGR libfunc_rgr;
|
|||||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
|
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
|
||||||
#define LJ_TARGET_HAS_GETENTROPY 1
|
#define LJ_TARGET_HAS_GETENTROPY 1
|
||||||
#endif
|
#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
|
#define LJ_TARGET_HAS_GETENTROPY 1
|
||||||
#endif
|
#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_sec = tm.it_interval.tv_sec = interval / 1000;
|
||||||
tm.it_value.tv_usec = tm.it_interval.tv_usec = (interval % 1000) * 1000;
|
tm.it_value.tv_usec = tm.it_interval.tv_usec = (interval % 1000) * 1000;
|
||||||
setitimer(ITIMER_PROF, &tm, NULL);
|
setitimer(ITIMER_PROF, &tm, NULL);
|
||||||
|
#if LJ_TARGET_QNX
|
||||||
|
sa.sa_flags = 0;
|
||||||
|
#else
|
||||||
sa.sa_flags = SA_RESTART;
|
sa.sa_flags = SA_RESTART;
|
||||||
|
#endif
|
||||||
sa.sa_handler = profile_signal;
|
sa.sa_handler = profile_signal;
|
||||||
sigemptyset(&sa.sa_mask);
|
sigemptyset(&sa.sa_mask);
|
||||||
sigaction(SIGPROF, &sa, &ps->oldsa);
|
sigaction(SIGPROF, &sa, &ps->oldsa);
|
||||||
|
|||||||
@@ -1945,6 +1945,8 @@ static void rec_varg(jit_State *J, BCReg dst, ptrdiff_t nresults)
|
|||||||
} else if (dst + nresults > J->maxslot) {
|
} else if (dst + nresults > J->maxslot) {
|
||||||
J->maxslot = dst + (BCReg)nresults;
|
J->maxslot = dst + (BCReg)nresults;
|
||||||
}
|
}
|
||||||
|
if (J->baseslot + J->maxslot >= LJ_MAX_JSLOTS)
|
||||||
|
lj_trace_err(J, LJ_TRERR_STACKOV);
|
||||||
for (i = 0; i < nresults; i++)
|
for (i = 0; i < nresults; i++)
|
||||||
J->base[dst+i] = i < nvararg ? getslot(J, i - nvararg - 1 - LJ_FR2) : TREF_NIL;
|
J->base[dst+i] = i < nvararg ? getslot(J, i - nvararg - 1 - LJ_FR2) : TREF_NIL;
|
||||||
} else { /* Unknown number of varargs passed to trace. */
|
} else { /* Unknown number of varargs passed to trace. */
|
||||||
@@ -1964,7 +1966,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)));
|
vbase = emitir(IRT(IR_ADD, IRT_PGC), vbase, lj_ir_kint(J, frofs-8*(1+LJ_FR2)));
|
||||||
for (i = 0; i < nload; i++) {
|
for (i = 0; i < nload; i++) {
|
||||||
IRType t = itype2irt(&J->L->base[i-1-LJ_FR2-nvararg]);
|
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 {
|
} else {
|
||||||
emitir(IRTGI(IR_LE), fr, lj_ir_kint(J, frofs));
|
emitir(IRTGI(IR_LE), fr, lj_ir_kint(J, frofs));
|
||||||
@@ -2022,8 +2024,6 @@ static void rec_varg(jit_State *J, BCReg dst, ptrdiff_t nresults)
|
|||||||
lj_trace_err_info(J, LJ_TRERR_NYIBC);
|
lj_trace_err_info(J, LJ_TRERR_NYIBC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (J->baseslot + J->maxslot >= LJ_MAX_JSLOTS)
|
|
||||||
lj_trace_err(J, LJ_TRERR_STACKOV);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- Record allocations -------------------------------------------------- */
|
/* -- Record allocations -------------------------------------------------- */
|
||||||
@@ -2572,7 +2572,8 @@ void lj_record_ins(jit_State *J)
|
|||||||
break;
|
break;
|
||||||
case BC_JLOOP:
|
case BC_JLOOP:
|
||||||
rec_loop_jit(J, rc, rec_loop(J, ra,
|
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;
|
break;
|
||||||
|
|
||||||
case BC_IFORL:
|
case BC_IFORL:
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ retlit:
|
|||||||
char * LJ_FASTCALL lj_strfmt_wint(char *p, int32_t k)
|
char * LJ_FASTCALL lj_strfmt_wint(char *p, int32_t k)
|
||||||
{
|
{
|
||||||
uint32_t u = (uint32_t)k;
|
uint32_t u = (uint32_t)k;
|
||||||
if (k < 0) { u = (uint32_t)-k; *p++ = '-'; }
|
if (k < 0) { u = ~u+1u; *p++ = '-'; }
|
||||||
if (u < 10000) {
|
if (u < 10000) {
|
||||||
if (u < 10) goto dig1;
|
if (u < 10) goto dig1;
|
||||||
if (u < 100) goto dig2;
|
if (u < 100) goto dig2;
|
||||||
@@ -287,7 +287,7 @@ SBuf *lj_strfmt_putfxint(SBuf *sb, SFormat sf, uint64_t k)
|
|||||||
/* Figure out signed prefixes. */
|
/* Figure out signed prefixes. */
|
||||||
if (STRFMT_TYPE(sf) == STRFMT_INT) {
|
if (STRFMT_TYPE(sf) == STRFMT_INT) {
|
||||||
if ((int64_t)k < 0) {
|
if ((int64_t)k < 0) {
|
||||||
k = (uint64_t)-(int64_t)k;
|
k = ~k+1u;
|
||||||
prefix = 256 + '-';
|
prefix = 256 + '-';
|
||||||
} else if ((sf & STRFMT_F_PLUS)) {
|
} else if ((sf & STRFMT_F_PLUS)) {
|
||||||
prefix = 256 + '+';
|
prefix = 256 + '+';
|
||||||
|
|||||||
@@ -124,19 +124,19 @@ static StrScanFmt strscan_hex(const uint8_t *p, TValue *o,
|
|||||||
case STRSCAN_INT:
|
case STRSCAN_INT:
|
||||||
if (!(opt & STRSCAN_OPT_TONUM) && x < 0x80000000u+neg &&
|
if (!(opt & STRSCAN_OPT_TONUM) && x < 0x80000000u+neg &&
|
||||||
!(x == 0 && neg)) {
|
!(x == 0 && neg)) {
|
||||||
o->i = neg ? -(int32_t)x : (int32_t)x;
|
o->i = neg ? (int32_t)(~x+1u) : (int32_t)x;
|
||||||
return STRSCAN_INT; /* Fast path for 32 bit integers. */
|
return STRSCAN_INT; /* Fast path for 32 bit integers. */
|
||||||
}
|
}
|
||||||
if (!(opt & STRSCAN_OPT_C)) { fmt = STRSCAN_NUM; break; }
|
if (!(opt & STRSCAN_OPT_C)) { fmt = STRSCAN_NUM; break; }
|
||||||
/* fallthrough */
|
/* fallthrough */
|
||||||
case STRSCAN_U32:
|
case STRSCAN_U32:
|
||||||
if (dig > 8) return STRSCAN_ERROR;
|
if (dig > 8) return STRSCAN_ERROR;
|
||||||
o->i = neg ? -(int32_t)x : (int32_t)x;
|
o->i = neg ? (int32_t)(~x+1u) : (int32_t)x;
|
||||||
return STRSCAN_U32;
|
return STRSCAN_U32;
|
||||||
case STRSCAN_I64:
|
case STRSCAN_I64:
|
||||||
case STRSCAN_U64:
|
case STRSCAN_U64:
|
||||||
if (dig > 16) return STRSCAN_ERROR;
|
if (dig > 16) return STRSCAN_ERROR;
|
||||||
o->u64 = neg ? (uint64_t)-(int64_t)x : x;
|
o->u64 = neg ? ~x+1u : x;
|
||||||
return fmt;
|
return fmt;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -168,12 +168,12 @@ static StrScanFmt strscan_oct(const uint8_t *p, TValue *o,
|
|||||||
/* fallthrough */
|
/* fallthrough */
|
||||||
case STRSCAN_U32:
|
case STRSCAN_U32:
|
||||||
if ((x >> 32)) return STRSCAN_ERROR;
|
if ((x >> 32)) return STRSCAN_ERROR;
|
||||||
o->i = neg ? -(int32_t)x : (int32_t)x;
|
o->i = neg ? (int32_t)(~(uint32_t)x+1u) : (int32_t)x;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case STRSCAN_I64:
|
case STRSCAN_I64:
|
||||||
case STRSCAN_U64:
|
case STRSCAN_U64:
|
||||||
o->u64 = neg ? (uint64_t)-(int64_t)x : x;
|
o->u64 = neg ? ~x+1u : x;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return fmt;
|
return fmt;
|
||||||
@@ -229,18 +229,18 @@ static StrScanFmt strscan_dec(const uint8_t *p, TValue *o,
|
|||||||
switch (fmt) {
|
switch (fmt) {
|
||||||
case STRSCAN_INT:
|
case STRSCAN_INT:
|
||||||
if (!(opt & STRSCAN_OPT_TONUM) && x < 0x80000000u+neg) {
|
if (!(opt & STRSCAN_OPT_TONUM) && x < 0x80000000u+neg) {
|
||||||
o->i = neg ? -(int32_t)x : (int32_t)x;
|
o->i = neg ? (int32_t)(~x+1u) : (int32_t)x;
|
||||||
return STRSCAN_INT; /* Fast path for 32 bit integers. */
|
return STRSCAN_INT; /* Fast path for 32 bit integers. */
|
||||||
}
|
}
|
||||||
if (!(opt & STRSCAN_OPT_C)) { fmt = STRSCAN_NUM; goto plainnumber; }
|
if (!(opt & STRSCAN_OPT_C)) { fmt = STRSCAN_NUM; goto plainnumber; }
|
||||||
/* fallthrough */
|
/* fallthrough */
|
||||||
case STRSCAN_U32:
|
case STRSCAN_U32:
|
||||||
if ((x >> 32) != 0) return STRSCAN_ERROR;
|
if ((x >> 32) != 0) return STRSCAN_ERROR;
|
||||||
o->i = neg ? -(int32_t)x : (int32_t)x;
|
o->i = neg ? (int32_t)(~x+1u) : (int32_t)x;
|
||||||
return STRSCAN_U32;
|
return STRSCAN_U32;
|
||||||
case STRSCAN_I64:
|
case STRSCAN_I64:
|
||||||
case STRSCAN_U64:
|
case STRSCAN_U64:
|
||||||
o->u64 = neg ? (uint64_t)-(int64_t)x : x;
|
o->u64 = neg ? ~x+1u : x;
|
||||||
return fmt;
|
return fmt;
|
||||||
default:
|
default:
|
||||||
plainnumber: /* Fast path for plain numbers < 2^63. */
|
plainnumber: /* Fast path for plain numbers < 2^63. */
|
||||||
@@ -348,18 +348,18 @@ static StrScanFmt strscan_bin(const uint8_t *p, TValue *o,
|
|||||||
switch (fmt) {
|
switch (fmt) {
|
||||||
case STRSCAN_INT:
|
case STRSCAN_INT:
|
||||||
if (!(opt & STRSCAN_OPT_TONUM) && x < 0x80000000u+neg) {
|
if (!(opt & STRSCAN_OPT_TONUM) && x < 0x80000000u+neg) {
|
||||||
o->i = neg ? -(int32_t)x : (int32_t)x;
|
o->i = neg ? (int32_t)(~x+1u) : (int32_t)x;
|
||||||
return STRSCAN_INT; /* Fast path for 32 bit integers. */
|
return STRSCAN_INT; /* Fast path for 32 bit integers. */
|
||||||
}
|
}
|
||||||
if (!(opt & STRSCAN_OPT_C)) { fmt = STRSCAN_NUM; break; }
|
if (!(opt & STRSCAN_OPT_C)) { fmt = STRSCAN_NUM; break; }
|
||||||
/* fallthrough */
|
/* fallthrough */
|
||||||
case STRSCAN_U32:
|
case STRSCAN_U32:
|
||||||
if (dig > 32) return STRSCAN_ERROR;
|
if (dig > 32) return STRSCAN_ERROR;
|
||||||
o->i = neg ? -(int32_t)x : (int32_t)x;
|
o->i = neg ? (int32_t)(~x+1u) : (int32_t)x;
|
||||||
return STRSCAN_U32;
|
return STRSCAN_U32;
|
||||||
case STRSCAN_I64:
|
case STRSCAN_I64:
|
||||||
case STRSCAN_U64:
|
case STRSCAN_U64:
|
||||||
o->u64 = neg ? (uint64_t)-(int64_t)x : x;
|
o->u64 = neg ? ~x+1u : x;
|
||||||
return fmt;
|
return fmt;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -468,7 +468,7 @@ StrScanFmt lj_strscan_scan(const uint8_t *p, MSize len, TValue *o,
|
|||||||
if (xx >= STRSCAN_MAXEXP) return STRSCAN_ERROR;
|
if (xx >= STRSCAN_MAXEXP) return STRSCAN_ERROR;
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
ex += negx ? -(int32_t)xx : (int32_t)xx;
|
ex += negx ? (int32_t)(~xx+1u) : (int32_t)xx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse suffix. */
|
/* Parse suffix. */
|
||||||
@@ -507,7 +507,7 @@ StrScanFmt lj_strscan_scan(const uint8_t *p, MSize len, TValue *o,
|
|||||||
o->n = -0.0;
|
o->n = -0.0;
|
||||||
return STRSCAN_NUM;
|
return STRSCAN_NUM;
|
||||||
} else {
|
} else {
|
||||||
o->i = neg ? -(int32_t)x : (int32_t)x;
|
o->i = neg ? (int32_t)(~x+1u) : (int32_t)x;
|
||||||
return STRSCAN_INT;
|
return STRSCAN_INT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,17 @@ LJ_FUNCA double lj_wrap_fmod(double x, double y) { return fmod(x, y); }
|
|||||||
|
|
||||||
/* -- Helper functions ---------------------------------------------------- */
|
/* -- Helper functions ---------------------------------------------------- */
|
||||||
|
|
||||||
|
/* Required to prevent the C compiler from applying FMA optimizations.
|
||||||
|
**
|
||||||
|
** Yes, there's -ffp-contract and the FP_CONTRACT pragma ... in theory.
|
||||||
|
** But the current state of C compilers is a mess in this regard.
|
||||||
|
** Also, this function is not performance sensitive at all.
|
||||||
|
*/
|
||||||
|
LJ_NOINLINE static double lj_vm_floormul(double x, double y)
|
||||||
|
{
|
||||||
|
return lj_vm_floor(x / y) * y;
|
||||||
|
}
|
||||||
|
|
||||||
double lj_vm_foldarith(double x, double y, int op)
|
double lj_vm_foldarith(double x, double y, int op)
|
||||||
{
|
{
|
||||||
switch (op) {
|
switch (op) {
|
||||||
@@ -43,7 +54,7 @@ double lj_vm_foldarith(double x, double y, int op)
|
|||||||
case IR_SUB - IR_ADD: return x-y; break;
|
case IR_SUB - IR_ADD: return x-y; break;
|
||||||
case IR_MUL - IR_ADD: return x*y; break;
|
case IR_MUL - IR_ADD: return x*y; break;
|
||||||
case IR_DIV - IR_ADD: return x/y; break;
|
case IR_DIV - IR_ADD: return x/y; break;
|
||||||
case IR_MOD - IR_ADD: return x-lj_vm_floor(x/y)*y; break;
|
case IR_MOD - IR_ADD: return x-lj_vm_floormul(x, y); break;
|
||||||
case IR_POW - IR_ADD: return pow(x, y); break;
|
case IR_POW - IR_ADD: return pow(x, y); break;
|
||||||
case IR_NEG - IR_ADD: return -x; break;
|
case IR_NEG - IR_ADD: return -x; break;
|
||||||
case IR_ABS - IR_ADD: return fabs(x); break;
|
case IR_ABS - IR_ADD: return fabs(x); break;
|
||||||
@@ -64,11 +75,11 @@ int32_t LJ_FASTCALL lj_vm_modi(int32_t a, int32_t b)
|
|||||||
uint32_t y, ua, ub;
|
uint32_t y, ua, ub;
|
||||||
/* This must be checked before using this function. */
|
/* This must be checked before using this function. */
|
||||||
lj_assertX(b != 0, "modulo with zero divisor");
|
lj_assertX(b != 0, "modulo with zero divisor");
|
||||||
ua = a < 0 ? (uint32_t)-a : (uint32_t)a;
|
ua = a < 0 ? ~(uint32_t)a+1u : (uint32_t)a;
|
||||||
ub = b < 0 ? (uint32_t)-b : (uint32_t)b;
|
ub = b < 0 ? ~(uint32_t)b+1u : (uint32_t)b;
|
||||||
y = ua % ub;
|
y = ua % ub;
|
||||||
if (y != 0 && (a^b) < 0) y = y - ub;
|
if (y != 0 && (a^b) < 0) y = y - ub;
|
||||||
if (((int32_t)y^b) < 0) y = (uint32_t)-(int32_t)y;
|
if (((int32_t)y^b) < 0) y = ~y+1u;
|
||||||
return (int32_t)y;
|
return (int32_t)y;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ goto :BUILD
|
|||||||
@set TARGETLIB=libluajit_%TARGETLIB_SUFFIX%.a
|
@set TARGETLIB=libluajit_%TARGETLIB_SUFFIX%.a
|
||||||
:BUILD
|
:BUILD
|
||||||
del %TARGETLIB%
|
del %TARGETLIB%
|
||||||
|
@set LJCOMPILE=%LJCOMPILE% -fPIC
|
||||||
@if "%1" neq "noamalg" goto :AMALG
|
@if "%1" neq "noamalg" goto :AMALG
|
||||||
for %%f in (lj_*.c lib_*.c) do (
|
for %%f in (lj_*.c lib_*.c) do (
|
||||||
%LJCOMPILE% %%f
|
%LJCOMPILE% %%f
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ if exist minilua.exe.manifest^
|
|||||||
minilua %DASM% -LN %DASMFLAGS% -o host\buildvm_arch.h %DASC%
|
minilua %DASM% -LN %DASMFLAGS% -o host\buildvm_arch.h %DASC%
|
||||||
@if errorlevel 1 goto :BAD
|
@if errorlevel 1 goto :BAD
|
||||||
|
|
||||||
%LJCOMPILE% /I "." /I %DASMDIR% %GC64% -DLUAJIT_TARGET=LUAJIT_ARCH_X64 -DLUAJIT_OS=LUAJIT_OS_OTHER -DLUAJIT_DISABLE_JIT -DLUAJIT_DISABLE_FFI -DLUAJIT_NO_UNWIND host\buildvm*.c
|
%LJCOMPILE% /I "." /I %DASMDIR% %GC64% -DLUAJIT_TARGET=LUAJIT_ARCH_X64 -DLUAJIT_OS=LUAJIT_OS_OTHER -DLUAJIT_DISABLE_JIT -DLUAJIT_DISABLE_FFI -DLUAJIT_USE_SYSMALLOC -DLUAJIT_NO_UNWIND host\buildvm*.c
|
||||||
@if errorlevel 1 goto :BAD
|
@if errorlevel 1 goto :BAD
|
||||||
%LJLINK% /out:buildvm.exe buildvm*.obj
|
%LJLINK% /out:buildvm.exe buildvm*.obj
|
||||||
@if errorlevel 1 goto :BAD
|
@if errorlevel 1 goto :BAD
|
||||||
@@ -78,7 +78,7 @@ buildvm -m folddef -o lj_folddef.h lj_opt_fold.c
|
|||||||
@set LJLIB="%SCE_ORBIS_SDK_DIR%\host_tools\bin\orbis-ar" rcus
|
@set LJLIB="%SCE_ORBIS_SDK_DIR%\host_tools\bin\orbis-ar" rcus
|
||||||
@set INCLUDE=""
|
@set INCLUDE=""
|
||||||
|
|
||||||
orbis-as -o lj_vm.o lj_vm.s
|
"%SCE_ORBIS_SDK_DIR%\host_tools\bin\orbis-as" -o lj_vm.o lj_vm.s
|
||||||
|
|
||||||
@if "%1" neq "debug" goto :NODEBUG
|
@if "%1" neq "debug" goto :NODEBUG
|
||||||
@shift
|
@shift
|
||||||
|
|||||||
@@ -74,11 +74,11 @@ buildvm -m folddef -o lj_folddef.h lj_opt_fold.c
|
|||||||
@if errorlevel 1 goto :BAD
|
@if errorlevel 1 goto :BAD
|
||||||
|
|
||||||
@rem ---- Cross compiler ----
|
@rem ---- Cross compiler ----
|
||||||
@set LJCOMPILE="%SCE_PROSPERO_SDK_DIR%\host_tools\bin\prospero-clang" -c -Wall -DLUAJIT_DISABLE_FFI %GC64%
|
@set LJCOMPILE="%SCE_PROSPERO_SDK_DIR%\host_tools\bin\prospero-clang" -c -Wall -DLUAJIT_DISABLE_FFI -DLUAJIT_USE_SYSMALLOC %GC64%
|
||||||
@set LJLIB="%SCE_PROSPERO_SDK_DIR%\host_tools\bin\prospero-llvm-ar" rcus
|
@set LJLIB="%SCE_PROSPERO_SDK_DIR%\host_tools\bin\prospero-llvm-ar" rcus
|
||||||
@set INCLUDE=""
|
@set INCLUDE=""
|
||||||
|
|
||||||
%SCE_PROSPERO_SDK_DIR%\host_tools\bin\prospero-llvm-as -o lj_vm.o lj_vm.s
|
"%SCE_PROSPERO_SDK_DIR%\host_tools\bin\prospero-clang" -c -o lj_vm.o lj_vm.s
|
||||||
|
|
||||||
@if "%1" neq "debug" goto :NODEBUG
|
@if "%1" neq "debug" goto :NODEBUG
|
||||||
@shift
|
@shift
|
||||||
|
|||||||
@@ -2636,7 +2636,9 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
|
|||||||
|.macro ins_arithmod, res, reg1, reg2
|
|.macro ins_arithmod, res, reg1, reg2
|
||||||
| fdiv d2, reg1, reg2
|
| fdiv d2, reg1, reg2
|
||||||
| frintm d2, d2
|
| frintm d2, d2
|
||||||
| fmsub res, d2, reg2, reg1
|
| // Cannot use fmsub, because FMA is not enabled by default.
|
||||||
|
| fmul d2, d2, reg2
|
||||||
|
| fsub res, reg1, d2
|
||||||
|.endmacro
|
|.endmacro
|
||||||
|
|
|
|
||||||
|.macro ins_arithdn, intins, fpins
|
|.macro ins_arithdn, intins, fpins
|
||||||
|
|||||||
Reference in New Issue
Block a user