summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--doc/api.html203
-rw-r--r--doc/bluequad-print.css166
-rw-r--r--doc/bluequad.css303
-rw-r--r--doc/changes.html281
-rw-r--r--doc/contact.html84
-rw-r--r--doc/faq.html141
-rw-r--r--doc/img/contact.pngbin0 -> 1340 bytes
-rw-r--r--doc/install.html216
-rw-r--r--doc/luajit.html120
-rw-r--r--doc/running.html233
-rw-r--r--doc/status.html235
11 files changed, 1982 insertions, 0 deletions
diff --git a/doc/api.html b/doc/api.html
new file mode 100644
index 00000000..79788d95
--- /dev/null
+++ b/doc/api.html
@@ -0,0 +1,203 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2<html>
3<head>
4<title>API Extensions</title>
5<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6<meta name="Author" content="Mike Pall">
7<meta name="Copyright" content="Copyright (C) 2005-2009, Mike Pall">
8<meta name="Language" content="en">
9<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
10<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
11</head>
12<body>
13<div id="site">
14<a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
15</div>
16<div id="head">
17<h1>API Extensions</h1>
18</div>
19<div id="nav">
20<ul><li>
21<a href="luajit.html">LuaJIT</a>
22<ul><li>
23<a href="install.html">Installation</a>
24</li><li>
25<a href="running.html">Running</a>
26</li><li>
27<a class="current" href="api.html">API Extensions</a>
28</li></ul>
29</li><li>
30<a href="status.html">Status</a>
31<ul><li>
32<a href="changes.html">Changes</a>
33</li></ul>
34</li><li>
35<a href="faq.html">FAQ</a>
36</li><li>
37<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
38</li></ul>
39</div>
40<div id="main">
41<p>
42LuaJIT is fully upwards-compatible with Lua 5.1. It supports all
43<a href="http://www.lua.org/manual/5.1/manual.html#5"><span class="ext">&raquo;</span>&nbsp;standard Lua
44library functions</a> and the full set of
45<a href="http://www.lua.org/manual/5.1/manual.html#3"><span class="ext">&raquo;</span>&nbsp;Lua/C API
46functions</a>.
47</p>
48<p>
49LuaJIT is also fully ABI-compatible to Lua 5.1 at the linker/dynamic
50loader level. This means you can compile a C&nbsp;module against the
51standard Lua headers and load the same shared library from either Lua
52or LuaJIT.
53</p>
54
55<h2 id="bit"><tt>bit.*</tt> &mdash; Bitwise Operations</h2>
56<p>
57LuaJIT supports all bitwise operations as defined by
58<a href="http://bitop.luajit.org"><span class="ext">&raquo;</span>&nbsp;Lua BitOp</a>:
59</p>
60<pre class="code">
61bit.tobit bit.tohex bit.bnot bit.band bit.bor bit.bxor
62bit.lshift bit.rshift bit.arshift bit.rol bit.ror bit.bswap
63</pre>
64<p>
65This module is a LuaJIT built-in &mdash; you don't need to download or
66install Lua BitOp. The Lua BitOp site has full documentation for all
67<a href="http://bitop.luajit.org/api.html"><span class="ext">&raquo;</span>&nbsp;Lua BitOp API functions</a>.
68</p>
69<p>
70Please make sure to <tt>require</tt> the module before using any of
71its functions:
72</p>
73<pre class="code">
74local bit = require("bit")
75</pre>
76<p>
77An already installed Lua BitOp module is ignored by LuaJIT.
78This way you can use bit operations from both Lua and LuaJIT on a
79shared installation.
80</p>
81
82<h2 id="jit"><tt>jit.*</tt> &mdash; JIT compiler control</h2>
83<p>
84The functions in this built-in module control the behavior
85of the JIT compiler engine.
86</p>
87
88<h3 id="jit_onoff"><tt>jit.on()<br>
89jit.off()</tt></h3>
90<p>
91Turns the whole JIT compiler on (default) or off.
92</p>
93<p>
94These functions are typically used with the command line options
95<tt>-j on</tt> or <tt>-j off</tt>.
96</p>
97
98<h3 id="jit_flush"><tt>jit.flush()</tt></h3>
99<p>
100Flushes the whole cache of compiled code.
101</p>
102
103<h3 id="jit_flush_tr"><tt>jit.flush(tr)</tt></h3>
104<p>
105Flushes the code for the specified root trace and all of its
106side traces from the cache.
107</p>
108
109<h3 id="jit_onoff_func"><tt>jit.on(func|true [,true|false])<br>
110jit.off(func|true [,true|false])<br>
111jit.flush(func|true [,true|false])</tt></h3>
112<p>
113<tt>jit.on</tt> enables JIT compilation for a Lua function (this is
114the default).
115</p>
116<p>
117<tt>jit.off</tt> disables JIT compilation for a Lua function and
118flushes any already compiled code from the code cache.
119</p>
120<p>
121<tt>jit.flush</tt> flushes the code, but doesn't affect the
122enable/disable status.
123</p>
124<p>
125The current function, i.e. the Lua function calling this library
126function, can also be specified by passing <tt>true</tt> as the first
127argument.
128</p>
129<p>
130If the second argument is <tt>true</tt>, JIT compilation is also
131enabled, disabled or flushed recursively for all subfunctions of a
132function. With <tt>false</tt> only the subfunctions are affected.
133</p>
134<p>
135The <tt>jit.on</tt> and <tt>jit.off</tt> functions only set a flag
136which is checked when the function is about to be compiled. They do
137not trigger immediate compilation.
138</p>
139<p>
140Typical usage is <tt>jit.off(true, true)</tt> in the main chunk
141of a module to turn off JIT compilation for the whole module for
142debugging purposes.
143</p>
144
145<h3 id="jit_version"><tt>jit.version</tt></h3>
146<p>
147Contains the LuaJIT version string.
148</p>
149
150<h3 id="jit_version_num"><tt>jit.version_num</tt></h3>
151<p>
152Contains the version number of the LuaJIT core. Version xx.yy.zz
153is represented by the decimal number xxyyzz.
154</p>
155
156<h3 id="jit_arch"><tt>jit.arch</tt></h3>
157<p>
158Contains the target architecture name (CPU and optional ABI).
159</p>
160
161<h2 id="jit_opt"><tt>jit.opt.*</tt> &mdash; JIT compiler optimization control</h2>
162<p>
163This module provides the backend for the <tt>-O</tt> command line
164option.
165</p>
166<p>
167You can also use it programmatically, e.g.:
168</p>
169<pre class="code">
170jit.opt.start(2) -- same as -O2
171jit.opt.start("-dce")
172jit.opt.start("hotloop=10", "hotexit=2")
173</pre>
174<p>
175Unlike in LuaJIT 1.x, the module is built-in and
176<b>optimization is turned on by default!</b>
177It's no longer necessary to run <tt>require("jit.opt").start()</tt>,
178which was one of the ways to enable optimization.
179</p>
180
181<h2 id="jit_util"><tt>jit.util.*</tt> &mdash; JIT compiler introspection</h2>
182<p>
183This module holds functions to introspect the bytecode, generated
184traces, the IR and the generated machine code. The functionality
185provided by this module is still in flux and therefore undocumented.
186</p>
187<p>
188The debug modules <tt>-jbc</tt>, <tt>-jv</tt> and <tt>-jdump</tt> make
189extensive use of these functions. Please check out their source code,
190if you want to know more.
191</p>
192<br class="flush">
193</div>
194<div id="foot">
195<hr class="hide">
196Copyright &copy; 2005-2009 Mike Pall
197<span class="noprint">
198&middot;
199<a href="contact.html">Contact</a>
200</span>
201</div>
202</body>
203</html>
diff --git a/doc/bluequad-print.css b/doc/bluequad-print.css
new file mode 100644
index 00000000..00a6b154
--- /dev/null
+++ b/doc/bluequad-print.css
@@ -0,0 +1,166 @@
1/* Copyright (C) 2004-2009 Mike Pall.
2 *
3 * You are welcome to use the general ideas of this design for your own sites.
4 * But please do not steal the stylesheet, the layout or the color scheme.
5 */
6body {
7 font-family: serif;
8 font-size: 11pt;
9 margin: 0 3em;
10 padding: 0;
11 border: none;
12}
13a:link, a:visited, a:hover, a:active {
14 text-decoration: none;
15 background: transparent;
16 color: #0000ff;
17}
18h1, h2, h3 {
19 font-family: sans-serif;
20 font-weight: bold;
21 text-align: left;
22 margin: 0.5em 0;
23 padding: 0;
24}
25h1 {
26 font-size: 200%;
27}
28h2 {
29 font-size: 150%;
30}
31h3 {
32 font-size: 125%;
33}
34p {
35 margin: 0 0 0.5em 0;
36 padding: 0;
37}
38ul, ol {
39 margin: 0.5em 0;
40 padding: 0 0 0 2em;
41}
42ul {
43 list-style: outside square;
44}
45ol {
46 list-style: outside decimal;
47}
48li {
49 margin: 0;
50 padding: 0;
51}
52dl {
53 margin: 1em 0;
54 padding: 1em;
55 border: 1px solid black;
56}
57dt {
58 font-weight: bold;
59 margin: 0;
60 padding: 0;
61}
62dt sup {
63 float: right;
64 margin-left: 1em;
65}
66dd {
67 margin: 0.5em 0 0 2em;
68 padding: 0;
69}
70table {
71 table-layout: fixed;
72 width: 100%;
73 margin: 1em 0;
74 padding: 0;
75 border: 1px solid black;
76 border-spacing: 0;
77 border-collapse: collapse;
78}
79tr {
80 margin: 0;
81 padding: 0;
82 border: none;
83}
84td {
85 text-align: left;
86 margin: 0;
87 padding: 0.2em 0.5em;
88 border-top: 1px solid black;
89 border-bottom: 1px solid black;
90}
91tr.separate td {
92 border-top: double;
93}
94tt, pre, code, kbd, samp {
95 font-family: monospace;
96 font-size: 75%;
97}
98kbd {
99 font-weight: bolder;
100}
101blockquote, pre {
102 margin: 1em 2em;
103 padding: 0;
104}
105img {
106 border: none;
107 vertical-align: baseline;
108 margin: 0;
109 padding: 0;
110}
111img.left {
112 float: left;
113 margin: 0.5em 1em 0.5em 0;
114}
115img.right {
116 float: right;
117 margin: 0.5em 0 0.5em 1em;
118}
119.flush {
120 clear: both;
121 visibility: hidden;
122}
123.hide, .noprint, #nav {
124 display: none !important;
125}
126.pagebreak {
127 page-break-before: always;
128}
129#site {
130 text-align: right;
131 font-family: sans-serif;
132 font-weight: bold;
133 margin: 0 1em;
134 border-bottom: 1pt solid black;
135}
136#site a {
137 font-size: 1.2em;
138}
139#site a:link, #site a:visited {
140 text-decoration: none;
141 font-weight: bold;
142 background: transparent;
143 color: #ffffff;
144}
145#logo {
146 color: #ff8000;
147}
148#head {
149 clear: both;
150 margin: 0 1em;
151}
152#main {
153 line-height: 1.3;
154 text-align: justify;
155 margin: 1em;
156}
157#foot {
158 clear: both;
159 font-size: 80%;
160 text-align: center;
161 margin: 0 1.25em;
162 padding: 0.5em 0 0 0;
163 border-top: 1pt solid black;
164 page-break-before: avoid;
165 page-break-after: avoid;
166}
diff --git a/doc/bluequad.css b/doc/bluequad.css
new file mode 100644
index 00000000..7e52102f
--- /dev/null
+++ b/doc/bluequad.css
@@ -0,0 +1,303 @@
1/* Copyright (C) 2004-2009 Mike Pall.
2 *
3 * You are welcome to use the general ideas of this design for your own sites.
4 * But please do not steal the stylesheet, the layout or the color scheme.
5 */
6/* colorscheme:
7 *
8 * site | head #4162bf/white | #6078bf/#e6ecff
9 * ------+------ ----------------+-------------------
10 * nav | main #bfcfff | #e6ecff/black
11 *
12 * nav: hiback loback #c5d5ff #b9c9f9
13 * hiborder loborder #e6ecff #97a7d7
14 * link hover #2142bf #ff0000
15 *
16 * link: link visited hover #2142bf #8122bf #ff0000
17 *
18 * main: boxback boxborder #f0f4ff #bfcfff
19 */
20body {
21 font-family: Verdana, Arial, Helvetica, sans-serif;
22 font-size: 10pt;
23 margin: 0;
24 padding: 0;
25 border: none;
26 background: #e0e0e0;
27 color: #000000;
28}
29a:link {
30 text-decoration: none;
31 background: transparent;
32 color: #2142bf;
33}
34a:visited {
35 text-decoration: none;
36 background: transparent;
37 color: #8122bf;
38}
39a:hover, a:active {
40 text-decoration: underline;
41 background: transparent;
42 color: #ff0000;
43}
44h1, h2, h3 {
45 font-weight: bold;
46 text-align: left;
47 margin: 0.5em 0;
48 padding: 0;
49 background: transparent;
50}
51h1 {
52 font-size: 200%;
53 line-height: 3em; /* really 6em relative to body, match #site span */
54 margin: 0;
55}
56h2 {
57 font-size: 150%;
58 color: #606060;
59}
60h3 {
61 font-size: 125%;
62 color: #404040;
63}
64p {
65 max-width: 600px;
66 margin: 0 0 0.5em 0;
67 padding: 0;
68}
69b {
70 color: #404040;
71}
72ul, ol {
73 max-width: 600px;
74 margin: 0.5em 0;
75 padding: 0 0 0 2em;
76}
77ul {
78 list-style: outside square;
79}
80ol {
81 list-style: outside decimal;
82}
83li {
84 margin: 0;
85 padding: 0;
86}
87dl {
88 max-width: 600px;
89 margin: 1em 0;
90 padding: 1em;
91 border: 1px solid #bfcfff;
92 background: #f0f4ff;
93}
94dt {
95 font-weight: bold;
96 margin: 0;
97 padding: 0;
98}
99dt sup {
100 float: right;
101 margin-left: 1em;
102 color: #808080;
103}
104dt a:visited {
105 text-decoration: none;
106 color: #2142bf;
107}
108dt a:hover, dt a:active {
109 text-decoration: none;
110 color: #ff0000;
111}
112dd {
113 margin: 0.5em 0 0 2em;
114 padding: 0;
115}
116div.tablewrap { /* for IE *sigh* */
117 max-width: 600px;
118}
119table {
120 table-layout: fixed;
121 border-spacing: 0;
122 border-collapse: collapse;
123 max-width: 600px;
124 width: 100%;
125 margin: 1em 0;
126 padding: 0;
127 border: 1px solid #bfcfff;
128}
129tr {
130 margin: 0;
131 padding: 0;
132 border: none;
133}
134tr.odd {
135 background: #f0f4ff;
136}
137tr.separate td {
138 border-top: 1px solid #bfcfff;
139}
140td {
141 text-align: left;
142 margin: 0;
143 padding: 0.2em 0.5em;
144 border: none;
145}
146tt, code, kbd, samp {
147 font-family: Courier New, Courier, monospace;
148 line-height: 1.2;
149 font-size: 110%;
150}
151kbd {
152 font-weight: bolder;
153}
154blockquote, pre {
155 max-width: 600px;
156 margin: 1em 2em;
157 padding: 0;
158}
159pre {
160 line-height: 1.1;
161}
162pre.code {
163 line-height: 1.4;
164 margin: 0.5em 0 1em 0.5em;
165 padding: 0.5em 1em;
166 border: 1px solid #bfcfff;
167 background: #f0f4ff;
168}
169img {
170 border: none;
171 vertical-align: baseline;
172 margin: 0;
173 padding: 0;
174}
175img.left {
176 float: left;
177 margin: 0.5em 1em 0.5em 0;
178}
179img.right {
180 float: right;
181 margin: 0.5em 0 0.5em 1em;
182}
183.indent {
184 padding-left: 1em;
185}
186.flush {
187 clear: both;
188 visibility: hidden;
189}
190.hide, .noscreen {
191 display: none !important;
192}
193.ext {
194 color: #ff8000;
195}
196#site {
197 clear: both;
198 float: left;
199 width: 13em;
200 text-align: center;
201 font-weight: bold;
202 margin: 0;
203 padding: 0;
204 background: transparent;
205 color: #ffffff;
206}
207#site a {
208 font-size: 200%;
209}
210#site a:link, #site a:visited {
211 text-decoration: none;
212 font-weight: bold;
213 background: transparent;
214 color: #ffffff;
215}
216#site span {
217 line-height: 3em; /* really 6em relative to body, match h1 */
218}
219#logo {
220 color: #ffb380;
221}
222#head {
223 margin: 0;
224 padding: 0 0 0 2em;
225 border-left: solid 13em #4162bf;
226 border-right: solid 3em #6078bf;
227 background: #6078bf;
228 color: #e6ecff;
229}
230#nav {
231 clear: both;
232 float: left;
233 overflow: hidden;
234 text-align: left;
235 line-height: 1.5;
236 width: 13em;
237 padding-top: 1em;
238 background: transparent;
239}
240#nav ul {
241 list-style: none outside;
242 margin: 0;
243 padding: 0;
244}
245#nav li {
246 margin: 0;
247 padding: 0;
248}
249#nav a {
250 display: block;
251 text-decoration: none;
252 font-weight: bold;
253 margin: 0;
254 padding: 2px 1em;
255 border-top: 1px solid transparent;
256 border-bottom: 1px solid transparent;
257 background: transparent;
258 color: #2142bf;
259}
260#nav a:hover, #nav a:active {
261 text-decoration: none;
262 border-top: 1px solid #97a7d7;
263 border-bottom: 1px solid #e6ecff;
264 background: #b9c9f9;
265 color: #ff0000;
266}
267#nav a.current, #nav a.current:hover, #nav a.current:active {
268 border-top: 1px solid #e6ecff;
269 border-bottom: 1px solid #97a7d7;
270 background: #c5d5ff;
271 color: #2142bf;
272}
273#nav ul ul a {
274 padding: 0 1em 0 2em;
275}
276#main {
277 line-height: 1.5;
278 text-align: left;
279 margin: 0;
280 padding: 1em 2em;
281 border-left: solid 13em #bfcfff;
282 border-right: solid 3em #e6ecff;
283 background: #e6ecff;
284}
285#foot {
286 clear: both;
287 font-size: 80%;
288 text-align: center;
289 margin: 0;
290 padding: 0.5em;
291 background: #6078bf;
292 color: #ffffff;
293}
294#foot a:link, #foot a:visited {
295 text-decoration: underline;
296 background: transparent;
297 color: #ffffff;
298}
299#foot a:hover, #foot a:active {
300 text-decoration: underline;
301 background: transparent;
302 color: #bfcfff;
303}
diff --git a/doc/changes.html b/doc/changes.html
new file mode 100644
index 00000000..6c34b8be
--- /dev/null
+++ b/doc/changes.html
@@ -0,0 +1,281 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2<html>
3<head>
4<title>LuaJIT Change History</title>
5<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6<meta name="Author" content="Mike Pall">
7<meta name="Copyright" content="Copyright (C) 2005-2009, Mike Pall">
8<meta name="Language" content="en">
9<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
10<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
11<style type="text/css">
12div.major { max-width: 600px; padding: 1em; margin: 1em 0 1em 0; }
13</style>
14</head>
15<body>
16<div id="site">
17<a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
18</div>
19<div id="head">
20<h1>LuaJIT Change History</h1>
21</div>
22<div id="nav">
23<ul><li>
24<a href="luajit.html">LuaJIT</a>
25<ul><li>
26<a href="install.html">Installation</a>
27</li><li>
28<a href="running.html">Running</a>
29</li><li>
30<a href="api.html">API Extensions</a>
31</li></ul>
32</li><li>
33<a href="status.html">Status</a>
34<ul><li>
35<a class="current" href="changes.html">Changes</a>
36</li></ul>
37</li><li>
38<a href="faq.html">FAQ</a>
39</li><li>
40<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
41</li></ul>
42</div>
43<div id="main">
44<p>
45This is a list of changes between the released versions of LuaJIT.<br>
46The current <span style="color: #c00000;">development version</span> is <strong>LuaJIT&nbsp;2.0.0-beta1</strong>.<br>
47The current <span style="color: #0000c0;">stable version</span> is <strong>LuaJIT&nbsp;1.1.5</strong>.
48</p>
49<p>
50Please check the
51<a href="http://luajit.org/luajit_changes.html"><span class="ext">&raquo;</span>&nbsp;Online Change History</a>
52to see whether newer versions are available.
53</p>
54
55<div class="major" style="background: #ffd0d0;">
56<h2 id="LuaJIT-2.0.0-beta1">LuaJIT 2.0.0-beta1 &mdash; 2009-10-31</h2>
57<ul>
58<li>This is the first public release of LuaJIT 2.0.</li>
59<li>The whole VM has been rewritten from the ground up, so there's
60no point in listing differences over earlier versions.</li>
61</ul>
62</div>
63
64<div class="major" style="background: #d0d0ff;">
65<h2 id="LuaJIT-1.1.5">LuaJIT 1.1.5 &mdash; 2008-10-25</h2>
66<ul>
67<li>Merged with Lua 5.1.4. Fixes all
68<a href="http://www.lua.org/bugs.html#5.1.3"><span class="ext">&raquo;</span>&nbsp;known bugs in Lua 5.1.3</a>.</li>
69</ul>
70
71<h2 id="LuaJIT-1.1.4">LuaJIT 1.1.4 &mdash; 2008-02-05</h2>
72<ul>
73<li>Merged with Lua 5.1.3. Fixes all
74<a href="http://www.lua.org/bugs.html#5.1.2"><span class="ext">&raquo;</span>&nbsp;known bugs in Lua 5.1.2</a>.</li>
75<li>Fixed possible (but unlikely) stack corruption while compiling
76<tt>k^x</tt> expressions.</li>
77<li>Fixed DynASM template for cmpss instruction.</li>
78</ul>
79
80<h2 id="LuaJIT-1.1.3">LuaJIT 1.1.3 &mdash; 2007-05-24</h2>
81<ul>
82<li>Merged with Lua 5.1.2. Fixes all
83<a href="http://www.lua.org/bugs.html#5.1.1"><span class="ext">&raquo;</span>&nbsp;known bugs in Lua 5.1.1</a>.</li>
84<li>Merged pending Lua 5.1.x fixes: "return -nil" bug, spurious count hook call.</li>
85<li>Remove a (sometimes) wrong assertion in <tt>luaJIT_findpc()</tt>.</li>
86<li>DynASM now allows labels for displacements and <tt>.aword</tt>.</li>
87<li>Fix some compiler warnings for DynASM glue (internal API change).</li>
88<li>Correct naming for SSSE3 (temporarily known as SSE4) in DynASM and x86 disassembler.</li>
89<li>The loadable debug modules now handle redirection to stdout
90(e.g. <tt>-j&nbsp;trace=-</tt>).</li>
91</ul>
92
93<h2 id="LuaJIT-1.1.2">LuaJIT 1.1.2 &mdash; 2006-06-24</h2>
94<ul>
95<li>Fix MSVC inline assembly: use only local variables with
96<tt>lua_number2int()</tt>.</li>
97<li>Fix "attempt to call a thread value" bug on Mac OS X:
98make values of consts used as lightuserdata keys unique
99to avoid joining by the compiler/linker.</li>
100</ul>
101
102<h2 id="LuaJIT-1.1.1">LuaJIT 1.1.1 &mdash; 2006-06-20</h2>
103<ul>
104<li>Merged with Lua 5.1.1. Fixes all
105<a href="http://www.lua.org/bugs.html#5.1"><span class="ext">&raquo;</span>&nbsp;known bugs in Lua 5.1</a>.</li>
106<li>Enforce (dynamic) linker error for EXE/DLL version mismatches.</li>
107<li>Minor changes to DynASM: faster preprocessing, smaller encoding
108for some immediates.</li>
109</ul>
110<p>
111This release is in sync with Coco 1.1.1 (see the
112<a href="http://coco.luajit.org/changes.html"><span class="ext">&raquo;</span>&nbsp;Coco Change History</a>).
113</p>
114
115<h2 id="LuaJIT-1.1.0">LuaJIT 1.1.0 &mdash; 2006-03-13</h2>
116<ul>
117<li>Merged with Lua 5.1 (final).</li>
118
119<li>New JIT call frame setup:
120<ul>
121<li>The C stack is kept 16 byte aligned (faster).
122Mandatory for Mac OS X on Intel, too.</li>
123<li>Faster calling conventions for internal C helper functions.</li>
124<li>Better instruction scheduling for function prologue, OP_CALL and
125OP_RETURN.</li>
126</ul></li>
127
128<li>Miscellaneous optimizations:
129<ul>
130<li>Faster loads of FP constants. Remove narrow-to-wide store-to-load
131forwarding stalls.</li>
132<li>Use (scalar) SSE2 ops (if the CPU supports it) to speed up slot moves
133and FP to integer conversions.</li>
134<li>Optimized the two-argument form of <tt>OP_CONCAT</tt> (<tt>a..b</tt>).</li>
135<li>Inlined <tt>OP_MOD</tt> (<tt>a%b</tt>).
136With better accuracy than the C variant, too.</li>
137<li>Inlined <tt>OP_POW</tt> (<tt>a^b</tt>). Unroll <tt>x^k</tt> or
138use <tt>k^x = 2^(log2(k)*x)</tt> or call <tt>pow()</tt>.</li>
139</ul></li>
140
141<li>Changes in the optimizer:
142<ul>
143<li>Improved hinting for table keys derived from table values
144(<tt>t1[t2[x]]</tt>).</li>
145<li>Lookup hinting now works with arbitrary object types and
146supports index chains, too.</li>
147<li>Generate type hints for arithmetic and comparison operators,
148OP_LEN, OP_CONCAT and OP_FORPREP.</li>
149<li>Remove several hint definitions in favour of a generic COMBINE hint.</li>
150<li>Complete rewrite of <tt>jit.opt_inline</tt> module
151(ex <tt>jit.opt_lib</tt>).</li>
152</ul></li>
153
154<li>Use adaptive deoptimization:
155<ul>
156<li>If runtime verification of a contract fails, the affected
157instruction is recompiled and patched on-the-fly.
158Regular programs will trigger deoptimization only occasionally.</li>
159<li>This avoids generating code for uncommon fallback cases
160most of the time. Generated code is up to 30% smaller compared to
161LuaJIT&nbsp;1.0.3.</li>
162<li>Deoptimization is used for many opcodes and contracts:
163<ul>
164<li>OP_CALL, OP_TAILCALL: type mismatch for callable.</li>
165<li>Inlined calls: closure mismatch, parameter number and type mismatches.</li>
166<li>OP_GETTABLE, OP_SETTABLE: table or key type and range mismatches.</li>
167<li>All arithmetic and comparison operators, OP_LEN, OP_CONCAT,
168OP_FORPREP: operand type and range mismatches.</li>
169</ul></li>
170<li>Complete redesign of the debug and traceback info
171(bytecode &harr; mcode) to support deoptimization.
172Much more flexible and needs only 50% of the space.</li>
173<li>The modules <tt>jit.trace</tt>, <tt>jit.dumphints</tt> and
174<tt>jit.dump</tt> handle deoptimization.</li>
175</ul></li>
176
177<li>Inlined many popular library functions
178(for commonly used arguments only):
179<ul>
180<li>Most <tt>math.*</tt> functions (the 18 most used ones)
181[2x-10x faster].</li>
182<li><tt>string.len</tt>, <tt>string.sub</tt> and <tt>string.char</tt>
183[2x-10x faster].</li>
184<li><tt>table.insert</tt>, <tt>table.remove</tt> and <tt>table.getn</tt>
185[3x-5x faster].</li>
186<li><tt>coroutine.yield</tt> and <tt>coroutine.resume</tt>
187[3x-5x faster].</li>
188<li><tt>pairs</tt>, <tt>ipairs</tt> and the corresponding iterators
189[8x-15x faster].</li>
190</ul></li>
191
192<li>Changes in the core and loadable modules and the stand-alone executable:
193<ul>
194<li>Added <tt>jit.version</tt>, <tt>jit.version_num</tt>
195and <tt>jit.arch</tt>.</li>
196<li>Reorganized some internal API functions (<tt>jit.util.*mcode*</tt>).</li>
197<li>The <tt>-j dump</tt> output now shows JSUB names, too.</li>
198<li>New x86 disassembler module written in pure Lua. No dependency
199on ndisasm anymore. Flexible API, very compact (500 lines)
200and complete (x87, MMX, SSE, SSE2, SSE3, SSSE3, privileged instructions).</li>
201<li><tt>luajit -v</tt> prints the LuaJIT version and copyright
202on a separate line.</li>
203</ul></li>
204
205<li>Added SSE, SSE2, SSE3 and SSSE3 support to DynASM.</li>
206<li>Miscellaneous doc changes. Added a section about
207<a href="luajit_install.html#embedding">embedding LuaJIT</a>.</li>
208</ul>
209<p>
210This release is in sync with Coco 1.1.0 (see the
211<a href="http://coco.luajit.org/changes.html"><span class="ext">&raquo;</span>&nbsp;Coco Change History</a>).
212</p>
213</div>
214
215<div class="major" style="background: #ffffd0;">
216<h2 id="LuaJIT-1.0.3">LuaJIT 1.0.3 &mdash; 2005-09-08</h2>
217<ul>
218<li>Even more docs.</li>
219<li>Unified closure checks in <tt>jit.*</tt>.</li>
220<li>Fixed some range checks in <tt>jit.util.*</tt>.</li>
221<li>Fixed __newindex call originating from <tt>jit_settable_str()</tt>.</li>
222<li>Merged with Lua 5.1 alpha (including early bugfixes).</li>
223</ul>
224<p>
225This is the first public release of LuaJIT.
226</p>
227
228<h2 id="LuaJIT-1.0.2">LuaJIT 1.0.2 &mdash; 2005-09-02</h2>
229<ul>
230<li>Add support for flushing the Valgrind translation cache <br>
231(<tt>MYCFLAGS= -DUSE_VALGRIND</tt>).</li>
232<li>Add support for freeing executable mcode memory to the <tt>mmap()</tt>-based
233variant for POSIX systems.</li>
234<li>Reorganized the C&nbsp;function signature handling in
235<tt>jit.opt_lib</tt>.</li>
236<li>Changed to index-based hints for inlining C&nbsp;functions.
237Still no support in the backend for inlining.</li>
238<li>Hardcode <tt>HEAP_CREATE_ENABLE_EXECUTE</tt> value if undefined.</li>
239<li>Misc. changes to the <tt>jit.*</tt> modules.</li>
240<li>Misc. changes to the Makefiles.</li>
241<li>Lots of new docs.</li>
242<li>Complete doc reorg.</li>
243</ul>
244<p>
245Not released because Lua 5.1 alpha came out today.
246</p>
247
248<h2 id="LuaJIT-1.0.1">LuaJIT 1.0.1 &mdash; 2005-08-31</h2>
249<ul>
250<li>Missing GC step in <tt>OP_CONCAT</tt>.</li>
251<li>Fix result handling for C &ndash;> JIT calls.</li>
252<li>Detect CPU feature bits.</li>
253<li>Encode conditional moves (<tt>fucomip</tt>) only when supported.</li>
254<li>Add fallback instructions for FP compares.</li>
255<li>Add support for <tt>LUA_COMPAT_VARARG</tt>. Still disabled by default.</li>
256<li>MSVC needs a specific place for the <tt>CALLBACK</tt> attribute
257(David Burgess).</li>
258<li>Misc. doc updates.</li>
259</ul>
260<p>
261Interim non-public release.
262Special thanks to Adam D. Moss for reporting most of the bugs.
263</p>
264
265<h2 id="LuaJIT-1.0.0">LuaJIT 1.0.0 &mdash; 2005-08-29</h2>
266<p>
267This is the initial non-public release of LuaJIT.
268</p>
269</div>
270<br class="flush">
271</div>
272<div id="foot">
273<hr class="hide">
274Copyright &copy; 2005-2009 Mike Pall
275<span class="noprint">
276&middot;
277<a href="contact.html">Contact</a>
278</span>
279</div>
280</body>
281</html>
diff --git a/doc/contact.html b/doc/contact.html
new file mode 100644
index 00000000..36d5a825
--- /dev/null
+++ b/doc/contact.html
@@ -0,0 +1,84 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2<html>
3<head>
4<title>Contact</title>
5<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6<meta name="Author" content="Mike Pall">
7<meta name="Copyright" content="Copyright (C) 2005-2009, Mike Pall">
8<meta name="Language" content="en">
9<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
10<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
11</head>
12<body>
13<div id="site">
14<a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
15</div>
16<div id="head">
17<h1>Contact</h1>
18</div>
19<div id="nav">
20<ul><li>
21<a href="luajit.html">LuaJIT</a>
22<ul><li>
23<a href="install.html">Installation</a>
24</li><li>
25<a href="running.html">Running</a>
26</li><li>
27<a href="api.html">API Extensions</a>
28</li></ul>
29</li><li>
30<a href="status.html">Status</a>
31<ul><li>
32<a href="changes.html">Changes</a>
33</li></ul>
34</li><li>
35<a href="faq.html">FAQ</a>
36</li><li>
37<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
38</li></ul>
39</div>
40<div id="main">
41<p>
42Please send general questions to the
43<a href="http://www.lua.org/lua-l.html"><span class="ext">&raquo;</span>&nbsp;Lua mailing list</a>.
44You can also send any questions you have directly to me:
45</p>
46
47<script type="text/javascript">
48<!--
49var xS="@-: .0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZa<b>cdefghijklmnopqrstuvwxyz"
50function xD(s)
51{var len=s.length;var r="";for(var i=0;i<len;i++)
52{var c=s.charAt(i);var n=xS.indexOf(c);if(n!=-1)
53c=xS.charAt(66-n);r+=c;}
54document.write("<"+"p>"+r+"<"+"/p>\n");}
55//-->
56</script>
57<script type="text/javascript">
58<!--
59xD("ewYKA7vu-EIwslx7 K9A.t41C")
60//--></script>
61<noscript>
62<p><img src="img/contact.png" alt="Contact info in image" width="170" height="13">
63</p>
64</noscript>
65
66<h2>Copyright</h2>
67<p>
68All documentation is
69Copyright &copy; 2005-2009 Mike Pall.
70</p>
71
72
73<br class="flush">
74</div>
75<div id="foot">
76<hr class="hide">
77Copyright &copy; 2005-2009 Mike Pall
78<span class="noprint">
79&middot;
80<a href="contact.html">Contact</a>
81</span>
82</div>
83</body>
84</html>
diff --git a/doc/faq.html b/doc/faq.html
new file mode 100644
index 00000000..6f62e1eb
--- /dev/null
+++ b/doc/faq.html
@@ -0,0 +1,141 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2<html>
3<head>
4<title>Frequently Asked Questions (FAQ)</title>
5<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6<meta name="Author" content="Mike Pall">
7<meta name="Copyright" content="Copyright (C) 2005-2009, Mike Pall">
8<meta name="Language" content="en">
9<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
10<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
11<style type="text/css">
12dd { margin-left: 1.5em; }
13</style>
14</head>
15<body>
16<div id="site">
17<a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
18</div>
19<div id="head">
20<h1>Frequently Asked Questions (FAQ)</h1>
21</div>
22<div id="nav">
23<ul><li>
24<a href="luajit.html">LuaJIT</a>
25<ul><li>
26<a href="install.html">Installation</a>
27</li><li>
28<a href="running.html">Running</a>
29</li><li>
30<a href="api.html">API Extensions</a>
31</li></ul>
32</li><li>
33<a href="status.html">Status</a>
34<ul><li>
35<a href="changes.html">Changes</a>
36</li></ul>
37</li><li>
38<a class="current" href="faq.html">FAQ</a>
39</li><li>
40<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
41</li></ul>
42</div>
43<div id="main">
44<dl>
45<dt>Q: Where can I learn more about Lua and LuaJIT?</dt>
46<dd>
47<ul style="padding: 0;">
48<li>The <a href="http://lua.org"><span class="ext">&raquo;</span>&nbsp;main Lua.org site</a> has complete
49<a href="http://www.lua.org/docs.html"><span class="ext">&raquo;</span>&nbsp;documentation</a> of the language
50and links to books and papers about Lua.</li>
51<li>The community-managed <a href="http://lua-users.org/wiki/"><span class="ext">&raquo;</span>&nbsp;Lua Wiki</a>
52has information about diverse topics.</li>
53<li>The primary source of information for the latest developments surrounding
54Lua is the <a href="http://www.lua.org/lua-l.html"><span class="ext">&raquo;</span>&nbsp;Lua mailing list</a>.
55You can check out the <a href="http://lua-users.org/lists/lua-l/"><span class="ext">&raquo;</span>&nbsp;mailing
56list archive</a> or
57<a href="http://bazar2.conectiva.com.br/mailman/listinfo/lua"><span class="ext">&raquo;</span>&nbsp;subscribe</a>
58to the list (you need to be subscribed before posting).<br>
59This is also the place where announcements and discussions about LuaJIT
60take place.</li>
61</ul>
62</dl>
63
64<dl>
65<dt>Q: Where can I learn more about the compiler technology used by LuaJIT?</dt>
66<dd>
67I'm planning to write more documentation about the internals of LuaJIT.
68In the meantime, please use the following Google Scholar searches
69to find relevant papers:<br>
70Search for: <a href="http://scholar.google.com/scholar?q=Trace+Compiler"><span class="ext">&raquo;</span>&nbsp;Trace Compiler</a><br>
71Search for: <a href="http://scholar.google.com/scholar?q=JIT+Compiler"><span class="ext">&raquo;</span>&nbsp;JIT Compiler</a><br>
72Search for: <a href="http://scholar.google.com/scholar?q=Dynamic+Language+Optimizations"><span class="ext">&raquo;</span>&nbsp;Dynamic Language Optimizations</a><br>
73Search for: <a href="http://scholar.google.com/scholar?q=SSA+Form"><span class="ext">&raquo;</span>&nbsp;SSA Form</a><br>
74Search for: <a href="http://scholar.google.com/scholar?q=Linear+Scan+Register+Allocation"><span class="ext">&raquo;</span>&nbsp;Linear Scan Register Allocation</a><br>
75And, you know, reading the source is of course the only way to enlightenment. :-)
76</dd>
77</dl>
78
79<dl>
80<dt>Q: Why do I get this error: "attempt to index global 'arg' (a nil value)"?<br>
81Q: My vararg functions fail after switching to LuaJIT!</dt>
82<dd>LuaJIT is compatible to the Lua 5.1 language standard. It doesn't
83support the implicit <tt>arg</tt> parameter for old-style vararg
84functions from Lua 5.0.<br>Please convert your code to the
85<a href="http://www.lua.org/manual/5.1/manual.html#2.5.9"><span class="ext">&raquo;</span>&nbsp;Lua 5.1
86vararg syntax</a>.</dd>
87</dl>
88
89<dl>
90<dt>Q: Sometimes Ctrl-C fails to stop my Lua program. Why?</dt>
91<dd>The interrupt signal handler sets a Lua debug hook. But this is
92currently ignored by compiled code (this will eventually be fixed). If
93your program is running in a tight loop and never falls back to the
94interpreter, the debug hook never runs and can't throw the
95"interrupted!" error.<br> In the meantime you have to press Ctrl-C
96twice to get stop your program. That's similar to when it's stuck
97running inside a C function under the Lua interpreter.</dd>
98</dl>
99
100<dl>
101<dt>Q: Why doesn't my favorite power-patch for Lua apply against LuaJIT?</dt>
102<dd>Because it's a completely redesigned VM and has very little code
103in common with Lua anymore. Also, if the patch introduces changes to
104the Lua semantics, this would need to be reflected everywhere in the
105VM, from the interpreter up to all stages of the compiler.<br> Please
106use only standard Lua language constructs. For many common needs you
107can use source transformations or use wrapper or proxy functions.
108The compiler will happily optimize away such indirections.</dd>
109</dl>
110
111<dl>
112<dt>Q: Lua runs everywhere. Why doesn't LuaJIT support my CPU?</dt>
113<dd>Because it's a compiler &mdash; it needs to generate native
114machine code. This means the code generator must be ported to each
115architecture. And the fast interpreter is written in assembler and
116must be ported, too. This is quite an undertaking.<br> Currently only
117x86 CPUs are supported. x64 support is in the works. Other
118architectures will follow with sufficient demand and/or
119sponsoring.</dd>
120</dl>
121
122<dl>
123<dt>Q: When will feature X be added? When will the next version be released?</dt>
124<dd>When it's ready.<br>
125C'mon, it's open source &mdash; I'm doing it on my own time and you're
126getting it for free. You can either contribute a patch or sponsor
127the development of certain features, if they are important to you.
128</dd>
129</dl>
130<br class="flush">
131</div>
132<div id="foot">
133<hr class="hide">
134Copyright &copy; 2005-2009 Mike Pall
135<span class="noprint">
136&middot;
137<a href="contact.html">Contact</a>
138</span>
139</div>
140</body>
141</html>
diff --git a/doc/img/contact.png b/doc/img/contact.png
new file mode 100644
index 00000000..9c73dc59
--- /dev/null
+++ b/doc/img/contact.png
Binary files differ
diff --git a/doc/install.html b/doc/install.html
new file mode 100644
index 00000000..b7211d21
--- /dev/null
+++ b/doc/install.html
@@ -0,0 +1,216 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2<html>
3<head>
4<title>Installation</title>
5<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6<meta name="Author" content="Mike Pall">
7<meta name="Copyright" content="Copyright (C) 2005-2009, Mike Pall">
8<meta name="Language" content="en">
9<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
10<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
11</head>
12<body>
13<div id="site">
14<a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
15</div>
16<div id="head">
17<h1>Installation</h1>
18</div>
19<div id="nav">
20<ul><li>
21<a href="luajit.html">LuaJIT</a>
22<ul><li>
23<a class="current" href="install.html">Installation</a>
24</li><li>
25<a href="running.html">Running</a>
26</li><li>
27<a href="api.html">API Extensions</a>
28</li></ul>
29</li><li>
30<a href="status.html">Status</a>
31<ul><li>
32<a href="changes.html">Changes</a>
33</li></ul>
34</li><li>
35<a href="faq.html">FAQ</a>
36</li><li>
37<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
38</li></ul>
39</div>
40<div id="main">
41<p>
42LuaJIT is only distributed as a source package. This page explains
43how to build and install LuaJIT with different operating systems
44and C&nbsp;compilers.
45</p>
46<p>
47For the impatient (on POSIX systems):
48</p>
49<pre class="code">
50make &amp;&amp; sudo make install
51</pre>
52<p>
53LuaJIT currently builds out-of-the box on all popular x86 systems
54(Linux, Windows, OSX etc.). It builds and runs fine as a 32&nbsp;bit
55application under x64-based systems, too.
56</p>
57
58<h2>Configuring LuaJIT</h2>
59<p>
60The standard configuration should work fine for most installations.
61Usually there is no need to tweak the settings, except when you want to
62install to a non-standard path. The following three files hold all
63user-configurable settings:
64</p>
65<ul>
66<li><tt>src/luaconf.h</tt> sets some configuration variables, in
67particular the default paths for loading modules.</li>
68<li><tt>Makefile</tt> has settings for installing LuaJIT (POSIX
69only).</li>
70<li><tt>src/Makefile</tt> has settings for compiling LuaJIT under POSIX,
71MinGW and Cygwin.</li>
72<li><tt>src/msvcbuild.bat</tt> has settings for compiling LuaJIT with
73MSVC.</li>
74</ul>
75<p>
76Please read the instructions given in these files, before changing
77any settings.
78</p>
79
80<h2 id="posix">POSIX Systems (Linux, OSX, *BSD etc.)</h2>
81<h3>Prerequisites</h3>
82<p>
83Depending on your distribution, you may need to install a package for
84GCC (GCC 3.4 or later required), the development headers and/or a
85complete SDK.
86</p>
87<p>
88E.g. on a current Debian/Ubuntu, install <tt>libc6-dev</tt>
89with the package manager. Currently LuaJIT only builds as a 32&nbsp;bit
90application, so you actually need to install <tt>libc6-dev-i386</tt>
91when building on an x64 OS.
92</p>
93<p>
94Download the current source package (pick the .tar.gz), if you haven't
95already done so. Move it to a directory of your choice, open a
96terminal window and change to this directory. Now unpack the archive
97and change to the newly created directory:
98</p>
99<pre class="code">
100tar zxf LuaJIT-2.0.0-beta1.tar.gz
101cd LuaJIT-2.0.0-beta1
102</pre>
103<h3>Building LuaJIT</h3>
104<p>
105The supplied Makefiles try to auto-detect the settings needed for your
106operating system and your compiler. They need to be run with GNU Make,
107which is probably the default on your system, anyway. Simply run:
108</p>
109<pre class="code">
110make
111</pre>
112<h3>Installing LuaJIT</h3>
113<p>
114The top-level Makefile installs LuaJIT by default under
115<tt>/usr/local</tt>, i.e. the executable ends up in
116<tt>/usr/local/bin</tt> and so on. You need to have root privileges
117to write to this path. So, assuming sudo is installed on your system,
118run the following command and enter your sudo password:
119</p>
120<pre class="code">
121sudo make install
122</pre>
123<p>
124Otherwise specify the directory prefix as an absolute path, e.g.:
125</p>
126<pre class="code">
127sudo make install PREFIX=/opt/lj2
128</pre>
129<p>
130But note that the installation prefix and the prefix for the module paths
131(configured in <tt>src/luaconf.h</tt>) must match.
132</p>
133<p style="color: #c00000;">
134Note: to avoid overwriting a previous version, the beta test releases
135only install the LuaJIT executable under the versioned name (i.e.
136<tt>luajit-2.0.0-beta1</tt>). You probably want to create a symlink
137for convenience, with a command like this:
138</p>
139<pre class="code" style="color: #c00000;">
140sudo ln -sf luajit-2.0.0-beta1 /usr/local/bin/luajit
141</pre>
142
143<h2 id="windows">Windows Systems</h2>
144<h3>Prerequisites</h3>
145<p>
146Either install one of the open source SDKs
147(<a href="http://mingw.org/"><span class="ext">&raquo;</span>&nbsp;MinGW</a> or
148<a href="http://www.cygwin.com/"><span class="ext">&raquo;</span>&nbsp;Cygwin</a>) which come with modified
149versions of GCC plus the required development headers.
150</p>
151<p>
152Or install Microsoft's Visual C++ (MSVC) &mdash; the freely downloadable
153<a href="http://www.microsoft.com/Express/VC/"><span class="ext">&raquo;</span>&nbsp;Express Edition</a>
154works just fine.
155</p>
156<p>
157Next, download the source package and unpack it using an archive manager
158(e.g. the Windows Explorer) to a directory of your choice.
159</p>
160<h3>Building with MSVC</h3>
161<p>
162Open a "Visual Studio .NET Command Prompt" and <tt>cd</tt> to the
163directory where you've unpacked the sources. Then run this command:
164</p>
165<pre class="code">
166cd src
167msvcbuild
168</pre>
169<p>
170Then follow the installation instructions below.
171</p>
172<h3>Building with MinGW or Cygwin</h3>
173<p>
174Open a command prompt window and make sure the MinGW or Cygwin programs
175are in your path. Then <tt>cd</tt> to the directory where
176you've unpacked the sources and run this command for MinGW:
177</p>
178<pre class="code">
179cd src
180mingw32-make
181</pre>
182<p>
183Or this command for Cygwin:
184</p>
185<pre class="code">
186cd src
187make
188</pre>
189<p>
190Then follow the installation instructions below.
191</p>
192<h3>Installing LuaJIT</h3>
193<p>
194Copy <tt>luajit.exe</tt> and <tt>lua51.dll</tt>
195to a newly created directory (any location is ok). Add <tt>lua</tt>
196and <tt>lua\jit</tt> directories below it and copy all Lua files
197from the <tt>lib</tt> directory of the distribution to the latter directory.
198</p>
199<p>
200There are no hardcoded
201absolute path names &mdash; all modules are loaded relative to the
202directory where <tt>luajit.exe</tt> is installed
203(see <tt>src/luaconf.h</tt>).
204</p>
205<br class="flush">
206</div>
207<div id="foot">
208<hr class="hide">
209Copyright &copy; 2005-2009 Mike Pall
210<span class="noprint">
211&middot;
212<a href="contact.html">Contact</a>
213</span>
214</div>
215</body>
216</html>
diff --git a/doc/luajit.html b/doc/luajit.html
new file mode 100644
index 00000000..9b16ea37
--- /dev/null
+++ b/doc/luajit.html
@@ -0,0 +1,120 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2<html>
3<head>
4<title>LuaJIT</title>
5<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6<meta name="Author" content="Mike Pall">
7<meta name="Copyright" content="Copyright (C) 2005-2009, Mike Pall">
8<meta name="Language" content="en">
9<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
10<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
11</head>
12<body>
13<div id="site">
14<a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
15</div>
16<div id="head">
17<h1>LuaJIT</h1>
18</div>
19<div id="nav">
20<ul><li>
21<a class="current" href="luajit.html">LuaJIT</a>
22<ul><li>
23<a href="install.html">Installation</a>
24</li><li>
25<a href="running.html">Running</a>
26</li><li>
27<a href="api.html">API Extensions</a>
28</li></ul>
29</li><li>
30<a href="status.html">Status</a>
31<ul><li>
32<a href="changes.html">Changes</a>
33</li></ul>
34</li><li>
35<a href="faq.html">FAQ</a>
36</li><li>
37<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
38</li></ul>
39</div>
40<div id="main">
41<p>
42LuaJIT is a <b>Just-In-Time Compiler</b> for the Lua<sup>*</sup>
43programming language.
44</p>
45<p>
46LuaJIT is Copyright &copy; 2005-2008 Mike Pall.
47LuaJIT is open source software, released under the
48<a href="http://www.opensource.org/licenses/mit-license.php"><span class="ext">&raquo;</span>&nbsp;MIT/X license</a>.
49</p>
50<p class="indent" style="color: #606060;">
51* Lua is a powerful, dynamic and light-weight programming language
52designed for extending applications. Lua is also frequently used as a
53general-purpose, stand-alone language. More information about
54Lua can be found at: <a href="http://www.lua.org/"><span class="ext">&raquo;</span>&nbsp;http://www.lua.org/</a>
55</p>
56<h2>Compatibility</h2>
57<p>
58LuaJIT implements the full set of language features defined by Lua 5.1.
59The virtual machine (VM) is <b>API- and ABI-compatible</b> to the
60standard Lua interpreter and can be deployed as a drop-in replacement.
61</p>
62<p>
63LuaJIT offers more performance, at the expense of portability. It
64currently runs on all popular operating systems based on <b>x86 CPUs</b>
65(Linux, Windows, OSX etc.). It will be ported to x64 CPUs and other
66platforms in the future, based on user demand and sponsoring.
67</p>
68
69<h2>Overview</h2>
70<p>
71LuaJIT has been successfully used as a <b>scripting middleware</b> in
72games, 3D modellers, numerical simulations, trading platforms and many
73other specialty applications. It combines high flexibility with high
74performance and an unmatched <b>low memory footprint</b>: less than
75<b>120K</b> for the VM plus less than <b>80K</b> for the JIT compiler.
76</p>
77<p>
78LuaJIT has been in continuous development since 2005. It's widely
79considered to be <b>one of the fastest dynamic language
80implementations</b>. It has outperfomed other dynamic languages on many
81cross-language benchmarks since its first release &mdash; often by a
82substantial margin. Only now, in 2009, other dynamic language VMs are
83starting to catch up with the performance of LuaJIT 1.x &hellip;
84</p>
85<p>
862009 also marks the first release of the long-awaited <b>LuaJIT 2.0</b>.
87The whole VM has been rewritten from the ground up and relentlessly
88optimized for performance. It combines a high-speed interpreter,
89written in assembler, with a state-of-the-art JIT compiler.
90</p>
91<p>
92An innovative <b>trace compiler</b> is integrated with advanced,
93SSA-based optimizations and a highly tuned code generation backend. This
94allows a substantial reduction of the overhead associated with dynamic
95language features. It's destined to break into the performance range
96traditionally reserved for offline, static language compilers.
97</p>
98
99<h2>More ...</h2>
100<p>
101Click on the LuaJIT sub-topics in the navigation bar to learn more
102about LuaJIT.
103</p>
104<p><p>
105Click on the Logo in the upper left corner to visit
106the LuaJIT project page on the web. All other links to online
107resources are marked with a '<span class="ext">&raquo;</span>'.
108</p>
109<br class="flush">
110</div>
111<div id="foot">
112<hr class="hide">
113Copyright &copy; 2005-2009 Mike Pall
114<span class="noprint">
115&middot;
116<a href="contact.html">Contact</a>
117</span>
118</div>
119</body>
120</html>
diff --git a/doc/running.html b/doc/running.html
new file mode 100644
index 00000000..db69578c
--- /dev/null
+++ b/doc/running.html
@@ -0,0 +1,233 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2<html>
3<head>
4<title>Running LuaJIT</title>
5<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6<meta name="Author" content="Mike Pall">
7<meta name="Copyright" content="Copyright (C) 2005-2009, Mike Pall">
8<meta name="Language" content="en">
9<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
10<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
11<style type="text/css">
12table.opt {
13 line-height: 1.2;
14}
15tr.opthead td {
16 font-weight: bold;
17}
18td.flag_name {
19 width: 4em;
20}
21td.flag_level {
22 width: 2em;
23 text-align: center;
24}
25td.param_name {
26 width: 6em;
27}
28td.param_default {
29 width: 4em;
30 text-align: right;
31}
32</style>
33</head>
34<body>
35<div id="site">
36<a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
37</div>
38<div id="head">
39<h1>Running LuaJIT</h1>
40</div>
41<div id="nav">
42<ul><li>
43<a href="luajit.html">LuaJIT</a>
44<ul><li>
45<a href="install.html">Installation</a>
46</li><li>
47<a class="current" href="running.html">Running</a>
48</li><li>
49<a href="api.html">API Extensions</a>
50</li></ul>
51</li><li>
52<a href="status.html">Status</a>
53<ul><li>
54<a href="changes.html">Changes</a>
55</li></ul>
56</li><li>
57<a href="faq.html">FAQ</a>
58</li><li>
59<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
60</li></ul>
61</div>
62<div id="main">
63<p>
64LuaJIT has only a single stand-alone executable, called <tt>luajit</tt> on
65POSIX systems or <tt>luajit.exe</tt> on Windows. It can be used to run simple
66Lua statements or whole Lua applications from the command line. It has an
67interactive mode, too.
68</p>
69<p class="indent" style="color: #c00000;">
70Note: the beta test releases only install under the versioned name on
71POSIX systems (to avoid overwriting a previous version). You either need
72to type <tt>luajit-2.0.0-beta1</tt> to start it or create a symlink
73with a command like this:
74</p>
75<pre class="code" style="color: #c00000;">
76sudo ln -sf luajit-2.0.0-beta1 /usr/local/bin/luajit
77</pre>
78<p>
79Unlike previous versions <b>optimization is turned on by default</b> in
80LuaJIT 2.0!<br>It's no longer necessary to use <tt>luajit&nbsp;-O</tt>.
81</p>
82
83<h2 id="options">Command Line Options</h2>
84<p>
85The <tt>luajit</tt> stand-alone executable is just a slightly modified
86version of the regular <tt>lua</tt> stand-alone executable.
87It supports the same basic options, too. <tt>luajit&nbsp;-h</tt>
88prints a short list of the available options. Please have a look at the
89<a href="http://www.lua.org/manual/5.1/manual.html#6"><span class="ext">&raquo;</span>&nbsp;Lua manual</a>
90for details.
91</p>
92<p>
93Two additional options control the behavior of LuaJIT:
94</p>
95
96<h3 id="opt_j"><tt>-j cmd[=arg[,arg...]]</tt></h3>
97<p>
98This option performs a LuaJIT control command or activates one of the
99loadable extension modules. The command is first looked up in the
100<tt>jit.*</tt> library. If no matching function is found, a module
101named <tt>jit.&lt;cmd&gt;</tt> is loaded and the <tt>start()</tt>
102function of the module is called with the specified arguments (if
103any). The space between <tt>-j</tt> and <tt>cmd</tt> is optional.
104</p>
105<p>
106Here are the available LuaJIT control commands:
107</p>
108<ul>
109<li id="j_on"><tt>-jon</tt> &mdash; Turns the JIT compiler on (default).</li>
110<li id="j_off"><tt>-joff</tt> &mdash; Turns the JIT compiler off (only use the interpreter).</li>
111<li id="j_flush"><tt>-jflush</tt> &mdash; Flushes the whole cache of compiled code.</li>
112<li id="j_v"><tt>-jv</tt> &mdash; Shows verbose information about the progress of the JIT compiler.</li>
113<li id="j_dump"><tt>-jdump</tt> &mdash; Dumps the code and structures used in various compiler stages.</li>
114</ul>
115<p>
116The <tt>-jv</tt> and <tt>-jdump</tt> commands are extension modules
117written in Lua. They are mainly used for debugging the JIT compiler
118itself. For a description of their options and output format, please
119read the comment block at the start of their source.
120They can be found in the <tt>lib</tt> directory of the source
121distribution or installed under the <tt>jit</tt> directory. By default
122this is <tt>/usr/local/share/luajit-2.0.0-beta1/jit</tt> on POSIX
123systems.
124</p>
125
126<h3 id="opt_O"><tt>-O[level]</tt><br>
127<tt>-O[+]flag</tt> <tt>-O-flag</tt><br>
128<tt>-Oparam=value</tt></h3>
129<p>
130This options allows fine-tuned control of the optimizations used by
131the JIT compiler. This is mainly intended for debugging LuaJIT itself.
132Please note that the JIT compiler is extremly fast (we are talking
133about the microsecond to millisecond range). Disabling optimizations
134doesn't have any visible impact on its overhead, but usually generates
135code that runs slower.
136</p>
137<p>
138The first form sets an optimization level &mdash; this enables a
139specific mix of optimization flags. <tt>-O0</tt> turns off all
140optimizations and higher numbers enable more optimizations. Omitting
141the level (i.e. just <tt>-O</tt>) sets the default optimization level,
142which is <tt>-O3</tt> in the current version.
143</p>
144<p>
145The second form adds or removes individual optimization flags.
146The third form sets a parameter for the VM or the JIT compiler
147to a specific value.
148</p>
149<p>
150You can either use this option multiple times (like <tt>-Ocse
151-O-dce -Ohotloop=10</tt>) or separate several settings with a comma
152(like <tt>-O+cse,-dce,hotloop=10</tt>). The settings are applied from
153left to right and later settings override earlier ones. You can freely
154mix the three forms, but note that setting an optimization level
155overrides all earlier flags.
156</p>
157<p>
158Here are the available flags and at what optimization levels they
159are enabled:
160</p>
161<table class="opt">
162<tr class="opthead">
163<td class="flag_name">Flag</td>
164<td class="flag_level">-O1</td>
165<td class="flag_level">-O2</td>
166<td class="flag_level">-O3</td>
167<td class="flag_desc">&nbsp;</td>
168</tr>
169<tr class="odd separate">
170<td class="flag_name">fold</td><td class="flag_level">&bull;</td><td class="flag_level">&bull;</td><td class="flag_level">&bull;</td><td class="flag_desc">Constant Folding, Simplifications and Reassociation</td></tr>
171<tr class="even">
172<td class="flag_name">cse</td><td class="flag_level">&bull;</td><td class="flag_level">&bull;</td><td class="flag_level">&bull;</td><td class="flag_desc">Common-Subexpression Elimination</td></tr>
173<tr class="odd">
174<td class="flag_name">dce</td><td class="flag_level">&bull;</td><td class="flag_level">&bull;</td><td class="flag_level">&bull;</td><td class="flag_desc">Dead-Code Elimination</td></tr>
175<tr class="even">
176<td class="flag_name">narrow</td><td class="flag_level">&nbsp;</td><td class="flag_level">&bull;</td><td class="flag_level">&bull;</td><td class="flag_desc">Narrowing of numbers to integers</td></tr>
177<tr class="odd">
178<td class="flag_name">loop</td><td class="flag_level">&nbsp;</td><td class="flag_level">&bull;</td><td class="flag_level">&bull;</td><td class="flag_desc">Loop Optimizations (code hoisting)</td></tr>
179<tr class="even">
180<td class="flag_name">fwd</td><td class="flag_level">&nbsp;</td><td class="flag_level">&nbsp;</td><td class="flag_level">&bull;</td><td class="flag_desc">Load Forwarding (L2L) and Store Forwarding (S2L)</td></tr>
181<tr class="odd">
182<td class="flag_name">dse</td><td class="flag_level">&nbsp;</td><td class="flag_level">&nbsp;</td><td class="flag_level">&bull;</td><td class="flag_desc">Dead-Store Elimination</td></tr>
183<tr class="even">
184<td class="flag_name">fuse</td><td class="flag_level">&nbsp;</td><td class="flag_level">&nbsp;</td><td class="flag_level">&bull;</td><td class="flag_desc">Fusion of operands into instructions</td></tr>
185</table>
186<p>
187Here are the parameters and their default settings:
188</p>
189<table class="opt">
190<tr class="opthead">
191<td class="param_name">Parameter</td>
192<td class="param_default">Default</td>
193<td class="param_desc">&nbsp;</td>
194</tr>
195<tr class="odd separate">
196<td class="param_name">maxtrace</td><td class="param_default">1000</td><td class="param_desc">Max. number of traces in the cache</td></tr>
197<tr class="even">
198<td class="param_name">maxrecord</td><td class="param_default">2000</td><td class="param_desc">Max. number of recorded IR instructions</td></tr>
199<tr class="odd">
200<td class="param_name">maxirconst</td><td class="param_default">500</td><td class="param_desc">Max. number of IR constants of a trace</td></tr>
201<tr class="even">
202<td class="param_name">maxside</td><td class="param_default">100</td><td class="param_desc">Max. number of side traces of a root trace</td></tr>
203<tr class="odd">
204<td class="param_name">maxsnap</td><td class="param_default">100</td><td class="param_desc">Max. number of snapshots for a trace</td></tr>
205<tr class="even separate">
206<td class="param_name">hotloop</td><td class="param_default">57</td><td class="param_desc">Number of iterations to detect a hot loop</td></tr>
207<tr class="odd">
208<td class="param_name">hotexit</td><td class="param_default">10</td><td class="param_desc">Number of taken exits to start a side trace</td></tr>
209<tr class="even">
210<td class="param_name">tryside</td><td class="param_default">4</td><td class="param_desc">Number of attempts to compile a side trace</td></tr>
211<tr class="odd separate">
212<td class="param_name">instunroll</td><td class="param_default">4</td><td class="param_desc">Max. unroll factor for instable loops</td></tr>
213<tr class="even">
214<td class="param_name">loopunroll</td><td class="param_default">7</td><td class="param_desc">Max. unroll factor for loop ops in side traces</td></tr>
215<tr class="odd">
216<td class="param_name">callunroll</td><td class="param_default">3</td><td class="param_desc">Max. unroll factor for pseudo-recursive calls</td></tr>
217<tr class="even separate">
218<td class="param_name">sizemcode</td><td class="param_default">32</td><td class="param_desc">Size of each machine code area in KBytes (Windows: 64K)</td></tr>
219<tr class="odd">
220<td class="param_name">maxmcode</td><td class="param_default">512</td><td class="param_desc">Max. total size of all machine code areas in KBytes</td></tr>
221</table>
222<br class="flush">
223</div>
224<div id="foot">
225<hr class="hide">
226Copyright &copy; 2005-2009 Mike Pall
227<span class="noprint">
228&middot;
229<a href="contact.html">Contact</a>
230</span>
231</div>
232</body>
233</html>
diff --git a/doc/status.html b/doc/status.html
new file mode 100644
index 00000000..23c14c76
--- /dev/null
+++ b/doc/status.html
@@ -0,0 +1,235 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2<html>
3<head>
4<title>Status &amp; Roadmap</title>
5<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6<meta name="Author" content="Mike Pall">
7<meta name="Copyright" content="Copyright (C) 2005-2009, Mike Pall">
8<meta name="Language" content="en">
9<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
10<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
11<style type="text/css">
12ul li { padding-bottom: 0.3em; }
13</style>
14</head>
15<body>
16<div id="site">
17<a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
18</div>
19<div id="head">
20<h1>Status &amp; Roadmap</h1>
21</div>
22<div id="nav">
23<ul><li>
24<a href="luajit.html">LuaJIT</a>
25<ul><li>
26<a href="install.html">Installation</a>
27</li><li>
28<a href="running.html">Running</a>
29</li><li>
30<a href="api.html">API Extensions</a>
31</li></ul>
32</li><li>
33<a class="current" href="status.html">Status</a>
34<ul><li>
35<a href="changes.html">Changes</a>
36</li></ul>
37</li><li>
38<a href="faq.html">FAQ</a>
39</li><li>
40<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
41</li></ul>
42</div>
43<div id="main">
44<p>
45The <span style="color: #0000c0;">LuaJIT 1.x</span> series represents
46the current <span style="color: #0000c0;">stable branch</span>. As of
47this writing there have been no open bugs since about a year. So, if
48you need a rock-solid VM, you are encouraged to fetch the latest
49release of LuaJIT 1.x from the <a href="http://luajit.org/download.html"><span class="ext">&raquo;</span>&nbsp;Download</a>
50page.
51</p>
52<p>
53<span style="color: #c00000;">LuaJIT 2.0</span> is the currently active
54<span style="color: #c00000;">development branch</span>.
55It has <b>Beta Test</b> status and is still undergoing
56substantial changes. It's expected to quickly mature within the next
57months. You should definitely start to evaluate it for new projects
58right now. But deploying it in production environments is not yet
59recommended.
60</p>
61
62<h2>Current Status</h2>
63<p>
64This is a list of the things you should know about the LuaJIT 2.0 beta test:
65</p>
66<ul>
67<li>
68The JIT compiler can only generate code for CPUs with <b>SSE2</b> at the
69moment. I.e. you need at least a P4, Core 2/i5/i7 or K8/K10 to use it. I
70plan to fix this during the beta phase and add support for emitting x87
71instructions to the backend.
72</li>
73<li>
74Obviously there will be many <b>bugs</b> in a VM which has been
75rewritten from the ground up. Please report your findings together with
76the circumstances needed to reproduce the bug. If possible reduce the
77problem down to a simple test cases.<br>
78There is no formal bug tracker at the moment. The best place for
79discussion is the
80<a href="http://www.lua.org/lua-l.html"><span class="ext">&raquo;</span>&nbsp;Lua mailing list</a>. Of course
81you may also send your bug report directly to me, especially when they
82contains lengthy debug output. Please check the
83<a href="contact.html">Contact</a> page for details.
84</li>
85<li>
86The VM is complete in the sense that it <b>should</b> run all Lua code
87just fine. It's considered a serious bug if the VM crashes or produces
88unexpected results &mdash; please report it. There are only very few
89known incompatibilities with standard Lua:
90<ul>
91<li>
92The Lua <b>debug API</b> is missing a couple of features (call/return
93hooks) and shows slightly different behavior (no per-coroutine hooks).
94</li>
95<li>
96Most other issues you're likely to find (e.g. with the existing test
97suites) are differences in the <b>implementation-defined</b> behavior.
98These either have a good reason (like early tail call resolving which
99may cause differences in error reporting), are arbitrary design choices
100or are due to quirks in the VM. The latter cases may get fixed if a
101demonstrable need is shown.
102</li>
103</ul>
104</li>
105<li>
106The <b>JIT compiler</b> is not complete (yet) and falls back to the
107interpreter in some cases. All of this works transparently, so unless
108you use -jv, you'll probably never notice (the interpreter is quite
109fast, too). Here are the known issues:
110<ul>
111<li>
112Many known issues cause a <b>NYI</b> (not yet implemented) trace abort
113message. E.g. for calls to vararg functions or many string library
114functions. Reporting these is only mildly useful, except if you have good
115example code that shows the problem. Obviously, reports accompanied with
116a patch to fix the issue are more than welcome. But please check back
117with me, before writing major improvements, to avoid duplication of
118effort.
119</li>
120<li>
121<b>Recursion</b> is not traced yet. Often no trace will be generated at
122all or some unroll limit will catch it and aborts the trace.
123</li>
124<li>
125The trace compiler currently does not back off specialization for
126function call dispatch. It should really fall back to specializing on
127the prototype, not the closure identity. This can lead to the so-called
128"trace explosion" problem with <b>closure-heavy programming</b>. The
129trace linking heuristics prevent this, but in the worst case this
130means the code always falls back to the interpreter.
131</li>
132<li>
133<b>Trace management</b> needs more tuning: better blacklisting of aborted
134traces, less drastic countermeasures against trace explosion and better
135heuristics in general.
136</li>
137<li>
138Some checks are missing in the JIT-compiled code for obscure situations
139with <b>open upvalues aliasing</b> one of the SSA slots later on (or
140vice versa). Bonus points, if you can find a real world test case for
141this.
142</li>
143</ul>
144</li>
145</ul>
146
147<h2>Roadmap</h2>
148<p>
149Rather than stating exact release dates (I'm well known for making
150spectacularly wrong guesses), this roadmap lists the general project
151plan, sorted by priority, as well as ideas for the future:
152</p>
153<ul>
154<li>
155The main goal right now is to stabilize LuaJIT 2.0 and get it out of
156beta test. <b>Correctness</b> has priority over completeness. This
157implies the first stable release will certainly NOT compile every
158library function call and will fall back to the interpreter from time
159to time. This is perfectly ok, since it still executes all Lua code,
160just not at the highest possible speed.
161</li>
162<li>
163The next step is to get it to compile more library functions and handle
164more cases where the compiler currently bails out. This doesn't mean it
165will compile every corner case. It's much more important that it
166performs well in a majority of use cases. Every compiler has to make
167these trade-offs &mdash; <b>completeness</b> just cannot be the
168overriding goal for a low-footprint, low-overhead JIT compiler.
169</li>
170<li>
171More <b>optimizations</b> will be added in parallel to the last step on
172an as-needed basis. Array-bounds-check (ABC) removal, sinking of stores
173to aggregates and sinking of allocations are high on the list. Faster
174handling of NEWREF and better alias analysis are desirable, too. More
175complex optimizations with less pay-off, such as value-range-propagation
176(VRP) will have to wait.
177</li>
178<li>
179LuaJIT 2.0 has been designed with <b>portability</b> in mind.
180Nonetheless, it compiles to native code and needs to be adapted to each
181architecture. Porting the compiler backend is probably the easier task,
182but a key element of its design is the fast interpreter, written in
183machine-specific assembler.<br>
184The code base and the internal structures are already prepared for
185easier porting to 64 bit architectures. The most likely next target is a
186port to <b>x64</b>, but this will have to wait until the x86 port
187stabilizes. Other ports will follow &mdash; companies which are
188interested in sponsoring a port to a particular architecture, please
189<a href="contact.html">contact me</a>.
190</li>
191<li>
192There are some planned <b>structural improvements</b> to the compiler,
193like compressed snapshot maps or generic handling of calls to helper
194methods. These are of lesser importance, unless other developments
195elevate their priority.
196</li>
197<li>
198<b>Documentation</b> about the <b>internals</b> of LuaJIT is still sorely
199missing. Although the source code is included and is IMHO well
200commented, many basic design decisions are in need of an explanation.
201The rather un-traditional compiler architecture and the many highly
202optimized data structures are a barrier for outside participation in
203the development. Alas, as I've repeatedly stated, I'm better at
204writing code than papers and I'm not in need of any academical merits.
205Someday I will find the time for it. :-)
206</li>
207<li>
208Producing good code for unbiased branches is a key problem for trace
209compilers. This is the main cause for "trace explosion".
210<b>Hyperblock scheduling</b> promises to solve this nicely at the
211price of a major redesign of the compiler. This would also pave the
212way for emitting predicated instructions, which is a prerequisite
213for efficient <b>vectorization</b>.
214</li>
215<li>
216Currently Lua is missing a standard library for access to <b>structured
217binary data</b> and <b>arrays/buffers</b> holding low-level data types.
218Allowing calls to arbitrary C functions (<b>FFI</b>) would obviate the
219need to write manual bindings. A variety of extension modules is floating
220around, with different scope and capabilities. Alas, none of them has been
221designed with a JIT compiler in mind.
222</li>
223</ul>
224<br class="flush">
225</div>
226<div id="foot">
227<hr class="hide">
228Copyright &copy; 2005-2009 Mike Pall
229<span class="noprint">
230&middot;
231<a href="contact.html">Contact</a>
232</span>
233</div>
234</body>
235</html>