aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/LuaJIT-1.1.7/jitdoc
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/LuaJIT-1.1.7/jitdoc')
-rw-r--r--libraries/LuaJIT-1.1.7/jitdoc/bluequad-print.css166
-rw-r--r--libraries/LuaJIT-1.1.7/jitdoc/bluequad.css292
-rw-r--r--libraries/LuaJIT-1.1.7/jitdoc/coco.html132
-rw-r--r--libraries/LuaJIT-1.1.7/jitdoc/coco_api.html182
-rw-r--r--libraries/LuaJIT-1.1.7/jitdoc/coco_changes.html146
-rw-r--r--libraries/LuaJIT-1.1.7/jitdoc/coco_portability.html235
-rw-r--r--libraries/LuaJIT-1.1.7/jitdoc/contact.html105
-rw-r--r--libraries/LuaJIT-1.1.7/jitdoc/dynasm.html116
-rw-r--r--libraries/LuaJIT-1.1.7/jitdoc/dynasm_examples.html188
-rw-r--r--libraries/LuaJIT-1.1.7/jitdoc/dynasm_features.html139
-rw-r--r--libraries/LuaJIT-1.1.7/jitdoc/img/backbar.pngbin0 -> 118 bytes
-rw-r--r--libraries/LuaJIT-1.1.7/jitdoc/img/bluebar.pngbin0 -> 134 bytes
-rw-r--r--libraries/LuaJIT-1.1.7/jitdoc/img/contact.pngbin0 -> 1340 bytes
-rw-r--r--libraries/LuaJIT-1.1.7/jitdoc/img/magentabar.pngbin0 -> 152 bytes
-rw-r--r--libraries/LuaJIT-1.1.7/jitdoc/img/spacer.pngbin0 -> 95 bytes
-rw-r--r--libraries/LuaJIT-1.1.7/jitdoc/index.html103
-rw-r--r--libraries/LuaJIT-1.1.7/jitdoc/luajit.html109
-rw-r--r--libraries/LuaJIT-1.1.7/jitdoc/luajit_api.html372
-rw-r--r--libraries/LuaJIT-1.1.7/jitdoc/luajit_changes.html301
-rw-r--r--libraries/LuaJIT-1.1.7/jitdoc/luajit_debug.html273
-rw-r--r--libraries/LuaJIT-1.1.7/jitdoc/luajit_features.html226
-rw-r--r--libraries/LuaJIT-1.1.7/jitdoc/luajit_install.html340
-rw-r--r--libraries/LuaJIT-1.1.7/jitdoc/luajit_intro.html389
-rw-r--r--libraries/LuaJIT-1.1.7/jitdoc/luajit_performance.html394
-rw-r--r--libraries/LuaJIT-1.1.7/jitdoc/luajit_run.html159
25 files changed, 4367 insertions, 0 deletions
diff --git a/libraries/LuaJIT-1.1.7/jitdoc/bluequad-print.css b/libraries/LuaJIT-1.1.7/jitdoc/bluequad-print.css
new file mode 100644
index 0000000..69c07d6
--- /dev/null
+++ b/libraries/LuaJIT-1.1.7/jitdoc/bluequad-print.css
@@ -0,0 +1,166 @@
1/* Copyright (C) 2004-2011 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/libraries/LuaJIT-1.1.7/jitdoc/bluequad.css b/libraries/LuaJIT-1.1.7/jitdoc/bluequad.css
new file mode 100644
index 0000000..8d72de9
--- /dev/null
+++ b/libraries/LuaJIT-1.1.7/jitdoc/bluequad.css
@@ -0,0 +1,292 @@
1/* Copyright (C) 2004-2011 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}
69ul, ol {
70 max-width: 600px;
71 margin: 0.5em 0;
72 padding: 0 0 0 2em;
73}
74ul {
75 list-style: outside square;
76}
77ol {
78 list-style: outside decimal;
79}
80li {
81 margin: 0;
82 padding: 0;
83}
84dl {
85 max-width: 600px;
86 margin: 1em 0;
87 padding: 1em;
88 border: 1px solid #bfcfff;
89 background: #f0f4ff;
90}
91dt {
92 font-weight: bold;
93 margin: 0;
94 padding: 0;
95}
96dt sup {
97 float: right;
98 margin-left: 1em;
99 color: #808080;
100}
101dt a:visited {
102 text-decoration: none;
103 color: #2142bf;
104}
105dt a:hover, dt a:active {
106 text-decoration: none;
107 color: #ff0000;
108}
109dd {
110 margin: 0.5em 0 0 2em;
111 padding: 0;
112}
113div.tablewrap { /* for IE *sigh* */
114 max-width: 600px;
115}
116table {
117 table-layout: fixed;
118 border-spacing: 0;
119 border-collapse: collapse;
120 max-width: 600px;
121 width: 100%;
122 margin: 1em 0;
123 padding: 0;
124 border: 1px solid #bfcfff;
125}
126tr {
127 margin: 0;
128 padding: 0;
129 border: none;
130}
131tr.odd {
132 background: #f0f4ff;
133}
134tr.separate td {
135 border-top: 1px solid #bfcfff;
136}
137td {
138 text-align: left;
139 margin: 0;
140 padding: 0.2em 0.5em;
141 border: none;
142}
143tt, code, kbd, samp {
144 font-family: Courier New, Courier, monospace;
145 font-size: 110%;
146}
147kbd {
148 font-weight: bolder;
149}
150blockquote, pre {
151 max-width: 600px;
152 margin: 1em 2em;
153 padding: 0;
154}
155pre {
156 line-height: 1.1;
157}
158img {
159 border: none;
160 vertical-align: baseline;
161 margin: 0;
162 padding: 0;
163}
164img.left {
165 float: left;
166 margin: 0.5em 1em 0.5em 0;
167}
168img.right {
169 float: right;
170 margin: 0.5em 0 0.5em 1em;
171}
172.indent {
173 padding-left: 1em;
174}
175.flush {
176 clear: both;
177 visibility: hidden;
178}
179.hide, .noscreen {
180 display: none !important;
181}
182.ext {
183 color: #ff8000;
184}
185#site {
186 clear: both;
187 float: left;
188 width: 13em;
189 text-align: center;
190 font-weight: bold;
191 margin: 0;
192 padding: 0;
193 background: transparent;
194 color: #ffffff;
195}
196#site a {
197 font-size: 200%;
198}
199#site a:link, #site a:visited {
200 text-decoration: none;
201 font-weight: bold;
202 background: transparent;
203 color: #ffffff;
204}
205#site span {
206 line-height: 3em; /* really 6em relative to body, match h1 */
207}
208#logo {
209 color: #ffb380;
210}
211#head {
212 margin: 0;
213 padding: 0 0 0 2em;
214 border-left: solid 13em #4162bf;
215 border-right: solid 3em #6078bf;
216 background: #6078bf;
217 color: #e6ecff;
218}
219#nav {
220 clear: both;
221 float: left;
222 overflow: hidden;
223 text-align: left;
224 line-height: 1.5;
225 width: 13em;
226 padding-top: 1em;
227 background: transparent;
228}
229#nav ul {
230 list-style: none outside;
231 margin: 0;
232 padding: 0;
233}
234#nav li {
235 margin: 0;
236 padding: 0;
237}
238#nav a {
239 display: block;
240 text-decoration: none;
241 font-weight: bold;
242 margin: 0;
243 padding: 2px 1em;
244 border-top: 1px solid transparent;
245 border-bottom: 1px solid transparent;
246 background: transparent;
247 color: #2142bf;
248}
249#nav a:hover, #nav a:active {
250 text-decoration: none;
251 border-top: 1px solid #97a7d7;
252 border-bottom: 1px solid #e6ecff;
253 background: #b9c9f9;
254 color: #ff0000;
255}
256#nav a.current, #nav a.current:hover, #nav a.current:active {
257 border-top: 1px solid #e6ecff;
258 border-bottom: 1px solid #97a7d7;
259 background: #c5d5ff;
260 color: #2142bf;
261}
262#nav ul ul a {
263 padding: 0 1em 0 2em;
264}
265#main {
266 line-height: 1.5;
267 text-align: left;
268 margin: 0;
269 padding: 1em 2em;
270 border-left: solid 13em #bfcfff;
271 border-right: solid 3em #e6ecff;
272 background: #e6ecff;
273}
274#foot {
275 clear: both;
276 font-size: 80%;
277 text-align: center;
278 margin: 0;
279 padding: 0.5em;
280 background: #6078bf;
281 color: #ffffff;
282}
283#foot a:link, #foot a:visited {
284 text-decoration: underline;
285 background: transparent;
286 color: #ffffff;
287}
288#foot a:hover, #foot a:active {
289 text-decoration: underline;
290 background: transparent;
291 color: #bfcfff;
292}
diff --git a/libraries/LuaJIT-1.1.7/jitdoc/coco.html b/libraries/LuaJIT-1.1.7/jitdoc/coco.html
new file mode 100644
index 0000000..0ef43f1
--- /dev/null
+++ b/libraries/LuaJIT-1.1.7/jitdoc/coco.html
@@ -0,0 +1,132 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2<html>
3<head>
4<title>Coco</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-2011, 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>Coco</h1>
18</div>
19<div id="nav">
20<ul><li>
21<a href="index.html">Index</a>
22</li><li>
23<a href="luajit.html">LuaJIT</a>
24<ul><li>
25<a href="luajit_features.html">Features</a>
26</li><li>
27<a href="luajit_install.html">Installation</a>
28</li><li>
29<a href="luajit_run.html">Running</a>
30</li><li>
31<a href="luajit_api.html">API Extensions</a>
32</li><li>
33<a href="luajit_intro.html">Introduction</a>
34</li><li>
35<a href="luajit_performance.html">Performance</a>
36</li><li>
37<a href="luajit_debug.html">Debugging</a>
38</li><li>
39<a href="luajit_changes.html">Changes</a>
40</li></ul>
41</li><li>
42<a class="current" href="coco.html">Coco</a>
43<ul><li>
44<a href="coco_portability.html">Portability</a>
45</li><li>
46<a href="coco_api.html">API Extensions</a>
47</li><li>
48<a href="coco_changes.html">Changes</a>
49</li></ul>
50</li><li>
51<a href="dynasm.html">DynASM</a>
52<ul><li>
53<a href="dynasm_features.html">Features</a>
54</li><li>
55<a href="dynasm_examples.html">Examples</a>
56</li></ul>
57</li><li>
58<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
59</li></ul>
60</div>
61<div id="main">
62<p>
63Coco is a small extension to get <strong>True C&nbsp;Coroutine</strong>
64semantics for Lua 5.1.
65</p>
66<p>
67Coco is both available as a stand-alone release and integrated
68into <a href="luajit.html">LuaJIT</a> 1.x.
69</p>
70<p>
71The stand-alone release is a patchset against the
72<a href="http://www.lua.org/ftp/"><span class="ext">&raquo;</span>&nbsp;standard Lua 5.1.4</a>
73distribution. There are no dependencies on LuaJIT. However LuaJIT 1.x
74depends on Coco to allow yielding for JIT compiled functions.
75</p>
76<p>
77Coco is Copyright &copy; 2004-2011 Mike Pall.
78Coco is free software, released under the
79<a href="http://www.opensource.org/licenses/mit-license.php"><span class="ext">&raquo;</span>&nbsp;MIT/X license</a>
80(same license as the Lua core).
81</p>
82<h2>Features</h2>
83<p>
84True C&nbsp;coroutine semantics mean you can yield from a coroutine
85across a C&nbsp;call boundary and resume back to it.
86</p>
87<p>
88Coco allows you to use a dedicated C&nbsp;stack for each coroutine.
89Resuming a coroutine and yielding from a coroutine automatically switches
90C&nbsp;stacks, too.
91</p>
92<p>
93In particular you can now:
94</p>
95<ul>
96<li>Yield across all metamethods (not advised for <tt>__gc</tt>).</li>
97<li>Yield across iterator functions (<tt>for x in func do</tt>).</li>
98<li>Yield across callbacks (<tt>table.foreach()</tt>, <tt>dofile()</tt>, ...).</li>
99<li>Yield across protected callbacks (<tt>pcall()</tt>, <tt>xpcall()</tt>, ...).</li>
100<li>Yield from C&nbsp;functions and resume back to them.</li>
101</ul>
102<p>
103Best of all, you don't need to change your Lua or C&nbsp;sources
104and still get the benefits. It's fully integrated into the
105Lua core, but tries to minimize the required changes.
106</p>
107
108<h2>More ...</h2>
109<p>
110Please visit the <a href="http://luajit.org/download.html"><span class="ext">&raquo;</span>&nbsp;Download</a> page
111to fetch the current version of the stand-alone package.
112</p>
113<p>
114Coco needs some machine-specific features &mdash; please have a look
115at the <a href="coco_portability.html">Portability Requirements</a>.
116</p>
117<p>
118Coco also provides some upwards-compatible
119<a href="coco_api.html">API Extensions</a> for Lua.
120</p>
121<br class="flush">
122</div>
123<div id="foot">
124<hr class="hide">
125Copyright &copy; 2005-2011 Mike Pall
126<span class="noprint">
127&middot;
128<a href="contact.html">Contact</a>
129</span>
130</div>
131</body>
132</html>
diff --git a/libraries/LuaJIT-1.1.7/jitdoc/coco_api.html b/libraries/LuaJIT-1.1.7/jitdoc/coco_api.html
new file mode 100644
index 0000000..990ac5b
--- /dev/null
+++ b/libraries/LuaJIT-1.1.7/jitdoc/coco_api.html
@@ -0,0 +1,182 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2<html>
3<head>
4<title>Coco 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-2011, 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>Coco API Extensions</h1>
18</div>
19<div id="nav">
20<ul><li>
21<a href="index.html">Index</a>
22</li><li>
23<a href="luajit.html">LuaJIT</a>
24<ul><li>
25<a href="luajit_features.html">Features</a>
26</li><li>
27<a href="luajit_install.html">Installation</a>
28</li><li>
29<a href="luajit_run.html">Running</a>
30</li><li>
31<a href="luajit_api.html">API Extensions</a>
32</li><li>
33<a href="luajit_intro.html">Introduction</a>
34</li><li>
35<a href="luajit_performance.html">Performance</a>
36</li><li>
37<a href="luajit_debug.html">Debugging</a>
38</li><li>
39<a href="luajit_changes.html">Changes</a>
40</li></ul>
41</li><li>
42<a href="coco.html">Coco</a>
43<ul><li>
44<a href="coco_portability.html">Portability</a>
45</li><li>
46<a class="current" href="coco_api.html">API Extensions</a>
47</li><li>
48<a href="coco_changes.html">Changes</a>
49</li></ul>
50</li><li>
51<a href="dynasm.html">DynASM</a>
52<ul><li>
53<a href="dynasm_features.html">Features</a>
54</li><li>
55<a href="dynasm_examples.html">Examples</a>
56</li></ul>
57</li><li>
58<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
59</li></ul>
60</div>
61<div id="main">
62<p>
63Coco changes the semantics of several standard API functions and
64provides a few API extensions for Lua.
65</p>
66<p>
67By default all your coroutines get an associated C&nbsp;stack.
68If you want to be more selective, see below.
69</p>
70
71<h2>Lua API extensions</h2>
72<p>
73All <tt>coroutine.*</tt> functions should be fully upwards compatible.
74</p>
75
76<h3><tt>coroutine.coco</tt></h3>
77<p>
78This field is <tt>true</tt> when Coco is present (nil otherwise).
79</p>
80
81<h3><tt>coro = coroutine.create(f [, cstacksize])<br>
82func = coroutine.wrap(f [, cstacksize])</tt></h3>
83<p>
84The optional argument <tt>cstacksize</tt> specifies the size of the
85C&nbsp;stack to allocate for the coroutine:
86</p>
87<ul>
88<li>A default stack size is used if <tt>cstacksize</tt> is not given
89or is nil or zero.</li>
90<li>No C&nbsp;stack is allocated if <tt>cstacksize</tt> is -1.</li>
91<li>Any other value is rounded up to the minimum size
92(i.e. use 1 to get the minimum size).</li>
93</ul>
94<p>
95Important notice for LuaJIT: JIT compiled functions cannot
96yield if a coroutine does not have a dedicated C&nbsp;stack.
97</p>
98
99<h3><tt>olddefault = coroutine.cstacksize([newdefault])</tt></h3>
100<p>
101Returns the current default C&nbsp;stack size (may be 0 if the
102underlying context switch method has its own default).
103Sets a new default C&nbsp;stack size if <tt>newdefault</tt> is present.
104Use 0 to reset it to the default C&nbsp;stack size. Any other
105value is rounded up to the minimum size.
106</p>
107
108<h2>C&nbsp;API extensions</h2>
109<p>
110All C&nbsp;API functions are either unchanged or upwards compatible.
111</p>
112
113<h3><tt>int lua_yield(lua_State *L, int nresults)</tt></h3>
114<p>
115The semantics for <tt>lua_yield()</tt> have changed slightly.
116Existing programs should work fine as long as they follow
117the usage conventions from the Lua manual:
118</p>
119<pre>
120return lua_yield(L, nresults);
121</pre>
122<p>
123Previously <tt>lua_yield()</tt> returned a 'magic' value (<tt>-1</tt>) that
124indicated a yield. Your C&nbsp;function had to pass this value
125on to the Lua core and was <em>not</em> called again.
126</p>
127<p>
128Now, if the current coroutine has an associated C&nbsp;stack,
129<tt>lua_yield()</tt> returns the number of arguments passed back from
130the resume. This just happens to be the right convention for
131returning them as a result from a C&nbsp;function. I.e. if you
132used the above convention, you'll never notice the change.
133</p>
134<p>
135But the results <em>are</em> on the Lua stack when <tt>lua_yield()</tt>
136returns. So the C&nbsp;function can just continue and process them
137or retry an I/O operation etc. And your whole C&nbsp;stack frame
138(local variables etc.) is still there, too. You can yield from
139anywhere in your C&nbsp;program, even several call levels deeper.
140</p>
141<p>
142Of course all of this only works with Lua+Coco and not with standard Lua.
143</p>
144
145<h3><tt>lua_State *lua_newcthread(lua_State *L, int cstacksize)</tt></h3>
146<p>
147This is an (optional) new function that allows you to create
148a coroutine with an associated C&nbsp;stack directly from the C&nbsp;API.
149Other than that it works the same as <tt>lua_newthread(L)</tt>.
150</p>
151<p>
152You have to declare this function as <tt>extern</tt>
153yourself, since it's not part of the official Lua API.
154This means that a C&nbsp;module that uses this call cannot
155be loaded with standard Lua. This may be intentional.
156</p>
157<p>
158If you want your C&nbsp;module to work with both standard Lua
159and Lua+Coco you can check whether Coco is available with:
160</p>
161<pre>
162 lua_getfield(L, LUA_GLOBALSINDEX, "coroutine");
163 lua_getfield(L, -1, "coco");
164 coco_available = lua_toboolean(L, -1);
165 lua_pop(L, 2);
166</pre>
167<p>
168You can create coroutines with a C&nbsp;stack by calling
169the Lua function <tt>coroutine.create()</tt> from C, too.
170</p>
171<br class="flush">
172</div>
173<div id="foot">
174<hr class="hide">
175Copyright &copy; 2005-2011 Mike Pall
176<span class="noprint">
177&middot;
178<a href="contact.html">Contact</a>
179</span>
180</div>
181</body>
182</html>
diff --git a/libraries/LuaJIT-1.1.7/jitdoc/coco_changes.html b/libraries/LuaJIT-1.1.7/jitdoc/coco_changes.html
new file mode 100644
index 0000000..ea2dc16
--- /dev/null
+++ b/libraries/LuaJIT-1.1.7/jitdoc/coco_changes.html
@@ -0,0 +1,146 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2<html>
3<head>
4<title>Coco 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-2011, 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>Coco Change History</h1>
18</div>
19<div id="nav">
20<ul><li>
21<a href="index.html">Index</a>
22</li><li>
23<a href="luajit.html">LuaJIT</a>
24<ul><li>
25<a href="luajit_features.html">Features</a>
26</li><li>
27<a href="luajit_install.html">Installation</a>
28</li><li>
29<a href="luajit_run.html">Running</a>
30</li><li>
31<a href="luajit_api.html">API Extensions</a>
32</li><li>
33<a href="luajit_intro.html">Introduction</a>
34</li><li>
35<a href="luajit_performance.html">Performance</a>
36</li><li>
37<a href="luajit_debug.html">Debugging</a>
38</li><li>
39<a href="luajit_changes.html">Changes</a>
40</li></ul>
41</li><li>
42<a href="coco.html">Coco</a>
43<ul><li>
44<a href="coco_portability.html">Portability</a>
45</li><li>
46<a href="coco_api.html">API Extensions</a>
47</li><li>
48<a class="current" href="coco_changes.html">Changes</a>
49</li></ul>
50</li><li>
51<a href="dynasm.html">DynASM</a>
52<ul><li>
53<a href="dynasm_features.html">Features</a>
54</li><li>
55<a href="dynasm_examples.html">Examples</a>
56</li></ul>
57</li><li>
58<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
59</li></ul>
60</div>
61<div id="main">
62<p>
63This is a list of changes between the released versions of Coco.
64The current stand-alone release is <strong>Coco&nbsp;1.1.6</strong>.
65</p>
66<p>
67Please check the
68<a href="http://coco.luajit.org/changes.html"><span class="ext">&raquo;</span>&nbsp;Online Change History</a>
69to see whether newer versions are available.
70</p>
71
72<h2 id="Coco-1.1.6">Coco 1.1.6 &mdash; 2009-09-08</h2>
73<ul>
74<li>Fix compilation of the GCC inline assembler code on x64.
75Now works when compiled as C++ code (reported by Jonathan Sauer)
76or with -fPIC (reported by Jim Pryor).</li>
77<li>Added GCC inline assembler for faster context switching on Sparc.
78Thanks to Takayuki Usui.</li>
79</ul>
80
81<h2 id="Coco-1.1.5">Coco 1.1.5 &mdash; 2008-10-25</h2>
82<ul>
83<li>Upgraded to patch cleanly into Lua 5.1.4.</li>
84<li>Added GCC inline assembler for faster context switching on x64.
85Thanks to Robert G. Jakabosky.</li>
86</ul>
87
88<h2 id="Coco-1.1.4">Coco 1.1.4 &mdash; 2008-02-05</h2>
89<ul>
90<li>Upgraded to patch cleanly into Lua 5.1.3.</li>
91<li>Fixed setjmp method for ARM with recent glibc versions.
92Thanks to the LuaTeX developers.</li>
93<li>Fixed setjmp method for x86 on Mac OS X (rarely used,
94default is GCC inline assembler). Thanks to Jason Toffaletti.</li>
95</ul>
96
97<h2 id="Coco-1.1.3">Coco 1.1.3 &mdash; 2007-05-24</h2>
98<ul>
99<li>Upgraded to patch cleanly into Lua 5.1.2.</li>
100<li>Merged patch from Zachary P. Landau for a Linux/ARM setjmp method (uClibc and glibc).</li>
101</ul>
102
103<h2 id="Coco-1.1.1">Coco 1.1.1 &mdash; 2006-06-20</h2>
104<ul>
105<li>Upgraded to patch cleanly into Lua 5.1.1.</li>
106<li>C stacks are deallocated early: when a coroutine ends, and not when
107the coroutine object is collected. This mainly benefits Windows Fibers.</li>
108<li>Windows threads get the required Fiber context when resuming
109a coroutine and not just on creation.</li>
110</ul>
111
112<h2 id="Coco-1.1.0">Coco 1.1.0 &mdash; 2006-02-18</h2>
113<ul>
114<li>Upgraded to patch cleanly into Lua 5.1 (final).</li>
115<li>Added GCC inline assembler for context switching on x86 and MIPS32
116[up to 3x faster].</li>
117<li>New targets for setjmp method:
118Mac OS X/x86, Solaris/x86 and x64 and Linux/MIPS32.</li>
119<li>Workaround for WinXP problem with GetCurrentFiber().</li>
120<li>The minimum C stack size has been increased to 32K+4K.</li>
121<li>Removed <tt>lcocolib.c</tt> and integrated the (much smaller) changes
122into <tt>lbaselib.c</tt>.<br>
123Note for embedders: this means you no longer need to call
124<tt>luaopen_coco()</tt>.</li>
125<li>Optional Valgrind support requires version 3.x.
126Renamed define to USE_VALGRIND.</li>
127<li>C stacks are now registered with Valgrind.</li>
128</ul>
129
130<h2 id="Coco-51w6">Coco pre-release 51w6 &mdash; 2005-08-09</h2>
131<p>
132This is the first pre-release of Coco. It targets Lua 5.1-work6 only
133and is no longer available for download.
134</p>
135<br class="flush">
136</div>
137<div id="foot">
138<hr class="hide">
139Copyright &copy; 2005-2011 Mike Pall
140<span class="noprint">
141&middot;
142<a href="contact.html">Contact</a>
143</span>
144</div>
145</body>
146</html>
diff --git a/libraries/LuaJIT-1.1.7/jitdoc/coco_portability.html b/libraries/LuaJIT-1.1.7/jitdoc/coco_portability.html
new file mode 100644
index 0000000..e120ae9
--- /dev/null
+++ b/libraries/LuaJIT-1.1.7/jitdoc/coco_portability.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>Portability Requirements for Coco</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-2011, 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.support {
13 line-height: 1.2;
14 width: 25em;
15}
16tr.supporthead td {
17 font-weight: bold;
18}
19td.supportcpu {
20 width: 6em;
21}
22td.supportsys {
23 width: 8em;
24}
25</style>
26</head>
27<body>
28<div id="site">
29<a href="http://luajit.org/"><span>Lua<span id="logo">JIT</span></span></a>
30</div>
31<div id="head">
32<h1>Portability Requirements for Coco</h1>
33</div>
34<div id="nav">
35<ul><li>
36<a href="index.html">Index</a>
37</li><li>
38<a href="luajit.html">LuaJIT</a>
39<ul><li>
40<a href="luajit_features.html">Features</a>
41</li><li>
42<a href="luajit_install.html">Installation</a>
43</li><li>
44<a href="luajit_run.html">Running</a>
45</li><li>
46<a href="luajit_api.html">API Extensions</a>
47</li><li>
48<a href="luajit_intro.html">Introduction</a>
49</li><li>
50<a href="luajit_performance.html">Performance</a>
51</li><li>
52<a href="luajit_debug.html">Debugging</a>
53</li><li>
54<a href="luajit_changes.html">Changes</a>
55</li></ul>
56</li><li>
57<a href="coco.html">Coco</a>
58<ul><li>
59<a class="current" href="coco_portability.html">Portability</a>
60</li><li>
61<a href="coco_api.html">API Extensions</a>
62</li><li>
63<a href="coco_changes.html">Changes</a>
64</li></ul>
65</li><li>
66<a href="dynasm.html">DynASM</a>
67<ul><li>
68<a href="dynasm_features.html">Features</a>
69</li><li>
70<a href="dynasm_examples.html">Examples</a>
71</li></ul>
72</li><li>
73<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
74</li></ul>
75</div>
76<div id="main">
77<p>
78Coco needs some machine-specific features which are
79inherently non-portable. Although the coverage is pretty good,
80this means that Coco will probably never be a standard part
81of the Lua core (which is pure ANSI&nbsp;C).
82</p>
83
84<h2>Context Switching Methods</h2>
85<p>
86Coco relies on four different machine-specific methods
87for allocating a C&nbsp;stack and switching context.
88The appropriate method is automatically selected at compile time.
89</p>
90
91<h3>GCC Inline Assembler</h3>
92<p>
93This method is only available when GCC 3.x/4.x is used
94to compile the source.
95This is the fastest method for context switching, but only available
96for a few CPUs (see below).
97</p>
98
99<h3>Modified setjmp Buffer</h3>
100<p>
101This method changes a few fields in the setjmp buffer to
102redirect the next longjmp to a new function with a new stack
103frame. It needs a bit of guesswork and lots of #ifdef's to
104handle the supported CPU/OS combinations, but this is quite
105manageable.
106</p>
107<p>
108This is the fallback method if inline assembler is not available.
109It's pretty fast because it doesn't have to save or restore signals
110(which is slow and generally undesirable for Lua coroutines).
111</p>
112
113<h3>POSIX ucontext</h3>
114<p>
115The POSIX calls getcontext, makecontext and switchcontext
116are used to set up and switch between different C&nbsp;stacks.
117Although highly portable and even available for some
118esoteric platforms, it's slower than the setjmp method
119because it saves and restores signals, too (using at least one
120syscall for each context switch).
121</p>
122<p>
123You can force the use of ucontext (instead of setjmp) by enabling
124<tt>-DCOCO_USE_UCONTEXT</tt> in <tt>src/Makefile</tt>.
125</p>
126
127<h3>Windows Fibers</h3>
128<p>
129This is the standard method to set up and switch between
130different C&nbsp;stacks on Windows. It's available on Windows&nbsp;98
131and later.
132</p>
133<p>
134None of the other methods work for Windows because OS specific code
135is required to switch exception handling contexts.
136</p>
137
138<h2 class="pagebreak">Supported Platforms</h2>
139<p>
140Coco has support for the following platforms:
141</p>
142<table class="support">
143<tr class="supporthead">
144<td class="supportcpu">CPU</td>
145<td class="supportsys">System</td>
146<td>Method</td>
147</tr>
148<tr class="odd separate">
149<td class="supportcpu">x86</td><td class="supportsys">(any OS)</td><td>gccasm</td></tr>
150<tr class="even">
151<td class="supportcpu">x86</td><td class="supportsys">Linux</td><td>setjmp</td></tr>
152<tr class="odd">
153<td class="supportcpu">x86</td><td class="supportsys">FreeBSD</td><td>setjmp</td></tr>
154<tr class="even">
155<td class="supportcpu">x86</td><td class="supportsys">NetBSD</td><td>setjmp</td></tr>
156<tr class="odd">
157<td class="supportcpu">x86</td><td class="supportsys">OpenBSD</td><td>setjmp</td></tr>
158<tr class="even">
159<td class="supportcpu">x86</td><td class="supportsys">Solaris</td><td>setjmp</td></tr>
160<tr class="odd">
161<td class="supportcpu">x86</td><td class="supportsys">Mac OS X</td><td>setjmp</td></tr>
162<tr class="even separate">
163<td class="supportcpu">x64</td><td class="supportsys">(any OS)</td><td>gccasm</td></tr>
164<tr class="odd">
165<td class="supportcpu">x64</td><td class="supportsys">Solaris</td><td>setjmp</td></tr>
166<tr class="even separate">
167<td class="supportcpu">MIPS32</td><td class="supportsys">(any OS)</td><td>gccasm</td></tr>
168<tr class="odd">
169<td class="supportcpu">MIPS32</td><td class="supportsys">Linux</td><td>setjmp</td></tr>
170<tr class="even separate">
171<td class="supportcpu">ARM</td><td class="supportsys">Linux</td><td>setjmp</td></tr>
172<tr class="odd separate">
173<td class="supportcpu">PPC32</td><td class="supportsys">Mac OS X</td><td>setjmp</td></tr>
174<tr class="even separate">
175<td class="supportcpu">(any CPU)</td><td class="supportsys">POSIX</td><td>ucontext</td></tr>
176<tr class="odd separate">
177<td class="supportcpu">(any CPU)</td><td class="supportsys">Windows</td><td>fibers</td></tr>
178</table>
179<pre>
180</pre>
181<p>
182It should work pretty much anywhere where a <em>correct</em>
183POSIX ucontext implementation is available. It has been tested
184on every systems I could get hold of (e.g. Sparc, PPC32/PPC64,
185IA64, Alpha, HPPA with various operating systems).
186</p>
187
188<h2>Caveats</h2>
189<ul>
190<li>
191Some older operating systems may have defective ucontext
192implementations because this feature is not widely used. E.g. some
193implementations don't mix well with other C&nbsp;library functions
194like <tt>malloc()</tt> or with native threads.
195This is really not the fault of Coco &mdash; please upgrade your OS.
196</li>
197<li>
198Note for Windows: Please read the explanation for the default
199<a href="http://msdn.microsoft.com/library/en-us/dllproc/base/thread_stack_size.asp"><span class="ext">&raquo;</span>&nbsp;Thread Stack Size</a>
200in case you want to create large numbers of Fiber-based coroutines.
201</li>
202<li>
203Note for MinGW/Cygwin: Older releases of GCC (before 4.0) generate
204wrong unwind information when <tt>-fomit-frame-pointer</tt> is used
205with stdcalls. This may lead to crashes when exceptions are thrown.
206The workaround is to always use two flags:<br>
207<tt>-fomit-frame-pointer -maccumulate-outgoing-args</tt>.
208</li>
209<li>
210Note for MIPS CPUs without FPU: It's recommended to compile
211<em>all</em> sources with <tt>-msoft-float</tt>, even if you don't use
212any floating point ops anywhere. Otherwise context switching must
213save and restore FPU registers (which needs to go through
214the slow kernel emulation).
215</li>
216<li>
217To run Coco with <a href="http://valgrind.org/"><span class="ext">&raquo;</span>&nbsp;Valgrind</a>
218(a memory debugger) you <em>must</em> add <tt>-DUSE_VALGRIND</tt>
219to <tt>MYCFLAGS</tt> and recompile. You will get random errors
220if you don't! Valgrind 3.x or later is required. Earlier versions
221do not work well with newly allocated C stacks.
222</li>
223</ul>
224<br class="flush">
225</div>
226<div id="foot">
227<hr class="hide">
228Copyright &copy; 2005-2011 Mike Pall
229<span class="noprint">
230&middot;
231<a href="contact.html">Contact</a>
232</span>
233</div>
234</body>
235</html>
diff --git a/libraries/LuaJIT-1.1.7/jitdoc/contact.html b/libraries/LuaJIT-1.1.7/jitdoc/contact.html
new file mode 100644
index 0000000..5da1ecf
--- /dev/null
+++ b/libraries/LuaJIT-1.1.7/jitdoc/contact.html
@@ -0,0 +1,105 @@
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-2011, 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="index.html">Index</a>
22</li><li>
23<a href="luajit.html">LuaJIT</a>
24<ul><li>
25<a href="luajit_features.html">Features</a>
26</li><li>
27<a href="luajit_install.html">Installation</a>
28</li><li>
29<a href="luajit_run.html">Running</a>
30</li><li>
31<a href="luajit_api.html">API Extensions</a>
32</li><li>
33<a href="luajit_intro.html">Introduction</a>
34</li><li>
35<a href="luajit_performance.html">Performance</a>
36</li><li>
37<a href="luajit_debug.html">Debugging</a>
38</li><li>
39<a href="luajit_changes.html">Changes</a>
40</li></ul>
41</li><li>
42<a href="coco.html">Coco</a>
43<ul><li>
44<a href="coco_portability.html">Portability</a>
45</li><li>
46<a href="coco_api.html">API Extensions</a>
47</li><li>
48<a href="coco_changes.html">Changes</a>
49</li></ul>
50</li><li>
51<a href="dynasm.html">DynASM</a>
52<ul><li>
53<a href="dynasm_features.html">Features</a>
54</li><li>
55<a href="dynasm_examples.html">Examples</a>
56</li></ul>
57</li><li>
58<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
59</li></ul>
60</div>
61<div id="main">
62<p>
63Please send general questions regarding LuaJIT or Coco to the
64<a href="http://www.lua.org/lua-l.html"><span class="ext">&raquo;</span>&nbsp;Lua mailing list</a>.
65You can also send any questions you have directly to me:
66</p>
67
68<script type="text/javascript">
69<!--
70var xS="@-: .0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZa<b>cdefghijklmnopqrstuvwxyz"
71function xD(s)
72{var len=s.length;var r="";for(var i=0;i<len;i++)
73{var c=s.charAt(i);var n=xS.indexOf(c);if(n!=-1)
74c=xS.charAt(66-n);r+=c;}
75document.write("<"+"p>"+r+"<"+"/p>\n");}
76//-->
77</script>
78<script type="text/javascript">
79<!--
80xD("ewYKA7vu-EIwslx7 K9A.t41C")
81//--></script>
82<noscript>
83<p><img src="img/contact.png" alt="Contact info in image" width="170" height="13">
84</p>
85</noscript>
86
87<h2>Copyright</h2>
88<p>
89All documentation is
90Copyright &copy; 2005-2011 Mike Pall.
91</p>
92
93
94<br class="flush">
95</div>
96<div id="foot">
97<hr class="hide">
98Copyright &copy; 2005-2011 Mike Pall
99<span class="noprint">
100&middot;
101<a href="contact.html">Contact</a>
102</span>
103</div>
104</body>
105</html>
diff --git a/libraries/LuaJIT-1.1.7/jitdoc/dynasm.html b/libraries/LuaJIT-1.1.7/jitdoc/dynasm.html
new file mode 100644
index 0000000..de8f859
--- /dev/null
+++ b/libraries/LuaJIT-1.1.7/jitdoc/dynasm.html
@@ -0,0 +1,116 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2<html>
3<head>
4<title>DynASM</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-2011, 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>DynASM</h1>
18</div>
19<div id="nav">
20<ul><li>
21<a href="index.html">Index</a>
22</li><li>
23<a href="luajit.html">LuaJIT</a>
24<ul><li>
25<a href="luajit_features.html">Features</a>
26</li><li>
27<a href="luajit_install.html">Installation</a>
28</li><li>
29<a href="luajit_run.html">Running</a>
30</li><li>
31<a href="luajit_api.html">API Extensions</a>
32</li><li>
33<a href="luajit_intro.html">Introduction</a>
34</li><li>
35<a href="luajit_performance.html">Performance</a>
36</li><li>
37<a href="luajit_debug.html">Debugging</a>
38</li><li>
39<a href="luajit_changes.html">Changes</a>
40</li></ul>
41</li><li>
42<a href="coco.html">Coco</a>
43<ul><li>
44<a href="coco_portability.html">Portability</a>
45</li><li>
46<a href="coco_api.html">API Extensions</a>
47</li><li>
48<a href="coco_changes.html">Changes</a>
49</li></ul>
50</li><li>
51<a class="current" href="dynasm.html">DynASM</a>
52<ul><li>
53<a href="dynasm_features.html">Features</a>
54</li><li>
55<a href="dynasm_examples.html">Examples</a>
56</li></ul>
57</li><li>
58<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
59</li></ul>
60</div>
61<div id="main">
62<p>
63DynASM is a <strong>Dynamic Assembler</strong> for code generation
64engines.
65</p>
66<p>
67DynASM has been developed primarily as a tool for
68<a href="luajit.html">LuaJIT</a>, but might be useful for other
69projects, too.
70</p>
71<p>
72If you are writing a just-in-time compiler or need to generate
73code on the fly (e.g. for high-performance graphics or other
74CPU-intensive computations), DynASM might be just what you
75are looking for.
76</p>
77<p>
78Please have a look at the list of <a href="dynasm_features.html">Features</a>
79to find out whether DynASM could be useful for your project.
80</p>
81<p>
82DynASM is Copyright &copy; 2005-2011 Mike Pall.
83DynASM is free software, released under the
84<a href="http://www.opensource.org/licenses/mit-license.php"><span class="ext">&raquo;</span>&nbsp;MIT/X license</a>.
85</p>
86
87<h2>More ...</h2>
88<p>
89Sorry, right now there is no proper documentation available other
90than some <a href="dynasm_examples.html">Examples</a> and of course
91the source code. The source <em>is</em> well documented, though (IMHO).
92</p>
93<p>
94I may add more docs in case someone actually finds DynASM to be
95useful outside of LuaJIT. If you do, I'd like to
96<a href="contact.html">hear</a> from you, please. Thank you!
97</p>
98<p>
99If you want to check it out please visit the
100<a href="http://luajit.org/download.html"><span class="ext">&raquo;</span>&nbsp;Download</a> page and fetch the most recent
101version of LuaJIT. All you need is in the dynasm directory.
102For some complex examples take a peek at the
103<tt>*.dasc</tt> and <tt>*.dash</tt> files in LuaJIT, too.
104</p>
105<br class="flush">
106</div>
107<div id="foot">
108<hr class="hide">
109Copyright &copy; 2005-2011 Mike Pall
110<span class="noprint">
111&middot;
112<a href="contact.html">Contact</a>
113</span>
114</div>
115</body>
116</html>
diff --git a/libraries/LuaJIT-1.1.7/jitdoc/dynasm_examples.html b/libraries/LuaJIT-1.1.7/jitdoc/dynasm_examples.html
new file mode 100644
index 0000000..5d2331e
--- /dev/null
+++ b/libraries/LuaJIT-1.1.7/jitdoc/dynasm_examples.html
@@ -0,0 +1,188 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2<html>
3<head>
4<title>DynASM Examples</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-2011, 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>DynASM Examples</h1>
18</div>
19<div id="nav">
20<ul><li>
21<a href="index.html">Index</a>
22</li><li>
23<a href="luajit.html">LuaJIT</a>
24<ul><li>
25<a href="luajit_features.html">Features</a>
26</li><li>
27<a href="luajit_install.html">Installation</a>
28</li><li>
29<a href="luajit_run.html">Running</a>
30</li><li>
31<a href="luajit_api.html">API Extensions</a>
32</li><li>
33<a href="luajit_intro.html">Introduction</a>
34</li><li>
35<a href="luajit_performance.html">Performance</a>
36</li><li>
37<a href="luajit_debug.html">Debugging</a>
38</li><li>
39<a href="luajit_changes.html">Changes</a>
40</li></ul>
41</li><li>
42<a href="coco.html">Coco</a>
43<ul><li>
44<a href="coco_portability.html">Portability</a>
45</li><li>
46<a href="coco_api.html">API Extensions</a>
47</li><li>
48<a href="coco_changes.html">Changes</a>
49</li></ul>
50</li><li>
51<a href="dynasm.html">DynASM</a>
52<ul><li>
53<a href="dynasm_features.html">Features</a>
54</li><li>
55<a class="current" href="dynasm_examples.html">Examples</a>
56</li></ul>
57</li><li>
58<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
59</li></ul>
60</div>
61<div id="main">
62<h2>A Simple Example</h2>
63<p>
64To get you started, here is a simple code snippet to be pre-processed.
65The lines starting with '|' (the pipe symbol) are for DynASM:
66</p>
67<pre>
68 if (ptr != NULL) {
69 | mov eax, foo+17
70 | mov edx, [eax+esi*2+0x20]
71 | add ebx, [ecx+bar(ptr, 9)]
72 }
73</pre>
74<p>
75After pre-processing you get:
76</p>
77<pre>
78 if (ptr != NULL) {
79 dasm_put(Dst, 123, foo+17, bar(ptr, 9));
80 }
81</pre>
82<p style="font-size: 80%;">
83Note: yes, you usually get the assembler code as comments and proper
84CPP directives to match them up with the source. I've omitted
85them here for clarity. Oh and BTW: the pipe symbols probably
86line up much more nicely in your editor than in a browser.
87</p>
88<p>
89Here 123 is an offset into the action list buffer that
90holds the partially specified machine code. Without going
91into too much detail, the embedded C&nbsp;library implements a
92tiny bytecode engine that takes the action list as input and
93outputs machine code. It basically copies machine code snippets
94from the action list and merges them with the arguments
95passed in by <tt>dasm_put()</tt>.
96</p>
97<p>
98The arguments can be any kind of C&nbsp;expressions. In practical
99use most of them evaluate to constants (e.g. structure offsets).
100Your C&nbsp;compiler should generate very compact code out of it.
101</p>
102<p>
103The embedded C&nbsp;library knows only what's absolutely needed to
104generate proper machine code for the target CPU (e.g. variable
105displacement sizes, variable branch offset sizes and so on).
106It doesn't have a clue about other atrocities like x86 opcode
107encodings &mdash; and it doesn't need to. This dramatically
108reduces the minimum required code size to around 2K [sic!].
109</p>
110<p>
111The action list buffer itself has a pretty compact encoding, too.
112E.g. the whole action list buffer for an early version of LuaJIT
113needs only around 3K.
114</p>
115
116<h2>Advanced Features</h2>
117<p>
118Here's a real-life example taken from LuaJIT that shows some
119advanced features like type maps, macros and how to access
120C&nbsp;structures:
121</p>
122<pre>
123|.type L, lua_State, esi // L.
124|.type BASE, TValue, ebx // L->base.
125|.type TOP, TValue, edi // L->top.
126|.type CI, CallInfo, ecx // L->ci.
127|.type LCL, LClosure, eax // L->ci->func->value.
128|.type UPVAL, UpVal
129
130|.macro copyslot, D, S, R1, R2, R3
131| mov R1, S.value; mov R2, S.value.na[1]; mov R3, S.tt
132| mov D.value, R1; mov D.value.na[1], R2; mov D.tt, R3
133|.endmacro
134
135|.macro copyslot, D, S; copyslot D, S, ecx, edx, eax; .endmacro
136
137|.macro getLCL, reg
138||if (!J->pt->is_vararg) {
139| mov LCL:reg, BASE[-1].value
140||} else {
141| mov CI, L->ci
142| mov TOP, CI->func
143| mov LCL:reg, TOP->value
144||}
145|.endmacro
146
147|.macro getLCL; getLCL eax; .endmacro
148
149[...]
150
151static void jit_op_getupval(jit_State *J, int dest, int uvidx)
152{
153 | getLCL
154 | mov UPVAL:ecx, LCL->upvals[uvidx]
155 | mov TOP, UPVAL:ecx->v
156 | copyslot BASE[dest], TOP[0]
157}
158</pre>
159<p>
160And here is the pre-processed output (stripped a bit for clarity):
161</p>
162<pre>
163#define Dt1(_V) (int)&amp;(((lua_State *)0)_V)
164[...]
165static void jit_op_getupval(jit_State *J, int dest, int uvidx)
166{
167 if (!J->pt->is_vararg) {
168 dasm_put(Dst, 1164, Dt2([-1].value));
169 } else {
170 dasm_put(Dst, 1168, Dt1(->ci), Dt4(->func), Dt3(->value));
171 }
172 dasm_put(Dst, 1178, Dt5(->upvals[uvidx]), DtF(->v), Dt3([0].value),
173 Dt3([0].value.na[1]), Dt3([0].tt), Dt2([dest].value),
174 Dt2([dest].value.na[1]), Dt2([dest].tt));
175}
176</pre>
177<br class="flush">
178</div>
179<div id="foot">
180<hr class="hide">
181Copyright &copy; 2005-2011 Mike Pall
182<span class="noprint">
183&middot;
184<a href="contact.html">Contact</a>
185</span>
186</div>
187</body>
188</html>
diff --git a/libraries/LuaJIT-1.1.7/jitdoc/dynasm_features.html b/libraries/LuaJIT-1.1.7/jitdoc/dynasm_features.html
new file mode 100644
index 0000000..1b8ce69
--- /dev/null
+++ b/libraries/LuaJIT-1.1.7/jitdoc/dynasm_features.html
@@ -0,0 +1,139 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2<html>
3<head>
4<title>DynASM Features</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-2011, 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>DynASM Features</h1>
18</div>
19<div id="nav">
20<ul><li>
21<a href="index.html">Index</a>
22</li><li>
23<a href="luajit.html">LuaJIT</a>
24<ul><li>
25<a href="luajit_features.html">Features</a>
26</li><li>
27<a href="luajit_install.html">Installation</a>
28</li><li>
29<a href="luajit_run.html">Running</a>
30</li><li>
31<a href="luajit_api.html">API Extensions</a>
32</li><li>
33<a href="luajit_intro.html">Introduction</a>
34</li><li>
35<a href="luajit_performance.html">Performance</a>
36</li><li>
37<a href="luajit_debug.html">Debugging</a>
38</li><li>
39<a href="luajit_changes.html">Changes</a>
40</li></ul>
41</li><li>
42<a href="coco.html">Coco</a>
43<ul><li>
44<a href="coco_portability.html">Portability</a>
45</li><li>
46<a href="coco_api.html">API Extensions</a>
47</li><li>
48<a href="coco_changes.html">Changes</a>
49</li></ul>
50</li><li>
51<a href="dynasm.html">DynASM</a>
52<ul><li>
53<a class="current" href="dynasm_features.html">Features</a>
54</li><li>
55<a href="dynasm_examples.html">Examples</a>
56</li></ul>
57</li><li>
58<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
59</li></ul>
60</div>
61<div id="main">
62<h2>DynASM Toolchain Features</h2>
63<ul>
64<li>DynASM is a pre-processing assembler.</li>
65<li>DynASM converts mixed C/Assembler source to plain C&nbsp;code.</li>
66<li>The primary knowledge about instruction names, operand modes,
67registers, opcodes and how to encode them is <em>only</em>
68needed in the pre-processor.</li>
69<li>The generated C&nbsp;code is extremely small and fast.</li>
70<li>A tiny embeddable C&nbsp;library helps with the process of dynamically
71assembling, relocating and linking machine code.</li>
72<li>There are no outside dependencies on other tools (such as
73stand-alone assemblers or linkers).</li>
74<li>Internal consistency checks catch runtime errors
75(e.g. undefined labels).</li>
76<li>The toolchain is split into a portable subset and
77CPU-specific modules.</li>
78<li>DynASM itself (the pre-processor) is written in Lua.</li>
79<li>There is no machine-dependency for the pre-processor itself.
80It should work everywhere you can get Lua 5.1 up and running
81(i.e. Linux, *BSD, Solaris, Windows, ... you name it).</li>
82</ul>
83
84<h2>DynASM Assembler Features</h2>
85<ul>
86<li>C&nbsp;code and assembler code can be freely mixed.
87<em>Readable</em>, too.</li>
88<li>All the usual syntax for instructions and operand modes
89you come to expect from a standard assembler.</li>
90<li>Access to C&nbsp;variables and CPP defines in assembler statements.</li>
91<li>Access to C&nbsp;structures and unions via type mapping.</li>
92<li>Convenient shortcuts for accessing C&nbsp;structures.</li>
93<li>Local and global labels.</li>
94<li>Numbered labels (e.g. for mapping bytecode instruction numbers).</li>
95<li>Multiple code sections (e.g. for tailcode).</li>
96<li>Defines/substitutions (inline and from command line).</li>
97<li>Conditionals (translation time) with proper nesting.</li>
98<li>Macros with parameters.</li>
99<li>Macros can mix assembler statements and C&nbsp;code.</li>
100<li>Captures (output diversion for code reordering).</li>
101<li>Simple and extensible template system for instruction definitions.</li>
102</ul>
103
104<h2>Restrictions</h2>
105<p>
106Currently only a subset of x86 (i386+) instructions is supported.
107Unsupported instructions are either not usable in user-mode or
108are slow on modern CPUs (i.e. not suited for a code generator).
109SSE, SSE2, SSE3 and SSSE3 are fully supported. MMX is not supported.
110</p>
111<p>
112The whole toolchain has been designed to support multiple CPU
113architectures. As LuaJIT gets support for more architectures,
114DynASM will be extended with new CPU-specific modules.
115</p>
116<p>
117The assembler itself will be extended with more features on an
118as-needed basis. E.g. I'm thinking about vararg macros.
119</p>
120<p>
121Note that runtime conditionals are not really needed, since you can
122just use plain C&nbsp;code for that (and LuaJIT does this <em>a lot</em>).
123It's not going to be more (time-) efficient if conditionals are done
124by the embedded C&nbsp;library (maybe a bit more space-efficient).
125</p>
126
127
128<br class="flush">
129</div>
130<div id="foot">
131<hr class="hide">
132Copyright &copy; 2005-2011 Mike Pall
133<span class="noprint">
134&middot;
135<a href="contact.html">Contact</a>
136</span>
137</div>
138</body>
139</html>
diff --git a/libraries/LuaJIT-1.1.7/jitdoc/img/backbar.png b/libraries/LuaJIT-1.1.7/jitdoc/img/backbar.png
new file mode 100644
index 0000000..3c90029
--- /dev/null
+++ b/libraries/LuaJIT-1.1.7/jitdoc/img/backbar.png
Binary files differ
diff --git a/libraries/LuaJIT-1.1.7/jitdoc/img/bluebar.png b/libraries/LuaJIT-1.1.7/jitdoc/img/bluebar.png
new file mode 100644
index 0000000..70dcf07
--- /dev/null
+++ b/libraries/LuaJIT-1.1.7/jitdoc/img/bluebar.png
Binary files differ
diff --git a/libraries/LuaJIT-1.1.7/jitdoc/img/contact.png b/libraries/LuaJIT-1.1.7/jitdoc/img/contact.png
new file mode 100644
index 0000000..9c73dc5
--- /dev/null
+++ b/libraries/LuaJIT-1.1.7/jitdoc/img/contact.png
Binary files differ
diff --git a/libraries/LuaJIT-1.1.7/jitdoc/img/magentabar.png b/libraries/LuaJIT-1.1.7/jitdoc/img/magentabar.png
new file mode 100644
index 0000000..11ebd2b
--- /dev/null
+++ b/libraries/LuaJIT-1.1.7/jitdoc/img/magentabar.png
Binary files differ
diff --git a/libraries/LuaJIT-1.1.7/jitdoc/img/spacer.png b/libraries/LuaJIT-1.1.7/jitdoc/img/spacer.png
new file mode 100644
index 0000000..75a203c
--- /dev/null
+++ b/libraries/LuaJIT-1.1.7/jitdoc/img/spacer.png
Binary files differ
diff --git a/libraries/LuaJIT-1.1.7/jitdoc/index.html b/libraries/LuaJIT-1.1.7/jitdoc/index.html
new file mode 100644
index 0000000..22236b4
--- /dev/null
+++ b/libraries/LuaJIT-1.1.7/jitdoc/index.html
@@ -0,0 +1,103 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2<html>
3<head>
4<title>The LuaJIT Project</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-2011, 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>The LuaJIT Project</h1>
18</div>
19<div id="nav">
20<ul><li>
21<a class="current" href="index.html">Index</a>
22</li><li>
23<a href="luajit.html">LuaJIT</a>
24<ul><li>
25<a href="luajit_features.html">Features</a>
26</li><li>
27<a href="luajit_install.html">Installation</a>
28</li><li>
29<a href="luajit_run.html">Running</a>
30</li><li>
31<a href="luajit_api.html">API Extensions</a>
32</li><li>
33<a href="luajit_intro.html">Introduction</a>
34</li><li>
35<a href="luajit_performance.html">Performance</a>
36</li><li>
37<a href="luajit_debug.html">Debugging</a>
38</li><li>
39<a href="luajit_changes.html">Changes</a>
40</li></ul>
41</li><li>
42<a href="coco.html">Coco</a>
43<ul><li>
44<a href="coco_portability.html">Portability</a>
45</li><li>
46<a href="coco_api.html">API Extensions</a>
47</li><li>
48<a href="coco_changes.html">Changes</a>
49</li></ul>
50</li><li>
51<a href="dynasm.html">DynASM</a>
52<ul><li>
53<a href="dynasm_features.html">Features</a>
54</li><li>
55<a href="dynasm_examples.html">Examples</a>
56</li></ul>
57</li><li>
58<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
59</li></ul>
60</div>
61<div id="main">
62<p>
63This is the offline documentation for:
64</p>
65<ul>
66<li>
67<a href="luajit.html">LuaJIT</a> &mdash;
68a <strong>Just-In-Time Compiler</strong> for Lua.
69</li>
70<li>
71<a href="coco.html">Coco</a> &mdash;
72a Lua extension for <strong>True C&nbsp;Coroutines</strong>.
73</li>
74<li>
75<a href="dynasm.html">DynASM</a> &mdash;
76a <strong>Dynamic Assembler</strong> for code generation engines.
77</li>
78</ul>
79
80
81
82<h2>More ...</h2>
83<p>
84Please click on one of the links in the navigation bar to your left
85to learn more.
86</p>
87<p>
88Click on the Logo in the upper left corner to visit
89the LuaJIT project page on the web. All other links to online
90resources are marked with a '<span class="ext">&raquo;</span>'.
91</p>
92<br class="flush">
93</div>
94<div id="foot">
95<hr class="hide">
96Copyright &copy; 2005-2011 Mike Pall
97<span class="noprint">
98&middot;
99<a href="contact.html">Contact</a>
100</span>
101</div>
102</body>
103</html>
diff --git a/libraries/LuaJIT-1.1.7/jitdoc/luajit.html b/libraries/LuaJIT-1.1.7/jitdoc/luajit.html
new file mode 100644
index 0000000..f9a7245
--- /dev/null
+++ b/libraries/LuaJIT-1.1.7/jitdoc/luajit.html
@@ -0,0 +1,109 @@
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-2011, 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 href="index.html">Index</a>
22</li><li>
23<a class="current" href="luajit.html">LuaJIT</a>
24<ul><li>
25<a href="luajit_features.html">Features</a>
26</li><li>
27<a href="luajit_install.html">Installation</a>
28</li><li>
29<a href="luajit_run.html">Running</a>
30</li><li>
31<a href="luajit_api.html">API Extensions</a>
32</li><li>
33<a href="luajit_intro.html">Introduction</a>
34</li><li>
35<a href="luajit_performance.html">Performance</a>
36</li><li>
37<a href="luajit_debug.html">Debugging</a>
38</li><li>
39<a href="luajit_changes.html">Changes</a>
40</li></ul>
41</li><li>
42<a href="coco.html">Coco</a>
43<ul><li>
44<a href="coco_portability.html">Portability</a>
45</li><li>
46<a href="coco_api.html">API Extensions</a>
47</li><li>
48<a href="coco_changes.html">Changes</a>
49</li></ul>
50</li><li>
51<a href="dynasm.html">DynASM</a>
52<ul><li>
53<a href="dynasm_features.html">Features</a>
54</li><li>
55<a href="dynasm_examples.html">Examples</a>
56</li></ul>
57</li><li>
58<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
59</li></ul>
60</div>
61<div id="main">
62<p>
63LuaJIT is a <strong>Just-In-Time Compiler</strong> for the Lua
64programming language.
65</p>
66<p class="indent">
67Lua is a powerful, light-weight programming language designed
68for extending applications. Lua is also frequently used as a
69general-purpose, stand-alone language. More information about
70Lua can be found at: <a href="http://www.lua.org/"><span class="ext">&raquo;</span>&nbsp;http://www.lua.org/</a>
71</p>
72<p>
73LuaJIT 1.x is based on the Lua 5.1.x virtual machine and bytecode interpreter
74from lua.org. It compiles bytecode to native x86 (i386+) machine code
75to speed up the execution of Lua programs.
76</p>
77<p>
78LuaJIT depends on <a href="coco.html">Coco</a> to allow yielding
79from coroutines for JIT compiled functions. Coco is part of the
80LuaJIT distribution.
81</p>
82<p>
83LuaJIT is Copyright &copy; 2005-2011 Mike Pall.
84LuaJIT is free software, released under the
85<a href="http://www.opensource.org/licenses/mit-license.php"><span class="ext">&raquo;</span>&nbsp;MIT/X license</a>
86(same license as the Lua core).
87</p>
88<h2>More ...</h2>
89<p>
90Click on the LuaJIT sub-topics in the navigation bar to learn more
91about LuaJIT.
92</p>
93<p style="background: #ffd0d0; text-align: center;">
94LuaJIT 2.0 is available with much improved performance!<br>
95Please visit the <a href="http://luajit.org/download.html"><span class="ext">&raquo;</span>&nbsp;Download</a> page to fetch
96the current version of LuaJIT.
97</p>
98<br class="flush">
99</div>
100<div id="foot">
101<hr class="hide">
102Copyright &copy; 2005-2011 Mike Pall
103<span class="noprint">
104&middot;
105<a href="contact.html">Contact</a>
106</span>
107</div>
108</body>
109</html>
diff --git a/libraries/LuaJIT-1.1.7/jitdoc/luajit_api.html b/libraries/LuaJIT-1.1.7/jitdoc/luajit_api.html
new file mode 100644
index 0000000..58ac809
--- /dev/null
+++ b/libraries/LuaJIT-1.1.7/jitdoc/luajit_api.html
@@ -0,0 +1,372 @@
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 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-2011, 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">
12td.stname { width: 10em; }
13tr.sthead td { font-weight: bold; }
14</style>
15</head>
16<body>
17<div id="site">
18<a href="http://luajit.org/"><span>Lua<span id="logo">JIT</span></span></a>
19</div>
20<div id="head">
21<h1>LuaJIT API Extensions</h1>
22</div>
23<div id="nav">
24<ul><li>
25<a href="index.html">Index</a>
26</li><li>
27<a href="luajit.html">LuaJIT</a>
28<ul><li>
29<a href="luajit_features.html">Features</a>
30</li><li>
31<a href="luajit_install.html">Installation</a>
32</li><li>
33<a href="luajit_run.html">Running</a>
34</li><li>
35<a class="current" href="luajit_api.html">API Extensions</a>
36</li><li>
37<a href="luajit_intro.html">Introduction</a>
38</li><li>
39<a href="luajit_performance.html">Performance</a>
40</li><li>
41<a href="luajit_debug.html">Debugging</a>
42</li><li>
43<a href="luajit_changes.html">Changes</a>
44</li></ul>
45</li><li>
46<a href="coco.html">Coco</a>
47<ul><li>
48<a href="coco_portability.html">Portability</a>
49</li><li>
50<a href="coco_api.html">API Extensions</a>
51</li><li>
52<a href="coco_changes.html">Changes</a>
53</li></ul>
54</li><li>
55<a href="dynasm.html">DynASM</a>
56<ul><li>
57<a href="dynasm_features.html">Features</a>
58</li><li>
59<a href="dynasm_examples.html">Examples</a>
60</li></ul>
61</li><li>
62<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
63</li></ul>
64</div>
65<div id="main">
66<p>
67LuaJIT provides several new API functions organized into two
68libraries.
69</p>
70<p>
71LuaJIT includes Coco &mdash; so have a look at the
72<a href="coco_api.html">Coco API Extensions</a>, too.
73</p>
74
75<h2>Standard Library Functions</h2>
76<p>
77All standard library functions have the same behaviour as
78in the Lua distribution LuaJIT is based on.
79</p>
80<p>
81The Lua loader used by the standard <tt>require()</tt> library
82function has been modified to turn off compilation of the main
83chunk of a module. The main chunk is only run once when the module
84is loaded for the first time. There is no point in compiling it.
85</p>
86<p>
87You might want to adapt this behaviour if you use your own utility
88functions (and not <tt>require()</tt>) to load modules.
89</p>
90<p>
91Note that the subfunctions defined in a loaded module <em>are</em>
92of course compiled. See below if you want to override this.
93</p>
94
95<h2>The jit.* Library</h2>
96<p>
97This library holds several functions to control the behaviour
98of the JIT engine.
99</p>
100
101<h3 id="jit_onoff"><tt>jit.on()<br>
102jit.off()</tt></h3>
103<p>
104Turns the JIT engine on (default) or off.
105</p>
106<p>
107These functions are typically used with the command line options
108<tt>-j on</tt> or <tt>-j off</tt>.
109</p>
110
111<h3 id="jit_onoff_func"><tt>jit.on(func|true [,true|false])<br>
112jit.off(func|true [,true|false])</tt></h3>
113<p>
114Enable (with <tt>jit.on</tt>, default) or disable (with <tt>jit.off</tt>)
115JIT compilation for a Lua function. The current function (the Lua function
116calling this library function) can be specified with <tt>true</tt>.
117</p>
118<p>
119If the second argument is <tt>true</tt>, JIT compilation is also
120enabled/disabled recursively for all subfunctions of a function.
121With <tt>false</tt> only the subfunctions are affected.
122</p>
123<p>
124Both library functions only set a flag which is checked when
125the function is executed for the first/next time. They do not
126trigger immediate compilation.
127</p>
128<p>
129Typical usage is <tt>jit.off(true, true)</tt> in the main chunk
130of a module to turn off JIT compilation for the whole module.
131Note that <tt>require()</tt> already turns off compilation for
132the main chunk itself.
133</p>
134
135<h3 id="jit_compile"><tt>status = jit.compile(func [,args...])</tt></h3>
136<p>
137Compiles a Lua function and returns the compilation status.
138Successful compilation is indicated with a <tt>nil</tt> status.
139Failure is indicated with a numeric status (see <tt>jit.util.status</tt>).
140</p>
141<p>
142The optimizer pass of the compiler tries to derive hints from the
143passed arguments. Not passing any arguments or passing untypical
144arguments (esp. the wrong types) reduces the efficiency of the
145optimizer. The compiled function will still run, but probably not
146with maximum speed.
147</p>
148<p>
149This library function is typically used for Ahead-Of-Time (AOT)
150compilation of time-critical functions or for testing/debugging.
151</p>
152
153<h3 id="jit_compilesub"><tt>status = jit.compilesub(func|true [,true])</tt></h3>
154<p>
155Recursively compile all subfunctions of a Lua function.
156The current function (the Lua function calling this library function)
157can be specified with <tt>true</tt>. Note that the function
158<em>itself</em> is not compiled (use <tt>jit.compile()</tt>).
159</p>
160<p>
161If the second argument is <tt>true</tt>, compilation will stop
162when the first error is encountered. Otherwise compilation will
163continue with the next subfunction.
164</p>
165<p>
166The returned status is <tt>nil</tt>, if all subfunctions have been
167compiled successfully. A numeric status (see <tt>jit.util.status</tt>)
168indicates that at least one compilation failed and gives the status
169of the last failure (this is only helpful when stop on error
170is <tt>true</tt>).
171</p>
172
173<h3 id="jit_debug"><tt>jit.debug([level])</tt></h3>
174<p>
175Set the debug level for JIT compilation. If no <tt>level</tt> is given,
176the maximum debug level is set.
177</p>
178<ul>
179<li>Level 0 disables debugging: no checks for hooks are compiled
180into the code. This is the default when LuaJIT is started and
181provides the maximum performance.</li>
182<li>Level 1 enables function call debugging: call hooks and
183return hooks are checked in the function prologue and epilogue.
184This slows down function calls somewhat (by up to 10%).</li>
185<li>Level 2 enables full debugging: all hooks are checked.
186This slows down execution quite a bit, even when the hooks
187are not active.</li>
188</ul>
189<p>
190Note that some compiler optimizations are turned off when
191debugging is enabled.
192</p>
193<p>
194This function is typically used with the command line options
195<tt>-j debug</tt> or <tt>-j debug=level</tt>.
196</p>
197
198<h3 id="jit_attach"><tt>jit.attach(handler [, priority])</tt></h3>
199<p>
200Attach a handler to the compiler pipeline with the given priority.
201The handler is detached if no priority is given.
202</p>
203<p>
204The inner workings of the compiler pipeline and the API for handlers
205are still in flux. Please see the source code for more details.
206</p>
207
208<h3 id="jit_version"><tt>jit.version</tt></h3>
209<p>
210Contains the LuaJIT version string.
211</p>
212
213<h3 id="jit_version_num"><tt>jit.version_num</tt></h3>
214<p>
215Contains the version number of the LuaJIT core. Version xx.yy.zz
216is represented by the decimal number xxyyzz.
217</p>
218
219<h3 id="jit_arch"><tt>jit.arch</tt></h3>
220<p>
221Contains the target architecture name (CPU and optional ABI).
222</p>
223
224
225<h2 id="jit_util">The jit.util.* Library</h2>
226<p>
227This library holds many utility functions used by the provided
228extension modules for LuaJIT (e.g. the optimizer). The API may
229change in future versions.
230</p>
231
232<h3 id="jit_util_stats"><tt>stats = jit.util.stats(func)</tt></h3>
233<p>
234Retrieves information about a function. Returns <tt>nil</tt>
235for C functions. Returns a table with the following fields for
236Lua functions:
237</p>
238<ul>
239<li><tt>status</tt>: numeric compilation status (see <tt>jit.util.status</tt>).</li>
240<li><tt>stackslots</tt>: number of stack slots.</li>
241<li><tt>params</tt>: number of fixed parameters (arguments).</li>
242<li><tt>consts</tt>: number of constants.</li>
243<li><tt>upvalues</tt>: number of upvalues.</li>
244<li><tt>subs</tt>: number of subfunctions (sub prototypes).</li>
245<li><tt>bytecodes</tt>: number of bytecode instructions.</li>
246<li><tt>isvararg</tt>: fixarg (false) or vararg (true) function.</li>
247<li><tt>env</tt>: function environment table.</li>
248<li><tt>mcodesize</tt>: size of the compiled machine code.</li>
249<li><tt>mcodeaddr</tt>: start address of the compiled machine code.</li>
250</ul>
251<p>
252<tt>mcodesize</tt> and <tt>mcodeaddr</tt> are not set if the
253function has not been compiled (yet).
254</p>
255
256<h3 id="jit_util_bytecode"><tt>op, a, b, c, test = jit.util.bytecode(func, pc)</tt></h3>
257<p>
258Returns the fields of the bytecode instruction at the given <tt>pc</tt>
259for a Lua function. The first instruction is at <tt>pc</tt> = 1.
260Nothing is returned if <tt>pc</tt> is out of range.
261</p>
262<p>
263The opcode name is returned as an uppercase string in <tt>op</tt>.
264The opcode arguments are returned as <tt>a</tt>, <tt>b</tt> and
265optionally <tt>c</tt>. Arguments that indicate an index into the
266array of constants are translated to negative numbers (the first
267constant is referred to with -1). Branch targets are signed numbers
268relative to the next instruction.
269</p>
270<p>
271<tt>test</tt> is true if the instruction is a test (i.e. followed
272by a JMP).
273</p>
274
275<h3 id="jit_util_const"><tt>const, ok = jit.util.const(func, idx)</tt></h3>
276<p>
277Returns a constant from the array of constants for a Lua function.
278<tt>ok</tt> is true if <tt>idx</tt> is in range. Otherwise nothing
279is returned.
280</p>
281<p>
282Constants are numbered starting with 1. A negative <tt>idx</tt>
283is mapped to a positive index.
284</p>
285
286<h3 id="jit_util_upvalue"><tt>upvalue, ok = jit.util.upvalue(func, idx)</tt></h3>
287<p>
288Returns an upvalue from the array of upvalues for a Lua function.
289<tt>ok</tt> is true if <tt>idx</tt> is in range. Otherwise nothing
290is returned. Upvalues are numbered starting with 0.
291</p>
292
293<h3 id="jit_util_closurenup"><tt>nup = jit.util.closurenup(func, idx)</tt></h3>
294<p>
295Returns the number of upvalues for the subfunction prototype with
296the given index <tt>idx</tt> for a Lua function. Nothing is returned
297if <tt>idx</tt> is out of range. Subfunctions are numbered starting
298with 0.
299</p>
300
301<h3 id="jit_util_mcode"><tt>addr, mcode, mfmiter = jit.util.mcode(func, block])</tt></h3>
302<p>
303Returns the numeric start address, the compiled machine code
304(converted to a string) and an iterator for the machine code fragment map
305for the specified machine code block associated with a Lua function.
306</p>
307<p>
308Returns <tt>nil</tt> and a numeric status code (see <tt>jit.util.status</tt>)
309if the function has not been compiled yet or compilation has failed
310or compilation is disabled. Returns nothing if the selected
311machine code block does not exist.
312</p>
313<p>
314The machine code fragment map is used for debugging and error handling.
315The format may change between versions and is an internal implementation
316detail of LuaJIT.
317</p>
318
319<h3 id="jit_util_jsubmcode"><tt>addr [, mcode] = jit.util.jsubmcode([idx])</tt></h3>
320<p>
321If <tt>idx</tt> is omitted or nil:
322Returns the numeric start address and the compiled machine code
323(converted to a string) for internal subroutines used by the
324compiled machine code.
325</p>
326<p>
327If <tt>idx</tt> is given:
328Returns the numeric start address of the machine code for a specific
329internal subroutine (0&nbsp;based). Nothing is returned if <tt>idx</tt> is
330out of range.
331</p>
332
333<h3 id="jit_util_status"><tt>jit.util.status</tt></h3>
334<p>
335This is a table that bidirectionally maps status numbers and
336status names (strings):
337</p>
338<div class="tablewrap">
339<table>
340<tr class="sthead"><td class="stname">Status Name</td><td>Description</td></tr>
341<tr class="odd"><td class="stname">OK</td><td>Ok, code has been compiled.</td></tr>
342<tr class="even"><td class="stname">NONE</td><td>Nothing analyzed or compiled, yet (default).</td></tr>
343<tr class="odd"><td class="stname">OFF</td><td>Compilation disabled for this function.</td></tr>
344<tr class="even"><td class="stname">ENGINE_OFF</td><td>JIT engine is turned off.</td></tr>
345<tr class="odd"><td class="stname">DELAYED</td><td>Compilation delayed (recursive invocation).</td></tr>
346<tr class="even"><td class="stname">TOOLARGE</td><td>Bytecode or machine code is too large.</td></tr>
347<tr class="odd"><td class="stname">COMPILER_ERROR</td><td>Error from compiler frontend.</td></tr>
348<tr class="even"><td class="stname">DASM_ERROR</td><td>Error from DynASM engine.</td></tr>
349</table>
350</div>
351
352<h3 id="jit_util_hints"><tt>jit.util.hints<br>
353jit.util.fhints</tt></h3>
354<p>
355These two tables map compiler hint names to internal hint numbers.
356</p>
357<p>
358The hint system is an internal implementation detail of LuaJIT.
359Please see the source code for more info.
360</p>
361<br class="flush">
362</div>
363<div id="foot">
364<hr class="hide">
365Copyright &copy; 2005-2011 Mike Pall
366<span class="noprint">
367&middot;
368<a href="contact.html">Contact</a>
369</span>
370</div>
371</body>
372</html>
diff --git a/libraries/LuaJIT-1.1.7/jitdoc/luajit_changes.html b/libraries/LuaJIT-1.1.7/jitdoc/luajit_changes.html
new file mode 100644
index 0000000..bf42b93
--- /dev/null
+++ b/libraries/LuaJIT-1.1.7/jitdoc/luajit_changes.html
@@ -0,0 +1,301 @@
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-2011, 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 Change History</h1>
18</div>
19<div id="nav">
20<ul><li>
21<a href="index.html">Index</a>
22</li><li>
23<a href="luajit.html">LuaJIT</a>
24<ul><li>
25<a href="luajit_features.html">Features</a>
26</li><li>
27<a href="luajit_install.html">Installation</a>
28</li><li>
29<a href="luajit_run.html">Running</a>
30</li><li>
31<a href="luajit_api.html">API Extensions</a>
32</li><li>
33<a href="luajit_intro.html">Introduction</a>
34</li><li>
35<a href="luajit_performance.html">Performance</a>
36</li><li>
37<a href="luajit_debug.html">Debugging</a>
38</li><li>
39<a class="current" href="luajit_changes.html">Changes</a>
40</li></ul>
41</li><li>
42<a href="coco.html">Coco</a>
43<ul><li>
44<a href="coco_portability.html">Portability</a>
45</li><li>
46<a href="coco_api.html">API Extensions</a>
47</li><li>
48<a href="coco_changes.html">Changes</a>
49</li></ul>
50</li><li>
51<a href="dynasm.html">DynASM</a>
52<ul><li>
53<a href="dynasm_features.html">Features</a>
54</li><li>
55<a href="dynasm_examples.html">Examples</a>
56</li></ul>
57</li><li>
58<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
59</li></ul>
60</div>
61<div id="main">
62<p>
63This is a list of changes between the released versions of LuaJIT.
64The current version is <strong>LuaJIT&nbsp;1.1.7</strong>.
65</p>
66<p>
67Please check the
68<a href="http://luajit.org/changes.html"><span class="ext">&raquo;</span>&nbsp;Online Change History</a>
69to see whether newer versions are available.
70</p>
71
72<h2 id="LuaJIT-1.1.7">LuaJIT 1.1.7 &mdash; 2011-05-05</h2>
73<ul>
74<li>Added fixes for the
75<a href="http://www.lua.org/bugs.html#5.1.4"><span class="ext">&raquo;</span>&nbsp;currently known bugs in Lua 5.1.4</a>.</li>
76</ul>
77
78<h2 id="LuaJIT-1.1.6">LuaJIT 1.1.6 &mdash; 2010-03-28</h2>
79<ul>
80<li>Added fixes for the
81<a href="http://www.lua.org/bugs.html#5.1.4"><span class="ext">&raquo;</span>&nbsp;currently known bugs in Lua 5.1.4</a>.</li>
82<li>Removed wrong GC check in <tt>jit_createstate()</tt>.
83Thanks to Tim Mensch.</li>
84<li>Fixed bad assertions while compiling <tt>table.insert()</tt> and
85<tt>table.remove()</tt>.</li>
86</ul>
87
88<h2 id="LuaJIT-1.1.5">LuaJIT 1.1.5 &mdash; 2008-10-25</h2>
89<ul>
90<li>Merged with Lua 5.1.4. Fixes all
91<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>
92</ul>
93
94<h2 id="LuaJIT-1.1.4">LuaJIT 1.1.4 &mdash; 2008-02-05</h2>
95<ul>
96<li>Merged with Lua 5.1.3. Fixes all
97<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>
98<li>Fixed possible (but unlikely) stack corruption while compiling
99<tt>k^x</tt> expressions.</li>
100<li>Fixed DynASM template for cmpss instruction.</li>
101</ul>
102
103<h2 id="LuaJIT-1.1.3">LuaJIT 1.1.3 &mdash; 2007-05-24</h2>
104<ul>
105<li>Merged with Lua 5.1.2. Fixes all
106<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>
107<li>Merged pending Lua 5.1.x fixes: "return -nil" bug, spurious count hook call.</li>
108<li>Remove a (sometimes) wrong assertion in <tt>luaJIT_findpc()</tt>.</li>
109<li>DynASM now allows labels for displacements and <tt>.aword</tt>.</li>
110<li>Fix some compiler warnings for DynASM glue (internal API change).</li>
111<li>Correct naming for SSSE3 (temporarily known as SSE4) in DynASM and x86 disassembler.</li>
112<li>The loadable debug modules now handle redirection to stdout
113(e.g. <tt>-j&nbsp;trace=-</tt>).</li>
114</ul>
115
116<h2 id="LuaJIT-1.1.2">LuaJIT 1.1.2 &mdash; 2006-06-24</h2>
117<ul>
118<li>Fix MSVC inline assembly: use only local variables with
119<tt>lua_number2int()</tt>.</li>
120<li>Fix "attempt to call a thread value" bug on Mac OS X:
121make values of consts used as lightuserdata keys unique
122to avoid joining by the compiler/linker.</li>
123</ul>
124
125<h2 id="LuaJIT-1.1.1">LuaJIT 1.1.1 &mdash; 2006-06-20</h2>
126<ul>
127<li>Merged with Lua 5.1.1. Fixes all
128<a href="http://www.lua.org/bugs.html#5.1"><span class="ext">&raquo;</span>&nbsp;known bugs in Lua 5.1</a>.</li>
129<li>Enforce (dynamic) linker error for EXE/DLL version mismatches.</li>
130<li>Minor changes to DynASM: faster preprocessing, smaller encoding
131for some immediates.</li>
132</ul>
133<p>
134This release is in sync with Coco 1.1.1 (see the
135<a href="coco_changes.html">Coco Change History</a>).
136</p>
137
138<h2 id="LuaJIT-1.1.0">LuaJIT 1.1.0 &mdash; 2006-03-13</h2>
139<ul>
140<li>Merged with Lua 5.1 (final).</li>
141
142<li>New JIT call frame setup:
143<ul>
144<li>The C stack is kept 16 byte aligned (faster).
145Mandatory for Mac OS X on Intel, too.</li>
146<li>Faster calling conventions for internal C helper functions.</li>
147<li>Better instruction scheduling for function prologue, OP_CALL and
148OP_RETURN.</li>
149</ul></li>
150
151<li>Miscellaneous optimizations:
152<ul>
153<li>Faster loads of FP constants. Remove narrow-to-wide store-to-load
154forwarding stalls.</li>
155<li>Use (scalar) SSE2 ops (if the CPU supports it) to speed up slot moves
156and FP to integer conversions.</li>
157<li>Optimized the two-argument form of <tt>OP_CONCAT</tt> (<tt>a..b</tt>).</li>
158<li>Inlined <tt>OP_MOD</tt> (<tt>a%b</tt>).
159With better accuracy than the C variant, too.</li>
160<li>Inlined <tt>OP_POW</tt> (<tt>a^b</tt>). Unroll <tt>x^k</tt> or
161use <tt>k^x = 2^(log2(k)*x)</tt> or call <tt>pow()</tt>.</li>
162</ul></li>
163
164<li>Changes in the optimizer:
165<ul>
166<li>Improved hinting for table keys derived from table values
167(<tt>t1[t2[x]]</tt>).</li>
168<li>Lookup hinting now works with arbitrary object types and
169supports index chains, too.</li>
170<li>Generate type hints for arithmetic and comparison operators,
171OP_LEN, OP_CONCAT and OP_FORPREP.</li>
172<li>Remove several hint definitions in favour of a generic COMBINE hint.</li>
173<li>Complete rewrite of <tt>jit.opt_inline</tt> module
174(ex <tt>jit.opt_lib</tt>).</li>
175</ul></li>
176
177<li>Use adaptive deoptimization:
178<ul>
179<li>If runtime verification of a contract fails, the affected
180instruction is recompiled and patched on-the-fly.
181Regular programs will trigger deoptimization only occasionally.</li>
182<li>This avoids generating code for uncommon fallback cases
183most of the time. Generated code is up to 30% smaller compared to
184LuaJIT&nbsp;1.0.3.</li>
185<li>Deoptimization is used for many opcodes and contracts:
186<ul>
187<li>OP_CALL, OP_TAILCALL: type mismatch for callable.</li>
188<li>Inlined calls: closure mismatch, parameter number and type mismatches.</li>
189<li>OP_GETTABLE, OP_SETTABLE: table or key type and range mismatches.</li>
190<li>All arithmetic and comparison operators, OP_LEN, OP_CONCAT,
191OP_FORPREP: operand type and range mismatches.</li>
192</ul></li>
193<li>Complete redesign of the debug and traceback info
194(bytecode &harr; mcode) to support deoptimization.
195Much more flexible and needs only 50% of the space.</li>
196<li>The modules <tt>jit.trace</tt>, <tt>jit.dumphints</tt> and
197<tt>jit.dump</tt> handle deoptimization.</li>
198</ul></li>
199
200<li>Inlined many popular library functions
201(for commonly used arguments only):
202<ul>
203<li>Most <tt>math.*</tt> functions (the 18 most used ones)
204[2x-10x faster].</li>
205<li><tt>string.len</tt>, <tt>string.sub</tt> and <tt>string.char</tt>
206[2x-10x faster].</li>
207<li><tt>table.insert</tt>, <tt>table.remove</tt> and <tt>table.getn</tt>
208[3x-5x faster].</li>
209<li><tt>coroutine.yield</tt> and <tt>coroutine.resume</tt>
210[3x-5x faster].</li>
211<li><tt>pairs</tt>, <tt>ipairs</tt> and the corresponding iterators
212[8x-15x faster].</li>
213</ul></li>
214
215<li>Changes in the core and loadable modules and the stand-alone executable:
216<ul>
217<li>Added <tt>jit.version</tt>, <tt>jit.version_num</tt>
218and <tt>jit.arch</tt>.</li>
219<li>Reorganized some internal API functions (<tt>jit.util.*mcode*</tt>).</li>
220<li>The <tt>-j dump</tt> output now shows JSUB names, too.</li>
221<li>New x86 disassembler module written in pure Lua. No dependency
222on ndisasm anymore. Flexible API, very compact (500 lines)
223and complete (x87, MMX, SSE, SSE2, SSE3, SSSE3, privileged instructions).</li>
224<li><tt>luajit -v</tt> prints the LuaJIT version and copyright
225on a separate line.</li>
226</ul></li>
227
228<li>Added SSE, SSE2, SSE3 and SSSE3 support to DynASM.</li>
229<li>Miscellaneous doc changes. Added a section about
230<a href="luajit_install.html#embedding">embedding LuaJIT</a>.</li>
231</ul>
232<p>
233This release is in sync with Coco 1.1.0 (see the
234<a href="coco_changes.html">Coco Change History</a>).
235</p>
236
237<h2 id="LuaJIT-1.0.3">LuaJIT 1.0.3 &mdash; 2005-09-08</h2>
238<ul>
239<li>Even more docs.</li>
240<li>Unified closure checks in <tt>jit.*</tt>.</li>
241<li>Fixed some range checks in <tt>jit.util.*</tt>.</li>
242<li>Fixed __newindex call originating from <tt>jit_settable_str()</tt>.</li>
243<li>Merged with Lua 5.1 alpha (including early bugfixes).</li>
244</ul>
245<p>
246This is the first public release of LuaJIT.
247</p>
248
249<h2 id="LuaJIT-1.0.2">LuaJIT 1.0.2 &mdash; 2005-09-02</h2>
250<ul>
251<li>Add support for flushing the Valgrind translation cache <br>
252(<tt>MYCFLAGS= -DUSE_VALGRIND</tt>).</li>
253<li>Add support for freeing executable mcode memory to the <tt>mmap()</tt>-based
254variant for POSIX systems.</li>
255<li>Reorganized the C&nbsp;function signature handling in
256<tt>jit.opt_lib</tt>.</li>
257<li>Changed to index-based hints for inlining C&nbsp;functions.
258Still no support in the backend for inlining.</li>
259<li>Hardcode <tt>HEAP_CREATE_ENABLE_EXECUTE</tt> value if undefined.</li>
260<li>Misc. changes to the <tt>jit.*</tt> modules.</li>
261<li>Misc. changes to the Makefiles.</li>
262<li>Lots of new docs.</li>
263<li>Complete doc reorg.</li>
264</ul>
265<p>
266Not released because Lua 5.1 alpha came out today.
267</p>
268
269<h2 id="LuaJIT-1.0.1">LuaJIT 1.0.1 &mdash; 2005-08-31</h2>
270<ul>
271<li>Missing GC step in <tt>OP_CONCAT</tt>.</li>
272<li>Fix result handling for C &ndash;> JIT calls.</li>
273<li>Detect CPU feature bits.</li>
274<li>Encode conditional moves (<tt>fucomip</tt>) only when supported.</li>
275<li>Add fallback instructions for FP compares.</li>
276<li>Add support for <tt>LUA_COMPAT_VARARG</tt>. Still disabled by default.</li>
277<li>MSVC needs a specific place for the <tt>CALLBACK</tt> attribute
278(David Burgess).</li>
279<li>Misc. doc updates.</li>
280</ul>
281<p>
282Interim non-public release.
283Special thanks to Adam D. Moss for reporting most of the bugs.
284</p>
285
286<h2 id="LuaJIT-1.0.0">LuaJIT 1.0.0 &mdash; 2005-08-29</h2>
287<p>
288This is the initial non-public release of LuaJIT.
289</p>
290<br class="flush">
291</div>
292<div id="foot">
293<hr class="hide">
294Copyright &copy; 2005-2011 Mike Pall
295<span class="noprint">
296&middot;
297<a href="contact.html">Contact</a>
298</span>
299</div>
300</body>
301</html>
diff --git a/libraries/LuaJIT-1.1.7/jitdoc/luajit_debug.html b/libraries/LuaJIT-1.1.7/jitdoc/luajit_debug.html
new file mode 100644
index 0000000..95d5565
--- /dev/null
+++ b/libraries/LuaJIT-1.1.7/jitdoc/luajit_debug.html
@@ -0,0 +1,273 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2<html>
3<head>
4<title>Debugging 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-2011, 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>Debugging LuaJIT</h1>
18</div>
19<div id="nav">
20<ul><li>
21<a href="index.html">Index</a>
22</li><li>
23<a href="luajit.html">LuaJIT</a>
24<ul><li>
25<a href="luajit_features.html">Features</a>
26</li><li>
27<a href="luajit_install.html">Installation</a>
28</li><li>
29<a href="luajit_run.html">Running</a>
30</li><li>
31<a href="luajit_api.html">API Extensions</a>
32</li><li>
33<a href="luajit_intro.html">Introduction</a>
34</li><li>
35<a href="luajit_performance.html">Performance</a>
36</li><li>
37<a class="current" href="luajit_debug.html">Debugging</a>
38</li><li>
39<a href="luajit_changes.html">Changes</a>
40</li></ul>
41</li><li>
42<a href="coco.html">Coco</a>
43<ul><li>
44<a href="coco_portability.html">Portability</a>
45</li><li>
46<a href="coco_api.html">API Extensions</a>
47</li><li>
48<a href="coco_changes.html">Changes</a>
49</li></ul>
50</li><li>
51<a href="dynasm.html">DynASM</a>
52<ul><li>
53<a href="dynasm_features.html">Features</a>
54</li><li>
55<a href="dynasm_examples.html">Examples</a>
56</li></ul>
57</li><li>
58<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
59</li></ul>
60</div>
61<div id="main">
62<p>
63LuaJIT is a rather complex application. There will undoubtedly
64be bugs lurking in there. You have been warned. :-)
65</p>
66<p>
67If you came here looking for information on how to debug
68<em>your application</em> (and not LuaJIT itself) then please
69check out <a href="luajit_api.html#jit_debug"><tt>jit.debug()</tt></a>
70and the <a href="luajit_run.html#j_debug"><tt>-j debug</tt></a>
71command line option.
72</p>
73<p>
74But if you suspect a problem with LuaJIT itself, then try
75any of the following suggestions (in order).
76</p>
77
78<h2>Is LuaJIT the Problem?</h2>
79<p>
80Try to run your application in several different ways:
81</p>
82<ul>
83<li><tt>luajit app.lua</tt></li>
84<li><tt>luajit -O1 app.lua</tt></li>
85<li><tt>luajit -O app.lua</tt></li>
86<li><tt>luajit -j off app.lua</tt></li>
87<li><tt>lua app.lua</tt> (i.e. with standard Lua)</li>
88</ul>
89<p>
90If the behaviour is the <em>same</em> as with standard Lua then ...
91well ... that's what LuaJIT is about: doing the same things,
92just faster. Even bugs fly faster. :-)
93</p>
94<p>
95So this is most likely a bug in your application then. It may be easier
96to debug this with plain Lua &mdash; the remainder of this page
97is probably not helpful for you.
98</p>
99<p>
100But if the behaviour is <em>different</em>, there is some likelihood
101that you caught a bug in LuaJIT. Oh dear ...
102</p>
103<p>
104Ok, so don't just give up. Please read on and help the community
105by finding the bug. Thank you!
106</p>
107
108<h2>Get the Latest Version</h2>
109<p>
110Number one on your list of things to check is the
111<a href="http://luajit.org/luajit_changes.html"><span class="ext">&raquo;</span>&nbsp;Online Change History</a>.
112</p>
113<p>
114Please check if a newer version is available. Maybe the bug
115you have encountered has been fixed already. Always download the
116latest version and try it with your application before continuing.
117</p>
118
119<h2>Reproduce the Bug</h2>
120<p>
121First try to make the bug reproducible. Try to isolate the module
122and the function the bug occurs in:
123</p>
124<p>
125Either selectively turn off compilation for some modules with<br>
126<tt>&nbsp;&nbsp;jit.off(true, true)</tt><br>
127until the bug disappears ...
128</p>
129<p>
130And/or turn the whole JIT engine off and selectively compile
131functions with<br>
132<tt>&nbsp;&nbsp;jit.compile(func)</tt><br>
133until it reappears.
134</p>
135<p>
136If you have isolated the point where it happens, it's most helpful
137to reduce the affected Lua code to a short code snippet that
138still shows the problem. You may need to <tt>print()</tt> some
139variables until you can pinpoint the exact spot where it happens.
140</p>
141<p>
142If you've got a <em>reproducible</em> and <em>short</em> test
143you can either send it directly to me or the mailing list
144(see the <a href="contact.html">Contact Information</a>)
145or you can try to debug this a bit further.
146</p>
147<p>
148Well &mdash; if you are brave enough. :-)
149</p>
150
151<h2>Look at the Generated Code</h2>
152<p>
153You may want to have a look at the output of <tt>-j dumphints</tt>
154first. Try to change things around until you can see which hint
155or which instruction is the cause of the bug. If you suspect
156an optimizer bug then have a look at the backend (<tt>*.das[ch]</tt>)
157and check how the hint is encoded.
158</p>
159<p>
160Otherwise have a look at <tt>-j dump</tt> and see whether
161you can spot the problem around the affected instruction.
162It's helpful to have a good knowledge of assembler, though
163(sorry).
164</p>
165
166<h2>Locate a Crash</h2>
167<p>
168If you get a crash, you should compile LuaJIT with debugging
169turned on:
170</p>
171<p>
172Add <tt>-g</tt> to <tt>CFLAGS</tt> and <tt>MYLDFLAGS</tt>
173or whatever is needed to turn on debugging. For Windows you
174need both an executable and a DLL built with debugging.
175</p>
176<p>
177Then start LuaJIT with your debugger. Run it with
178<tt>-j dump=test.dump</tt>.
179</p>
180<p>
181Have a look at the backtrace and compare it with the generated
182dump file to find out exactly where it crashes. I'm sorry, but
183symbols or instructions for JIT compiled functions are not
184displayed in your debugger (this is really hard to solve).
185</p>
186
187<h2>Turn on Assertions</h2>
188<p>
189Another way to debug LuaJIT is to turn on assertions.
190They can be turned on only for the JIT engine by adding
191<tt>-DLUAJIT_ASSERT</tt> to <tt>JITCFLAGS</tt> in <tt>src/Makefile</tt>.
192Then recompile with <tt>make&nbsp;clean</tt> and <tt>make</tt>.
193</p>
194<p>
195Add these two lines to <tt>src/luaconf.h</tt> to turn on all assertions in the Lua core:<br>
196<tt>&nbsp;&nbsp;#include &lt;assert.h&gt;</tt><br>
197<tt>&nbsp;&nbsp;#define lua_assert(x) assert(x)</tt><br>
198This turns on the JIT engine assertions, too.
199Recompile and see whether any assertions trigger.
200Don't forget to turn off the (slow) assertions when you're done!
201</p>
202
203<h2>Use Valgrind</h2>
204<p>
205A tremendously useful (and free) tool for runtime code analysis
206is <a href="http://valgrind.org/"><span class="ext">&raquo;</span>&nbsp;Valgrind</a>. Regularly
207run your applications with <tt>valgrind --memcheck</tt> and
208your life will be better.
209</p>
210<p>
211To run LuaJIT under Valgrind you <em>must</em> add
212<tt>-DUSE_VALGRIND</tt> to <tt>MYCFLAGS</tt>
213and recompile LuaJIT. You will get random errors if you don't!
214Valgrind 3.x or later is required. Earlier versions
215do not work well with newly allocated C stacks.
216</p>
217<p>
218An executable built with this option runs fine without Valgrind
219and without a performance loss. But it needs the Valgrind header
220files for compilation (which is why it's not enabled by default).
221</p>
222<p>
223It's helpful to compile LuaJIT with debugging turned on, too
224(see above).
225</p>
226<p>
227If Valgrind spots many invalid memory accesses that involve
228memory allocation/free functions you've probably found a bug
229related to garbage collection. Some object reference must have
230gone astray.
231</p>
232<p>
233Try to find out which object is disappearing. You can force
234eager garbage collection with repeated calls to
235<tt>collectgarbage()</tt> or by setting a very low threshold
236with <tt>collectgarbage("setpause", 1)</tt>.
237</p>
238
239<h2>Don't Despair</h2>
240<p>
241If all of this doesn't help to find the bug, please send
242a summary of your findings to the mailing list. Describe as much
243of the circumstances you think are relevant.
244</p>
245<p>
246Please <em>don't</em> send your whole application to me
247(without asking first) and especially not to the mailing list.
248Code snippets should preferrably be less than 50 lines and
249up to the point.
250</p>
251<p>
252All bug reports are helpful, even if no immediate solution
253is available. Often enough someone else finds the same bug
254in a different setting and together with your bug report
255this may help to track it down.
256</p>
257<p>
258Finally I have to say a <strong>BIG THANK YOU</strong>
259to everyone who has helped to make LuaJIT better by finding
260and fixing bugs!
261</p>
262<br class="flush">
263</div>
264<div id="foot">
265<hr class="hide">
266Copyright &copy; 2005-2011 Mike Pall
267<span class="noprint">
268&middot;
269<a href="contact.html">Contact</a>
270</span>
271</div>
272</body>
273</html>
diff --git a/libraries/LuaJIT-1.1.7/jitdoc/luajit_features.html b/libraries/LuaJIT-1.1.7/jitdoc/luajit_features.html
new file mode 100644
index 0000000..b4e896f
--- /dev/null
+++ b/libraries/LuaJIT-1.1.7/jitdoc/luajit_features.html
@@ -0,0 +1,226 @@
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 Features</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-2011, 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 Features</h1>
18</div>
19<div id="nav">
20<ul><li>
21<a href="index.html">Index</a>
22</li><li>
23<a href="luajit.html">LuaJIT</a>
24<ul><li>
25<a class="current" href="luajit_features.html">Features</a>
26</li><li>
27<a href="luajit_install.html">Installation</a>
28</li><li>
29<a href="luajit_run.html">Running</a>
30</li><li>
31<a href="luajit_api.html">API Extensions</a>
32</li><li>
33<a href="luajit_intro.html">Introduction</a>
34</li><li>
35<a href="luajit_performance.html">Performance</a>
36</li><li>
37<a href="luajit_debug.html">Debugging</a>
38</li><li>
39<a href="luajit_changes.html">Changes</a>
40</li></ul>
41</li><li>
42<a href="coco.html">Coco</a>
43<ul><li>
44<a href="coco_portability.html">Portability</a>
45</li><li>
46<a href="coco_api.html">API Extensions</a>
47</li><li>
48<a href="coco_changes.html">Changes</a>
49</li></ul>
50</li><li>
51<a href="dynasm.html">DynASM</a>
52<ul><li>
53<a href="dynasm_features.html">Features</a>
54</li><li>
55<a href="dynasm_examples.html">Examples</a>
56</li></ul>
57</li><li>
58<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
59</li></ul>
60</div>
61<div id="main">
62<p>
63LuaJIT tries to keep the spirit of Lua &mdash; it's <em>light-weight</em>,
64<em>efficient</em> and <em>extensible</em>.
65</p>
66
67<h2>Features</h2>
68<p>
69All functions are by default compiled Just-In-Time (JIT) to
70machine code:
71</p>
72<ul>
73<li>Functions that are unused are not compiled at all.</li>
74<li>Compilation can be enabled/disabled selectively for individual
75functions and subfunctions or even whole modules.</li>
76<li>Interpreted and compiled functions can be freely mixed.</li>
77</ul>
78<p>
79Ahead-Of-Time (AOT) compilation (at runtime) is supported, too:
80</p>
81<ul>
82<li>A number of API functions and command line options allows
83full user control over the compilation process.</li>
84</ul>
85<p>
86The JIT compiler is extensible:
87</p>
88<ul>
89<li>The optimizer is an extra module that attaches to the compiler
90pipeline.</li>
91<li>Various modules provide trace and debug information about
92the compilation process.</li>
93<li>All of these features can be activated with command line options.</li>
94</ul>
95
96<h2>Performance</h2>
97<p>
98The compiled machine code is <em>very efficient</em>:
99</p>
100<ul>
101<li>Have a look at some
102<a href="luajit_performance.html">Performance Measurements</a>.</li>
103<li>Aggressive optimizations (specialization, inlining) are enabled
104wherever possible. Inlined contracts catch wrong optimizer predictions
105at runtime (undetected polymorphism).</li>
106<li>Adaptive deoptimization is used to recompile individual bytecode
107instructions with broken contracts. This avoids generating code for the
108generic fallback cases most of the time (faster compilation, reduced
109I-cache contention).</li>
110<li>Special CPU features (such as conditional moves or SSE2)
111are automatically used when detected.</li>
112</ul>
113<p>
114The JIT compiler is <em>very fast</em>:
115</p>
116<ul>
117<li>Compilation times vary a great deal (depending on the nature of
118the function to be compiled) but are generally in the
119<em>microsecond</em> range.</li>
120<li>Even compiling large functions (hundreds of lines) with the
121maximum optimization level takes only a few milliseconds in the
122worst case.</li>
123</ul>
124<p>
125LuaJIT is <em>very small</em>:
126</p>
127<ul>
128<li>The whole JIT compiler engine adds only around <strong>32K</strong>
129of code to the Lua core (if compiled with <tt>-Os</tt>).</li>
130<li>The optimizer is split into several optional modules that
131can be loaded at runtime if requested.</li>
132<li>LuaJIT adds around 6.000 lines of C and assembler code and
1332.000 lines of Lua code to the Lua 5.1 core (17.000 lines of C).</li>
134<li>Required build tools (<a href="dynasm.html">DynASM</a>)
135take another 2.500 lines of Lua code.</li>
136</ul>
137
138<h2>Compatibility</h2>
139<p>
140LuaJIT is designed to be <em>fully compatible</em> with Lua 5.1.
141It accepts the same source code and/or precompiled bytecode.
142It supports all standard language semantics. In particular:
143</p>
144<ul>
145<li>All standard types, operators and metamethods are supported.</li>
146<li>Implicit type coercions (number/string) work as expected.</li>
147<li>Full IEEE-754 semantics for floating point arithmetics
148(NaN, +-Inf, +-0, ...).</li>
149<li>Full support for lexical closures.
150Proper tail calls do not consume a call frame.</li>
151<li>Exceptions are precise. Backtraces work fine.</li>
152<li>Coroutines are supported with the help of <a href="coco.html">Coco</a>.</li>
153<li>No changes to the Lua 5.1 incremental garbage collector.</li>
154<li>No changes to the standard Lua/C API.</li>
155<li>Dynamically loaded C modules are link compatible with Lua 5.1
156(same ABI).</li>
157<li>LuaJIT can be <a href="luajit_install.html#embedding">embedded</a>
158into an application just like Lua.</li>
159</ul>
160<p>
161Some minor differences are related to debugging:
162</p>
163<ul>
164<li>Debug hooks are only called if debug code generation is enabled.</li>
165<li>There is no support for tailcall counting in JIT compiled code.
166HOOKTAILRET is not called, too. Note: this won't affect you unless
167you are writing a Lua debugger. <sup>*</sup></li>
168</ul>
169<p style="font-size: 80%;">
170<sup>*</sup> There is not much I can do to improve this situation without undue
171complications. A suggestion to modify the behaviour of standard Lua
172has been made on the mailing list (it would be beneficial there, too).
173</p>
174
175<h2>Restrictions</h2>
176<ul>
177<li>Only x86 (i386+) CPUs are supported right now (but see below).</li>
178<li>Only the default type for <tt>lua_Number</tt> is supported
179(<tt>double</tt>).</li>
180<li>The interrupt signal (Ctrl-C) is ignored unless you enable
181debug hooks (with <tt>-j debug</tt>). But this will seriously
182slow down your application. I'm looking for better ways to handle
183this. In the meantime you have to press Ctrl-C twice to interrupt
184a currently running JIT compiled function (just like C functions).</li>
185<li>GDB, Valgrind and other debugging tools can't report symbols
186or stack frames for JIT compiled code. This is rather difficult to solve.
187Have a look at <a href="luajit_debug.html">Debugging LuaJIT</a>, too.</li>
188</ul>
189
190<h2>Caveats</h2>
191<ul>
192<li>LuaJIT allocates executable memory for the generated machine code
193if your OS has support for it: either <tt>HeapCreate()</tt> for Windows or
194<tt>mmap()</tt> on POSIX systems.<br>
195The fallback is the standard Lua allocator (i.e. malloc()).
196But this usually means the allocated memory is not marked executable.
197Running compiled code will trap on CPUs/OS with the NX (No eXecute)
198extension <em>if you can only use the fallback</em>.</li>
199<li><a href="dynasm.html">DynASM</a> is needed to regenerate the
200<tt>ljit_x86.h</tt> file. But only in case you want to <em>modify</em>
201the <tt>*.dasc</tt>/<tt>*.dash</tt> files. A pre-processed <tt>*.h</tt>
202file is supplied with LuaJIT.<br>
203DynASM is written in Lua and needs a plain copy of Lua 5.1
204(installed as <tt>lua</tt>). Or you can run it with LuaJIT built from
205the <tt>*.h</tt> file supplied with the distribution (modify
206<tt>DASM=</tt> in <tt>src/Makefile</tt>). It's a good idea to install
207a known good copy of LuaJIT under a different name for this.</li>
208<li>LuaJIT ships with <tt>LUA_COMPAT_VARARG</tt> turned off.
209I.e. the implicit <tt>arg</tt> parameter is not created anymore.
210Please have a look at the comments in <tt>luaconf.h</tt> for
211this configuration option. You can turn it on, if you really need it.
212Or better yet, convert your code to the new Lua 5.1 vararg syntax.</li>
213</ul>
214
215<br class="flush">
216</div>
217<div id="foot">
218<hr class="hide">
219Copyright &copy; 2005-2011 Mike Pall
220<span class="noprint">
221&middot;
222<a href="contact.html">Contact</a>
223</span>
224</div>
225</body>
226</html>
diff --git a/libraries/LuaJIT-1.1.7/jitdoc/luajit_install.html b/libraries/LuaJIT-1.1.7/jitdoc/luajit_install.html
new file mode 100644
index 0000000..bc5a3cd
--- /dev/null
+++ b/libraries/LuaJIT-1.1.7/jitdoc/luajit_install.html
@@ -0,0 +1,340 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2<html>
3<head>
4<title>Installing 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-2011, 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.build {
13 line-height: 1.2;
14}
15td.buildsys {
16 width: 11em;
17}
18td.buildcmd {
19 width: 10em;
20 font-family: Courier New, Courier, monospace;
21}
22tr.buildhead td {
23 /* font-family: inherit; ... not supported in IE *sigh* */
24 font-family: Verdana, Arial, Helvetica, sans-serif;
25 font-weight: bold;
26}
27</style>
28</head>
29<body>
30<div id="site">
31<a href="http://luajit.org/"><span>Lua<span id="logo">JIT</span></span></a>
32</div>
33<div id="head">
34<h1>Installing LuaJIT</h1>
35</div>
36<div id="nav">
37<ul><li>
38<a href="index.html">Index</a>
39</li><li>
40<a href="luajit.html">LuaJIT</a>
41<ul><li>
42<a href="luajit_features.html">Features</a>
43</li><li>
44<a class="current" href="luajit_install.html">Installation</a>
45</li><li>
46<a href="luajit_run.html">Running</a>
47</li><li>
48<a href="luajit_api.html">API Extensions</a>
49</li><li>
50<a href="luajit_intro.html">Introduction</a>
51</li><li>
52<a href="luajit_performance.html">Performance</a>
53</li><li>
54<a href="luajit_debug.html">Debugging</a>
55</li><li>
56<a href="luajit_changes.html">Changes</a>
57</li></ul>
58</li><li>
59<a href="coco.html">Coco</a>
60<ul><li>
61<a href="coco_portability.html">Portability</a>
62</li><li>
63<a href="coco_api.html">API Extensions</a>
64</li><li>
65<a href="coco_changes.html">Changes</a>
66</li></ul>
67</li><li>
68<a href="dynasm.html">DynASM</a>
69<ul><li>
70<a href="dynasm_features.html">Features</a>
71</li><li>
72<a href="dynasm_examples.html">Examples</a>
73</li></ul>
74</li><li>
75<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
76</li></ul>
77</div>
78<div id="main">
79<p>
80LuaJIT is not much more difficult to install than Lua itself.
81Just unpack the distribution file, change into the newly created
82directory and follow the instructions below.
83</p>
84<p class="indent">
85For the impatient: <b><tt>make&nbsp;linux&nbsp;&amp;&amp;&nbsp;sudo&nbsp;make&nbsp;install</tt></b><br>
86Replace <tt>linux</tt> with e.g. <tt>bsd</tt> or <tt>macosx</tt> depending on your OS.
87</p>
88<p>
89In case you've missed this in <a href="luajit_features.html">Features</a>:
90LuaJIT only works on x86 (i386+) systems right now. Support for
91other architectures may be added in future versions.
92</p>
93
94<h2>Configuring LuaJIT</h2>
95<p>
96LuaJIT is (deliberately) <em>not</em> autoconfigured &mdash; the
97defaults should work fine on most systems. But please check the
98system-specific instructions below.
99</p>
100<p>
101The following three files hold all configuration information:
102</p>
103<ul>
104<li><tt>Makefile</tt> holds settings for installing LuaJIT.</li>
105<li><tt>src/Makefile</tt> holds settings for compiling LuaJIT.</li>
106<li><tt>src/luaconf.h</tt> sets a multitude of configuration
107variables.</li>
108</ul>
109<p>
110If this is your first build then it's better not to give into
111the temptation to tweak every little setting. The standard
112configuration provides sensible defaults (IMHO).
113</p>
114<p>
115One particular setting you might want to change is the installation
116path. Note that you need to modify both the top-level <tt>Makefile</tt>
117and <tt>src/luaconf.h</tt> (right at the start) to take
118effect.
119</p>
120<p>
121If you have trouble getting Coco to work, you can disable it by
122uncommenting the <tt>COCOFLAGS= -DCOCO_DISABLE</tt> line in
123<tt>src/Makefile</tt>. But note that this effectively disables
124yielding from coroutines for JIT compiled functions.
125</p>
126<p>
127A few more settings need to be changed if you want to
128<a href="luajit_debug.html">Debug LuaJIT</a> <em>itself</em>.
129Application debugging can be turned on/off at runtime.
130</p>
131
132<h3>Upgrading From Previous Versions</h3>
133<p>
134It's important to keep the LuaJIT core and the add-on modules in sync.
135Be sure to delete any old versions of LuaJIT modules from the
136Lua module search path (check the current directory, too!).
137</p>
138<p>
139Lua files compiled to bytecode may be incompatible if the underlying
140Lua core has changed (like from Lua&nbsp;5.1 alpha to Lua&nbsp;5.1
141final between LuaJIT&nbsp;1.0.3 and LuaJIT&nbsp;1.1.0). The same
142applies to any
143<a href="http://lua-users.org/wiki/BuildingModules"><span class="ext">&raquo;</span>&nbsp;loadable C modules</a>
144(shared libraries, DLLs) which need to be recompiled with the new
145Lua header files.
146</p>
147<p>
148Compiled bytecode and loadable C modules are fully compatible and
149can be freely exchanged between LuaJIT and the <em>same</em>
150version of Lua it is based on. Please verify that <tt>LUA_RELEASE</tt>
151in <tt>src/lua.h</tt> is the same in both distributions.
152</p>
153
154<h2>Building LuaJIT</h2>
155
156<h3>Makefile Targets</h3>
157<p>
158The Makefiles have a number of targets for various operating systems:
159</p>
160
161<div class="tablewrap">
162<table class="build">
163<tr class="buildhead"><td class="buildsys">System</td><td class="buildcmd">Build Command</td><td>Notes</td></tr>
164<tr class="odd"><td class="buildsys">Linux i386</td><td class="buildcmd">make linux</td><td></td></tr>
165<tr class="even"><td class="buildsys">BSD i386</td><td class="buildcmd">make bsd</td><td>FreeBSD, NetBSD or OpenBSD</td></tr>
166<tr class="odd"><td class="buildsys">Mac OS X on Intel</td><td class="buildcmd">make macosx</td><td>Check <tt>src/Makefile</tt> for OS X &lt; 10.4</td></tr>
167<tr class="even"><td class="buildsys">Solaris x86</td><td class="buildcmd">make solaris</td><td>GCC only, SunCC miscompiles LuaJIT</td></tr>
168<tr class="odd"><td class="buildsys">MinGW (Win32)</td><td class="buildcmd">make mingw</td><td>cross-MinGW: must be 1st in PATH</td></tr>
169<tr class="even"><td class="buildsys">Cygwin</td><td class="buildcmd">make cygwin</td><td></td></tr>
170<tr class="odd"><td class="buildsys">POSIX on x86</td><td class="buildcmd">make posix</td><td>Check <a href="coco_portability.html">Portability Req. for Coco</a>, too</td></tr>
171<tr class="even"><td class="buildsys">Generic x86</td><td class="buildcmd">make generic</td><td>Check <a href="coco_portability.html">Portability Req. for Coco</a>, too</td></tr>
172</table>
173</div>
174
175<p>
176You may want to enable interactive line editing for the stand-alone
177executable. There are extra targets for Linux, BSD and Mac OS X:
178<tt>make&nbsp;linux_rl</tt>, <tt>make&nbsp;bsd_rl</tt>
179and <tt>make&nbsp;macosx_rl</tt>.
180</p>
181
182<h3>MSVC (Win32)</h3>
183<p>
184First check out <tt>etc\luavs.bat</tt> if it suits your needs. Then try
185running it from the MSVC command prompt (start it from the toplevel directory).
186</p>
187<p>
188Another option is to set up your own MSVC project:
189</p>
190<p>
191Change to the <tt>src</tt> directory
192and create a new DLL project for <tt>lua51.dll</tt>.
193Add all C files to it except for <tt>lua.c</tt>, <tt>luac.c</tt>
194and <tt>print.c</tt>. Add the <tt>..\dynasm</tt> directory
195to the include path and build the DLL.
196</p>
197<p>
198Next create a new EXE project for <tt>luajit.exe</tt>.
199Add <tt>lua.c</tt> to it and link with the import library
200<tt>lua51.lib</tt> created for <tt>lua51.dll</tt>. Build
201the executable.
202</p>
203
204<h2>Installation</h2>
205
206<h3>POSIX systems</h3>
207<p>
208Run <tt>make&nbsp;install</tt> from the top-level directory.
209You probably need to be the root user before doing so, i.e. use
210<tt>sudo&nbsp;make&nbsp;install</tt> or <tt>su&nbsp;-&nbsp;root</tt>
211before the <tt>make&nbsp;install</tt>.
212</p>
213<p>
214By default this installs only:<br>
215<tt>&nbsp;&nbsp;/usr/local/bin/<strong>luajit</strong></tt> &mdash; The stand-alone executable.<br>
216<tt>&nbsp;&nbsp;/usr/local/lib/lua/5.1</tt> &mdash; C module directory.<br>
217<tt>&nbsp;&nbsp;/usr/local/share/lua/5.1</tt> &mdash; Lua module directory.<br>
218<tt>&nbsp;&nbsp;/usr/local/share/lua/5.1/<strong>jit/*.lua</strong></tt> &mdash;
219<tt>jit.*</tt> modules.<br>
220</p>
221<p>
222The Lua docs and includes are not installed to avoid overwriting
223an existing Lua installation. In any case these are identical
224to the version of Lua that LuaJIT is based on. If you want
225to install them, edit the top-level makefile (look for <tt>###</tt>).
226</p>
227<p>
228The stand-alone Lua bytecode compiler <tt>luac</tt> is neither
229built nor installed, for the same reason. If you really need it,
230you may be better off with <tt>luac</tt> built from the original Lua
231distribution (use the <em>same</em> version your copy of LuaJIT
232is based on). This avoids dragging in most of LuaJIT which is not
233needed for the pure bytecode compiler. You can also use the bare-bones
234Lua to bytecode translator <tt>luac.lua</tt> (look in the <tt>test</tt>
235directory of the original Lua distribution).
236</p>
237
238<h3>Windows</h3>
239<p>
240Copy <tt>luajit.exe</tt> and <tt>lua51.dll</tt>
241to a newly created directory (any location is ok). Add <tt>lua</tt>
242and <tt>lua\jit</tt> directories below it and copy all Lua files
243from the <tt>jit</tt> directory of the distribution to the latter directory.
244</p>
245<p>
246There are no hardcoded
247absolute path names &mdash; all modules are loaded relative to the
248directory where <tt>luajit.exe</tt> is installed
249(see <tt>src/luaconf.h</tt>).
250</p>
251
252<h2 id="embedding">Embedding LuaJIT</h2>
253<p>
254It's strongly recommended that you build the stand-alone executable
255with your toolchain and verify that it works <em>before</em> starting
256to embed LuaJIT into an application. The stand-alone executable is
257also useful later on, when you want to experiment with code snippets
258or try out some Lua files.
259</p>
260<p>
261Please consult the Lua docs for general information about how to
262embed Lua into your application. The following list only shows
263the additional steps needed for embedding LuaJIT:
264</p>
265<ul>
266<li>You need to add the LuaJIT library functions by running
267<tt>luaopen_jit()</tt> after all the other standard library functions.
268The modified <tt>src/linit.c</tt> used by the stand-alone executable
269already does this for you.</li>
270<li><em>Caveat:</em> LuaJIT is based on Lua 5.1 which
271means the <tt>luaopen_*()</tt> functions <em>must not</em>
272be called directly. See <tt>src/linit.c</tt> for the proper way to
273run them. You'll get an error initializing the <tt>io</tt> library
274if you don't follow these instructions.</li>
275<li>To use the optimizer (strongly recommended) you need to:
276<ul>
277<li>Install the optimizer modules <tt>jit.opt</tt> and
278<tt>jit.opt_inline</tt> relative to the Lua module path
279(you've probably modified it &mdash; see <tt>src/luaconf.h</tt>):<br>
280<tt>jit/opt.lua</tt><br>
281<tt>jit/opt_inline.lua</tt></li>
282<li>If you want to ship a single executable then you may want to
283embed the optimizer modules into your application (but don't loose
284time with this during the early development phase). This involves:
285<ul>
286<li>Compile the two modules to bytecode
287(using <tt>luac&nbsp;-s</tt> from a plain Lua installation).</li>
288<li>Convert them to C include files (search for "Lua&nbsp;bin2c").</li>
289<li>On Windows you can also put the compiled bytecode into a resource
290(search for "Lua&nbsp;bin2res").</li>
291<li>Load the bytecode with <tt>luaL_loadbuffer</tt> (but don't run it).</li>
292<li>Put the resulting functions into <tt>package.preload["jit.opt"]</tt>
293and <tt>package.preload["jit.opt_inline"]</tt>.</li>
294</ul></li>
295<li>Activate the LuaJIT optimizer from Lua code to be run at startup:
296<tt>&nbsp;&nbsp;require("jit.opt").start()</tt><br>
297Or use equivalent C code. See <tt>dojitopt()</tt> in <tt>src/lua.c</tt>.</li>
298</ul></li>
299<li>All other LuaJIT specific modules (<tt>jit.*</tt>) are for debugging only.
300They do not need to be shipped with an application. But they may be quite
301useful, anyway (especially <tt>jit.trace</tt>).</li>
302<li>DynASM is only needed while <em>building</em> LuaJIT. It's not
303needed while running LuaJIT and there is no point in shipping or
304installing it together with an application.</li>
305<li>In case you want to strip some of the standard libraries from
306your application: The optimizer modules need several functions from
307the base library and the string library (and of course the LuaJIT
308core libraries). The io library is only used to print a fatal error
309message (you may want to replace it). The optional modules
310for debugging depend on a few more library functions &mdash;
311please check the source.</li>
312</ul>
313<p>
314Although the very liberal LuaJIT
315<a href="http://www.opensource.org/licenses/mit-license.php"><span class="ext">&raquo;</span>&nbsp;license</a>
316does not require any acknowledgment whatsoever, it would be appreciated
317if you give some credit in the docs (or the "About" box) of your application.
318A simple line like:<br>
319<tt>&nbsp;&nbsp;This product includes LuaJIT, http://luajit.org/</tt><br>
320would be nice. Please do not include any E-Mail addresses. Thank you!
321</p>
322<p>
323I'm always interested where LuaJIT can be put to good use in applications.
324Please <a href="contact.html">tell me</a>
325or better yet write a few lines about your project to the
326<a href="http://www.lua.org/lua-l.html"><span class="ext">&raquo;</span>&nbsp;Lua mailing list</a>.
327Thank you!
328</p>
329<br class="flush">
330</div>
331<div id="foot">
332<hr class="hide">
333Copyright &copy; 2005-2011 Mike Pall
334<span class="noprint">
335&middot;
336<a href="contact.html">Contact</a>
337</span>
338</div>
339</body>
340</html>
diff --git a/libraries/LuaJIT-1.1.7/jitdoc/luajit_intro.html b/libraries/LuaJIT-1.1.7/jitdoc/luajit_intro.html
new file mode 100644
index 0000000..9e1fb23
--- /dev/null
+++ b/libraries/LuaJIT-1.1.7/jitdoc/luajit_intro.html
@@ -0,0 +1,389 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2<html>
3<head>
4<title>Introducing 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-2011, 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>Introducing LuaJIT</h1>
18</div>
19<div id="nav">
20<ul><li>
21<a href="index.html">Index</a>
22</li><li>
23<a href="luajit.html">LuaJIT</a>
24<ul><li>
25<a href="luajit_features.html">Features</a>
26</li><li>
27<a href="luajit_install.html">Installation</a>
28</li><li>
29<a href="luajit_run.html">Running</a>
30</li><li>
31<a href="luajit_api.html">API Extensions</a>
32</li><li>
33<a class="current" href="luajit_intro.html">Introduction</a>
34</li><li>
35<a href="luajit_performance.html">Performance</a>
36</li><li>
37<a href="luajit_debug.html">Debugging</a>
38</li><li>
39<a href="luajit_changes.html">Changes</a>
40</li></ul>
41</li><li>
42<a href="coco.html">Coco</a>
43<ul><li>
44<a href="coco_portability.html">Portability</a>
45</li><li>
46<a href="coco_api.html">API Extensions</a>
47</li><li>
48<a href="coco_changes.html">Changes</a>
49</li></ul>
50</li><li>
51<a href="dynasm.html">DynASM</a>
52<ul><li>
53<a href="dynasm_features.html">Features</a>
54</li><li>
55<a href="dynasm_examples.html">Examples</a>
56</li></ul>
57</li><li>
58<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
59</li></ul>
60</div>
61<div id="main">
62<p>
63This is a little essay that tries to answer the question:
64<em>'So, how does LuaJIT really work?'</em>.
65</p>
66<p>
67I tried to avoid going into all the gory details, but at the
68same time provide a deep enough explanation, to let you find
69your way around LuaJIT's inner workings.
70</p>
71<p>
72The learning curve is maybe a little bit steep for newbies and
73compiler gurus will certainly fall asleep after two paragraphs.
74It's difficult to strike a balance here.
75</p>
76
77<h2>Acronym Soup</h2>
78<p>
79As the name says LuaJIT is a <em>Just-In-Time</em> (JIT) compiler.
80This means that functions are compiled on demand, i.e. when they
81are run first. This ensures both a quick application startup
82and helps to avoid useless work, too. E.g. unused functions
83are not compiled at all.
84</p>
85<p>
86The other alternative is known as <em>Ahead-Of-Time</em> (AOT)
87compilation. Here everything is compiled before running any function.
88This is the classic way for many languages, such as C or C++.
89</p>
90<p>
91In fact plain Lua allows you to pre-compile Lua source code into
92Lua bytecode and store it in a binary file that can be run
93later on. This is used only in specific settings (e.g. memory limited
94embedded systems), because the Lua bytecode compiler is really fast.
95The ability to run source files right away is part of what makes
96a dynamic language (aka scripting language) so powerful.
97</p>
98<p>
99JIT compilation has a few other advantages for dynamic languages
100that AOT compilation can only provide with a massive amount
101of code analysis. More can be found in the literature.
102One particular advantage is explained later.
103</p>
104
105<h2>Quick, JIT &mdash; Run!</h2>
106<p>
107JIT compilation happens mostly invisible. You'll probably never
108notice that a compilation is going on. Part of the secret is
109that everything happens in little pieces intermixed with running
110the application itself inbetween. The other part of the secret
111is that JIT compilation can be made pretty fast.
112</p>
113<p>
114Most applications quickly converge to a stable state where
115everything that really needs to be compiled is compiled
116right away. Only occasional isolated compiles happen later on.
117</p>
118<p>
119Even though the name doesn't suggest it, LuaJIT <em>can</em> operate
120in AOT mode, too. But this is completely under user control
121(see <a href="luajit_api.html#jit_compile"><tt>jit.compile()</tt></a>)
122and doesn't happen automatically.
123</p>
124<p>
125Unless you have good reason to suspect that AOT compilation
126might help for a specific application, I wouldn't bother though.
127Compilation speed is usually a non-argument, because LuaJIT
128is extremely fast. Compilation times are typically in the
129<em>microsecond range</em> for individual Lua functions.
130</p>
131
132<h2>Starting Up</h2>
133<p>
134The next few paragraphs may not be exactly breaking news to you,
135if you are familiar with JIT compilers. Still, please read on,
136because some terms are introduced that are used later on.
137</p>
138<p>
139When you start LuaJIT everything proceeds like in standard Lua:
140the Lua core is initialized, the standard libraries are loaded and
141the command line is analyzed. Then usually the first Lua source
142code file is loaded and is translated to Lua bytecode. And finally
143the function for the initial main chunk is run ...
144</p>
145
146<h2>Kicking the Compiler</h2>
147<p>
148This is where LuaJIT kicks in:
149</p>
150<p>
151All Lua functions carry an additional <em>status code</em> for LuaJIT.
152Initially this is set to 'NONE', i.e. the function has not been
153looked at (yet). If a function is run with this setting,
154the LuaJIT <em>compiler pipeline</em> is started up.
155</p>
156<p>
157If you haven't loaded any special LuaJIT modules and optimization
158is not turned on, the compiler pipeline only consists of the
159<em>compiler backend</em>.
160</p>
161<p>
162The compiler backend is the low-level encoding engine that translates
163bytecode instructions to machine code instructions. Without any
164further hints from other modules, the backend more or less does a
1651:1 translation. I.e. a single variant of a bytecode instruction
166corresponds to a single piece of machine code.
167</p>
168<p>
169If all goes well, these little code pieces are put together,
170a function prologue is slapped on and voila: your Lua function
171has been translated to machine code. Of course things are not
172that simple when you look closer, but hey &mdash; this is
173the theory.
174</p>
175<p>
176Anyway, the status code for the function is set to 'OK' and the
177machine code is run. If this function runs another Lua function
178which has not been compiled, that one is compiled, too. And so on.
179</p>
180
181<h2>Call Gates</h2>
182<p>
183Ok, so what happens when a function is called repeatedly? After all
184this is the most common case.
185</p>
186<p>
187Simple: The status code is checked again. This time it's set to 'OK',
188so the machine code can be run directly. Well &mdash; that's not the
189whole truth: for calls that originate in a JIT compiled function
190a better mechanism, tentatively named <em>call gates</em> is used.
191</p>
192<p>
193Every function has a call gate field (a function pointer). By default
194it's set to a function that does the above checks and runs the
195compiler. But as soon as a function is compiled, the call gate
196is modified to point to the just compiled machine code.
197</p>
198<p>
199Calling a function is then as easy as calling the code that the
200call gate points to. But due to special (faster) calling conventions
201this function pointer cannot be used directly from C. So calls from
202a non-compiled function or from a C&nbsp;function use an extra entry
203call gate which in turn calls the real call gate. But this is
204really a non-issue since most calls in typical applications
205are intra-JIT calls.
206</p>
207
208<h2>The Compiler Pipeline</h2>
209<p>
210The compiler pipeline has already been mentioned. This sounds
211more complicated than it is. Basically this is a coroutine that
212runs a <em>frontend</em> function which in turn calls all functions
213from the <em>pipeline table</em>.
214</p>
215<p>
216The pipeline table is sorted by <em>priorities</em>. The standard
217backend has priority 0. Positive priorities are run before the
218backend and negative priorities are run after the backend. Modules
219can dynamically attach or detach themselves to the pipeline with
220the library function <tt>jit.attach()</tt>.
221</p>
222<p>
223So a typical optimizer pass better have a positive priority,
224because it needs to be run before the backend is run. E.g. the
225LuaJIT optimizer module registers itself with priority 50.
226</p>
227<p>
228On the other hand a typical helper module for debugging &mdash;
229a machine code disassembler &mdash; needs to be run after the
230backend and is attached with a negative priority.
231</p>
232<p>
233One special case occurs when compilation fails. This can be due to
234an internal error (ouch) or on purpose. E.g. the optimizer module
235checks some characteristics of the function to be compiled and
236may decide that it's just not worth it. In this case a status
237other than OK is passed back to the pipeline frontend.
238</p>
239<p>
240The easiest thing would be to abort pipeline processing and just
241give up. But this would remove the ability to trace the progress
242of the compiler (which better include failed compilations, too).
243So there is a special rule that odd priorities are still run,
244but even priorities are not. That's why e.g. <tt>-j trace</tt>
245registers itself with priority -99.
246</p>
247
248<h2>The Optimizer</h2>
249<p>
250Maybe it hasn't become clear from the above description,
251but a module can attach any Lua or C&nbsp;function to the compiler
252pipeline. In fact all of the loadable modules are Lua modules.
253Only the backend itself is written in C.
254</p>
255<p>
256So, yes &mdash; the LuaJIT optimizer is written in pure Lua!
257</p>
258<p>
259And no, don't worry, it's quite fast. One reason for this is
260that a very simple <em>abstract interpretation</em> algorithm
261is used. It mostly ignores control flow and/or basic block
262boundaries.
263</p>
264<p>
265Thus the results of the analysis are really only <em>hints</em>.
266The backend <em>must</em> check the preconditions (the contracts)
267for these hints (e.g. the object type). Still, the generated
268hints are pretty accurate and quite useful to speed up the
269compiled code (see below).
270</p>
271<p>
272Explaining how abstract interpretation works is not within the
273scope for this short essay. You may want to have a look at the
274optimizer source code and/or read some articles or books on
275this topic. The canonical reference is
276<a href="http://www2.imm.dtu.dk/~riis/PPA/ppa.html"><span class="ext">&raquo;</span>&nbsp;Principles of Program Analysis</a>.
277Ok, so this one is a bit more on the theoretical side (a gross
278understatement). Try a search engine with the keywords "abstract
279interpretation", too.
280</p>
281<p>
282Suffice to say the optimizer generates hints and passes these
283on to the backend. The backend then decides to encode different
284forms for the same bytecode instruction, to combine several
285instructions or to inline code for C&nbsp;functions. If the hints
286from the optimizer are good, the resulting code will perform
287better because shorter code paths are used for the typical cases.
288</p>
289
290<h2>The JIT Advantage</h2>
291<p>
292One important feature of the optimizer is that it takes 'live'
293function arguments into account. Since the JIT compiler is
294called just before the function is run, the arguments for this
295first invocation are already present. This can be used to great
296advantage in a <em>dynamically typed language</em>, such as Lua.
297</p>
298<p>
299Here's a trivial example:
300</p>
301<pre>
302function foo(t, k)
303 return t[k]
304end
305</pre>
306<p>
307Without knowing the most likely arguments for the function
308there's not much to optimize.
309</p>
310<p>
311Ok, so 't' is most likely a table. But it could be userdata, too.
312In fact it could be any type since the introduction of generic
313metatables for types.
314</p>
315<p>
316And more importantly 'k' can be a number, a string
317or any other type. Oh and let's not forget about metamethods ...
318</p>
319<p>
320If you know a bit about Lua internals, it should be clear by now
321that the code for this function could potentially branch to half
322of the Lua core. And it's of course impossible to inline all
323these cases.
324</p>
325<p>
326On the other hand if it's <em>known</em> (or there's a good hint)
327that 't' is a table and that 'k' is a positive integer, then there
328is a high likeliness that the key 'k' is in the array part
329of the table. This lookup can be done with just a few machine code
330instructions.
331</p>
332<p>
333Of course the preconditions for this fast path have to be checked
334(unless there are definitive hints). But if the hints are right,
335the code runs a lot faster (about a factor of 3 in this case
336for the pure table lookup).
337</p>
338
339<h2>Optimizing the Optimizer</h2>
340<p>
341A question that surely popped up in your mind while reading
342the above section: does the optimizer optimize itself? I.e.
343is the optimizer module compiled?
344</p>
345<p>
346The current answer is no. Mainly because the compiler pipeline
347is single-threaded only. It's locked during compilation and
348any parallel attempt to JIT compile a function results in
349a 'DELAYED' status code. In fact all modules that attach to
350the compiler pipeline disable compilation for the entire
351module (because LuaJIT would do that anyway). The main chunk
352of modules loaded with <tt>require()</tt> is never compiled,
353so there is no chicken-and-egg problem here.
354</p>
355<p>
356Of course you could do an AOT compilation in the main chunk of
357the optimizer module. But then only with the plain backend.
358Recompiling it later on with the optimizer attached doesn't work,
359because a function cannot be compiled twice (I plan to lift
360this restriction).
361</p>
362<p>
363The other question is whether it pays off to compile the optimizer
364at all? Honestly, I haven't tried, because the current optimizer
365is really simple. It runs very quickly, even under the bytecode
366interpreter.
367</p>
368
369<h2>That's All Folks</h2>
370<p>
371Ok, that's all for now. I'll extend this text later on with
372new topics that come up in questions. Keep on asking these
373on the mailing list if you are interested.
374</p>
375<p>
376Thank you for your attention!
377</p>
378<br class="flush">
379</div>
380<div id="foot">
381<hr class="hide">
382Copyright &copy; 2005-2011 Mike Pall
383<span class="noprint">
384&middot;
385<a href="contact.html">Contact</a>
386</span>
387</div>
388</body>
389</html>
diff --git a/libraries/LuaJIT-1.1.7/jitdoc/luajit_performance.html b/libraries/LuaJIT-1.1.7/jitdoc/luajit_performance.html
new file mode 100644
index 0000000..7f2307c
--- /dev/null
+++ b/libraries/LuaJIT-1.1.7/jitdoc/luajit_performance.html
@@ -0,0 +1,394 @@
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 Performance</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-2011, 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.bench {
13 line-height: 1.2;
14}
15tr.benchhead td {
16 font-weight: bold;
17}
18td img, li img {
19 vertical-align: middle;
20}
21td.barhead, td.bar {
22 font-size: 8pt;
23 font-family: Courier New, Courier, monospace;
24 width: 360px;
25 padding: 0;
26}
27td.bar {
28 background: url('img/backbar.png');
29}
30td.speedup {
31 text-align: center;
32}
33</style>
34</head>
35<body>
36<div id="site">
37<a href="http://luajit.org/"><span>Lua<span id="logo">JIT</span></span></a>
38</div>
39<div id="head">
40<h1>LuaJIT Performance</h1>
41</div>
42<div id="nav">
43<ul><li>
44<a href="index.html">Index</a>
45</li><li>
46<a href="luajit.html">LuaJIT</a>
47<ul><li>
48<a href="luajit_features.html">Features</a>
49</li><li>
50<a href="luajit_install.html">Installation</a>
51</li><li>
52<a href="luajit_run.html">Running</a>
53</li><li>
54<a href="luajit_api.html">API Extensions</a>
55</li><li>
56<a href="luajit_intro.html">Introduction</a>
57</li><li>
58<a class="current" href="luajit_performance.html">Performance</a>
59</li><li>
60<a href="luajit_debug.html">Debugging</a>
61</li><li>
62<a href="luajit_changes.html">Changes</a>
63</li></ul>
64</li><li>
65<a href="coco.html">Coco</a>
66<ul><li>
67<a href="coco_portability.html">Portability</a>
68</li><li>
69<a href="coco_api.html">API Extensions</a>
70</li><li>
71<a href="coco_changes.html">Changes</a>
72</li></ul>
73</li><li>
74<a href="dynasm.html">DynASM</a>
75<ul><li>
76<a href="dynasm_features.html">Features</a>
77</li><li>
78<a href="dynasm_examples.html">Examples</a>
79</li></ul>
80</li><li>
81<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
82</li></ul>
83</div>
84<div id="main">
85<p>
86Here are some performance measurements, based on a few benchmarks.
87</p>
88<p style="background: #ffd0d0; text-align: center;">
89LuaJIT 2.0 is available with much improved performance!<br>
90Please check the new
91<a href="http://luajit.org/performance.html"><span class="ext">&raquo;</span> interactive performance comparison</a>.
92</p>
93
94<h2 id="interpretation">Interpreting the Results</h2>
95<p>
96As is always the case with benchmarks, care must be taken to
97interpret the results:
98</p>
99<p>
100First, the standard Lua interpreter is already <em>very</em> fast.
101It's commonly the fastest of it's class (interpreters) in the
102<a href="http://shootout.alioth.debian.org/"><span class="ext">&raquo;</span>&nbsp;Great Computer Language Shootout</a>.
103Only true machine code compilers get a better overall score.
104</p>
105<p>
106Any performance improvements due to LuaJIT can only be incremental.
107You can't expect a speedup of 50x if the fastest compiled language
108is only 5x faster than interpreted Lua in a particular benchmark.
109LuaJIT can't do miracles.
110</p>
111<p>
112Also please note that most of the benchmarks below are <em>not</em>
113trivial micro-benchmarks, which are often cited with marvelous numbers.
114Micro-benchmarks do not realistically model the performance gains you
115can expect in your own programs.
116</p>
117<p>
118It's easy to make up a few one-liners like:<br>
119<tt>&nbsp;&nbsp;local function f(...) end; for i=1,1e7 do f() end</tt><br>
120This is more than 30x faster with LuaJIT. But you won't find
121this in a real-world program.
122</p>
123
124<h2 id="methods">Measurement Methods</h2>
125<p>
126All measurements have been taken on a Pentium&nbsp;III 1.139&nbsp;GHz
127running Linux&nbsp;2.6. Both Lua and LuaJIT have been compiled with
128GCC&nbsp;3.3.6 with <tt>-O3 -fomit-frame-pointer</tt>.
129You'll definitely get different results on different machines or
130with different C&nbsp;compiler options. <sup>*</sup>
131</p>
132<p>
133The base for the comparison are the user CPU times as reported by
134<tt>/usr/bin/time</tt>. The runtime of each benchmark is parametrized
135and has been adjusted to minimize the variation between several runs.
136The ratio between the times for LuaJIT and Lua gives the speedup.
137Only this number is shown because it's less dependent on a specific system.
138</p>
139<p>
140E.g. a speedup of 6.74 means the same benchmark runs almost 7 times
141faster with <tt>luajit&nbsp;-O</tt> than with standard Lua (or with
142<tt>-j off</tt>). Your mileage may vary.
143</p>
144<p style="font-size: 80%;">
145<sup>*</sup> Yes, LuaJIT relies on quite a bit of the Lua core infrastructure
146like table and string handling. All of this is written in C and
147should be compiled with full optimization turned on, or performance
148will suffer.
149</p>
150
151<h2 id="lua_luajit" class="pagebreak">Comparing Lua to LuaJIT</h2>
152<p>
153Here is a comparison using the current benchmark collection of the
154<a href="http://shootout.alioth.debian.org/"><span class="ext">&raquo;</span>&nbsp;Great Computer Language Shootout</a> (as of 3/2006):
155</p>
156
157<div class="tablewrap">
158<table class="bench">
159<tr class="benchhead">
160<td>Benchmark</td>
161<td class="speedup">Speedup</td>
162<td class="barhead">
163<img src="img/spacer.png" width="360" height="12" alt="-----1x----2x----3x----4x----5x----6x----7x----8x">
164</td>
165</tr>
166<tr class="odd">
167<td>mandelbrot</td>
168<td class="speedup">6.74</td>
169<td class="bar"><img src="img/bluebar.png" width="303" height="12" alt="========================================"></td>
170</tr>
171<tr class="even">
172<td>recursive</td>
173<td class="speedup">6.64</td>
174<td class="bar"><img src="img/bluebar.png" width="299" height="12" alt="========================================"></td>
175</tr>
176<tr class="odd">
177<td>fannkuch</td>
178<td class="speedup">5.37</td>
179<td class="bar"><img src="img/bluebar.png" width="242" height="12" alt="================================"></td>
180</tr>
181<tr class="even">
182<td>chameneos</td>
183<td class="speedup">5.08</td>
184<td class="bar"><img src="img/bluebar.png" width="229" height="12" alt="=============================="></td>
185</tr>
186<tr class="odd">
187<td>nsievebits</td>
188<td class="speedup">5.05</td>
189<td class="bar"><img src="img/bluebar.png" width="227" height="12" alt="=============================="></td>
190</tr>
191<tr class="even">
192<td>pidigits</td>
193<td class="speedup">4.94</td>
194<td class="bar"><img src="img/bluebar.png" width="222" height="12" alt="=============================="></td>
195</tr>
196<tr class="odd">
197<td>nbody</td>
198<td class="speedup">4.63</td>
199<td class="bar"><img src="img/bluebar.png" width="208" height="12" alt="============================"></td>
200</tr>
201<tr class="even">
202<td>spectralnorm</td>
203<td class="speedup">4.59</td>
204<td class="bar"><img src="img/bluebar.png" width="207" height="12" alt="============================"></td>
205</tr>
206<tr class="odd">
207<td>cheapconcr</td>
208<td class="speedup">4.46</td>
209<td class="bar"><img src="img/bluebar.png" width="201" height="12" alt="==========================="></td>
210</tr>
211<tr class="even">
212<td>partialsums</td>
213<td class="speedup">3.73</td>
214<td class="bar"><img src="img/bluebar.png" width="168" height="12" alt="======================"></td>
215</tr>
216<tr class="odd">
217<td>fasta</td>
218<td class="speedup">2.68</td>
219<td class="bar"><img src="img/bluebar.png" width="121" height="12" alt="================"></td>
220</tr>
221<tr class="even">
222<td>cheapconcw</td>
223<td class="speedup">2.52</td>
224<td class="bar"><img src="img/bluebar.png" width="113" height="12" alt="==============="></td>
225</tr>
226<tr class="odd">
227<td>nsieve</td>
228<td class="speedup">1.95</td>
229<td class="bar"><img src="img/bluebar.png" width="88" height="12" alt="============"></td>
230</tr>
231<tr class="even">
232<td>revcomp</td>
233<td class="speedup">1.92</td>
234<td class="bar"><img src="img/bluebar.png" width="86" height="12" alt="============"></td>
235</tr>
236<tr class="odd">
237<td>knucleotide</td>
238<td class="speedup">1.59</td>
239<td class="bar"><img src="img/bluebar.png" width="72" height="12" alt="=========="></td>
240</tr>
241<tr class="even">
242<td>binarytrees</td>
243<td class="speedup">1.52</td>
244<td class="bar"><img src="img/bluebar.png" width="68" height="12" alt="========="></td>
245</tr>
246<tr class="odd">
247<td>sumfile</td>
248<td class="speedup">1.27</td>
249<td class="bar"><img src="img/bluebar.png" width="57" height="12" alt="========"></td>
250</tr>
251<tr class="even">
252<td>regexdna</td>
253<td class="speedup">1.01</td>
254<td class="bar"><img src="img/bluebar.png" width="45" height="12" alt="======"></td>
255</tr>
256</table>
257</div>
258<p>
259Note that many of these benchmarks have changed over time (both spec
260and code). Benchmark results shown in previous versions of LuaJIT
261are not directly comparable. The next section compares different
262versions with the current set of benchmarks.
263</p>
264
265<h2 id="luajit_versions" class="pagebreak">Comparing LuaJIT Versions</h2>
266<p>
267This shows the improvements between the following versions:
268</p>
269<ul>
270<li>LuaJIT&nbsp;1.0.x <img src="img/bluebar.png" width="30" height="12" alt="(===)"></li>
271<li>LuaJIT&nbsp;1.1.x <img src="img/bluebar.png" width="30" height="12" alt="(===##)"><img src="img/magentabar.png" width="20" height="12" alt=""></li>
272</ul>
273
274<div class="tablewrap">
275<table class="bench">
276<tr class="benchhead">
277<td>Benchmark</td>
278<td class="speedup">Speedup</td>
279<td class="barhead">
280<img src="img/spacer.png" width="360" height="12" alt="-----1x----2x----3x----4x----5x----6x----7x----8x">
281</td>
282</tr>
283<tr class="odd">
284<td>fannkuch</td>
285<td class="speedup">3.96&nbsp;&rarr;&nbsp;5.37</td>
286<td class="bar"><img src="img/bluebar.png" width="178" height="12" alt="========================"><img src="img/magentabar.png" width="64" height="12" alt="########"></td>
287</tr>
288<tr class="even">
289<td>chameneos</td>
290<td class="speedup">2.25&nbsp;&rarr;&nbsp;5.08</td>
291<td class="bar"><img src="img/bluebar.png" width="101" height="12" alt="=============="><img src="img/magentabar.png" width="128" height="12" alt="################"></td>
292</tr>
293<tr class="odd">
294<td>nsievebits</td>
295<td class="speedup">2.90&nbsp;&rarr;&nbsp;5.05</td>
296<td class="bar"><img src="img/bluebar.png" width="131" height="12" alt="================="><img src="img/magentabar.png" width="96" height="12" alt="#############"></td>
297</tr>
298<tr class="even">
299<td>pidigits</td>
300<td class="speedup">3.58&nbsp;&rarr;&nbsp;4.94</td>
301<td class="bar"><img src="img/bluebar.png" width="161" height="12" alt="====================="><img src="img/magentabar.png" width="61" height="12" alt="#########"></td>
302</tr>
303<tr class="odd">
304<td>nbody</td>
305<td class="speedup">4.16&nbsp;&rarr;&nbsp;4.63</td>
306<td class="bar"><img src="img/bluebar.png" width="187" height="12" alt="========================="><img src="img/magentabar.png" width="21" height="12" alt="###"></td>
307</tr>
308<tr class="even">
309<td>cheapconcr</td>
310<td class="speedup">1.46&nbsp;&rarr;&nbsp;4.46</td>
311<td class="bar"><img src="img/bluebar.png" width="66" height="12" alt="========="><img src="img/magentabar.png" width="135" height="12" alt="##################"></td>
312</tr>
313<tr class="odd">
314<td>partialsums</td>
315<td class="speedup">1.71&nbsp;&rarr;&nbsp;3.73</td>
316<td class="bar"><img src="img/bluebar.png" width="77" height="12" alt="=========="><img src="img/magentabar.png" width="91" height="12" alt="############"></td>
317</tr>
318<tr class="even">
319<td>fasta</td>
320<td class="speedup">2.37&nbsp;&rarr;&nbsp;2.68</td>
321<td class="bar"><img src="img/bluebar.png" width="107" height="12" alt="=============="><img src="img/magentabar.png" width="14" height="12" alt="##"></td>
322</tr>
323<tr class="odd">
324<td>cheapconcw</td>
325<td class="speedup">1.27&nbsp;&rarr;&nbsp;2.52</td>
326<td class="bar"><img src="img/bluebar.png" width="57" height="12" alt="========"><img src="img/magentabar.png" width="56" height="12" alt="#######"></td>
327</tr>
328<tr class="even">
329<td>revcomp</td>
330<td class="speedup">1.45&nbsp;&rarr;&nbsp;1.92</td>
331<td class="bar"><img src="img/bluebar.png" width="65" height="12" alt="========="><img src="img/magentabar.png" width="21" height="12" alt="###"></td>
332</tr>
333<tr class="odd">
334<td>knucleotide</td>
335<td class="speedup">1.32&nbsp;&rarr;&nbsp;1.59</td>
336<td class="bar"><img src="img/bluebar.png" width="59" height="12" alt="========"><img src="img/magentabar.png" width="13" height="12" alt="##"></td>
337</tr>
338</table>
339</div>
340<p>
341All other benchmarks show only minor performance differences.
342</p>
343
344<h2 id="summary">Summary</h2>
345<p>
346These results should give you an idea about what speedup
347you can expect depending on the nature of your Lua code:
348</p>
349<ul>
350<li>
351LuaJIT is really good at (floating-point) math and loops
352(mandelbrot, pidigits, spectralnorm, partialsums).
353</li>
354<li>
355Function calls (recursive), vararg calls, table lookups (nbody),
356table iteration and coroutine switching (chameneos, cheapconc)
357are a lot faster than with plain Lua.
358</li>
359<li>
360It's still pretty good for indexed table access (fannkuch, nsieve)
361and string processing (fasta, revcomp, knucleotide).
362But there is room for improvement in a future version.
363</li>
364<li>
365If your application spends most of the time in C&nbsp;code
366you won't see much of a difference (regexdna, sumfile).
367Ok, so write more code in pure Lua. :-)
368</li>
369<li>
370The real speedup may be shadowed by other dominant factors in a benchmark:
371<ul>
372<li>Common parts of the Lua core: e.g. memory allocation
373and GC (binarytrees).</li>
374<li>Language characteristics: e.g. lack of bit operations (nsievebits).</li>
375<li>System characteristics: e.g. CPU cache size and memory speed (nsieve).</li>
376</ul>
377</li>
378</ul>
379<p>
380The best idea is of course to benchmark your <em>own</em> applications.
381Please report any interesting results you may find. Thank you!
382</p>
383<br class="flush">
384</div>
385<div id="foot">
386<hr class="hide">
387Copyright &copy; 2005-2011 Mike Pall
388<span class="noprint">
389&middot;
390<a href="contact.html">Contact</a>
391</span>
392</div>
393</body>
394</html>
diff --git a/libraries/LuaJIT-1.1.7/jitdoc/luajit_run.html b/libraries/LuaJIT-1.1.7/jitdoc/luajit_run.html
new file mode 100644
index 0000000..bc9105b
--- /dev/null
+++ b/libraries/LuaJIT-1.1.7/jitdoc/luajit_run.html
@@ -0,0 +1,159 @@
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-2011, 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>Running LuaJIT</h1>
18</div>
19<div id="nav">
20<ul><li>
21<a href="index.html">Index</a>
22</li><li>
23<a href="luajit.html">LuaJIT</a>
24<ul><li>
25<a href="luajit_features.html">Features</a>
26</li><li>
27<a href="luajit_install.html">Installation</a>
28</li><li>
29<a class="current" href="luajit_run.html">Running</a>
30</li><li>
31<a href="luajit_api.html">API Extensions</a>
32</li><li>
33<a href="luajit_intro.html">Introduction</a>
34</li><li>
35<a href="luajit_performance.html">Performance</a>
36</li><li>
37<a href="luajit_debug.html">Debugging</a>
38</li><li>
39<a href="luajit_changes.html">Changes</a>
40</li></ul>
41</li><li>
42<a href="coco.html">Coco</a>
43<ul><li>
44<a href="coco_portability.html">Portability</a>
45</li><li>
46<a href="coco_api.html">API Extensions</a>
47</li><li>
48<a href="coco_changes.html">Changes</a>
49</li></ul>
50</li><li>
51<a href="dynasm.html">DynASM</a>
52<ul><li>
53<a href="dynasm_features.html">Features</a>
54</li><li>
55<a href="dynasm_examples.html">Examples</a>
56</li></ul>
57</li><li>
58<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
59</li></ul>
60</div>
61<div id="main">
62<p>
63LuaJIT has only a single stand-alone executable, called <tt>luajit</tt>.
64It can be used to run simple Lua statements or whole Lua applications
65from the command line. It has an interactive mode, too.
66</p>
67<p>
68<em>Note: The optimizer is not activated by default because it resides
69in an external module
70(see <a href="luajit_install.html">Installing LuaJIT</a>).
71It's recommended to always use the optimizer, i.e.:</em> <tt>luajit -O</tt>
72</p>
73
74<h2 id="options">Command Line Options</h2>
75<p>
76The <tt>luajit</tt> stand-alone executable is just a slightly modified
77version of the regular <tt>lua</tt> stand-alone executable.
78It supports the same basic options, too. Please have a look at the
79<a href="../doc/lua.html">Manual Page</a>
80for the regular <tt>lua</tt> stand-alone executable.
81</p>
82<p>
83Two additional options control LuaJIT behaviour:
84</p>
85
86<h3 id="opt_j"><tt>-j cmd[=value]</tt></h3>
87<p>
88This option performs a LuaJIT control command. LuaJIT has a small
89but extensible set of control commands. It's easy to add your own.
90</p>
91<p>
92The command is first searched for in the <tt>jit.*</tt> library.
93If no matching function is found, a module named <tt>jit.&lt;cmd&gt;</tt>
94is loaded. The module table must provide a <tt>start()</tt> function.
95</p>
96<p>
97For the <tt>-j cmd</tt> form the function is called without an argument.
98Otherwise the <tt>value</tt> is passed as the first argument (a string).
99</p>
100<p>
101Here are the built-in LuaJIT control commands:
102</p>
103<ul>
104<li id="j_on"><tt>-j on</tt> &mdash; Turns the JIT engine on (default).</li>
105<li id="j_off"><tt>-j off</tt> &mdash; Turns the JIT engine off.</li>
106<li id="j_debug"><tt>-j debug[=level]</tt> &mdash; Set debug level. See
107<a href="luajit_api.html#jit_debug">jit.debug()</a>.</li>
108</ul>
109<p>
110The following control commands are loaded from add-on modules:
111</p>
112<ul>
113<li id="j_trace"><tt>-j trace[=file]</tt> &mdash; Trace the progress of the JIT compiler.</li>
114<li id="j_dumphints"><tt>-j dumphints[=file]</tt> &mdash; Dump bytecode + hints before compilation.</li>
115<li id="j_dump"><tt>-j dump[=file]</tt> &mdash; Dump machine code after compilation.</li>
116</ul>
117
118<!--
119<h3 id="opt_O"><tt>-O[level|ext]</tt></h3>
120-->
121<h3 id="opt_O"><tt>-O[level]</tt></h3>
122<p>
123This option loads and runs the optimizer module <tt>jit.opt</tt>.
124The optimizer generates hints for the compiler backend to improve
125the performance of the compiled code. The optimizer slows down
126compilation slightly, but the end result should make up for it
127in almost every case.
128</p>
129<p>
130The <tt>-O</tt> form sets the default optimizer level, which is
131currently <tt>2</tt> (this may change in future versions
132of LuaJIT).
133</p>
134<p>
135The <tt>-Olevel</tt> form explicitly sets the optimizer level:
136</p>
137<ul>
138<li><tt>-O0</tt> &mdash; disable the optimizer but leave it attached.</li>
139<li><tt>-O1</tt> &mdash; perform standard optimizations (like hints for table lookups).</li>
140<li><tt>-O2</tt> &mdash; like <tt>-O1</tt> but also loads <tt>jit.opt_inline</tt> to enable result hints and inlining for standard library functions.</li>
141</ul>
142<!--
143<p>
144The <tt>-Oext</tt> form loads optimizer extension modules
145from <tt>jit.opt_&lt;ext&gt;</tt>.
146</p>
147-->
148<br class="flush">
149</div>
150<div id="foot">
151<hr class="hide">
152Copyright &copy; 2005-2011 Mike Pall
153<span class="noprint">
154&middot;
155<a href="contact.html">Contact</a>
156</span>
157</div>
158</body>
159</html>