1
0
mirror of https://github.com/wg/wrk synced 2025-01-08 06:52:55 +08:00

import LuaJIT 2.0.3

This commit is contained in:
Will 2014-05-15 20:09:09 +09:00
parent 5b2fa06151
commit 14088561d9
183 changed files with 673 additions and 407 deletions

View File

@ -1,7 +1,7 @@
===============================================================================
LuaJIT -- a Just-In-Time Compiler for Lua. http://luajit.org/
Copyright (C) 2005-2013 Mike Pall. All rights reserved.
Copyright (C) 2005-2014 Mike Pall. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

10
deps/luajit/Makefile vendored
View File

@ -10,12 +10,12 @@
# For MSVC, please follow the instructions given in src/msvcbuild.bat.
# For MinGW and Cygwin, cd to src and run make with the Makefile there.
#
# Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
# Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
##############################################################################
MAJVER= 2
MINVER= 0
RELVER= 2
RELVER= 3
VERSION= $(MAJVER).$(MINVER).$(RELVER)
ABIVER= 5.1
@ -25,11 +25,12 @@ ABIVER= 5.1
# the paths in src/luaconf.h, too. Note: PREFIX must be an absolute path!
#
export PREFIX= /usr/local
export MULTILIB= lib
##############################################################################
DPREFIX= $(DESTDIR)$(PREFIX)
INSTALL_BIN= $(DPREFIX)/bin
INSTALL_LIB= $(DPREFIX)/lib
INSTALL_LIB= $(DPREFIX)/$(MULTILIB)
INSTALL_SHARE= $(DPREFIX)/share
INSTALL_INC= $(DPREFIX)/include/luajit-$(MAJVER).$(MINVER)
@ -73,7 +74,8 @@ INSTALL_X= install -m 0755
INSTALL_F= install -m 0644
UNINSTALL= $(RM)
LDCONFIG= ldconfig -n
SED_PC= sed -e "s|^prefix=.*|prefix=$(PREFIX)|"
SED_PC= sed -e "s|^prefix=.*|prefix=$(PREFIX)|" \
-e "s|^multilib=.*|multilib=$(MULTILIB)|"
FILE_T= luajit
FILE_A= libluajit.a

4
deps/luajit/README vendored
View File

@ -1,11 +1,11 @@
README for LuaJIT 2.0.2
README for LuaJIT 2.0.3
-----------------------
LuaJIT is a Just-In-Time (JIT) compiler for the Lua programming language.
Project Homepage: http://luajit.org/
LuaJIT is Copyright (C) 2005-2013 Mike Pall.
LuaJIT is Copyright (C) 2005-2014 Mike Pall.
LuaJIT is free software, released under the MIT license.
See full Copyright Notice in the COPYRIGHT file or in luajit.h.

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2004-2013 Mike Pall.
/* Copyright (C) 2004-2014 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-2013 Mike Pall.
/* Copyright (C) 2004-2014 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

@ -4,7 +4,7 @@
<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-2013, Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2014, Mike Pall">
<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">
@ -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.2</strong>.<br>
The current <span style="color: #0000c0;">stable version</span> is <strong>LuaJIT&nbsp;2.0.3</strong>.<br>
</p>
<p>
Please check the
@ -72,6 +72,42 @@ to see whether newer versions are available.
</p>
<div class="major" style="background: #d0d0ff;">
<h2 id="LuaJIT-2.0.3">LuaJIT 2.0.3 &mdash; 2014-03-12</h2>
<ul>
<li>Add PS4 port.</li>
<li>Add support for multilib distro builds.</li>
<li>Fix OSX build.</li>
<li>Fix MinGW build.</li>
<li>Fix Xbox 360 build.</li>
<li>Improve ULOAD forwarding for open upvalues.</li>
<li>Fix GC steps threshold handling when called by JIT-compiled code.</li>
<li>Fix argument checks for <tt>math.deg()</tt> and <tt>math.rad()</tt>.</li>
<li>Fix <tt>jit.flush(func|true)</tt>.</li>
<li>Respect <tt>jit.off(func)</tt> when returning to a function, too.</li>
<li>Fix compilation of <tt>string.byte(s, nil, n)</tt>.</li>
<li>Fix line number for relocated bytecode after closure fixup</li>
<li>Fix frame traversal for backtraces.</li>
<li>Fix ABC elimination.</li>
<li>Fix handling of redundant PHIs.</li>
<li>Fix snapshot restore for exit to function header.</li>
<li>Fix type punning alias analysis for constified pointers</li>
<li>Fix call unroll checks in the presence of metamethod frames.</li>
<li>Fix initial maxslot for down-recursive traces.</li>
<li>Prevent BASE register coalescing if parent uses <tt>IR_RETF</tt>.</li>
<li>Don't purge modified function from stack slots in <tt>BC_RET</tt>.</li>
<li>Fix recording of <tt>BC_VARG</tt>.</li>
<li>Don't access dangling reference to reallocated IR.</li>
<li>Fix frame depth display for bytecode dump in <tt>-jdump</tt>.</li>
<li>ARM: Fix register allocation when rematerializing FPRs.</li>
<li>x64: Fix store to upvalue for lightuserdata values.</li>
<li>FFI: Add missing GC steps for callback argument conversions.</li>
<li>FFI: Properly unload loaded DLLs.</li>
<li>FFI: Fix argument checks for <tt>ffi.string()</tt>.</li>
<li>FFI/x64: Fix passing of vector arguments to calls.</li>
<li>FFI: Rehash finalizer table after GC cycle, if needed.</li>
<li>FFI: Fix <tt>cts-&gt;L</tt> for cdata unsinking in snapshot restore.</li>
</ul>
<h2 id="LuaJIT-2.0.2">LuaJIT 2.0.2 &mdash; 2013-06-03</h2>
<ul>
<li>Fix memory access check for fast string interning.</li>
@ -882,7 +918,7 @@ This is the initial non-public release of LuaJIT.
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2013 Mike Pall
Copyright &copy; 2005-2014 Mike Pall
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View File

@ -4,7 +4,7 @@
<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-2013, Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2014, Mike Pall">
<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">
@ -84,7 +84,7 @@ xD("fyZKB8xv\"FJytmz8.KAB0u52D")
<h2>Copyright</h2>
<p>
All documentation is
Copyright &copy; 2005-2013 Mike Pall.
Copyright &copy; 2005-2014 Mike Pall.
</p>
@ -92,7 +92,7 @@ Copyright &copy; 2005-2013 Mike Pall.
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2013 Mike Pall
Copyright &copy; 2005-2014 Mike Pall
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View File

@ -4,7 +4,7 @@
<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-2013, Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2014, Mike Pall">
<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 +177,7 @@ Also note that this mechanism is not without overhead.
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2013 Mike Pall
Copyright &copy; 2005-2014 Mike Pall
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View File

@ -4,7 +4,7 @@
<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-2013, Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2014, Mike Pall">
<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 +320,7 @@ without undue conversion penalties.
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2013 Mike Pall
Copyright &copy; 2005-2014 Mike Pall
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View File

@ -4,7 +4,7 @@
<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-2013, Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2014, Mike Pall">
<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 +556,7 @@ named <tt>i</tt>.
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2013 Mike Pall
Copyright &copy; 2005-2014 Mike Pall
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View File

@ -4,7 +4,7 @@
<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-2013, Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2014, Mike Pall">
<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">
@ -1188,7 +1188,9 @@ storing and initializing them are supported, yet.</li>
<li>The <tt>volatile</tt> type qualifier is currently ignored by
compiled code.</li>
<li><a href="ext_ffi_api.html#ffi_cdef"><tt>ffi.cdef</tt></a> silently
ignores all re-declarations.</li>
ignores most re-declarations. Note: avoid re-declarations which do not
conform to C99. The implementation will eventually be changed to
perform strict checks.</li>
</ul>
<p>
The JIT compiler already handles a large subset of all FFI operations.
@ -1233,7 +1235,7 @@ compiled.</li>
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2013 Mike Pall
Copyright &copy; 2005-2014 Mike Pall
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View File

@ -4,7 +4,7 @@
<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-2013, Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2014, Mike Pall">
<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 +591,7 @@ it to a local variable in the function scope is unnecessary.
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2013 Mike Pall
Copyright &copy; 2005-2014 Mike Pall
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View File

@ -4,7 +4,7 @@
<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-2013, Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2014, Mike Pall">
<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 +189,7 @@ if you want to know more.
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2013 Mike Pall
Copyright &copy; 2005-2014 Mike Pall
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View File

@ -4,7 +4,7 @@
<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-2013, Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2014, Mike Pall">
<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 +398,7 @@ lead to the termination of the process.</li>
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2013 Mike Pall
Copyright &copy; 2005-2014 Mike Pall
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View File

@ -4,7 +4,7 @@
<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-2013, Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2014, Mike Pall">
<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 +174,7 @@ the development of certain features, if they are important to you.
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2013 Mike Pall
Copyright &copy; 2005-2014 Mike Pall
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View File

@ -4,7 +4,7 @@
<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-2013, Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2014, Mike Pall">
<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">
@ -120,7 +120,7 @@ operating systems, CPUs and compilers:
<tr class="even">
<td class="compatcpu">x64 (64 bit)</td>
<td class="compatos">GCC 4.x</td>
<td class="compatos compatno">&nbsp;</td>
<td class="compatos">ORBIS (<a href="#ps4">PS4</a>)</td>
<td class="compatos">GCC 4.x</td>
<td class="compatos">MSVC + SDK v7.0<br>WinSDK v7.0</td>
</tr>
@ -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.2.tar.gz
cd LuaJIT-2.0.2</pre>
tar zxf LuaJIT-2.0.3.tar.gz
cd LuaJIT-2.0.3</pre>
<h3>Building LuaJIT</h3>
<p>
The supplied Makefiles try to auto-detect the settings needed for your
@ -460,7 +460,7 @@ make HOST_CC="gcc -m32 -arch i386" CROSS=$ISDKP TARGET_FLAGS="$ISDKF" \
</pre>
<p>
You can cross-compile for <b id="ps3">PS3</b> using the PS3&nbsp;SDK from
a Linux host or a Windows host (requires 32 bit MinGW (GCC) on the host,
a Linux host or a Windows host (requires 32&nbsp;bit MinGW (GCC) on the host,
too). Due to restrictions on consoles, the JIT compiler is disabled and
only the fast interpreter is built:
</p>
@ -468,6 +468,22 @@ only the fast interpreter is built:
make HOST_CC="gcc -m32" CROSS=ppu-lv2-
</pre>
<p>
You can cross-compile for <b id="ps4">PS4</b> from a Windows host using
the PS4&nbsp;SDK (ORBIS) plus 64&nbsp;bit MSVC. Due to restrictions on
consoles, the JIT compiler is disabled and only the fast interpreter
is built.
</p>
<p>
Open a "Visual Studio .NET Command Prompt" (64&nbsp;bit host compiler),
<tt>cd</tt> to the directory where you've unpacked the sources and run
the following commands. This builds a static library <tt>libluajit.a</tt>,
which can be linked against your game, just like the Lua library.
</p>
<pre class="code">
cd src
ps4build
</pre>
<p>
You can cross-compile for <b id="xbox360">Xbox 360</b> using the
Xbox&nbsp;360 SDK (MSVC + XEDK). Due to restrictions on consoles, the
JIT compiler is disabled and only the fast interpreter is built.
@ -565,9 +581,11 @@ for a regular distribution build:
<ul>
<li><tt>PREFIX</tt> overrides the installation path and should usually
be set to <tt>/usr</tt>. Setting this also changes the module paths and
the <tt>-rpath</tt> of the shared library.</li>
the paths needed to locate the shared library.</li>
<li><tt>DESTDIR</tt> is an absolute path which allows you to install
to a shadow tree instead of the root tree of the build system.</li>
<li><tt>MULTILIB</tt> sets the architecture-specific library path component
for multilib systems. The default is <tt>lib</tt>.</li>
<li>Have a look at the top-level <tt>Makefile</tt> and <tt>src/Makefile</tt>
for additional variables to tweak. The following variables <em>may</em> be
overridden, but it's <em>not</em> recommended, except for special needs
@ -603,7 +621,7 @@ to me (the upstream) and not you (the package maintainer), anyway.
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2013 Mike Pall
Copyright &copy; 2005-2014 Mike Pall
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View File

@ -4,7 +4,7 @@
<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-2013, Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2014, Mike Pall">
<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">
@ -147,7 +147,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-2013 Mike Pall, released under the
LuaJIT is Copyright &copy; 2005-2014 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>
@ -158,7 +158,7 @@ LuaJIT is Copyright &copy; 2005-2013 Mike Pall, released under the
<tr><td>Windows</td><td>Linux</td><td>BSD</td><td>OSX</td><td>POSIX</td></tr>
</table>
<table class="feature os os2">
<tr><td><span style="font-size:90%;">Embedded</span></td><td>Android</td><td>iOS</td><td>PS3</td><td>Xbox 360</td></tr>
<tr><td><span style="font-size:90%;">Embedded</span></td><td>Android</td><td>iOS</td><td>PS3</td><td>PS4</td><td>Xbox 360</td></tr>
</table>
<table class="feature compiler">
<tr><td>GCC</td><td>CLANG<br>LLVM</td><td>MSVC</td></tr>
@ -218,7 +218,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-2013 Mike Pall
Copyright &copy; 2005-2014 Mike Pall
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View File

@ -4,7 +4,7 @@
<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-2013, Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2014, Mike Pall">
<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">
@ -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.2/jit</tt> on POSIX
this is <tt>/usr/local/share/luajit-2.0.3/jit</tt> on POSIX
systems.
</p>
@ -296,7 +296,7 @@ Here are the parameters and their default settings:
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2013 Mike Pall
Copyright &copy; 2005-2014 Mike Pall
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View File

@ -4,7 +4,7 @@
<title>Status &amp; Roadmap</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-2013, Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2014, Mike Pall">
<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">
@ -115,7 +115,7 @@ Please refer to the
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2013 Mike Pall
Copyright &copy; 2005-2014 Mike Pall
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View File

@ -1,6 +1,6 @@
/*
** DynASM ARM encoding engine.
** Copyright (C) 2005-2013 Mike Pall. All rights reserved.
** Copyright (C) 2005-2014 Mike Pall. All rights reserved.
** Released under the MIT license. See dynasm.lua for full copyright notice.
*/

View File

@ -1,7 +1,7 @@
------------------------------------------------------------------------------
-- DynASM ARM module.
--
-- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
-- Copyright (C) 2005-2014 Mike Pall. All rights reserved.
-- See dynasm.lua for full copyright notice.
------------------------------------------------------------------------------

View File

@ -1,6 +1,6 @@
/*
** DynASM MIPS encoding engine.
** Copyright (C) 2005-2013 Mike Pall. All rights reserved.
** Copyright (C) 2005-2014 Mike Pall. All rights reserved.
** Released under the MIT license. See dynasm.lua for full copyright notice.
*/

View File

@ -1,7 +1,7 @@
------------------------------------------------------------------------------
-- DynASM MIPS module.
--
-- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
-- Copyright (C) 2005-2014 Mike Pall. All rights reserved.
-- See dynasm.lua for full copyright notice.
------------------------------------------------------------------------------

View File

@ -1,6 +1,6 @@
/*
** DynASM PPC encoding engine.
** Copyright (C) 2005-2013 Mike Pall. All rights reserved.
** Copyright (C) 2005-2014 Mike Pall. All rights reserved.
** Released under the MIT license. See dynasm.lua for full copyright notice.
*/

View File

@ -1,7 +1,7 @@
------------------------------------------------------------------------------
-- DynASM PPC module.
--
-- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
-- Copyright (C) 2005-2014 Mike Pall. All rights reserved.
-- See dynasm.lua for full copyright notice.
------------------------------------------------------------------------------

View File

@ -1,6 +1,6 @@
/*
** DynASM encoding engine prototypes.
** Copyright (C) 2005-2013 Mike Pall. All rights reserved.
** Copyright (C) 2005-2014 Mike Pall. All rights reserved.
** Released under the MIT license. See dynasm.lua for full copyright notice.
*/

View File

@ -1,7 +1,7 @@
------------------------------------------------------------------------------
-- DynASM x64 module.
--
-- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
-- Copyright (C) 2005-2014 Mike Pall. All rights reserved.
-- See dynasm.lua for full copyright notice.
------------------------------------------------------------------------------
-- This module just sets 64 bit mode for the combined x86/x64 module.

View File

@ -1,6 +1,6 @@
/*
** DynASM x86 encoding engine.
** Copyright (C) 2005-2013 Mike Pall. All rights reserved.
** Copyright (C) 2005-2014 Mike Pall. All rights reserved.
** Released under the MIT license. See dynasm.lua for full copyright notice.
*/

View File

@ -1,7 +1,7 @@
------------------------------------------------------------------------------
-- DynASM x86/x64 module.
--
-- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
-- Copyright (C) 2005-2014 Mike Pall. All rights reserved.
-- See dynasm.lua for full copyright notice.
------------------------------------------------------------------------------
@ -1040,7 +1040,7 @@ local map_op = {
-- ED: *in Rdw,dx
-- EE: *out dx,Rb
-- EF: *out dx,Rdw
-- F0: *lock
lock_0 = "F0",
int1_0 = "F1",
repne_0 = "F2",
repnz_0 = "F2",
@ -1678,7 +1678,7 @@ if x64 then
function map_op.mov64_2(params)
if not params then return { "reg, imm", "reg, [disp]", "[disp], reg" } end
if secpos+2 > maxsecpos then wflush() end
local opcode, op64, sz, rex
local opcode, op64, sz, rex, vreg
local op64 = match(params[1], "^%[%s*(.-)%s*%]$")
if op64 then
local a = parseoperand(params[2])
@ -1699,11 +1699,17 @@ if x64 then
werror("bad operand mode")
end
op64 = params[2]
opcode = 0xb8 + band(a.reg, 7) -- !x64: no VREG support.
if a.reg == -1 then
vreg = a.vreg
opcode = 0xb8
else
opcode = 0xb8 + band(a.reg, 7)
end
rex = a.reg > 7 and 9 or 8
end
end
wputop(sz, opcode, rex)
if vreg then waction("VREG", vreg); wputxb(0) end
waction("IMM_D", format("(unsigned int)(%s)", op64))
waction("IMM_D", format("(unsigned int)((%s)>>32)", op64))
end

View File

@ -2,7 +2,7 @@
-- DynASM. A dynamic assembler for code generation engines.
-- Originally designed and implemented for LuaJIT.
--
-- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
-- Copyright (C) 2005-2014 Mike Pall. All rights reserved.
-- See below for full copyright notice.
------------------------------------------------------------------------------
@ -17,7 +17,7 @@ local _info = {
url = "http://luajit.org/dynasm.html",
license = "MIT",
copyright = [[
Copyright (C) 2005-2013 Mike Pall. All rights reserved.
Copyright (C) 2005-2014 Mike Pall. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
@ -85,7 +85,7 @@ end
-- Resync CPP line numbers.
local function wsync()
if g_synclineno ~= g_lineno and g_opt.cpp then
wline("# "..g_lineno..' "'..g_fname..'"')
wline("#line "..g_lineno..' "'..g_fname..'"')
g_synclineno = g_lineno
end
end
@ -695,6 +695,9 @@ map_op[".arch_1"] = function(params)
if not params then return "name" end
local err = loadarch(params[1])
if err then wfatal(err) end
wline(format("#if DASM_VERSION != %d", _info.vernum))
wline('#error "Version mismatch between DynASM and included encoding engine"')
wline("#endif")
end
-- Dummy .arch pseudo-opcode to improve the error report.
@ -877,13 +880,9 @@ local function dasmhead(out)
** DO NOT EDIT! The original file is in "%s".
*/
#if DASM_VERSION != %d
#error "Version mismatch between DynASM and included encoding engine"
#endif
]], _info.url,
_info.version, g_arch._info.arch, g_arch._info.version,
g_fname, _info.vernum))
g_fname))
end
-- Read input file.

View File

@ -74,7 +74,7 @@ luajit \-jv \-e "for i=1,10 do for j=1,10 do for k=1,100 do end end end"
Runs some nested loops and shows the resulting traces.
.SH COPYRIGHT
.PP
\fBLuaJIT\fR is Copyright \(co 2005-2013 Mike Pall.
\fBLuaJIT\fR is Copyright \(co 2005-2014 Mike Pall.
.br
\fBLuaJIT\fR is open source software, released under the MIT license.
.SH SEE ALSO

View File

@ -1,18 +1,19 @@
# Package information for LuaJIT to be used by pkg-config.
majver=2
minver=0
relver=2
relver=3
version=${majver}.${minver}.${relver}
abiver=5.1
prefix=/usr/local
multilib=lib
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
libdir=${exec_prefix}/${multilib}
libname=luajit-${abiver}
includedir=${prefix}/include/luajit-${majver}.${minver}
INSTALL_LMOD=${prefix}/share/lua/${abiver}
INSTALL_CMOD=${prefix}/lib/lua/${abiver}
INSTALL_CMOD=${prefix}/${multilib}/lua/${abiver}
Name: LuaJIT
Description: Just-in-time compiler for Lua

View File

@ -7,12 +7,12 @@
# Also works with MinGW and Cygwin on Windows.
# Please check msvcbuild.bat for building with MSVC on Windows.
#
# Copyright (C) 2005-2012 Mike Pall. See Copyright Notice in luajit.h
# Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
##############################################################################
MAJVER= 2
MINVER= 0
RELVER= 2
RELVER= 3
ABIVER= 5.1
NODOTABIVER= 51
@ -188,9 +188,10 @@ TARGET_LD= $(CROSS)$(CC)
TARGET_AR= $(CROSS)ar rcus
TARGET_STRIP= $(CROSS)strip
TARGET_LIBPATH= $(or $(PREFIX),/usr/local)/$(or $(MULTILIB),lib)
TARGET_SONAME= libluajit-$(ABIVER).so.$(MAJVER)
TARGET_DYLIBNAME= libluajit-$(ABIVER).$(MAJVER).dylib
TARGET_DYLIBPATH= $(or $(PREFIX),/usr/local)/lib/$(TARGET_DYLIBNAME)
TARGET_DYLIBPATH= $(TARGET_LIBPATH)/$(TARGET_DYLIBNAME)
TARGET_DLLNAME= lua$(NODOTABIVER).dll
TARGET_XSHLDFLAGS= -shared -fPIC -Wl,-soname,$(TARGET_SONAME)
TARGET_DYNXLDOPTS=
@ -249,12 +250,18 @@ TARGET_ARCH+= $(patsubst %,-DLUAJIT_TARGET=LUAJIT_ARCH_%,$(TARGET_LJARCH))
ifneq (,$(PREFIX))
ifneq (/usr/local,$(PREFIX))
TARGET_XCFLAGS+= -DLUA_XROOT=\"$(PREFIX)/\"
TARGET_XCFLAGS+= -DLUA_ROOT=\"$(PREFIX)\"
ifneq (/usr,$(PREFIX))
TARGET_DYNXLDOPTS= -Wl,-rpath,$(PREFIX)/lib
TARGET_DYNXLDOPTS= -Wl,-rpath,$(TARGET_LIBPATH)
endif
endif
endif
ifneq (,$(MULTILIB))
TARGET_XCFLAGS+= -DLUA_MULTILIB=\"$(MULTILIB)\"
endif
ifneq (,$(LMULTILIB))
TARGET_XCFLAGS+= -DLUA_LMULTILIB=\"$(LMULTILIB)\"
endif
##############################################################################
# System detection.
@ -287,7 +294,9 @@ ifeq (Darwin,$(TARGET_SYS))
endif
TARGET_STRIP+= -x
TARGET_AR+= 2>/dev/null
TARGET_XCFLAGS+= -fno-stack-protector
ifeq (,$(shell $(TARGET_CC) -o /dev/null -c -x c /dev/null -fno-stack-protector 2>/dev/null || echo 1))
TARGET_XCFLAGS+= -fno-stack-protector
endif
TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC
TARGET_DYNXLDOPTS=
TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER)

View File

@ -17,8 +17,8 @@ lib_ffi.o: lib_ffi.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h lj_def.h \
lj_ccallback.h lj_clib.h lj_ff.h lj_ffdef.h lj_lib.h lj_libdef.h
lib_init.o: lib_init.c lua.h luaconf.h lauxlib.h lualib.h lj_arch.h
lib_io.o: lib_io.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h lj_def.h \
lj_arch.h lj_err.h lj_errmsg.h lj_str.h lj_state.h lj_ff.h lj_ffdef.h \
lj_lib.h lj_libdef.h
lj_arch.h lj_gc.h lj_err.h lj_errmsg.h lj_str.h lj_state.h lj_ff.h \
lj_ffdef.h lj_lib.h lj_libdef.h
lib_jit.o: lib_jit.c lua.h luaconf.h lauxlib.h lualib.h lj_arch.h \
lj_obj.h lj_def.h lj_err.h lj_errmsg.h lj_debug.h lj_str.h lj_tab.h \
lj_bc.h lj_ir.h lj_jit.h lj_ircall.h lj_iropt.h lj_target.h \
@ -129,8 +129,8 @@ lj_load.o: lj_load.c lua.h luaconf.h lauxlib.h lj_obj.h lj_def.h \
lj_arch.h lj_gc.h lj_err.h lj_errmsg.h lj_str.h lj_func.h lj_frame.h \
lj_bc.h lj_vm.h lj_lex.h lj_bcdump.h lj_parse.h
lj_mcode.o: lj_mcode.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \
lj_gc.h lj_jit.h lj_ir.h lj_mcode.h lj_trace.h lj_dispatch.h lj_bc.h \
lj_traceerr.h lj_vm.h
lj_gc.h lj_err.h lj_errmsg.h lj_jit.h lj_ir.h lj_mcode.h lj_trace.h \
lj_dispatch.h lj_bc.h lj_traceerr.h lj_vm.h
lj_meta.o: lj_meta.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \
lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_meta.h lj_frame.h lj_bc.h \
lj_vm.h lj_strscan.h

View File

@ -1,6 +1,6 @@
/*
** LuaJIT VM builder.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
**
** This is a tool to build the hand-tuned assembler code required for
** LuaJIT's bytecode interpreter. It supports a variety of output formats

View File

@ -1,6 +1,6 @@
/*
** LuaJIT VM builder.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _BUILDVM_H

View File

@ -1,6 +1,6 @@
/*
** LuaJIT VM builder: Assembler source code emitter.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#include "buildvm.h"
@ -100,7 +100,7 @@ static void emit_asm_wordreloc(BuildCtx *ctx, uint8_t *p, int n,
fprintf(ctx->fp, "\tblx %s\n", sym);
} else if ((ins & 0x0e000000u) == 0x0a000000u) {
fprintf(ctx->fp, "\t%s%.2s %s\n", (ins & 0x01000000u) ? "bl" : "b",
"eqnecsccmiplvsvchilsgeltgtle" + 2*(ins >> 28), sym);
&"eqnecsccmiplvsvchilsgeltgtle"[2*(ins >> 28)], sym);
} else {
fprintf(stderr,
"Error: unsupported opcode %08x for %s symbol relocation.\n",

View File

@ -1,6 +1,6 @@
/*
** LuaJIT VM builder: IR folding hash table generator.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#include "buildvm.h"

View File

@ -1,6 +1,6 @@
/*
** LuaJIT VM builder: library definition compiler.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#include "buildvm.h"

View File

@ -1,6 +1,6 @@
/*
** LuaJIT VM builder: PE object emitter.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
**
** Only used for building on Windows, since we cannot assume the presence
** of a suitable assembler. The host and target byte order must match.

View File

@ -2,7 +2,7 @@
-- Lua script to generate a customized, minified version of Lua.
-- The resulting 'minilua' is used for the build process of LuaJIT.
----------------------------------------------------------------------------
-- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
-- Copyright (C) 2005-2014 Mike Pall. All rights reserved.
-- Released under the MIT license. See Copyright Notice in luajit.h
----------------------------------------------------------------------------
@ -210,6 +210,7 @@ typedef unsigned __int64 U64;
#else
typedef unsigned long long U64;
#endif
int _CRT_glob = 0;
]]}, {}
local function preprocess(src)

View File

@ -27,6 +27,7 @@ typedef unsigned __int64 U64;
#else
typedef unsigned long long U64;
#endif
int _CRT_glob = 0;
#include <stddef.h>
#include <stdarg.h>
#include <limits.h>

View File

@ -1,7 +1,7 @@
----------------------------------------------------------------------------
-- LuaJIT bytecode listing module.
--
-- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
-- Copyright (C) 2005-2014 Mike Pall. All rights reserved.
-- Released under the MIT license. See Copyright Notice in luajit.h
----------------------------------------------------------------------------
--
@ -41,7 +41,7 @@
-- Cache some library functions and objects.
local jit = require("jit")
assert(jit.version_num == 20002, "LuaJIT core/library version mismatch")
assert(jit.version_num == 20003, "LuaJIT core/library version mismatch")
local jutil = require("jit.util")
local vmdef = require("jit.vmdef")
local bit = require("bit")

View File

@ -1,7 +1,7 @@
----------------------------------------------------------------------------
-- LuaJIT module to save/list bytecode.
--
-- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
-- Copyright (C) 2005-2014 Mike Pall. All rights reserved.
-- Released under the MIT license. See Copyright Notice in luajit.h
----------------------------------------------------------------------------
--
@ -11,7 +11,7 @@
------------------------------------------------------------------------------
local jit = require("jit")
assert(jit.version_num == 20002, "LuaJIT core/library version mismatch")
assert(jit.version_num == 20003, "LuaJIT core/library version mismatch")
local bit = require("bit")
-- Symbol name prefix for LuaJIT bytecode.

View File

@ -1,7 +1,7 @@
----------------------------------------------------------------------------
-- LuaJIT ARM disassembler module.
--
-- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
-- Copyright (C) 2005-2014 Mike Pall. All rights reserved.
-- Released under the MIT license. See Copyright Notice in luajit.h
----------------------------------------------------------------------------
-- This is a helper module used by the LuaJIT machine code dumper module.

View File

@ -1,7 +1,7 @@
----------------------------------------------------------------------------
-- LuaJIT MIPS disassembler module.
--
-- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
-- Copyright (C) 2005-2014 Mike Pall. All rights reserved.
-- Released under the MIT/X license. See Copyright Notice in luajit.h
----------------------------------------------------------------------------
-- This is a helper module used by the LuaJIT machine code dumper module.

View File

@ -1,7 +1,7 @@
----------------------------------------------------------------------------
-- LuaJIT MIPSEL disassembler wrapper module.
--
-- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
-- Copyright (C) 2005-2014 Mike Pall. All rights reserved.
-- Released under the MIT license. See Copyright Notice in luajit.h
----------------------------------------------------------------------------
-- This module just exports the little-endian functions from the

View File

@ -1,7 +1,7 @@
----------------------------------------------------------------------------
-- LuaJIT PPC disassembler module.
--
-- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
-- Copyright (C) 2005-2014 Mike Pall. All rights reserved.
-- Released under the MIT/X license. See Copyright Notice in luajit.h
----------------------------------------------------------------------------
-- This is a helper module used by the LuaJIT machine code dumper module.

View File

@ -1,7 +1,7 @@
----------------------------------------------------------------------------
-- LuaJIT x64 disassembler wrapper module.
--
-- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
-- Copyright (C) 2005-2014 Mike Pall. All rights reserved.
-- Released under the MIT license. See Copyright Notice in luajit.h
----------------------------------------------------------------------------
-- This module just exports the 64 bit functions from the combined

View File

@ -1,7 +1,7 @@
----------------------------------------------------------------------------
-- LuaJIT x86/x64 disassembler module.
--
-- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
-- Copyright (C) 2005-2014 Mike Pall. All rights reserved.
-- Released under the MIT license. See Copyright Notice in luajit.h
----------------------------------------------------------------------------
-- This is a helper module used by the LuaJIT machine code dumper module.

View File

@ -1,7 +1,7 @@
----------------------------------------------------------------------------
-- LuaJIT compiler dump module.
--
-- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
-- Copyright (C) 2005-2014 Mike Pall. All rights reserved.
-- Released under the MIT license. See Copyright Notice in luajit.h
----------------------------------------------------------------------------
--
@ -36,6 +36,7 @@
-- * m Dump the generated machine code.
-- x Print each taken trace exit.
-- X Print each taken trace exit and the contents of all registers.
-- a Print the IR of aborted traces, too.
--
-- The output format can be set with the following characters:
--
@ -54,7 +55,7 @@
-- Cache some library functions and objects.
local jit = require("jit")
assert(jit.version_num == 20002, "LuaJIT core/library version mismatch")
assert(jit.version_num == 20003, "LuaJIT core/library version mismatch")
local jutil = require("jit.util")
local vmdef = require("jit.vmdef")
local funcinfo, funcbc = jutil.funcinfo, jutil.funcbc
@ -546,10 +547,8 @@ local function dump_trace(what, tr, func, pc, otr, oex)
out:write("---- TRACE ", tr, " ", what)
if otr then out:write(" ", otr, "/", oex) end
out:write(" ", fmtfunc(func, pc), "\n")
recprefix = ""
elseif what == "stop" or what == "abort" then
out:write("---- TRACE ", tr, " ", what)
recprefix = nil
if what == "abort" then
out:write(" ", fmtfunc(func, pc), " -- ", fmterr(otr, oex), "\n")
else

View File

@ -1,7 +1,7 @@
----------------------------------------------------------------------------
-- Verbose mode of the LuaJIT compiler.
--
-- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
-- Copyright (C) 2005-2014 Mike Pall. All rights reserved.
-- Released under the MIT license. See Copyright Notice in luajit.h
----------------------------------------------------------------------------
--
@ -59,7 +59,7 @@
-- Cache some library functions and objects.
local jit = require("jit")
assert(jit.version_num == 20002, "LuaJIT core/library version mismatch")
assert(jit.version_num == 20003, "LuaJIT core/library version mismatch")
local jutil = require("jit.util")
local vmdef = require("jit.vmdef")
local funcinfo, traceinfo = jutil.funcinfo, jutil.traceinfo

View File

@ -1,6 +1,6 @@
/*
** Auxiliary library for the Lua/C API.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
**
** Major parts taken verbatim or adapted from the Lua interpreter.
** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h

View File

@ -1,6 +1,6 @@
/*
** Base and coroutine library.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
**
** Major portions taken verbatim or adapted from the Lua interpreter.
** Copyright (C) 1994-2011 Lua.org, PUC-Rio. See Copyright Notice in lua.h

View File

@ -1,6 +1,6 @@
/*
** Bit manipulation library.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#define lib_bit_c

View File

@ -1,6 +1,6 @@
/*
** Debug library.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
**
** Major portions taken verbatim or adapted from the Lua interpreter.
** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h

View File

@ -1,6 +1,6 @@
/*
** FFI library.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#define lib_ffi_c
@ -657,7 +657,7 @@ LJLIB_CF(ffi_string) LJLIB_REC(.)
TValue *o = lj_lib_checkany(L, 1);
const char *p;
size_t len;
if (o+1 < L->top) {
if (o+1 < L->top && !tvisnil(o+1)) {
len = (size_t)ffi_checkint(L, 2);
lj_cconv_ct_tv(cts, ctype_get(cts, CTID_P_CVOID), (uint8_t *)&p, o,
CCF_ARG(1));

View File

@ -1,6 +1,6 @@
/*
** Library initialization.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
**
** Major parts taken verbatim from the Lua interpreter.
** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h

View File

@ -1,6 +1,6 @@
/*
** I/O library.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
**
** Major portions taken verbatim or adapted from the Lua interpreter.
** Copyright (C) 1994-2011 Lua.org, PUC-Rio. See Copyright Notice in lua.h
@ -426,7 +426,7 @@ LJLIB_CF(io_popen)
LJLIB_CF(io_tmpfile)
{
IOFileUD *iof = io_file_new(L);
#if LJ_TARGET_PS3
#if LJ_TARGET_PS3 || LJ_TARGET_PS4
iof->fp = NULL; errno = ENOSYS;
#else
iof->fp = tmpfile();

View File

@ -1,6 +1,6 @@
/*
** JIT library.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#define lib_jit_c
@ -73,7 +73,7 @@ LJLIB_CF(jit_off)
LJLIB_CF(jit_flush)
{
#if LJ_HASJIT
if (L->base < L->top && !tvisnil(L->base)) {
if (L->base < L->top && tvisnumber(L->base)) {
int traceno = lj_lib_checkint(L, 1);
luaJIT_setmode(L, traceno, LUAJIT_MODE_FLUSH|LUAJIT_MODE_TRACE);
return 0;

View File

@ -1,6 +1,6 @@
/*
** Math library.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#include <math.h>
@ -47,6 +47,12 @@ LJLIB_ASM_(math_tanh) LJLIB_REC(math_htrig IRCALL_tanh)
LJLIB_ASM_(math_frexp)
LJLIB_ASM_(math_modf) LJLIB_REC(.)
LJLIB_PUSH(57.29577951308232)
LJLIB_ASM_(math_deg) LJLIB_REC(math_degrad)
LJLIB_PUSH(0.017453292519943295)
LJLIB_ASM_(math_rad) LJLIB_REC(math_degrad)
LJLIB_ASM(math_log) LJLIB_REC(math_log)
{
double x = lj_lib_checknum(L, 1);
@ -63,12 +69,6 @@ LJLIB_ASM(math_log) LJLIB_REC(math_log)
return FFH_RETRY;
}
LJLIB_PUSH(57.29577951308232)
LJLIB_ASM_(math_deg) LJLIB_REC(math_degrad)
LJLIB_PUSH(0.017453292519943295)
LJLIB_ASM_(math_rad) LJLIB_REC(math_degrad)
LJLIB_ASM(math_atan2) LJLIB_REC(.)
{
lj_lib_checknum(L, 1);

View File

@ -1,6 +1,6 @@
/*
** OS library.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
**
** Major portions taken verbatim or adapted from the Lua interpreter.
** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h
@ -70,7 +70,7 @@ LJLIB_CF(os_rename)
LJLIB_CF(os_tmpname)
{
#if LJ_TARGET_PS3
#if LJ_TARGET_PS3 || LJ_TARGET_PS4
lj_err_caller(L, LJ_ERR_OSUNIQF);
return 0;
#else

View File

@ -1,6 +1,6 @@
/*
** Package library.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
**
** Major portions taken verbatim or adapted from the Lua interpreter.
** Copyright (C) 1994-2012 Lua.org, PUC-Rio. See Copyright Notice in lua.h
@ -68,9 +68,6 @@ static const char *ll_bcsym(void *lib, const char *sym)
#elif LJ_TARGET_WINDOWS
#define WIN32_LEAN_AND_MEAN
#ifndef WINVER
#define WINVER 0x0500
#endif
#include <windows.h>
#ifndef GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS

View File

@ -1,6 +1,6 @@
/*
** String library.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
**
** Major portions taken verbatim or adapted from the Lua interpreter.
** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h
@ -64,7 +64,7 @@ LJLIB_ASM(string_byte) LJLIB_REC(string_range 0)
LJLIB_ASM(string_char)
{
int i, nargs = (int)(L->top - L->base);
char *buf = lj_str_needbuf(L, &G(L)->tmpbuf, (size_t)nargs);
char *buf = lj_str_needbuf(L, &G(L)->tmpbuf, (MSize)nargs);
for (i = 1; i <= nargs; i++) {
int32_t k = lj_lib_checkint(L, i);
if (!checku8(k))

View File

@ -1,6 +1,6 @@
/*
** Table library.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
**
** Major portions taken verbatim or adapted from the Lua interpreter.
** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h

View File

@ -177,7 +177,7 @@ static LJ_AINLINE int CALL_MUNMAP(void *ptr, size_t size)
#if LJ_64
/* 64 bit mode needs special support for allocating memory in the lower 2GB. */
#if LJ_TARGET_LINUX
#if defined(MAP_32BIT)
/* Actually this only gives us max. 1GB in current Linux kernels. */
static LJ_AINLINE void *CALL_MMAP(size_t size)
@ -188,7 +188,7 @@ static LJ_AINLINE void *CALL_MMAP(size_t size)
return ptr;
}
#elif LJ_TARGET_OSX || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__sun__)
#elif LJ_TARGET_OSX || LJ_TARGET_PS4 || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__sun__)
/* OSX and FreeBSD mmap() use a naive first-fit linear search.
** That's perfect for us. Except that -pagezero_size must be set for OSX,
@ -197,12 +197,14 @@ static LJ_AINLINE void *CALL_MMAP(size_t size)
*/
#if LJ_TARGET_OSX
#define MMAP_REGION_START ((uintptr_t)0x10000)
#elif LJ_TARGET_PS4
#define MMAP_REGION_START ((uintptr_t)0x4000)
#else
#define MMAP_REGION_START ((uintptr_t)0x10000000)
#endif
#define MMAP_REGION_END ((uintptr_t)0x80000000)
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && !LJ_TARGET_PS4
#include <sys/resource.h>
#endif
@ -212,7 +214,7 @@ static LJ_AINLINE void *CALL_MMAP(size_t size)
/* Hint for next allocation. Doesn't need to be thread-safe. */
static uintptr_t alloc_hint = MMAP_REGION_START;
int retry = 0;
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && !LJ_TARGET_PS4
static int rlimit_modified = 0;
if (LJ_UNLIKELY(rlimit_modified == 0)) {
struct rlimit rlim;

View File

@ -1,6 +1,6 @@
/*
** Public Lua/C API.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
**
** Major portions taken verbatim or adapted from the Lua interpreter.
** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h
@ -1164,7 +1164,7 @@ LUA_API int lua_gc(lua_State *L, int what, int data)
MSize a = (MSize)data << 10;
g->gc.threshold = (a <= g->gc.total) ? (g->gc.total - a) : 0;
while (g->gc.total >= g->gc.threshold)
if (lj_gc_step(L)) {
if (lj_gc_step(L) > 0) {
res = 1;
break;
}

View File

@ -1,6 +1,6 @@
/*
** Target architecture selection.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_ARCH_H
@ -66,8 +66,8 @@
#define LUAJIT_OS LUAJIT_OS_LINUX
#elif defined(__MACH__) && defined(__APPLE__)
#define LUAJIT_OS LUAJIT_OS_OSX
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
defined(__NetBSD__) || defined(__OpenBSD__)
#elif (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
defined(__NetBSD__) || defined(__OpenBSD__)) && !defined(__ORBIS__)
#define LUAJIT_OS LUAJIT_OS_BSD
#elif (defined(__sun__) && defined(__svr4__)) || defined(__CYGWIN__)
#define LUAJIT_OS LUAJIT_OS_POSIX
@ -104,6 +104,13 @@
#define LJ_TARGET_CONSOLE 1
#endif
#ifdef __ORBIS__
#define LJ_TARGET_PS4 1
#define LJ_TARGET_CONSOLE 1
#undef NULL
#define NULL ((void*)0)
#endif
#if _XBOX_VER >= 200
#define LJ_TARGET_XBOX360 1
#define LJ_TARGET_CONSOLE 1

View File

@ -1,6 +1,6 @@
/*
** IR assembler (SSA IR -> machine code).
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#define lj_asm_c
@ -1246,16 +1246,18 @@ static void asm_phi_fixup(ASMState *as)
Reg r = rset_picktop(work);
IRRef lref = as->phireg[r];
IRIns *ir = IR(lref);
/* Left PHI gained a spill slot before the loop? */
if (irt_ismarked(ir->t) && ra_hasspill(ir->s)) {
IRRef ren;
lj_ir_set(as->J, IRT(IR_RENAME, IRT_NIL), lref, as->loopsnapno);
ren = tref_ref(lj_ir_emit(as->J));
as->ir = as->T->ir; /* The IR may have been reallocated. */
IR(ren)->r = (uint8_t)r;
IR(ren)->s = SPS_NONE;
if (irt_ismarked(ir->t)) {
irt_clearmark(ir->t);
/* Left PHI gained a spill slot before the loop? */
if (ra_hasspill(ir->s)) {
IRRef ren;
lj_ir_set(as->J, IRT(IR_RENAME, IRT_NIL), lref, as->loopsnapno);
ren = tref_ref(lj_ir_emit(as->J));
as->ir = as->T->ir; /* The IR may have been reallocated. */
IR(ren)->r = (uint8_t)r;
IR(ren)->s = SPS_NONE;
}
}
irt_clearmark(ir->t); /* Always clear marker. */
rset_clear(work, r);
}
}

View File

@ -1,6 +1,6 @@
/*
** IR assembler (SSA IR -> machine code).
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_ASM_H

View File

@ -1,6 +1,6 @@
/*
** ARM IR assembler (SSA IR -> machine code).
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
/* -- Register allocator extensions --------------------------------------- */
@ -493,6 +493,7 @@ static void asm_retf(ASMState *as, IRIns *ir)
int32_t delta = 1+bc_a(*((const BCIns *)pc - 1));
as->topslot -= (BCReg)delta;
if ((int32_t)as->topslot < 0) as->topslot = 0;
irt_setmark(IR(REF_BASE)->t); /* Children must not coalesce with BASE reg. */
/* Need to force a spill on REF_BASE now to update the stack slot. */
emit_lso(as, ARMI_STR, base, RID_SP, ra_spill(as, IR(REF_BASE)));
emit_setgl(as, base, jit_base);
@ -521,10 +522,10 @@ static void asm_tointg(ASMState *as, IRIns *ir, Reg left)
static void asm_tobit(ASMState *as, IRIns *ir)
{
RegSet allow = RSET_FPR;
Reg dest = ra_dest(as, ir, RSET_GPR);
Reg left = ra_alloc1(as, ir->op1, allow);
Reg right = ra_alloc1(as, ir->op2, rset_clear(allow, left));
Reg tmp = ra_scratch(as, rset_clear(allow, right));
Reg dest = ra_dest(as, ir, RSET_GPR);
emit_dn(as, ARMI_VMOV_R_S, dest, (tmp & 15));
emit_dnm(as, ARMI_VADD_D, (tmp & 15), (left & 15), (right & 15));
}
@ -564,9 +565,9 @@ static void asm_conv(ASMState *as, IRIns *ir)
lua_assert(irt_isint(ir->t) && st == IRT_NUM);
asm_tointg(as, ir, ra_alloc1(as, lref, RSET_FPR));
} else {
Reg dest = ra_dest(as, ir, RSET_GPR);
Reg left = ra_alloc1(as, lref, RSET_FPR);
Reg tmp = ra_scratch(as, rset_exclude(RSET_FPR, left));
Reg dest = ra_dest(as, ir, RSET_GPR);
ARMIns ai;
emit_dn(as, ARMI_VMOV_R_S, dest, (tmp & 15));
ai = irt_isint(ir->t) ?
@ -1210,6 +1211,9 @@ static void asm_sload(ASMState *as, IRIns *ir)
} else
#endif
if (ra_used(ir)) {
Reg tmp = RID_NONE;
if ((ir->op2 & IRSLOAD_CONVERT))
tmp = ra_scratch(as, t == IRT_INT ? RSET_FPR : RSET_GPR);
lua_assert((LJ_SOFTFP ? 0 : irt_isnum(ir->t)) ||
irt_isint(ir->t) || irt_isaddr(ir->t));
dest = ra_dest(as, ir, (!LJ_SOFTFP && t == IRT_NUM) ? RSET_FPR : allow);
@ -1217,18 +1221,15 @@ static void asm_sload(ASMState *as, IRIns *ir)
base = ra_alloc1(as, REF_BASE, allow);
if ((ir->op2 & IRSLOAD_CONVERT)) {
if (t == IRT_INT) {
Reg tmp = ra_scratch(as, RSET_FPR);
emit_dn(as, ARMI_VMOV_R_S, dest, (tmp & 15));
emit_dm(as, ARMI_VCVT_S32_F64, (tmp & 15), (tmp & 15));
dest = tmp;
t = IRT_NUM; /* Check for original type. */
} else {
Reg tmp = ra_scratch(as, RSET_GPR);
emit_dm(as, ARMI_VCVT_F64_S32, (dest & 15), (dest & 15));
emit_dn(as, ARMI_VMOV_S_R, tmp, (dest & 15));
dest = tmp;
t = IRT_INT; /* Check for original type. */
}
dest = tmp;
}
goto dotypecheck;
}
@ -1503,7 +1504,7 @@ static void asm_intmul(ASMState *as, IRIns *ir)
if (dest == left && left != right) { left = right; right = dest; }
if (irt_isguard(ir->t)) { /* IR_MULOV */
if (!(as->flags & JIT_F_ARMV6) && dest == left)
tmp = left = ra_scratch(as, rset_exclude(RSET_FPR, left));
tmp = left = ra_scratch(as, rset_exclude(RSET_GPR, left));
asm_guardcc(as, CC_NE);
emit_nm(as, ARMI_TEQ|ARMF_SH(ARMSH_ASR, 31), RID_TMP, dest);
emit_dnm(as, ARMI_SMULL|ARMF_S(right), dest, RID_TMP, left);
@ -2102,7 +2103,8 @@ static void asm_head_root_base(ASMState *as)
IRIns *ir;
asm_head_lreg(as);
ir = IR(REF_BASE);
if (ra_hasreg(ir->r) && rset_test(as->modset, ir->r)) ra_spill(as, ir);
if (ra_hasreg(ir->r) && (rset_test(as->modset, ir->r) || irt_ismarked(ir->t)))
ra_spill(as, ir);
ra_destreg(as, ir, RID_BASE);
}
@ -2112,7 +2114,8 @@ static RegSet asm_head_side_base(ASMState *as, IRIns *irp, RegSet allow)
IRIns *ir;
asm_head_lreg(as);
ir = IR(REF_BASE);
if (ra_hasreg(ir->r) && rset_test(as->modset, ir->r)) ra_spill(as, ir);
if (ra_hasreg(ir->r) && (rset_test(as->modset, ir->r) || irt_ismarked(ir->t)))
ra_spill(as, ir);
if (ra_hasspill(irp->s)) {
rset_clear(allow, ra_dest(as, ir, allow));
} else {

View File

@ -1,6 +1,6 @@
/*
** MIPS IR assembler (SSA IR -> machine code).
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
/* -- Register allocator extensions --------------------------------------- */
@ -394,6 +394,7 @@ static void asm_retf(ASMState *as, IRIns *ir)
int32_t delta = 1+bc_a(*((const BCIns *)pc - 1));
as->topslot -= (BCReg)delta;
if ((int32_t)as->topslot < 0) as->topslot = 0;
irt_setmark(IR(REF_BASE)->t); /* Children must not coalesce with BASE reg. */
emit_setgl(as, base, jit_base);
emit_addptr(as, base, -8*delta);
asm_guard(as, MIPSI_BNE, RID_TMP,
@ -1723,7 +1724,7 @@ static void asm_head_root_base(ASMState *as)
if (as->loopinv) as->mctop--;
if (ra_hasreg(r)) {
ra_free(as, r);
if (rset_test(as->modset, r))
if (rset_test(as->modset, r) || irt_ismarked(ir->t))
ir->r = RID_INIT; /* No inheritance for modified BASE register. */
if (r != RID_BASE)
emit_move(as, r, RID_BASE);
@ -1738,7 +1739,7 @@ static RegSet asm_head_side_base(ASMState *as, IRIns *irp, RegSet allow)
if (as->loopinv) as->mctop--;
if (ra_hasreg(r)) {
ra_free(as, r);
if (rset_test(as->modset, r))
if (rset_test(as->modset, r) || irt_ismarked(ir->t))
ir->r = RID_INIT; /* No inheritance for modified BASE register. */
if (irp->r == r) {
rset_clear(allow, r); /* Mark same BASE register as coalesced. */

View File

@ -1,6 +1,6 @@
/*
** PPC IR assembler (SSA IR -> machine code).
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
/* -- Register allocator extensions --------------------------------------- */
@ -381,6 +381,7 @@ static void asm_retf(ASMState *as, IRIns *ir)
int32_t delta = 1+bc_a(*((const BCIns *)pc - 1));
as->topslot -= (BCReg)delta;
if ((int32_t)as->topslot < 0) as->topslot = 0;
irt_setmark(IR(REF_BASE)->t); /* Children must not coalesce with BASE reg. */
emit_setgl(as, base, jit_base);
emit_addptr(as, base, -8*delta);
asm_guardcc(as, CC_NE);
@ -1901,7 +1902,7 @@ static void asm_head_root_base(ASMState *as)
Reg r = ir->r;
if (ra_hasreg(r)) {
ra_free(as, r);
if (rset_test(as->modset, r))
if (rset_test(as->modset, r) || irt_ismarked(ir->t))
ir->r = RID_INIT; /* No inheritance for modified BASE register. */
if (r != RID_BASE)
emit_mr(as, r, RID_BASE);
@ -1915,7 +1916,7 @@ static RegSet asm_head_side_base(ASMState *as, IRIns *irp, RegSet allow)
Reg r = ir->r;
if (ra_hasreg(r)) {
ra_free(as, r);
if (rset_test(as->modset, r))
if (rset_test(as->modset, r) || irt_ismarked(ir->t))
ir->r = RID_INIT; /* No inheritance for modified BASE register. */
if (irp->r == r) {
rset_clear(allow, r); /* Mark same BASE register as coalesced. */

View File

@ -1,6 +1,6 @@
/*
** x86/x64 IR assembler (SSA IR -> machine code).
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
/* -- Guard handling ------------------------------------------------------ */
@ -647,6 +647,7 @@ static void asm_retf(ASMState *as, IRIns *ir)
int32_t delta = 1+bc_a(*((const BCIns *)pc - 1));
as->topslot -= (BCReg)delta;
if ((int32_t)as->topslot < 0) as->topslot = 0;
irt_setmark(IR(REF_BASE)->t); /* Children must not coalesce with BASE reg. */
emit_setgl(as, base, jit_base);
emit_addptr(as, base, -8*delta);
asm_guardcc(as, CC_NE);
@ -2481,7 +2482,7 @@ static void asm_head_root_base(ASMState *as)
Reg r = ir->r;
if (ra_hasreg(r)) {
ra_free(as, r);
if (rset_test(as->modset, r))
if (rset_test(as->modset, r) || irt_ismarked(ir->t))
ir->r = RID_INIT; /* No inheritance for modified BASE register. */
if (r != RID_BASE)
emit_rr(as, XO_MOV, r, RID_BASE);
@ -2495,7 +2496,7 @@ static RegSet asm_head_side_base(ASMState *as, IRIns *irp, RegSet allow)
Reg r = ir->r;
if (ra_hasreg(r)) {
ra_free(as, r);
if (rset_test(as->modset, r))
if (rset_test(as->modset, r) || irt_ismarked(ir->t))
ir->r = RID_INIT; /* No inheritance for modified BASE register. */
if (irp->r == r) {
rset_clear(allow, r); /* Mark same BASE register as coalesced. */

View File

@ -1,6 +1,6 @@
/*
** Bytecode instruction modes.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#define lj_bc_c

View File

@ -1,6 +1,6 @@
/*
** Bytecode instruction format.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_BC_H

View File

@ -1,6 +1,6 @@
/*
** Bytecode dump definitions.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_BCDUMP_H

View File

@ -1,6 +1,6 @@
/*
** Bytecode reader.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#define lj_bcread_c

View File

@ -1,6 +1,6 @@
/*
** Bytecode writer.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#define lj_bcwrite_c

View File

@ -1,6 +1,6 @@
/*
** C data arithmetic.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#include "lj_obj.h"

View File

@ -1,6 +1,6 @@
/*
** C data arithmetic.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_CARITH_H

View File

@ -1,6 +1,6 @@
/*
** FFI C call handling.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#include "lj_obj.h"
@ -173,9 +173,10 @@
#define CCALL_HANDLE_REGARG \
if (isfp) { /* Try to pass argument in FPRs. */ \
if (nfpr + n <= CCALL_NARG_FPR) { \
int n2 = ctype_isvector(d->info) ? 1 : n; \
if (nfpr + n2 <= CCALL_NARG_FPR) { \
dp = &cc->fpr[nfpr]; \
nfpr += n; \
nfpr += n2; \
goto done; \
} \
} else { /* Try to pass argument in GPRs. */ \

View File

@ -1,6 +1,6 @@
/*
** FFI C call handling.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_CCALL_H

View File

@ -1,6 +1,6 @@
/*
** FFI C callback handling.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#include "lj_obj.h"
@ -408,6 +408,7 @@ static void callback_conv_args(CTState *cts, lua_State *L)
intptr_t *stack = cts->cb.stack;
MSize slot = cts->cb.slot;
CTypeID id = 0, rid, fid;
int gcsteps = 0;
CType *ct;
GCfunc *fn;
MSize ngpr = 0, nsp = 0, maxgpr = CCALL_NARG_GPR;
@ -475,7 +476,7 @@ static void callback_conv_args(CTState *cts, lua_State *L)
done:
if (LJ_BE && cta->size < CTSIZE_PTR)
sp = (void *)((uint8_t *)sp + CTSIZE_PTR-cta->size);
lj_cconv_tv_ct(cts, cta, 0, o++, sp);
gcsteps += lj_cconv_tv_ct(cts, cta, 0, o++, sp);
}
fid = ctf->sib;
}
@ -485,6 +486,8 @@ static void callback_conv_args(CTState *cts, lua_State *L)
if (ctype_cconv(ct->info) != CTCC_CDECL)
(L->base-2)->u32.hi |= (nsp << (16+2));
#endif
while (gcsteps-- > 0)
lj_gc_check(L);
}
/* Convert Lua object to callback result. */

View File

@ -1,6 +1,6 @@
/*
** FFI C callback handling.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_CCALLBACK_H

View File

@ -1,6 +1,6 @@
/*
** C type conversions.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#include "lj_obj.h"

View File

@ -1,6 +1,6 @@
/*
** C type conversions.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_CCONV_H
@ -29,7 +29,7 @@ static LJ_AINLINE uint32_t cconv_idx(CTInfo info)
uint32_t idx = ((info >> 26) & 15u); /* Dispatch bits. */
lua_assert(ctype_type(info) <= CT_MAYCONVERT);
#if LJ_64
idx = ((U64x(f436fff5,fff7f021) >> 4*idx) & 15u);
idx = ((uint32_t)(U64x(f436fff5,fff7f021) >> 4*idx) & 15u);
#else
idx = (((idx < 8 ? 0xfff7f021u : 0xf436fff5) >> 4*(idx & 7u)) & 15u);
#endif

View File

@ -1,6 +1,6 @@
/*
** C data management.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#include "lj_obj.h"

View File

@ -1,6 +1,6 @@
/*
** C data management.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_CDATA_H

View File

@ -1,6 +1,6 @@
/*
** FFI C library loader.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#include "lj_obj.h"
@ -144,9 +144,6 @@ static void *clib_getsym(CLibrary *cl, const char *name)
#elif LJ_TARGET_WINDOWS
#define WIN32_LEAN_AND_MEAN
#ifndef WINVER
#define WINVER 0x0500
#endif
#include <windows.h>
#ifndef GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
@ -220,7 +217,7 @@ static void clib_unloadlib(CLibrary *cl)
FreeLibrary((HINSTANCE)h);
}
}
} else if (!cl->handle) {
} else if (cl->handle) {
FreeLibrary((HINSTANCE)cl->handle);
}
}

View File

@ -1,6 +1,6 @@
/*
** FFI C library loader.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_CLIB_H

View File

@ -1,6 +1,6 @@
/*
** C declaration parser.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#include "lj_obj.h"
@ -57,14 +57,22 @@ static LJ_AINLINE int cp_iseol(CPChar c)
return (c == '\n' || c == '\r');
}
static LJ_AINLINE CPChar cp_get(CPState *cp);
/* Peek next raw character. */
static LJ_AINLINE CPChar cp_rawpeek(CPState *cp)
{
return (CPChar)(uint8_t)(*cp->p);
}
static LJ_NOINLINE CPChar cp_get_bs(CPState *cp);
/* Get next character. */
static LJ_AINLINE CPChar cp_get(CPState *cp)
{
cp->c = (CPChar)(uint8_t)(*cp->p++);
if (LJ_LIKELY(cp->c != '\\')) return cp->c;
return cp_get_bs(cp);
}
/* Transparently skip backslash-escaped line breaks. */
static LJ_NOINLINE CPChar cp_get_bs(CPState *cp)
{
@ -77,14 +85,6 @@ static LJ_NOINLINE CPChar cp_get_bs(CPState *cp)
return cp_get(cp);
}
/* Get next character. */
static LJ_AINLINE CPChar cp_get(CPState *cp)
{
cp->c = (CPChar)(uint8_t)(*cp->p++);
if (LJ_LIKELY(cp->c != '\\')) return cp->c;
return cp_get_bs(cp);
}
/* Grow save buffer. */
static LJ_NOINLINE void cp_save_grow(CPState *cp, CPChar c)
{
@ -1258,7 +1258,7 @@ static void cp_struct_layout(CPState *cp, CTypeID sid, CTInfo sattr)
sinfo |= (info & (CTF_QUAL|CTF_VLA)); /* Merge pseudo-qualifiers. */
/* Check for size overflow and determine alignment. */
if (sz >= 0x20000000u || bofs + csz < bofs) {
if (sz >= 0x20000000u || bofs + csz < bofs || (info & CTF_VLA)) {
if (!(sz == CTSIZE_INVALID && ctype_isarray(info) &&
!(sinfo & CTF_UNION)))
cp_err(cp, LJ_ERR_FFI_INVSIZE);

View File

@ -1,6 +1,6 @@
/*
** C declaration parser.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_CPARSE_H

View File

@ -1,6 +1,6 @@
/*
** Trace recorder for C data operations.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#define lj_ffrecord_c
@ -1514,7 +1514,7 @@ void LJ_FASTCALL recff_ffi_string(jit_State *J, RecordFFData *rd)
TRef tr = J->base[0];
if (tr) {
TRef trlen = J->base[1];
if (trlen) {
if (!tref_isnil(trlen)) {
trlen = crec_toint(J, cts, trlen, &rd->argv[1]);
tr = crec_ct_tv(J, ctype_get(cts, CTID_P_CVOID), 0, tr, &rd->argv[0]);
} else {

View File

@ -1,6 +1,6 @@
/*
** Trace recorder for C data operations.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_CRECORD_H

View File

@ -1,6 +1,6 @@
/*
** C type management.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#include "lj_obj.h"

View File

@ -1,6 +1,6 @@
/*
** C type management.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_CTYPE_H

View File

@ -1,6 +1,6 @@
/*
** Debugging and introspection.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#define lj_debug_c
@ -71,9 +71,18 @@ static BCPos debug_framepc(lua_State *L, GCfunc *fn, cTValue *nextframe)
/* Lua function below errfunc/gc/hook: find cframe to get the PC. */
void *cf = cframe_raw(L->cframe);
TValue *f = L->base-1;
if (cf == NULL)
return NO_BCPOS;
while (f > nextframe) {
for (;;) {
if (cf == NULL)
return NO_BCPOS;
while (cframe_nres(cf) < 0) {
if (f >= restorestack(L, -cframe_nres(cf)))
break;
cf = cframe_raw(cframe_prev(cf));
if (cf == NULL)
return NO_BCPOS;
}
if (f < nextframe)
break;
if (frame_islua(f)) {
f = frame_prevl(f);
} else {
@ -82,8 +91,6 @@ static BCPos debug_framepc(lua_State *L, GCfunc *fn, cTValue *nextframe)
f = frame_prevd(f);
}
}
if (cframe_prev(cf))
cf = cframe_raw(cframe_prev(cf));
ins = cframe_pc(cf);
}
}

View File

@ -1,6 +1,6 @@
/*
** Debugging and introspection.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_DEBUG_H

View File

@ -1,6 +1,6 @@
/*
** LuaJIT common internal definitions.
** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_DEF_H

Some files were not shown because too many files have changed in this diff Show More