diff options
author | David Walter Seikel | 2012-01-23 23:36:30 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-23 23:36:30 +1000 |
commit | 6523585c66c04cea54df50013df8886b589847d8 (patch) | |
tree | 0b22aee7064166d88595eda260ca2d17c0773da5 /libraries/LuaJIT-1.1.7/jitdoc | |
parent | Update the EFL to what I'm actually using, coz I'm using some stuff not yet r... (diff) | |
download | SledjHamr-6523585c66c04cea54df50013df8886b589847d8.zip SledjHamr-6523585c66c04cea54df50013df8886b589847d8.tar.gz SledjHamr-6523585c66c04cea54df50013df8886b589847d8.tar.bz2 SledjHamr-6523585c66c04cea54df50013df8886b589847d8.tar.xz |
Add luaproc and LuaJIT libraries.
Two versions of LuaJIT, the stable release, and the dev version. Try the dev version first, until ih fails badly.
Diffstat (limited to '')
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 | */ | ||
6 | body { | ||
7 | font-family: serif; | ||
8 | font-size: 11pt; | ||
9 | margin: 0 3em; | ||
10 | padding: 0; | ||
11 | border: none; | ||
12 | } | ||
13 | a:link, a:visited, a:hover, a:active { | ||
14 | text-decoration: none; | ||
15 | background: transparent; | ||
16 | color: #0000ff; | ||
17 | } | ||
18 | h1, h2, h3 { | ||
19 | font-family: sans-serif; | ||
20 | font-weight: bold; | ||
21 | text-align: left; | ||
22 | margin: 0.5em 0; | ||
23 | padding: 0; | ||
24 | } | ||
25 | h1 { | ||
26 | font-size: 200%; | ||
27 | } | ||
28 | h2 { | ||
29 | font-size: 150%; | ||
30 | } | ||
31 | h3 { | ||
32 | font-size: 125%; | ||
33 | } | ||
34 | p { | ||
35 | margin: 0 0 0.5em 0; | ||
36 | padding: 0; | ||
37 | } | ||
38 | ul, ol { | ||
39 | margin: 0.5em 0; | ||
40 | padding: 0 0 0 2em; | ||
41 | } | ||
42 | ul { | ||
43 | list-style: outside square; | ||
44 | } | ||
45 | ol { | ||
46 | list-style: outside decimal; | ||
47 | } | ||
48 | li { | ||
49 | margin: 0; | ||
50 | padding: 0; | ||
51 | } | ||
52 | dl { | ||
53 | margin: 1em 0; | ||
54 | padding: 1em; | ||
55 | border: 1px solid black; | ||
56 | } | ||
57 | dt { | ||
58 | font-weight: bold; | ||
59 | margin: 0; | ||
60 | padding: 0; | ||
61 | } | ||
62 | dt sup { | ||
63 | float: right; | ||
64 | margin-left: 1em; | ||
65 | } | ||
66 | dd { | ||
67 | margin: 0.5em 0 0 2em; | ||
68 | padding: 0; | ||
69 | } | ||
70 | table { | ||
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 | } | ||
79 | tr { | ||
80 | margin: 0; | ||
81 | padding: 0; | ||
82 | border: none; | ||
83 | } | ||
84 | td { | ||
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 | } | ||
91 | tr.separate td { | ||
92 | border-top: double; | ||
93 | } | ||
94 | tt, pre, code, kbd, samp { | ||
95 | font-family: monospace; | ||
96 | font-size: 75%; | ||
97 | } | ||
98 | kbd { | ||
99 | font-weight: bolder; | ||
100 | } | ||
101 | blockquote, pre { | ||
102 | margin: 1em 2em; | ||
103 | padding: 0; | ||
104 | } | ||
105 | img { | ||
106 | border: none; | ||
107 | vertical-align: baseline; | ||
108 | margin: 0; | ||
109 | padding: 0; | ||
110 | } | ||
111 | img.left { | ||
112 | float: left; | ||
113 | margin: 0.5em 1em 0.5em 0; | ||
114 | } | ||
115 | img.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 | */ | ||
20 | body { | ||
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 | } | ||
29 | a:link { | ||
30 | text-decoration: none; | ||
31 | background: transparent; | ||
32 | color: #2142bf; | ||
33 | } | ||
34 | a:visited { | ||
35 | text-decoration: none; | ||
36 | background: transparent; | ||
37 | color: #8122bf; | ||
38 | } | ||
39 | a:hover, a:active { | ||
40 | text-decoration: underline; | ||
41 | background: transparent; | ||
42 | color: #ff0000; | ||
43 | } | ||
44 | h1, h2, h3 { | ||
45 | font-weight: bold; | ||
46 | text-align: left; | ||
47 | margin: 0.5em 0; | ||
48 | padding: 0; | ||
49 | background: transparent; | ||
50 | } | ||
51 | h1 { | ||
52 | font-size: 200%; | ||
53 | line-height: 3em; /* really 6em relative to body, match #site span */ | ||
54 | margin: 0; | ||
55 | } | ||
56 | h2 { | ||
57 | font-size: 150%; | ||
58 | color: #606060; | ||
59 | } | ||
60 | h3 { | ||
61 | font-size: 125%; | ||
62 | color: #404040; | ||
63 | } | ||
64 | p { | ||
65 | max-width: 600px; | ||
66 | margin: 0 0 0.5em 0; | ||
67 | padding: 0; | ||
68 | } | ||
69 | ul, ol { | ||
70 | max-width: 600px; | ||
71 | margin: 0.5em 0; | ||
72 | padding: 0 0 0 2em; | ||
73 | } | ||
74 | ul { | ||
75 | list-style: outside square; | ||
76 | } | ||
77 | ol { | ||
78 | list-style: outside decimal; | ||
79 | } | ||
80 | li { | ||
81 | margin: 0; | ||
82 | padding: 0; | ||
83 | } | ||
84 | dl { | ||
85 | max-width: 600px; | ||
86 | margin: 1em 0; | ||
87 | padding: 1em; | ||
88 | border: 1px solid #bfcfff; | ||
89 | background: #f0f4ff; | ||
90 | } | ||
91 | dt { | ||
92 | font-weight: bold; | ||
93 | margin: 0; | ||
94 | padding: 0; | ||
95 | } | ||
96 | dt sup { | ||
97 | float: right; | ||
98 | margin-left: 1em; | ||
99 | color: #808080; | ||
100 | } | ||
101 | dt a:visited { | ||
102 | text-decoration: none; | ||
103 | color: #2142bf; | ||
104 | } | ||
105 | dt a:hover, dt a:active { | ||
106 | text-decoration: none; | ||
107 | color: #ff0000; | ||
108 | } | ||
109 | dd { | ||
110 | margin: 0.5em 0 0 2em; | ||
111 | padding: 0; | ||
112 | } | ||
113 | div.tablewrap { /* for IE *sigh* */ | ||
114 | max-width: 600px; | ||
115 | } | ||
116 | table { | ||
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 | } | ||
126 | tr { | ||
127 | margin: 0; | ||
128 | padding: 0; | ||
129 | border: none; | ||
130 | } | ||
131 | tr.odd { | ||
132 | background: #f0f4ff; | ||
133 | } | ||
134 | tr.separate td { | ||
135 | border-top: 1px solid #bfcfff; | ||
136 | } | ||
137 | td { | ||
138 | text-align: left; | ||
139 | margin: 0; | ||
140 | padding: 0.2em 0.5em; | ||
141 | border: none; | ||
142 | } | ||
143 | tt, code, kbd, samp { | ||
144 | font-family: Courier New, Courier, monospace; | ||
145 | font-size: 110%; | ||
146 | } | ||
147 | kbd { | ||
148 | font-weight: bolder; | ||
149 | } | ||
150 | blockquote, pre { | ||
151 | max-width: 600px; | ||
152 | margin: 1em 2em; | ||
153 | padding: 0; | ||
154 | } | ||
155 | pre { | ||
156 | line-height: 1.1; | ||
157 | } | ||
158 | img { | ||
159 | border: none; | ||
160 | vertical-align: baseline; | ||
161 | margin: 0; | ||
162 | padding: 0; | ||
163 | } | ||
164 | img.left { | ||
165 | float: left; | ||
166 | margin: 0.5em 1em 0.5em 0; | ||
167 | } | ||
168 | img.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">»</span></a> | ||
59 | </li></ul> | ||
60 | </div> | ||
61 | <div id="main"> | ||
62 | <p> | ||
63 | Coco is a small extension to get <strong>True C Coroutine</strong> | ||
64 | semantics for Lua 5.1. | ||
65 | </p> | ||
66 | <p> | ||
67 | Coco is both available as a stand-alone release and integrated | ||
68 | into <a href="luajit.html">LuaJIT</a> 1.x. | ||
69 | </p> | ||
70 | <p> | ||
71 | The stand-alone release is a patchset against the | ||
72 | <a href="http://www.lua.org/ftp/"><span class="ext">»</span> standard Lua 5.1.4</a> | ||
73 | distribution. There are no dependencies on LuaJIT. However LuaJIT 1.x | ||
74 | depends on Coco to allow yielding for JIT compiled functions. | ||
75 | </p> | ||
76 | <p> | ||
77 | Coco is Copyright © 2004-2011 Mike Pall. | ||
78 | Coco is free software, released under the | ||
79 | <a href="http://www.opensource.org/licenses/mit-license.php"><span class="ext">»</span> MIT/X license</a> | ||
80 | (same license as the Lua core). | ||
81 | </p> | ||
82 | <h2>Features</h2> | ||
83 | <p> | ||
84 | True C coroutine semantics mean you can yield from a coroutine | ||
85 | across a C call boundary and resume back to it. | ||
86 | </p> | ||
87 | <p> | ||
88 | Coco allows you to use a dedicated C stack for each coroutine. | ||
89 | Resuming a coroutine and yielding from a coroutine automatically switches | ||
90 | C stacks, too. | ||
91 | </p> | ||
92 | <p> | ||
93 | In 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 functions and resume back to them.</li> | ||
101 | </ul> | ||
102 | <p> | ||
103 | Best of all, you don't need to change your Lua or C sources | ||
104 | and still get the benefits. It's fully integrated into the | ||
105 | Lua core, but tries to minimize the required changes. | ||
106 | </p> | ||
107 | |||
108 | <h2>More ...</h2> | ||
109 | <p> | ||
110 | Please visit the <a href="http://luajit.org/download.html"><span class="ext">»</span> Download</a> page | ||
111 | to fetch the current version of the stand-alone package. | ||
112 | </p> | ||
113 | <p> | ||
114 | Coco needs some machine-specific features — please have a look | ||
115 | at the <a href="coco_portability.html">Portability Requirements</a>. | ||
116 | </p> | ||
117 | <p> | ||
118 | Coco 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"> | ||
125 | Copyright © 2005-2011 Mike Pall | ||
126 | <span class="noprint"> | ||
127 | · | ||
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">»</span></a> | ||
59 | </li></ul> | ||
60 | </div> | ||
61 | <div id="main"> | ||
62 | <p> | ||
63 | Coco changes the semantics of several standard API functions and | ||
64 | provides a few API extensions for Lua. | ||
65 | </p> | ||
66 | <p> | ||
67 | By default all your coroutines get an associated C stack. | ||
68 | If you want to be more selective, see below. | ||
69 | </p> | ||
70 | |||
71 | <h2>Lua API extensions</h2> | ||
72 | <p> | ||
73 | All <tt>coroutine.*</tt> functions should be fully upwards compatible. | ||
74 | </p> | ||
75 | |||
76 | <h3><tt>coroutine.coco</tt></h3> | ||
77 | <p> | ||
78 | This field is <tt>true</tt> when Coco is present (nil otherwise). | ||
79 | </p> | ||
80 | |||
81 | <h3><tt>coro = coroutine.create(f [, cstacksize])<br> | ||
82 | func = coroutine.wrap(f [, cstacksize])</tt></h3> | ||
83 | <p> | ||
84 | The optional argument <tt>cstacksize</tt> specifies the size of the | ||
85 | C 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 | ||
89 | or is nil or zero.</li> | ||
90 | <li>No C 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> | ||
95 | Important notice for LuaJIT: JIT compiled functions cannot | ||
96 | yield if a coroutine does not have a dedicated C stack. | ||
97 | </p> | ||
98 | |||
99 | <h3><tt>olddefault = coroutine.cstacksize([newdefault])</tt></h3> | ||
100 | <p> | ||
101 | Returns the current default C stack size (may be 0 if the | ||
102 | underlying context switch method has its own default). | ||
103 | Sets a new default C stack size if <tt>newdefault</tt> is present. | ||
104 | Use 0 to reset it to the default C stack size. Any other | ||
105 | value is rounded up to the minimum size. | ||
106 | </p> | ||
107 | |||
108 | <h2>C API extensions</h2> | ||
109 | <p> | ||
110 | All C 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> | ||
115 | The semantics for <tt>lua_yield()</tt> have changed slightly. | ||
116 | Existing programs should work fine as long as they follow | ||
117 | the usage conventions from the Lua manual: | ||
118 | </p> | ||
119 | <pre> | ||
120 | return lua_yield(L, nresults); | ||
121 | </pre> | ||
122 | <p> | ||
123 | Previously <tt>lua_yield()</tt> returned a 'magic' value (<tt>-1</tt>) that | ||
124 | indicated a yield. Your C function had to pass this value | ||
125 | on to the Lua core and was <em>not</em> called again. | ||
126 | </p> | ||
127 | <p> | ||
128 | Now, if the current coroutine has an associated C stack, | ||
129 | <tt>lua_yield()</tt> returns the number of arguments passed back from | ||
130 | the resume. This just happens to be the right convention for | ||
131 | returning them as a result from a C function. I.e. if you | ||
132 | used the above convention, you'll never notice the change. | ||
133 | </p> | ||
134 | <p> | ||
135 | But the results <em>are</em> on the Lua stack when <tt>lua_yield()</tt> | ||
136 | returns. So the C function can just continue and process them | ||
137 | or retry an I/O operation etc. And your whole C stack frame | ||
138 | (local variables etc.) is still there, too. You can yield from | ||
139 | anywhere in your C program, even several call levels deeper. | ||
140 | </p> | ||
141 | <p> | ||
142 | Of 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> | ||
147 | This is an (optional) new function that allows you to create | ||
148 | a coroutine with an associated C stack directly from the C API. | ||
149 | Other than that it works the same as <tt>lua_newthread(L)</tt>. | ||
150 | </p> | ||
151 | <p> | ||
152 | You have to declare this function as <tt>extern</tt> | ||
153 | yourself, since it's not part of the official Lua API. | ||
154 | This means that a C module that uses this call cannot | ||
155 | be loaded with standard Lua. This may be intentional. | ||
156 | </p> | ||
157 | <p> | ||
158 | If you want your C module to work with both standard Lua | ||
159 | and 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> | ||
168 | You can create coroutines with a C stack by calling | ||
169 | the 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"> | ||
175 | Copyright © 2005-2011 Mike Pall | ||
176 | <span class="noprint"> | ||
177 | · | ||
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">»</span></a> | ||
59 | </li></ul> | ||
60 | </div> | ||
61 | <div id="main"> | ||
62 | <p> | ||
63 | This is a list of changes between the released versions of Coco. | ||
64 | The current stand-alone release is <strong>Coco 1.1.6</strong>. | ||
65 | </p> | ||
66 | <p> | ||
67 | Please check the | ||
68 | <a href="http://coco.luajit.org/changes.html"><span class="ext">»</span> Online Change History</a> | ||
69 | to see whether newer versions are available. | ||
70 | </p> | ||
71 | |||
72 | <h2 id="Coco-1.1.6">Coco 1.1.6 — 2009-09-08</h2> | ||
73 | <ul> | ||
74 | <li>Fix compilation of the GCC inline assembler code on x64. | ||
75 | Now works when compiled as C++ code (reported by Jonathan Sauer) | ||
76 | or with -fPIC (reported by Jim Pryor).</li> | ||
77 | <li>Added GCC inline assembler for faster context switching on Sparc. | ||
78 | Thanks to Takayuki Usui.</li> | ||
79 | </ul> | ||
80 | |||
81 | <h2 id="Coco-1.1.5">Coco 1.1.5 — 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. | ||
85 | Thanks to Robert G. Jakabosky.</li> | ||
86 | </ul> | ||
87 | |||
88 | <h2 id="Coco-1.1.4">Coco 1.1.4 — 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. | ||
92 | Thanks to the LuaTeX developers.</li> | ||
93 | <li>Fixed setjmp method for x86 on Mac OS X (rarely used, | ||
94 | default is GCC inline assembler). Thanks to Jason Toffaletti.</li> | ||
95 | </ul> | ||
96 | |||
97 | <h2 id="Coco-1.1.3">Coco 1.1.3 — 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 — 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 | ||
107 | the coroutine object is collected. This mainly benefits Windows Fibers.</li> | ||
108 | <li>Windows threads get the required Fiber context when resuming | ||
109 | a coroutine and not just on creation.</li> | ||
110 | </ul> | ||
111 | |||
112 | <h2 id="Coco-1.1.0">Coco 1.1.0 — 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: | ||
118 | Mac 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 | ||
122 | into <tt>lbaselib.c</tt>.<br> | ||
123 | Note 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. | ||
126 | Renamed 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 — 2005-08-09</h2> | ||
131 | <p> | ||
132 | This is the first pre-release of Coco. It targets Lua 5.1-work6 only | ||
133 | and is no longer available for download. | ||
134 | </p> | ||
135 | <br class="flush"> | ||
136 | </div> | ||
137 | <div id="foot"> | ||
138 | <hr class="hide"> | ||
139 | Copyright © 2005-2011 Mike Pall | ||
140 | <span class="noprint"> | ||
141 | · | ||
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"> | ||
12 | table.support { | ||
13 | line-height: 1.2; | ||
14 | width: 25em; | ||
15 | } | ||
16 | tr.supporthead td { | ||
17 | font-weight: bold; | ||
18 | } | ||
19 | td.supportcpu { | ||
20 | width: 6em; | ||
21 | } | ||
22 | td.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">»</span></a> | ||
74 | </li></ul> | ||
75 | </div> | ||
76 | <div id="main"> | ||
77 | <p> | ||
78 | Coco needs some machine-specific features which are | ||
79 | inherently non-portable. Although the coverage is pretty good, | ||
80 | this means that Coco will probably never be a standard part | ||
81 | of the Lua core (which is pure ANSI C). | ||
82 | </p> | ||
83 | |||
84 | <h2>Context Switching Methods</h2> | ||
85 | <p> | ||
86 | Coco relies on four different machine-specific methods | ||
87 | for allocating a C stack and switching context. | ||
88 | The appropriate method is automatically selected at compile time. | ||
89 | </p> | ||
90 | |||
91 | <h3>GCC Inline Assembler</h3> | ||
92 | <p> | ||
93 | This method is only available when GCC 3.x/4.x is used | ||
94 | to compile the source. | ||
95 | This is the fastest method for context switching, but only available | ||
96 | for a few CPUs (see below). | ||
97 | </p> | ||
98 | |||
99 | <h3>Modified setjmp Buffer</h3> | ||
100 | <p> | ||
101 | This method changes a few fields in the setjmp buffer to | ||
102 | redirect the next longjmp to a new function with a new stack | ||
103 | frame. It needs a bit of guesswork and lots of #ifdef's to | ||
104 | handle the supported CPU/OS combinations, but this is quite | ||
105 | manageable. | ||
106 | </p> | ||
107 | <p> | ||
108 | This is the fallback method if inline assembler is not available. | ||
109 | It'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> | ||
115 | The POSIX calls getcontext, makecontext and switchcontext | ||
116 | are used to set up and switch between different C stacks. | ||
117 | Although highly portable and even available for some | ||
118 | esoteric platforms, it's slower than the setjmp method | ||
119 | because it saves and restores signals, too (using at least one | ||
120 | syscall for each context switch). | ||
121 | </p> | ||
122 | <p> | ||
123 | You 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> | ||
129 | This is the standard method to set up and switch between | ||
130 | different C stacks on Windows. It's available on Windows 98 | ||
131 | and later. | ||
132 | </p> | ||
133 | <p> | ||
134 | None of the other methods work for Windows because OS specific code | ||
135 | is required to switch exception handling contexts. | ||
136 | </p> | ||
137 | |||
138 | <h2 class="pagebreak">Supported Platforms</h2> | ||
139 | <p> | ||
140 | Coco 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> | ||
182 | It should work pretty much anywhere where a <em>correct</em> | ||
183 | POSIX ucontext implementation is available. It has been tested | ||
184 | on every systems I could get hold of (e.g. Sparc, PPC32/PPC64, | ||
185 | IA64, Alpha, HPPA with various operating systems). | ||
186 | </p> | ||
187 | |||
188 | <h2>Caveats</h2> | ||
189 | <ul> | ||
190 | <li> | ||
191 | Some older operating systems may have defective ucontext | ||
192 | implementations because this feature is not widely used. E.g. some | ||
193 | implementations don't mix well with other C library functions | ||
194 | like <tt>malloc()</tt> or with native threads. | ||
195 | This is really not the fault of Coco — please upgrade your OS. | ||
196 | </li> | ||
197 | <li> | ||
198 | Note 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">»</span> Thread Stack Size</a> | ||
200 | in case you want to create large numbers of Fiber-based coroutines. | ||
201 | </li> | ||
202 | <li> | ||
203 | Note for MinGW/Cygwin: Older releases of GCC (before 4.0) generate | ||
204 | wrong unwind information when <tt>-fomit-frame-pointer</tt> is used | ||
205 | with stdcalls. This may lead to crashes when exceptions are thrown. | ||
206 | The workaround is to always use two flags:<br> | ||
207 | <tt>-fomit-frame-pointer -maccumulate-outgoing-args</tt>. | ||
208 | </li> | ||
209 | <li> | ||
210 | Note 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 | ||
212 | any floating point ops anywhere. Otherwise context switching must | ||
213 | save and restore FPU registers (which needs to go through | ||
214 | the slow kernel emulation). | ||
215 | </li> | ||
216 | <li> | ||
217 | To run Coco with <a href="http://valgrind.org/"><span class="ext">»</span> Valgrind</a> | ||
218 | (a memory debugger) you <em>must</em> add <tt>-DUSE_VALGRIND</tt> | ||
219 | to <tt>MYCFLAGS</tt> and recompile. You will get random errors | ||
220 | if you don't! Valgrind 3.x or later is required. Earlier versions | ||
221 | do 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"> | ||
228 | Copyright © 2005-2011 Mike Pall | ||
229 | <span class="noprint"> | ||
230 | · | ||
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">»</span></a> | ||
59 | </li></ul> | ||
60 | </div> | ||
61 | <div id="main"> | ||
62 | <p> | ||
63 | Please send general questions regarding LuaJIT or Coco to the | ||
64 | <a href="http://www.lua.org/lua-l.html"><span class="ext">»</span> Lua mailing list</a>. | ||
65 | You can also send any questions you have directly to me: | ||
66 | </p> | ||
67 | |||
68 | <script type="text/javascript"> | ||
69 | <!-- | ||
70 | var xS="@-: .0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZa<b>cdefghijklmnopqrstuvwxyz" | ||
71 | function 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) | ||
74 | c=xS.charAt(66-n);r+=c;} | ||
75 | document.write("<"+"p>"+r+"<"+"/p>\n");} | ||
76 | //--> | ||
77 | </script> | ||
78 | <script type="text/javascript"> | ||
79 | <!-- | ||
80 | xD("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> | ||
89 | All documentation is | ||
90 | Copyright © 2005-2011 Mike Pall. | ||
91 | </p> | ||
92 | |||
93 | |||
94 | <br class="flush"> | ||
95 | </div> | ||
96 | <div id="foot"> | ||
97 | <hr class="hide"> | ||
98 | Copyright © 2005-2011 Mike Pall | ||
99 | <span class="noprint"> | ||
100 | · | ||
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">»</span></a> | ||
59 | </li></ul> | ||
60 | </div> | ||
61 | <div id="main"> | ||
62 | <p> | ||
63 | DynASM is a <strong>Dynamic Assembler</strong> for code generation | ||
64 | engines. | ||
65 | </p> | ||
66 | <p> | ||
67 | DynASM has been developed primarily as a tool for | ||
68 | <a href="luajit.html">LuaJIT</a>, but might be useful for other | ||
69 | projects, too. | ||
70 | </p> | ||
71 | <p> | ||
72 | If you are writing a just-in-time compiler or need to generate | ||
73 | code on the fly (e.g. for high-performance graphics or other | ||
74 | CPU-intensive computations), DynASM might be just what you | ||
75 | are looking for. | ||
76 | </p> | ||
77 | <p> | ||
78 | Please have a look at the list of <a href="dynasm_features.html">Features</a> | ||
79 | to find out whether DynASM could be useful for your project. | ||
80 | </p> | ||
81 | <p> | ||
82 | DynASM is Copyright © 2005-2011 Mike Pall. | ||
83 | DynASM is free software, released under the | ||
84 | <a href="http://www.opensource.org/licenses/mit-license.php"><span class="ext">»</span> MIT/X license</a>. | ||
85 | </p> | ||
86 | |||
87 | <h2>More ...</h2> | ||
88 | <p> | ||
89 | Sorry, right now there is no proper documentation available other | ||
90 | than some <a href="dynasm_examples.html">Examples</a> and of course | ||
91 | the source code. The source <em>is</em> well documented, though (IMHO). | ||
92 | </p> | ||
93 | <p> | ||
94 | I may add more docs in case someone actually finds DynASM to be | ||
95 | useful 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> | ||
99 | If you want to check it out please visit the | ||
100 | <a href="http://luajit.org/download.html"><span class="ext">»</span> Download</a> page and fetch the most recent | ||
101 | version of LuaJIT. All you need is in the dynasm directory. | ||
102 | For 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"> | ||
109 | Copyright © 2005-2011 Mike Pall | ||
110 | <span class="noprint"> | ||
111 | · | ||
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">»</span></a> | ||
59 | </li></ul> | ||
60 | </div> | ||
61 | <div id="main"> | ||
62 | <h2>A Simple Example</h2> | ||
63 | <p> | ||
64 | To get you started, here is a simple code snippet to be pre-processed. | ||
65 | The 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> | ||
75 | After 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%;"> | ||
83 | Note: yes, you usually get the assembler code as comments and proper | ||
84 | CPP directives to match them up with the source. I've omitted | ||
85 | them here for clarity. Oh and BTW: the pipe symbols probably | ||
86 | line up much more nicely in your editor than in a browser. | ||
87 | </p> | ||
88 | <p> | ||
89 | Here 123 is an offset into the action list buffer that | ||
90 | holds the partially specified machine code. Without going | ||
91 | into too much detail, the embedded C library implements a | ||
92 | tiny bytecode engine that takes the action list as input and | ||
93 | outputs machine code. It basically copies machine code snippets | ||
94 | from the action list and merges them with the arguments | ||
95 | passed in by <tt>dasm_put()</tt>. | ||
96 | </p> | ||
97 | <p> | ||
98 | The arguments can be any kind of C expressions. In practical | ||
99 | use most of them evaluate to constants (e.g. structure offsets). | ||
100 | Your C compiler should generate very compact code out of it. | ||
101 | </p> | ||
102 | <p> | ||
103 | The embedded C library knows only what's absolutely needed to | ||
104 | generate proper machine code for the target CPU (e.g. variable | ||
105 | displacement sizes, variable branch offset sizes and so on). | ||
106 | It doesn't have a clue about other atrocities like x86 opcode | ||
107 | encodings — and it doesn't need to. This dramatically | ||
108 | reduces the minimum required code size to around 2K [sic!]. | ||
109 | </p> | ||
110 | <p> | ||
111 | The action list buffer itself has a pretty compact encoding, too. | ||
112 | E.g. the whole action list buffer for an early version of LuaJIT | ||
113 | needs only around 3K. | ||
114 | </p> | ||
115 | |||
116 | <h2>Advanced Features</h2> | ||
117 | <p> | ||
118 | Here's a real-life example taken from LuaJIT that shows some | ||
119 | advanced features like type maps, macros and how to access | ||
120 | C 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 | |||
151 | static 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> | ||
160 | And here is the pre-processed output (stripped a bit for clarity): | ||
161 | </p> | ||
162 | <pre> | ||
163 | #define Dt1(_V) (int)&(((lua_State *)0)_V) | ||
164 | [...] | ||
165 | static 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"> | ||
181 | Copyright © 2005-2011 Mike Pall | ||
182 | <span class="noprint"> | ||
183 | · | ||
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">»</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 code.</li> | ||
66 | <li>The primary knowledge about instruction names, operand modes, | ||
67 | registers, opcodes and how to encode them is <em>only</em> | ||
68 | needed in the pre-processor.</li> | ||
69 | <li>The generated C code is extremely small and fast.</li> | ||
70 | <li>A tiny embeddable C library helps with the process of dynamically | ||
71 | assembling, relocating and linking machine code.</li> | ||
72 | <li>There are no outside dependencies on other tools (such as | ||
73 | stand-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 | ||
77 | CPU-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. | ||
80 | It 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 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 | ||
89 | you come to expect from a standard assembler.</li> | ||
90 | <li>Access to C variables and CPP defines in assembler statements.</li> | ||
91 | <li>Access to C structures and unions via type mapping.</li> | ||
92 | <li>Convenient shortcuts for accessing C 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 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> | ||
106 | Currently only a subset of x86 (i386+) instructions is supported. | ||
107 | Unsupported instructions are either not usable in user-mode or | ||
108 | are slow on modern CPUs (i.e. not suited for a code generator). | ||
109 | SSE, SSE2, SSE3 and SSSE3 are fully supported. MMX is not supported. | ||
110 | </p> | ||
111 | <p> | ||
112 | The whole toolchain has been designed to support multiple CPU | ||
113 | architectures. As LuaJIT gets support for more architectures, | ||
114 | DynASM will be extended with new CPU-specific modules. | ||
115 | </p> | ||
116 | <p> | ||
117 | The assembler itself will be extended with more features on an | ||
118 | as-needed basis. E.g. I'm thinking about vararg macros. | ||
119 | </p> | ||
120 | <p> | ||
121 | Note that runtime conditionals are not really needed, since you can | ||
122 | just use plain C code for that (and LuaJIT does this <em>a lot</em>). | ||
123 | It's not going to be more (time-) efficient if conditionals are done | ||
124 | by the embedded C 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"> | ||
132 | Copyright © 2005-2011 Mike Pall | ||
133 | <span class="noprint"> | ||
134 | · | ||
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">»</span></a> | ||
59 | </li></ul> | ||
60 | </div> | ||
61 | <div id="main"> | ||
62 | <p> | ||
63 | This is the offline documentation for: | ||
64 | </p> | ||
65 | <ul> | ||
66 | <li> | ||
67 | <a href="luajit.html">LuaJIT</a> — | ||
68 | a <strong>Just-In-Time Compiler</strong> for Lua. | ||
69 | </li> | ||
70 | <li> | ||
71 | <a href="coco.html">Coco</a> — | ||
72 | a Lua extension for <strong>True C Coroutines</strong>. | ||
73 | </li> | ||
74 | <li> | ||
75 | <a href="dynasm.html">DynASM</a> — | ||
76 | a <strong>Dynamic Assembler</strong> for code generation engines. | ||
77 | </li> | ||
78 | </ul> | ||
79 | |||
80 | |||
81 | |||
82 | <h2>More ...</h2> | ||
83 | <p> | ||
84 | Please click on one of the links in the navigation bar to your left | ||
85 | to learn more. | ||
86 | </p> | ||
87 | <p> | ||
88 | Click on the Logo in the upper left corner to visit | ||
89 | the LuaJIT project page on the web. All other links to online | ||
90 | resources are marked with a '<span class="ext">»</span>'. | ||
91 | </p> | ||
92 | <br class="flush"> | ||
93 | </div> | ||
94 | <div id="foot"> | ||
95 | <hr class="hide"> | ||
96 | Copyright © 2005-2011 Mike Pall | ||
97 | <span class="noprint"> | ||
98 | · | ||
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">»</span></a> | ||
59 | </li></ul> | ||
60 | </div> | ||
61 | <div id="main"> | ||
62 | <p> | ||
63 | LuaJIT is a <strong>Just-In-Time Compiler</strong> for the Lua | ||
64 | programming language. | ||
65 | </p> | ||
66 | <p class="indent"> | ||
67 | Lua is a powerful, light-weight programming language designed | ||
68 | for extending applications. Lua is also frequently used as a | ||
69 | general-purpose, stand-alone language. More information about | ||
70 | Lua can be found at: <a href="http://www.lua.org/"><span class="ext">»</span> http://www.lua.org/</a> | ||
71 | </p> | ||
72 | <p> | ||
73 | LuaJIT 1.x is based on the Lua 5.1.x virtual machine and bytecode interpreter | ||
74 | from lua.org. It compiles bytecode to native x86 (i386+) machine code | ||
75 | to speed up the execution of Lua programs. | ||
76 | </p> | ||
77 | <p> | ||
78 | LuaJIT depends on <a href="coco.html">Coco</a> to allow yielding | ||
79 | from coroutines for JIT compiled functions. Coco is part of the | ||
80 | LuaJIT distribution. | ||
81 | </p> | ||
82 | <p> | ||
83 | LuaJIT is Copyright © 2005-2011 Mike Pall. | ||
84 | LuaJIT is free software, released under the | ||
85 | <a href="http://www.opensource.org/licenses/mit-license.php"><span class="ext">»</span> MIT/X license</a> | ||
86 | (same license as the Lua core). | ||
87 | </p> | ||
88 | <h2>More ...</h2> | ||
89 | <p> | ||
90 | Click on the LuaJIT sub-topics in the navigation bar to learn more | ||
91 | about LuaJIT. | ||
92 | </p> | ||
93 | <p style="background: #ffd0d0; text-align: center;"> | ||
94 | LuaJIT 2.0 is available with much improved performance!<br> | ||
95 | Please visit the <a href="http://luajit.org/download.html"><span class="ext">»</span> Download</a> page to fetch | ||
96 | the current version of LuaJIT. | ||
97 | </p> | ||
98 | <br class="flush"> | ||
99 | </div> | ||
100 | <div id="foot"> | ||
101 | <hr class="hide"> | ||
102 | Copyright © 2005-2011 Mike Pall | ||
103 | <span class="noprint"> | ||
104 | · | ||
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"> | ||
12 | td.stname { width: 10em; } | ||
13 | tr.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">»</span></a> | ||
63 | </li></ul> | ||
64 | </div> | ||
65 | <div id="main"> | ||
66 | <p> | ||
67 | LuaJIT provides several new API functions organized into two | ||
68 | libraries. | ||
69 | </p> | ||
70 | <p> | ||
71 | LuaJIT includes Coco — 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> | ||
77 | All standard library functions have the same behaviour as | ||
78 | in the Lua distribution LuaJIT is based on. | ||
79 | </p> | ||
80 | <p> | ||
81 | The Lua loader used by the standard <tt>require()</tt> library | ||
82 | function has been modified to turn off compilation of the main | ||
83 | chunk of a module. The main chunk is only run once when the module | ||
84 | is loaded for the first time. There is no point in compiling it. | ||
85 | </p> | ||
86 | <p> | ||
87 | You might want to adapt this behaviour if you use your own utility | ||
88 | functions (and not <tt>require()</tt>) to load modules. | ||
89 | </p> | ||
90 | <p> | ||
91 | Note that the subfunctions defined in a loaded module <em>are</em> | ||
92 | of course compiled. See below if you want to override this. | ||
93 | </p> | ||
94 | |||
95 | <h2>The jit.* Library</h2> | ||
96 | <p> | ||
97 | This library holds several functions to control the behaviour | ||
98 | of the JIT engine. | ||
99 | </p> | ||
100 | |||
101 | <h3 id="jit_onoff"><tt>jit.on()<br> | ||
102 | jit.off()</tt></h3> | ||
103 | <p> | ||
104 | Turns the JIT engine on (default) or off. | ||
105 | </p> | ||
106 | <p> | ||
107 | These 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> | ||
112 | jit.off(func|true [,true|false])</tt></h3> | ||
113 | <p> | ||
114 | Enable (with <tt>jit.on</tt>, default) or disable (with <tt>jit.off</tt>) | ||
115 | JIT compilation for a Lua function. The current function (the Lua function | ||
116 | calling this library function) can be specified with <tt>true</tt>. | ||
117 | </p> | ||
118 | <p> | ||
119 | If the second argument is <tt>true</tt>, JIT compilation is also | ||
120 | enabled/disabled recursively for all subfunctions of a function. | ||
121 | With <tt>false</tt> only the subfunctions are affected. | ||
122 | </p> | ||
123 | <p> | ||
124 | Both library functions only set a flag which is checked when | ||
125 | the function is executed for the first/next time. They do not | ||
126 | trigger immediate compilation. | ||
127 | </p> | ||
128 | <p> | ||
129 | Typical usage is <tt>jit.off(true, true)</tt> in the main chunk | ||
130 | of a module to turn off JIT compilation for the whole module. | ||
131 | Note that <tt>require()</tt> already turns off compilation for | ||
132 | the main chunk itself. | ||
133 | </p> | ||
134 | |||
135 | <h3 id="jit_compile"><tt>status = jit.compile(func [,args...])</tt></h3> | ||
136 | <p> | ||
137 | Compiles a Lua function and returns the compilation status. | ||
138 | Successful compilation is indicated with a <tt>nil</tt> status. | ||
139 | Failure is indicated with a numeric status (see <tt>jit.util.status</tt>). | ||
140 | </p> | ||
141 | <p> | ||
142 | The optimizer pass of the compiler tries to derive hints from the | ||
143 | passed arguments. Not passing any arguments or passing untypical | ||
144 | arguments (esp. the wrong types) reduces the efficiency of the | ||
145 | optimizer. The compiled function will still run, but probably not | ||
146 | with maximum speed. | ||
147 | </p> | ||
148 | <p> | ||
149 | This library function is typically used for Ahead-Of-Time (AOT) | ||
150 | compilation 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> | ||
155 | Recursively compile all subfunctions of a Lua function. | ||
156 | The current function (the Lua function calling this library function) | ||
157 | can 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> | ||
161 | If the second argument is <tt>true</tt>, compilation will stop | ||
162 | when the first error is encountered. Otherwise compilation will | ||
163 | continue with the next subfunction. | ||
164 | </p> | ||
165 | <p> | ||
166 | The returned status is <tt>nil</tt>, if all subfunctions have been | ||
167 | compiled successfully. A numeric status (see <tt>jit.util.status</tt>) | ||
168 | indicates that at least one compilation failed and gives the status | ||
169 | of the last failure (this is only helpful when stop on error | ||
170 | is <tt>true</tt>). | ||
171 | </p> | ||
172 | |||
173 | <h3 id="jit_debug"><tt>jit.debug([level])</tt></h3> | ||
174 | <p> | ||
175 | Set the debug level for JIT compilation. If no <tt>level</tt> is given, | ||
176 | the maximum debug level is set. | ||
177 | </p> | ||
178 | <ul> | ||
179 | <li>Level 0 disables debugging: no checks for hooks are compiled | ||
180 | into the code. This is the default when LuaJIT is started and | ||
181 | provides the maximum performance.</li> | ||
182 | <li>Level 1 enables function call debugging: call hooks and | ||
183 | return hooks are checked in the function prologue and epilogue. | ||
184 | This slows down function calls somewhat (by up to 10%).</li> | ||
185 | <li>Level 2 enables full debugging: all hooks are checked. | ||
186 | This slows down execution quite a bit, even when the hooks | ||
187 | are not active.</li> | ||
188 | </ul> | ||
189 | <p> | ||
190 | Note that some compiler optimizations are turned off when | ||
191 | debugging is enabled. | ||
192 | </p> | ||
193 | <p> | ||
194 | This 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> | ||
200 | Attach a handler to the compiler pipeline with the given priority. | ||
201 | The handler is detached if no priority is given. | ||
202 | </p> | ||
203 | <p> | ||
204 | The inner workings of the compiler pipeline and the API for handlers | ||
205 | are 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> | ||
210 | Contains the LuaJIT version string. | ||
211 | </p> | ||
212 | |||
213 | <h3 id="jit_version_num"><tt>jit.version_num</tt></h3> | ||
214 | <p> | ||
215 | Contains the version number of the LuaJIT core. Version xx.yy.zz | ||
216 | is represented by the decimal number xxyyzz. | ||
217 | </p> | ||
218 | |||
219 | <h3 id="jit_arch"><tt>jit.arch</tt></h3> | ||
220 | <p> | ||
221 | Contains the target architecture name (CPU and optional ABI). | ||
222 | </p> | ||
223 | |||
224 | |||
225 | <h2 id="jit_util">The jit.util.* Library</h2> | ||
226 | <p> | ||
227 | This library holds many utility functions used by the provided | ||
228 | extension modules for LuaJIT (e.g. the optimizer). The API may | ||
229 | change in future versions. | ||
230 | </p> | ||
231 | |||
232 | <h3 id="jit_util_stats"><tt>stats = jit.util.stats(func)</tt></h3> | ||
233 | <p> | ||
234 | Retrieves information about a function. Returns <tt>nil</tt> | ||
235 | for C functions. Returns a table with the following fields for | ||
236 | Lua 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 | ||
253 | function 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> | ||
258 | Returns the fields of the bytecode instruction at the given <tt>pc</tt> | ||
259 | for a Lua function. The first instruction is at <tt>pc</tt> = 1. | ||
260 | Nothing is returned if <tt>pc</tt> is out of range. | ||
261 | </p> | ||
262 | <p> | ||
263 | The opcode name is returned as an uppercase string in <tt>op</tt>. | ||
264 | The opcode arguments are returned as <tt>a</tt>, <tt>b</tt> and | ||
265 | optionally <tt>c</tt>. Arguments that indicate an index into the | ||
266 | array of constants are translated to negative numbers (the first | ||
267 | constant is referred to with -1). Branch targets are signed numbers | ||
268 | relative to the next instruction. | ||
269 | </p> | ||
270 | <p> | ||
271 | <tt>test</tt> is true if the instruction is a test (i.e. followed | ||
272 | by a JMP). | ||
273 | </p> | ||
274 | |||
275 | <h3 id="jit_util_const"><tt>const, ok = jit.util.const(func, idx)</tt></h3> | ||
276 | <p> | ||
277 | Returns 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 | ||
279 | is returned. | ||
280 | </p> | ||
281 | <p> | ||
282 | Constants are numbered starting with 1. A negative <tt>idx</tt> | ||
283 | is 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> | ||
288 | Returns 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 | ||
290 | is 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> | ||
295 | Returns the number of upvalues for the subfunction prototype with | ||
296 | the given index <tt>idx</tt> for a Lua function. Nothing is returned | ||
297 | if <tt>idx</tt> is out of range. Subfunctions are numbered starting | ||
298 | with 0. | ||
299 | </p> | ||
300 | |||
301 | <h3 id="jit_util_mcode"><tt>addr, mcode, mfmiter = jit.util.mcode(func, block])</tt></h3> | ||
302 | <p> | ||
303 | Returns the numeric start address, the compiled machine code | ||
304 | (converted to a string) and an iterator for the machine code fragment map | ||
305 | for the specified machine code block associated with a Lua function. | ||
306 | </p> | ||
307 | <p> | ||
308 | Returns <tt>nil</tt> and a numeric status code (see <tt>jit.util.status</tt>) | ||
309 | if the function has not been compiled yet or compilation has failed | ||
310 | or compilation is disabled. Returns nothing if the selected | ||
311 | machine code block does not exist. | ||
312 | </p> | ||
313 | <p> | ||
314 | The machine code fragment map is used for debugging and error handling. | ||
315 | The format may change between versions and is an internal implementation | ||
316 | detail of LuaJIT. | ||
317 | </p> | ||
318 | |||
319 | <h3 id="jit_util_jsubmcode"><tt>addr [, mcode] = jit.util.jsubmcode([idx])</tt></h3> | ||
320 | <p> | ||
321 | If <tt>idx</tt> is omitted or nil: | ||
322 | Returns the numeric start address and the compiled machine code | ||
323 | (converted to a string) for internal subroutines used by the | ||
324 | compiled machine code. | ||
325 | </p> | ||
326 | <p> | ||
327 | If <tt>idx</tt> is given: | ||
328 | Returns the numeric start address of the machine code for a specific | ||
329 | internal subroutine (0 based). Nothing is returned if <tt>idx</tt> is | ||
330 | out of range. | ||
331 | </p> | ||
332 | |||
333 | <h3 id="jit_util_status"><tt>jit.util.status</tt></h3> | ||
334 | <p> | ||
335 | This is a table that bidirectionally maps status numbers and | ||
336 | status 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> | ||
353 | jit.util.fhints</tt></h3> | ||
354 | <p> | ||
355 | These two tables map compiler hint names to internal hint numbers. | ||
356 | </p> | ||
357 | <p> | ||
358 | The hint system is an internal implementation detail of LuaJIT. | ||
359 | Please see the source code for more info. | ||
360 | </p> | ||
361 | <br class="flush"> | ||
362 | </div> | ||
363 | <div id="foot"> | ||
364 | <hr class="hide"> | ||
365 | Copyright © 2005-2011 Mike Pall | ||
366 | <span class="noprint"> | ||
367 | · | ||
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">»</span></a> | ||
59 | </li></ul> | ||
60 | </div> | ||
61 | <div id="main"> | ||
62 | <p> | ||
63 | This is a list of changes between the released versions of LuaJIT. | ||
64 | The current version is <strong>LuaJIT 1.1.7</strong>. | ||
65 | </p> | ||
66 | <p> | ||
67 | Please check the | ||
68 | <a href="http://luajit.org/changes.html"><span class="ext">»</span> Online Change History</a> | ||
69 | to see whether newer versions are available. | ||
70 | </p> | ||
71 | |||
72 | <h2 id="LuaJIT-1.1.7">LuaJIT 1.1.7 — 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">»</span> currently known bugs in Lua 5.1.4</a>.</li> | ||
76 | </ul> | ||
77 | |||
78 | <h2 id="LuaJIT-1.1.6">LuaJIT 1.1.6 — 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">»</span> currently known bugs in Lua 5.1.4</a>.</li> | ||
82 | <li>Removed wrong GC check in <tt>jit_createstate()</tt>. | ||
83 | Thanks 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 — 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">»</span> known bugs in Lua 5.1.3</a>.</li> | ||
92 | </ul> | ||
93 | |||
94 | <h2 id="LuaJIT-1.1.4">LuaJIT 1.1.4 — 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">»</span> 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 — 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">»</span> 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 trace=-</tt>).</li> | ||
114 | </ul> | ||
115 | |||
116 | <h2 id="LuaJIT-1.1.2">LuaJIT 1.1.2 — 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: | ||
121 | make values of consts used as lightuserdata keys unique | ||
122 | to avoid joining by the compiler/linker.</li> | ||
123 | </ul> | ||
124 | |||
125 | <h2 id="LuaJIT-1.1.1">LuaJIT 1.1.1 — 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">»</span> 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 | ||
131 | for some immediates.</li> | ||
132 | </ul> | ||
133 | <p> | ||
134 | This 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 — 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). | ||
145 | Mandatory 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 | ||
148 | OP_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 | ||
154 | forwarding stalls.</li> | ||
155 | <li>Use (scalar) SSE2 ops (if the CPU supports it) to speed up slot moves | ||
156 | and 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>). | ||
159 | With 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 | ||
161 | use <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 | ||
169 | supports index chains, too.</li> | ||
170 | <li>Generate type hints for arithmetic and comparison operators, | ||
171 | OP_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 | ||
180 | instruction is recompiled and patched on-the-fly. | ||
181 | Regular programs will trigger deoptimization only occasionally.</li> | ||
182 | <li>This avoids generating code for uncommon fallback cases | ||
183 | most of the time. Generated code is up to 30% smaller compared to | ||
184 | LuaJIT 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, | ||
191 | OP_FORPREP: operand type and range mismatches.</li> | ||
192 | </ul></li> | ||
193 | <li>Complete redesign of the debug and traceback info | ||
194 | (bytecode ↔ mcode) to support deoptimization. | ||
195 | Much 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> | ||
218 | and <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 | ||
222 | on ndisasm anymore. Flexible API, very compact (500 lines) | ||
223 | and complete (x87, MMX, SSE, SSE2, SSE3, SSSE3, privileged instructions).</li> | ||
224 | <li><tt>luajit -v</tt> prints the LuaJIT version and copyright | ||
225 | on 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> | ||
233 | This 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 — 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> | ||
246 | This is the first public release of LuaJIT. | ||
247 | </p> | ||
248 | |||
249 | <h2 id="LuaJIT-1.0.2">LuaJIT 1.0.2 — 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 | ||
254 | variant for POSIX systems.</li> | ||
255 | <li>Reorganized the C function signature handling in | ||
256 | <tt>jit.opt_lib</tt>.</li> | ||
257 | <li>Changed to index-based hints for inlining C functions. | ||
258 | Still 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> | ||
266 | Not released because Lua 5.1 alpha came out today. | ||
267 | </p> | ||
268 | |||
269 | <h2 id="LuaJIT-1.0.1">LuaJIT 1.0.1 — 2005-08-31</h2> | ||
270 | <ul> | ||
271 | <li>Missing GC step in <tt>OP_CONCAT</tt>.</li> | ||
272 | <li>Fix result handling for C –> 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> | ||
282 | Interim non-public release. | ||
283 | Special 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 — 2005-08-29</h2> | ||
287 | <p> | ||
288 | This is the initial non-public release of LuaJIT. | ||
289 | </p> | ||
290 | <br class="flush"> | ||
291 | </div> | ||
292 | <div id="foot"> | ||
293 | <hr class="hide"> | ||
294 | Copyright © 2005-2011 Mike Pall | ||
295 | <span class="noprint"> | ||
296 | · | ||
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">»</span></a> | ||
59 | </li></ul> | ||
60 | </div> | ||
61 | <div id="main"> | ||
62 | <p> | ||
63 | LuaJIT is a rather complex application. There will undoubtedly | ||
64 | be bugs lurking in there. You have been warned. :-) | ||
65 | </p> | ||
66 | <p> | ||
67 | If you came here looking for information on how to debug | ||
68 | <em>your application</em> (and not LuaJIT itself) then please | ||
69 | check out <a href="luajit_api.html#jit_debug"><tt>jit.debug()</tt></a> | ||
70 | and the <a href="luajit_run.html#j_debug"><tt>-j debug</tt></a> | ||
71 | command line option. | ||
72 | </p> | ||
73 | <p> | ||
74 | But if you suspect a problem with LuaJIT itself, then try | ||
75 | any of the following suggestions (in order). | ||
76 | </p> | ||
77 | |||
78 | <h2>Is LuaJIT the Problem?</h2> | ||
79 | <p> | ||
80 | Try 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> | ||
90 | If the behaviour is the <em>same</em> as with standard Lua then ... | ||
91 | well ... that's what LuaJIT is about: doing the same things, | ||
92 | just faster. Even bugs fly faster. :-) | ||
93 | </p> | ||
94 | <p> | ||
95 | So this is most likely a bug in your application then. It may be easier | ||
96 | to debug this with plain Lua — the remainder of this page | ||
97 | is probably not helpful for you. | ||
98 | </p> | ||
99 | <p> | ||
100 | But if the behaviour is <em>different</em>, there is some likelihood | ||
101 | that you caught a bug in LuaJIT. Oh dear ... | ||
102 | </p> | ||
103 | <p> | ||
104 | Ok, so don't just give up. Please read on and help the community | ||
105 | by finding the bug. Thank you! | ||
106 | </p> | ||
107 | |||
108 | <h2>Get the Latest Version</h2> | ||
109 | <p> | ||
110 | Number one on your list of things to check is the | ||
111 | <a href="http://luajit.org/luajit_changes.html"><span class="ext">»</span> Online Change History</a>. | ||
112 | </p> | ||
113 | <p> | ||
114 | Please check if a newer version is available. Maybe the bug | ||
115 | you have encountered has been fixed already. Always download the | ||
116 | latest version and try it with your application before continuing. | ||
117 | </p> | ||
118 | |||
119 | <h2>Reproduce the Bug</h2> | ||
120 | <p> | ||
121 | First try to make the bug reproducible. Try to isolate the module | ||
122 | and the function the bug occurs in: | ||
123 | </p> | ||
124 | <p> | ||
125 | Either selectively turn off compilation for some modules with<br> | ||
126 | <tt> jit.off(true, true)</tt><br> | ||
127 | until the bug disappears ... | ||
128 | </p> | ||
129 | <p> | ||
130 | And/or turn the whole JIT engine off and selectively compile | ||
131 | functions with<br> | ||
132 | <tt> jit.compile(func)</tt><br> | ||
133 | until it reappears. | ||
134 | </p> | ||
135 | <p> | ||
136 | If you have isolated the point where it happens, it's most helpful | ||
137 | to reduce the affected Lua code to a short code snippet that | ||
138 | still shows the problem. You may need to <tt>print()</tt> some | ||
139 | variables until you can pinpoint the exact spot where it happens. | ||
140 | </p> | ||
141 | <p> | ||
142 | If you've got a <em>reproducible</em> and <em>short</em> test | ||
143 | you can either send it directly to me or the mailing list | ||
144 | (see the <a href="contact.html">Contact Information</a>) | ||
145 | or you can try to debug this a bit further. | ||
146 | </p> | ||
147 | <p> | ||
148 | Well — if you are brave enough. :-) | ||
149 | </p> | ||
150 | |||
151 | <h2>Look at the Generated Code</h2> | ||
152 | <p> | ||
153 | You may want to have a look at the output of <tt>-j dumphints</tt> | ||
154 | first. Try to change things around until you can see which hint | ||
155 | or which instruction is the cause of the bug. If you suspect | ||
156 | an optimizer bug then have a look at the backend (<tt>*.das[ch]</tt>) | ||
157 | and check how the hint is encoded. | ||
158 | </p> | ||
159 | <p> | ||
160 | Otherwise have a look at <tt>-j dump</tt> and see whether | ||
161 | you can spot the problem around the affected instruction. | ||
162 | It's helpful to have a good knowledge of assembler, though | ||
163 | (sorry). | ||
164 | </p> | ||
165 | |||
166 | <h2>Locate a Crash</h2> | ||
167 | <p> | ||
168 | If you get a crash, you should compile LuaJIT with debugging | ||
169 | turned on: | ||
170 | </p> | ||
171 | <p> | ||
172 | Add <tt>-g</tt> to <tt>CFLAGS</tt> and <tt>MYLDFLAGS</tt> | ||
173 | or whatever is needed to turn on debugging. For Windows you | ||
174 | need both an executable and a DLL built with debugging. | ||
175 | </p> | ||
176 | <p> | ||
177 | Then start LuaJIT with your debugger. Run it with | ||
178 | <tt>-j dump=test.dump</tt>. | ||
179 | </p> | ||
180 | <p> | ||
181 | Have a look at the backtrace and compare it with the generated | ||
182 | dump file to find out exactly where it crashes. I'm sorry, but | ||
183 | symbols or instructions for JIT compiled functions are not | ||
184 | displayed in your debugger (this is really hard to solve). | ||
185 | </p> | ||
186 | |||
187 | <h2>Turn on Assertions</h2> | ||
188 | <p> | ||
189 | Another way to debug LuaJIT is to turn on assertions. | ||
190 | They 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>. | ||
192 | Then recompile with <tt>make clean</tt> and <tt>make</tt>. | ||
193 | </p> | ||
194 | <p> | ||
195 | Add these two lines to <tt>src/luaconf.h</tt> to turn on all assertions in the Lua core:<br> | ||
196 | <tt> #include <assert.h></tt><br> | ||
197 | <tt> #define lua_assert(x) assert(x)</tt><br> | ||
198 | This turns on the JIT engine assertions, too. | ||
199 | Recompile and see whether any assertions trigger. | ||
200 | Don't forget to turn off the (slow) assertions when you're done! | ||
201 | </p> | ||
202 | |||
203 | <h2>Use Valgrind</h2> | ||
204 | <p> | ||
205 | A tremendously useful (and free) tool for runtime code analysis | ||
206 | is <a href="http://valgrind.org/"><span class="ext">»</span> Valgrind</a>. Regularly | ||
207 | run your applications with <tt>valgrind --memcheck</tt> and | ||
208 | your life will be better. | ||
209 | </p> | ||
210 | <p> | ||
211 | To run LuaJIT under Valgrind you <em>must</em> add | ||
212 | <tt>-DUSE_VALGRIND</tt> to <tt>MYCFLAGS</tt> | ||
213 | and recompile LuaJIT. You will get random errors if you don't! | ||
214 | Valgrind 3.x or later is required. Earlier versions | ||
215 | do not work well with newly allocated C stacks. | ||
216 | </p> | ||
217 | <p> | ||
218 | An executable built with this option runs fine without Valgrind | ||
219 | and without a performance loss. But it needs the Valgrind header | ||
220 | files for compilation (which is why it's not enabled by default). | ||
221 | </p> | ||
222 | <p> | ||
223 | It's helpful to compile LuaJIT with debugging turned on, too | ||
224 | (see above). | ||
225 | </p> | ||
226 | <p> | ||
227 | If Valgrind spots many invalid memory accesses that involve | ||
228 | memory allocation/free functions you've probably found a bug | ||
229 | related to garbage collection. Some object reference must have | ||
230 | gone astray. | ||
231 | </p> | ||
232 | <p> | ||
233 | Try to find out which object is disappearing. You can force | ||
234 | eager garbage collection with repeated calls to | ||
235 | <tt>collectgarbage()</tt> or by setting a very low threshold | ||
236 | with <tt>collectgarbage("setpause", 1)</tt>. | ||
237 | </p> | ||
238 | |||
239 | <h2>Don't Despair</h2> | ||
240 | <p> | ||
241 | If all of this doesn't help to find the bug, please send | ||
242 | a summary of your findings to the mailing list. Describe as much | ||
243 | of the circumstances you think are relevant. | ||
244 | </p> | ||
245 | <p> | ||
246 | Please <em>don't</em> send your whole application to me | ||
247 | (without asking first) and especially not to the mailing list. | ||
248 | Code snippets should preferrably be less than 50 lines and | ||
249 | up to the point. | ||
250 | </p> | ||
251 | <p> | ||
252 | All bug reports are helpful, even if no immediate solution | ||
253 | is available. Often enough someone else finds the same bug | ||
254 | in a different setting and together with your bug report | ||
255 | this may help to track it down. | ||
256 | </p> | ||
257 | <p> | ||
258 | Finally I have to say a <strong>BIG THANK YOU</strong> | ||
259 | to everyone who has helped to make LuaJIT better by finding | ||
260 | and fixing bugs! | ||
261 | </p> | ||
262 | <br class="flush"> | ||
263 | </div> | ||
264 | <div id="foot"> | ||
265 | <hr class="hide"> | ||
266 | Copyright © 2005-2011 Mike Pall | ||
267 | <span class="noprint"> | ||
268 | · | ||
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">»</span></a> | ||
59 | </li></ul> | ||
60 | </div> | ||
61 | <div id="main"> | ||
62 | <p> | ||
63 | LuaJIT tries to keep the spirit of Lua — it's <em>light-weight</em>, | ||
64 | <em>efficient</em> and <em>extensible</em>. | ||
65 | </p> | ||
66 | |||
67 | <h2>Features</h2> | ||
68 | <p> | ||
69 | All functions are by default compiled Just-In-Time (JIT) to | ||
70 | machine 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 | ||
75 | functions and subfunctions or even whole modules.</li> | ||
76 | <li>Interpreted and compiled functions can be freely mixed.</li> | ||
77 | </ul> | ||
78 | <p> | ||
79 | Ahead-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 | ||
83 | full user control over the compilation process.</li> | ||
84 | </ul> | ||
85 | <p> | ||
86 | The JIT compiler is extensible: | ||
87 | </p> | ||
88 | <ul> | ||
89 | <li>The optimizer is an extra module that attaches to the compiler | ||
90 | pipeline.</li> | ||
91 | <li>Various modules provide trace and debug information about | ||
92 | the 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> | ||
98 | The 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 | ||
104 | wherever possible. Inlined contracts catch wrong optimizer predictions | ||
105 | at runtime (undetected polymorphism).</li> | ||
106 | <li>Adaptive deoptimization is used to recompile individual bytecode | ||
107 | instructions with broken contracts. This avoids generating code for the | ||
108 | generic fallback cases most of the time (faster compilation, reduced | ||
109 | I-cache contention).</li> | ||
110 | <li>Special CPU features (such as conditional moves or SSE2) | ||
111 | are automatically used when detected.</li> | ||
112 | </ul> | ||
113 | <p> | ||
114 | The JIT compiler is <em>very fast</em>: | ||
115 | </p> | ||
116 | <ul> | ||
117 | <li>Compilation times vary a great deal (depending on the nature of | ||
118 | the 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 | ||
121 | maximum optimization level takes only a few milliseconds in the | ||
122 | worst case.</li> | ||
123 | </ul> | ||
124 | <p> | ||
125 | LuaJIT is <em>very small</em>: | ||
126 | </p> | ||
127 | <ul> | ||
128 | <li>The whole JIT compiler engine adds only around <strong>32K</strong> | ||
129 | of code to the Lua core (if compiled with <tt>-Os</tt>).</li> | ||
130 | <li>The optimizer is split into several optional modules that | ||
131 | can be loaded at runtime if requested.</li> | ||
132 | <li>LuaJIT adds around 6.000 lines of C and assembler code and | ||
133 | 2.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>) | ||
135 | take another 2.500 lines of Lua code.</li> | ||
136 | </ul> | ||
137 | |||
138 | <h2>Compatibility</h2> | ||
139 | <p> | ||
140 | LuaJIT is designed to be <em>fully compatible</em> with Lua 5.1. | ||
141 | It accepts the same source code and/or precompiled bytecode. | ||
142 | It 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. | ||
150 | Proper 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> | ||
158 | into an application just like Lua.</li> | ||
159 | </ul> | ||
160 | <p> | ||
161 | Some 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. | ||
166 | HOOKTAILRET is not called, too. Note: this won't affect you unless | ||
167 | you 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 | ||
171 | complications. A suggestion to modify the behaviour of standard Lua | ||
172 | has 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 | ||
181 | debug hooks (with <tt>-j debug</tt>). But this will seriously | ||
182 | slow down your application. I'm looking for better ways to handle | ||
183 | this. In the meantime you have to press Ctrl-C twice to interrupt | ||
184 | a currently running JIT compiled function (just like C functions).</li> | ||
185 | <li>GDB, Valgrind and other debugging tools can't report symbols | ||
186 | or stack frames for JIT compiled code. This is rather difficult to solve. | ||
187 | Have 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 | ||
193 | if your OS has support for it: either <tt>HeapCreate()</tt> for Windows or | ||
194 | <tt>mmap()</tt> on POSIX systems.<br> | ||
195 | The fallback is the standard Lua allocator (i.e. malloc()). | ||
196 | But this usually means the allocated memory is not marked executable. | ||
197 | Running compiled code will trap on CPUs/OS with the NX (No eXecute) | ||
198 | extension <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> | ||
201 | the <tt>*.dasc</tt>/<tt>*.dash</tt> files. A pre-processed <tt>*.h</tt> | ||
202 | file is supplied with LuaJIT.<br> | ||
203 | DynASM 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 | ||
205 | the <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 | ||
207 | a known good copy of LuaJIT under a different name for this.</li> | ||
208 | <li>LuaJIT ships with <tt>LUA_COMPAT_VARARG</tt> turned off. | ||
209 | I.e. the implicit <tt>arg</tt> parameter is not created anymore. | ||
210 | Please have a look at the comments in <tt>luaconf.h</tt> for | ||
211 | this configuration option. You can turn it on, if you really need it. | ||
212 | Or 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"> | ||
219 | Copyright © 2005-2011 Mike Pall | ||
220 | <span class="noprint"> | ||
221 | · | ||
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"> | ||
12 | table.build { | ||
13 | line-height: 1.2; | ||
14 | } | ||
15 | td.buildsys { | ||
16 | width: 11em; | ||
17 | } | ||
18 | td.buildcmd { | ||
19 | width: 10em; | ||
20 | font-family: Courier New, Courier, monospace; | ||
21 | } | ||
22 | tr.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">»</span></a> | ||
76 | </li></ul> | ||
77 | </div> | ||
78 | <div id="main"> | ||
79 | <p> | ||
80 | LuaJIT is not much more difficult to install than Lua itself. | ||
81 | Just unpack the distribution file, change into the newly created | ||
82 | directory and follow the instructions below. | ||
83 | </p> | ||
84 | <p class="indent"> | ||
85 | For the impatient: <b><tt>make linux && sudo make install</tt></b><br> | ||
86 | Replace <tt>linux</tt> with e.g. <tt>bsd</tt> or <tt>macosx</tt> depending on your OS. | ||
87 | </p> | ||
88 | <p> | ||
89 | In case you've missed this in <a href="luajit_features.html">Features</a>: | ||
90 | LuaJIT only works on x86 (i386+) systems right now. Support for | ||
91 | other architectures may be added in future versions. | ||
92 | </p> | ||
93 | |||
94 | <h2>Configuring LuaJIT</h2> | ||
95 | <p> | ||
96 | LuaJIT is (deliberately) <em>not</em> autoconfigured — the | ||
97 | defaults should work fine on most systems. But please check the | ||
98 | system-specific instructions below. | ||
99 | </p> | ||
100 | <p> | ||
101 | The 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 | ||
107 | variables.</li> | ||
108 | </ul> | ||
109 | <p> | ||
110 | If this is your first build then it's better not to give into | ||
111 | the temptation to tweak every little setting. The standard | ||
112 | configuration provides sensible defaults (IMHO). | ||
113 | </p> | ||
114 | <p> | ||
115 | One particular setting you might want to change is the installation | ||
116 | path. Note that you need to modify both the top-level <tt>Makefile</tt> | ||
117 | and <tt>src/luaconf.h</tt> (right at the start) to take | ||
118 | effect. | ||
119 | </p> | ||
120 | <p> | ||
121 | If you have trouble getting Coco to work, you can disable it by | ||
122 | uncommenting the <tt>COCOFLAGS= -DCOCO_DISABLE</tt> line in | ||
123 | <tt>src/Makefile</tt>. But note that this effectively disables | ||
124 | yielding from coroutines for JIT compiled functions. | ||
125 | </p> | ||
126 | <p> | ||
127 | A few more settings need to be changed if you want to | ||
128 | <a href="luajit_debug.html">Debug LuaJIT</a> <em>itself</em>. | ||
129 | Application debugging can be turned on/off at runtime. | ||
130 | </p> | ||
131 | |||
132 | <h3>Upgrading From Previous Versions</h3> | ||
133 | <p> | ||
134 | It's important to keep the LuaJIT core and the add-on modules in sync. | ||
135 | Be sure to delete any old versions of LuaJIT modules from the | ||
136 | Lua module search path (check the current directory, too!). | ||
137 | </p> | ||
138 | <p> | ||
139 | Lua files compiled to bytecode may be incompatible if the underlying | ||
140 | Lua core has changed (like from Lua 5.1 alpha to Lua 5.1 | ||
141 | final between LuaJIT 1.0.3 and LuaJIT 1.1.0). The same | ||
142 | applies to any | ||
143 | <a href="http://lua-users.org/wiki/BuildingModules"><span class="ext">»</span> loadable C modules</a> | ||
144 | (shared libraries, DLLs) which need to be recompiled with the new | ||
145 | Lua header files. | ||
146 | </p> | ||
147 | <p> | ||
148 | Compiled bytecode and loadable C modules are fully compatible and | ||
149 | can be freely exchanged between LuaJIT and the <em>same</em> | ||
150 | version of Lua it is based on. Please verify that <tt>LUA_RELEASE</tt> | ||
151 | in <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> | ||
158 | The 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 < 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> | ||
176 | You may want to enable interactive line editing for the stand-alone | ||
177 | executable. There are extra targets for Linux, BSD and Mac OS X: | ||
178 | <tt>make linux_rl</tt>, <tt>make bsd_rl</tt> | ||
179 | and <tt>make macosx_rl</tt>. | ||
180 | </p> | ||
181 | |||
182 | <h3>MSVC (Win32)</h3> | ||
183 | <p> | ||
184 | First check out <tt>etc\luavs.bat</tt> if it suits your needs. Then try | ||
185 | running it from the MSVC command prompt (start it from the toplevel directory). | ||
186 | </p> | ||
187 | <p> | ||
188 | Another option is to set up your own MSVC project: | ||
189 | </p> | ||
190 | <p> | ||
191 | Change to the <tt>src</tt> directory | ||
192 | and create a new DLL project for <tt>lua51.dll</tt>. | ||
193 | Add all C files to it except for <tt>lua.c</tt>, <tt>luac.c</tt> | ||
194 | and <tt>print.c</tt>. Add the <tt>..\dynasm</tt> directory | ||
195 | to the include path and build the DLL. | ||
196 | </p> | ||
197 | <p> | ||
198 | Next create a new EXE project for <tt>luajit.exe</tt>. | ||
199 | Add <tt>lua.c</tt> to it and link with the import library | ||
200 | <tt>lua51.lib</tt> created for <tt>lua51.dll</tt>. Build | ||
201 | the executable. | ||
202 | </p> | ||
203 | |||
204 | <h2>Installation</h2> | ||
205 | |||
206 | <h3>POSIX systems</h3> | ||
207 | <p> | ||
208 | Run <tt>make install</tt> from the top-level directory. | ||
209 | You probably need to be the root user before doing so, i.e. use | ||
210 | <tt>sudo make install</tt> or <tt>su - root</tt> | ||
211 | before the <tt>make install</tt>. | ||
212 | </p> | ||
213 | <p> | ||
214 | By default this installs only:<br> | ||
215 | <tt> /usr/local/bin/<strong>luajit</strong></tt> — The stand-alone executable.<br> | ||
216 | <tt> /usr/local/lib/lua/5.1</tt> — C module directory.<br> | ||
217 | <tt> /usr/local/share/lua/5.1</tt> — Lua module directory.<br> | ||
218 | <tt> /usr/local/share/lua/5.1/<strong>jit/*.lua</strong></tt> — | ||
219 | <tt>jit.*</tt> modules.<br> | ||
220 | </p> | ||
221 | <p> | ||
222 | The Lua docs and includes are not installed to avoid overwriting | ||
223 | an existing Lua installation. In any case these are identical | ||
224 | to the version of Lua that LuaJIT is based on. If you want | ||
225 | to install them, edit the top-level makefile (look for <tt>###</tt>). | ||
226 | </p> | ||
227 | <p> | ||
228 | The stand-alone Lua bytecode compiler <tt>luac</tt> is neither | ||
229 | built nor installed, for the same reason. If you really need it, | ||
230 | you may be better off with <tt>luac</tt> built from the original Lua | ||
231 | distribution (use the <em>same</em> version your copy of LuaJIT | ||
232 | is based on). This avoids dragging in most of LuaJIT which is not | ||
233 | needed for the pure bytecode compiler. You can also use the bare-bones | ||
234 | Lua to bytecode translator <tt>luac.lua</tt> (look in the <tt>test</tt> | ||
235 | directory of the original Lua distribution). | ||
236 | </p> | ||
237 | |||
238 | <h3>Windows</h3> | ||
239 | <p> | ||
240 | Copy <tt>luajit.exe</tt> and <tt>lua51.dll</tt> | ||
241 | to a newly created directory (any location is ok). Add <tt>lua</tt> | ||
242 | and <tt>lua\jit</tt> directories below it and copy all Lua files | ||
243 | from the <tt>jit</tt> directory of the distribution to the latter directory. | ||
244 | </p> | ||
245 | <p> | ||
246 | There are no hardcoded | ||
247 | absolute path names — all modules are loaded relative to the | ||
248 | directory 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> | ||
254 | It's strongly recommended that you build the stand-alone executable | ||
255 | with your toolchain and verify that it works <em>before</em> starting | ||
256 | to embed LuaJIT into an application. The stand-alone executable is | ||
257 | also useful later on, when you want to experiment with code snippets | ||
258 | or try out some Lua files. | ||
259 | </p> | ||
260 | <p> | ||
261 | Please consult the Lua docs for general information about how to | ||
262 | embed Lua into your application. The following list only shows | ||
263 | the 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. | ||
268 | The modified <tt>src/linit.c</tt> used by the stand-alone executable | ||
269 | already does this for you.</li> | ||
270 | <li><em>Caveat:</em> LuaJIT is based on Lua 5.1 which | ||
271 | means the <tt>luaopen_*()</tt> functions <em>must not</em> | ||
272 | be called directly. See <tt>src/linit.c</tt> for the proper way to | ||
273 | run them. You'll get an error initializing the <tt>io</tt> library | ||
274 | if 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 — 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 | ||
283 | embed the optimizer modules into your application (but don't loose | ||
284 | time with this during the early development phase). This involves: | ||
285 | <ul> | ||
286 | <li>Compile the two modules to bytecode | ||
287 | (using <tt>luac -s</tt> from a plain Lua installation).</li> | ||
288 | <li>Convert them to C include files (search for "Lua bin2c").</li> | ||
289 | <li>On Windows you can also put the compiled bytecode into a resource | ||
290 | (search for "Lua 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> | ||
293 | and <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> require("jit.opt").start()</tt><br> | ||
297 | Or 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. | ||
300 | They do not need to be shipped with an application. But they may be quite | ||
301 | useful, anyway (especially <tt>jit.trace</tt>).</li> | ||
302 | <li>DynASM is only needed while <em>building</em> LuaJIT. It's not | ||
303 | needed while running LuaJIT and there is no point in shipping or | ||
304 | installing it together with an application.</li> | ||
305 | <li>In case you want to strip some of the standard libraries from | ||
306 | your application: The optimizer modules need several functions from | ||
307 | the base library and the string library (and of course the LuaJIT | ||
308 | core libraries). The io library is only used to print a fatal error | ||
309 | message (you may want to replace it). The optional modules | ||
310 | for debugging depend on a few more library functions — | ||
311 | please check the source.</li> | ||
312 | </ul> | ||
313 | <p> | ||
314 | Although the very liberal LuaJIT | ||
315 | <a href="http://www.opensource.org/licenses/mit-license.php"><span class="ext">»</span> license</a> | ||
316 | does not require any acknowledgment whatsoever, it would be appreciated | ||
317 | if you give some credit in the docs (or the "About" box) of your application. | ||
318 | A simple line like:<br> | ||
319 | <tt> This product includes LuaJIT, http://luajit.org/</tt><br> | ||
320 | would be nice. Please do not include any E-Mail addresses. Thank you! | ||
321 | </p> | ||
322 | <p> | ||
323 | I'm always interested where LuaJIT can be put to good use in applications. | ||
324 | Please <a href="contact.html">tell me</a> | ||
325 | or better yet write a few lines about your project to the | ||
326 | <a href="http://www.lua.org/lua-l.html"><span class="ext">»</span> Lua mailing list</a>. | ||
327 | Thank you! | ||
328 | </p> | ||
329 | <br class="flush"> | ||
330 | </div> | ||
331 | <div id="foot"> | ||
332 | <hr class="hide"> | ||
333 | Copyright © 2005-2011 Mike Pall | ||
334 | <span class="noprint"> | ||
335 | · | ||
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">»</span></a> | ||
59 | </li></ul> | ||
60 | </div> | ||
61 | <div id="main"> | ||
62 | <p> | ||
63 | This is a little essay that tries to answer the question: | ||
64 | <em>'So, how does LuaJIT really work?'</em>. | ||
65 | </p> | ||
66 | <p> | ||
67 | I tried to avoid going into all the gory details, but at the | ||
68 | same time provide a deep enough explanation, to let you find | ||
69 | your way around LuaJIT's inner workings. | ||
70 | </p> | ||
71 | <p> | ||
72 | The learning curve is maybe a little bit steep for newbies and | ||
73 | compiler gurus will certainly fall asleep after two paragraphs. | ||
74 | It's difficult to strike a balance here. | ||
75 | </p> | ||
76 | |||
77 | <h2>Acronym Soup</h2> | ||
78 | <p> | ||
79 | As the name says LuaJIT is a <em>Just-In-Time</em> (JIT) compiler. | ||
80 | This means that functions are compiled on demand, i.e. when they | ||
81 | are run first. This ensures both a quick application startup | ||
82 | and helps to avoid useless work, too. E.g. unused functions | ||
83 | are not compiled at all. | ||
84 | </p> | ||
85 | <p> | ||
86 | The other alternative is known as <em>Ahead-Of-Time</em> (AOT) | ||
87 | compilation. Here everything is compiled before running any function. | ||
88 | This is the classic way for many languages, such as C or C++. | ||
89 | </p> | ||
90 | <p> | ||
91 | In fact plain Lua allows you to pre-compile Lua source code into | ||
92 | Lua bytecode and store it in a binary file that can be run | ||
93 | later on. This is used only in specific settings (e.g. memory limited | ||
94 | embedded systems), because the Lua bytecode compiler is really fast. | ||
95 | The ability to run source files right away is part of what makes | ||
96 | a dynamic language (aka scripting language) so powerful. | ||
97 | </p> | ||
98 | <p> | ||
99 | JIT compilation has a few other advantages for dynamic languages | ||
100 | that AOT compilation can only provide with a massive amount | ||
101 | of code analysis. More can be found in the literature. | ||
102 | One particular advantage is explained later. | ||
103 | </p> | ||
104 | |||
105 | <h2>Quick, JIT — Run!</h2> | ||
106 | <p> | ||
107 | JIT compilation happens mostly invisible. You'll probably never | ||
108 | notice that a compilation is going on. Part of the secret is | ||
109 | that everything happens in little pieces intermixed with running | ||
110 | the application itself inbetween. The other part of the secret | ||
111 | is that JIT compilation can be made pretty fast. | ||
112 | </p> | ||
113 | <p> | ||
114 | Most applications quickly converge to a stable state where | ||
115 | everything that really needs to be compiled is compiled | ||
116 | right away. Only occasional isolated compiles happen later on. | ||
117 | </p> | ||
118 | <p> | ||
119 | Even though the name doesn't suggest it, LuaJIT <em>can</em> operate | ||
120 | in AOT mode, too. But this is completely under user control | ||
121 | (see <a href="luajit_api.html#jit_compile"><tt>jit.compile()</tt></a>) | ||
122 | and doesn't happen automatically. | ||
123 | </p> | ||
124 | <p> | ||
125 | Unless you have good reason to suspect that AOT compilation | ||
126 | might help for a specific application, I wouldn't bother though. | ||
127 | Compilation speed is usually a non-argument, because LuaJIT | ||
128 | is 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> | ||
134 | The next few paragraphs may not be exactly breaking news to you, | ||
135 | if you are familiar with JIT compilers. Still, please read on, | ||
136 | because some terms are introduced that are used later on. | ||
137 | </p> | ||
138 | <p> | ||
139 | When you start LuaJIT everything proceeds like in standard Lua: | ||
140 | the Lua core is initialized, the standard libraries are loaded and | ||
141 | the command line is analyzed. Then usually the first Lua source | ||
142 | code file is loaded and is translated to Lua bytecode. And finally | ||
143 | the function for the initial main chunk is run ... | ||
144 | </p> | ||
145 | |||
146 | <h2>Kicking the Compiler</h2> | ||
147 | <p> | ||
148 | This is where LuaJIT kicks in: | ||
149 | </p> | ||
150 | <p> | ||
151 | All Lua functions carry an additional <em>status code</em> for LuaJIT. | ||
152 | Initially this is set to 'NONE', i.e. the function has not been | ||
153 | looked at (yet). If a function is run with this setting, | ||
154 | the LuaJIT <em>compiler pipeline</em> is started up. | ||
155 | </p> | ||
156 | <p> | ||
157 | If you haven't loaded any special LuaJIT modules and optimization | ||
158 | is not turned on, the compiler pipeline only consists of the | ||
159 | <em>compiler backend</em>. | ||
160 | </p> | ||
161 | <p> | ||
162 | The compiler backend is the low-level encoding engine that translates | ||
163 | bytecode instructions to machine code instructions. Without any | ||
164 | further hints from other modules, the backend more or less does a | ||
165 | 1:1 translation. I.e. a single variant of a bytecode instruction | ||
166 | corresponds to a single piece of machine code. | ||
167 | </p> | ||
168 | <p> | ||
169 | If all goes well, these little code pieces are put together, | ||
170 | a function prologue is slapped on and voila: your Lua function | ||
171 | has been translated to machine code. Of course things are not | ||
172 | that simple when you look closer, but hey — this is | ||
173 | the theory. | ||
174 | </p> | ||
175 | <p> | ||
176 | Anyway, the status code for the function is set to 'OK' and the | ||
177 | machine code is run. If this function runs another Lua function | ||
178 | which has not been compiled, that one is compiled, too. And so on. | ||
179 | </p> | ||
180 | |||
181 | <h2>Call Gates</h2> | ||
182 | <p> | ||
183 | Ok, so what happens when a function is called repeatedly? After all | ||
184 | this is the most common case. | ||
185 | </p> | ||
186 | <p> | ||
187 | Simple: The status code is checked again. This time it's set to 'OK', | ||
188 | so the machine code can be run directly. Well — that's not the | ||
189 | whole truth: for calls that originate in a JIT compiled function | ||
190 | a better mechanism, tentatively named <em>call gates</em> is used. | ||
191 | </p> | ||
192 | <p> | ||
193 | Every function has a call gate field (a function pointer). By default | ||
194 | it's set to a function that does the above checks and runs the | ||
195 | compiler. But as soon as a function is compiled, the call gate | ||
196 | is modified to point to the just compiled machine code. | ||
197 | </p> | ||
198 | <p> | ||
199 | Calling a function is then as easy as calling the code that the | ||
200 | call gate points to. But due to special (faster) calling conventions | ||
201 | this function pointer cannot be used directly from C. So calls from | ||
202 | a non-compiled function or from a C function use an extra entry | ||
203 | call gate which in turn calls the real call gate. But this is | ||
204 | really a non-issue since most calls in typical applications | ||
205 | are intra-JIT calls. | ||
206 | </p> | ||
207 | |||
208 | <h2>The Compiler Pipeline</h2> | ||
209 | <p> | ||
210 | The compiler pipeline has already been mentioned. This sounds | ||
211 | more complicated than it is. Basically this is a coroutine that | ||
212 | runs a <em>frontend</em> function which in turn calls all functions | ||
213 | from the <em>pipeline table</em>. | ||
214 | </p> | ||
215 | <p> | ||
216 | The pipeline table is sorted by <em>priorities</em>. The standard | ||
217 | backend has priority 0. Positive priorities are run before the | ||
218 | backend and negative priorities are run after the backend. Modules | ||
219 | can dynamically attach or detach themselves to the pipeline with | ||
220 | the library function <tt>jit.attach()</tt>. | ||
221 | </p> | ||
222 | <p> | ||
223 | So a typical optimizer pass better have a positive priority, | ||
224 | because it needs to be run before the backend is run. E.g. the | ||
225 | LuaJIT optimizer module registers itself with priority 50. | ||
226 | </p> | ||
227 | <p> | ||
228 | On the other hand a typical helper module for debugging — | ||
229 | a machine code disassembler — needs to be run after the | ||
230 | backend and is attached with a negative priority. | ||
231 | </p> | ||
232 | <p> | ||
233 | One special case occurs when compilation fails. This can be due to | ||
234 | an internal error (ouch) or on purpose. E.g. the optimizer module | ||
235 | checks some characteristics of the function to be compiled and | ||
236 | may decide that it's just not worth it. In this case a status | ||
237 | other than OK is passed back to the pipeline frontend. | ||
238 | </p> | ||
239 | <p> | ||
240 | The easiest thing would be to abort pipeline processing and just | ||
241 | give up. But this would remove the ability to trace the progress | ||
242 | of the compiler (which better include failed compilations, too). | ||
243 | So there is a special rule that odd priorities are still run, | ||
244 | but even priorities are not. That's why e.g. <tt>-j trace</tt> | ||
245 | registers itself with priority -99. | ||
246 | </p> | ||
247 | |||
248 | <h2>The Optimizer</h2> | ||
249 | <p> | ||
250 | Maybe it hasn't become clear from the above description, | ||
251 | but a module can attach any Lua or C function to the compiler | ||
252 | pipeline. In fact all of the loadable modules are Lua modules. | ||
253 | Only the backend itself is written in C. | ||
254 | </p> | ||
255 | <p> | ||
256 | So, yes — the LuaJIT optimizer is written in pure Lua! | ||
257 | </p> | ||
258 | <p> | ||
259 | And no, don't worry, it's quite fast. One reason for this is | ||
260 | that a very simple <em>abstract interpretation</em> algorithm | ||
261 | is used. It mostly ignores control flow and/or basic block | ||
262 | boundaries. | ||
263 | </p> | ||
264 | <p> | ||
265 | Thus the results of the analysis are really only <em>hints</em>. | ||
266 | The backend <em>must</em> check the preconditions (the contracts) | ||
267 | for these hints (e.g. the object type). Still, the generated | ||
268 | hints are pretty accurate and quite useful to speed up the | ||
269 | compiled code (see below). | ||
270 | </p> | ||
271 | <p> | ||
272 | Explaining how abstract interpretation works is not within the | ||
273 | scope for this short essay. You may want to have a look at the | ||
274 | optimizer source code and/or read some articles or books on | ||
275 | this topic. The canonical reference is | ||
276 | <a href="http://www2.imm.dtu.dk/~riis/PPA/ppa.html"><span class="ext">»</span> Principles of Program Analysis</a>. | ||
277 | Ok, so this one is a bit more on the theoretical side (a gross | ||
278 | understatement). Try a search engine with the keywords "abstract | ||
279 | interpretation", too. | ||
280 | </p> | ||
281 | <p> | ||
282 | Suffice to say the optimizer generates hints and passes these | ||
283 | on to the backend. The backend then decides to encode different | ||
284 | forms for the same bytecode instruction, to combine several | ||
285 | instructions or to inline code for C functions. If the hints | ||
286 | from the optimizer are good, the resulting code will perform | ||
287 | better because shorter code paths are used for the typical cases. | ||
288 | </p> | ||
289 | |||
290 | <h2>The JIT Advantage</h2> | ||
291 | <p> | ||
292 | One important feature of the optimizer is that it takes 'live' | ||
293 | function arguments into account. Since the JIT compiler is | ||
294 | called just before the function is run, the arguments for this | ||
295 | first invocation are already present. This can be used to great | ||
296 | advantage in a <em>dynamically typed language</em>, such as Lua. | ||
297 | </p> | ||
298 | <p> | ||
299 | Here's a trivial example: | ||
300 | </p> | ||
301 | <pre> | ||
302 | function foo(t, k) | ||
303 | return t[k] | ||
304 | end | ||
305 | </pre> | ||
306 | <p> | ||
307 | Without knowing the most likely arguments for the function | ||
308 | there's not much to optimize. | ||
309 | </p> | ||
310 | <p> | ||
311 | Ok, so 't' is most likely a table. But it could be userdata, too. | ||
312 | In fact it could be any type since the introduction of generic | ||
313 | metatables for types. | ||
314 | </p> | ||
315 | <p> | ||
316 | And more importantly 'k' can be a number, a string | ||
317 | or any other type. Oh and let's not forget about metamethods ... | ||
318 | </p> | ||
319 | <p> | ||
320 | If you know a bit about Lua internals, it should be clear by now | ||
321 | that the code for this function could potentially branch to half | ||
322 | of the Lua core. And it's of course impossible to inline all | ||
323 | these cases. | ||
324 | </p> | ||
325 | <p> | ||
326 | On the other hand if it's <em>known</em> (or there's a good hint) | ||
327 | that 't' is a table and that 'k' is a positive integer, then there | ||
328 | is a high likeliness that the key 'k' is in the array part | ||
329 | of the table. This lookup can be done with just a few machine code | ||
330 | instructions. | ||
331 | </p> | ||
332 | <p> | ||
333 | Of course the preconditions for this fast path have to be checked | ||
334 | (unless there are definitive hints). But if the hints are right, | ||
335 | the code runs a lot faster (about a factor of 3 in this case | ||
336 | for the pure table lookup). | ||
337 | </p> | ||
338 | |||
339 | <h2>Optimizing the Optimizer</h2> | ||
340 | <p> | ||
341 | A question that surely popped up in your mind while reading | ||
342 | the above section: does the optimizer optimize itself? I.e. | ||
343 | is the optimizer module compiled? | ||
344 | </p> | ||
345 | <p> | ||
346 | The current answer is no. Mainly because the compiler pipeline | ||
347 | is single-threaded only. It's locked during compilation and | ||
348 | any parallel attempt to JIT compile a function results in | ||
349 | a 'DELAYED' status code. In fact all modules that attach to | ||
350 | the compiler pipeline disable compilation for the entire | ||
351 | module (because LuaJIT would do that anyway). The main chunk | ||
352 | of modules loaded with <tt>require()</tt> is never compiled, | ||
353 | so there is no chicken-and-egg problem here. | ||
354 | </p> | ||
355 | <p> | ||
356 | Of course you could do an AOT compilation in the main chunk of | ||
357 | the optimizer module. But then only with the plain backend. | ||
358 | Recompiling it later on with the optimizer attached doesn't work, | ||
359 | because a function cannot be compiled twice (I plan to lift | ||
360 | this restriction). | ||
361 | </p> | ||
362 | <p> | ||
363 | The other question is whether it pays off to compile the optimizer | ||
364 | at all? Honestly, I haven't tried, because the current optimizer | ||
365 | is really simple. It runs very quickly, even under the bytecode | ||
366 | interpreter. | ||
367 | </p> | ||
368 | |||
369 | <h2>That's All Folks</h2> | ||
370 | <p> | ||
371 | Ok, that's all for now. I'll extend this text later on with | ||
372 | new topics that come up in questions. Keep on asking these | ||
373 | on the mailing list if you are interested. | ||
374 | </p> | ||
375 | <p> | ||
376 | Thank you for your attention! | ||
377 | </p> | ||
378 | <br class="flush"> | ||
379 | </div> | ||
380 | <div id="foot"> | ||
381 | <hr class="hide"> | ||
382 | Copyright © 2005-2011 Mike Pall | ||
383 | <span class="noprint"> | ||
384 | · | ||
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"> | ||
12 | table.bench { | ||
13 | line-height: 1.2; | ||
14 | } | ||
15 | tr.benchhead td { | ||
16 | font-weight: bold; | ||
17 | } | ||
18 | td img, li img { | ||
19 | vertical-align: middle; | ||
20 | } | ||
21 | td.barhead, td.bar { | ||
22 | font-size: 8pt; | ||
23 | font-family: Courier New, Courier, monospace; | ||
24 | width: 360px; | ||
25 | padding: 0; | ||
26 | } | ||
27 | td.bar { | ||
28 | background: url('img/backbar.png'); | ||
29 | } | ||
30 | td.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">»</span></a> | ||
82 | </li></ul> | ||
83 | </div> | ||
84 | <div id="main"> | ||
85 | <p> | ||
86 | Here are some performance measurements, based on a few benchmarks. | ||
87 | </p> | ||
88 | <p style="background: #ffd0d0; text-align: center;"> | ||
89 | LuaJIT 2.0 is available with much improved performance!<br> | ||
90 | Please check the new | ||
91 | <a href="http://luajit.org/performance.html"><span class="ext">»</span> interactive performance comparison</a>. | ||
92 | </p> | ||
93 | |||
94 | <h2 id="interpretation">Interpreting the Results</h2> | ||
95 | <p> | ||
96 | As is always the case with benchmarks, care must be taken to | ||
97 | interpret the results: | ||
98 | </p> | ||
99 | <p> | ||
100 | First, the standard Lua interpreter is already <em>very</em> fast. | ||
101 | It's commonly the fastest of it's class (interpreters) in the | ||
102 | <a href="http://shootout.alioth.debian.org/"><span class="ext">»</span> Great Computer Language Shootout</a>. | ||
103 | Only true machine code compilers get a better overall score. | ||
104 | </p> | ||
105 | <p> | ||
106 | Any performance improvements due to LuaJIT can only be incremental. | ||
107 | You can't expect a speedup of 50x if the fastest compiled language | ||
108 | is only 5x faster than interpreted Lua in a particular benchmark. | ||
109 | LuaJIT can't do miracles. | ||
110 | </p> | ||
111 | <p> | ||
112 | Also please note that most of the benchmarks below are <em>not</em> | ||
113 | trivial micro-benchmarks, which are often cited with marvelous numbers. | ||
114 | Micro-benchmarks do not realistically model the performance gains you | ||
115 | can expect in your own programs. | ||
116 | </p> | ||
117 | <p> | ||
118 | It's easy to make up a few one-liners like:<br> | ||
119 | <tt> local function f(...) end; for i=1,1e7 do f() end</tt><br> | ||
120 | This is more than 30x faster with LuaJIT. But you won't find | ||
121 | this in a real-world program. | ||
122 | </p> | ||
123 | |||
124 | <h2 id="methods">Measurement Methods</h2> | ||
125 | <p> | ||
126 | All measurements have been taken on a Pentium III 1.139 GHz | ||
127 | running Linux 2.6. Both Lua and LuaJIT have been compiled with | ||
128 | GCC 3.3.6 with <tt>-O3 -fomit-frame-pointer</tt>. | ||
129 | You'll definitely get different results on different machines or | ||
130 | with different C compiler options. <sup>*</sup> | ||
131 | </p> | ||
132 | <p> | ||
133 | The 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 | ||
135 | and has been adjusted to minimize the variation between several runs. | ||
136 | The ratio between the times for LuaJIT and Lua gives the speedup. | ||
137 | Only this number is shown because it's less dependent on a specific system. | ||
138 | </p> | ||
139 | <p> | ||
140 | E.g. a speedup of 6.74 means the same benchmark runs almost 7 times | ||
141 | faster with <tt>luajit -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 | ||
146 | like table and string handling. All of this is written in C and | ||
147 | should be compiled with full optimization turned on, or performance | ||
148 | will suffer. | ||
149 | </p> | ||
150 | |||
151 | <h2 id="lua_luajit" class="pagebreak">Comparing Lua to LuaJIT</h2> | ||
152 | <p> | ||
153 | Here is a comparison using the current benchmark collection of the | ||
154 | <a href="http://shootout.alioth.debian.org/"><span class="ext">»</span> 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> | ||
259 | Note that many of these benchmarks have changed over time (both spec | ||
260 | and code). Benchmark results shown in previous versions of LuaJIT | ||
261 | are not directly comparable. The next section compares different | ||
262 | versions with the current set of benchmarks. | ||
263 | </p> | ||
264 | |||
265 | <h2 id="luajit_versions" class="pagebreak">Comparing LuaJIT Versions</h2> | ||
266 | <p> | ||
267 | This shows the improvements between the following versions: | ||
268 | </p> | ||
269 | <ul> | ||
270 | <li>LuaJIT 1.0.x <img src="img/bluebar.png" width="30" height="12" alt="(===)"></li> | ||
271 | <li>LuaJIT 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 → 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 → 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 → 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 → 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 → 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 → 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 → 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 → 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 → 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 → 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 → 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> | ||
341 | All other benchmarks show only minor performance differences. | ||
342 | </p> | ||
343 | |||
344 | <h2 id="summary">Summary</h2> | ||
345 | <p> | ||
346 | These results should give you an idea about what speedup | ||
347 | you can expect depending on the nature of your Lua code: | ||
348 | </p> | ||
349 | <ul> | ||
350 | <li> | ||
351 | LuaJIT is really good at (floating-point) math and loops | ||
352 | (mandelbrot, pidigits, spectralnorm, partialsums). | ||
353 | </li> | ||
354 | <li> | ||
355 | Function calls (recursive), vararg calls, table lookups (nbody), | ||
356 | table iteration and coroutine switching (chameneos, cheapconc) | ||
357 | are a lot faster than with plain Lua. | ||
358 | </li> | ||
359 | <li> | ||
360 | It's still pretty good for indexed table access (fannkuch, nsieve) | ||
361 | and string processing (fasta, revcomp, knucleotide). | ||
362 | But there is room for improvement in a future version. | ||
363 | </li> | ||
364 | <li> | ||
365 | If your application spends most of the time in C code | ||
366 | you won't see much of a difference (regexdna, sumfile). | ||
367 | Ok, so write more code in pure Lua. :-) | ||
368 | </li> | ||
369 | <li> | ||
370 | The 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 | ||
373 | and 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> | ||
380 | The best idea is of course to benchmark your <em>own</em> applications. | ||
381 | Please 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"> | ||
387 | Copyright © 2005-2011 Mike Pall | ||
388 | <span class="noprint"> | ||
389 | · | ||
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">»</span></a> | ||
59 | </li></ul> | ||
60 | </div> | ||
61 | <div id="main"> | ||
62 | <p> | ||
63 | LuaJIT has only a single stand-alone executable, called <tt>luajit</tt>. | ||
64 | It can be used to run simple Lua statements or whole Lua applications | ||
65 | from 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 | ||
69 | in an external module | ||
70 | (see <a href="luajit_install.html">Installing LuaJIT</a>). | ||
71 | It'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> | ||
76 | The <tt>luajit</tt> stand-alone executable is just a slightly modified | ||
77 | version of the regular <tt>lua</tt> stand-alone executable. | ||
78 | It supports the same basic options, too. Please have a look at the | ||
79 | <a href="../doc/lua.html">Manual Page</a> | ||
80 | for the regular <tt>lua</tt> stand-alone executable. | ||
81 | </p> | ||
82 | <p> | ||
83 | Two additional options control LuaJIT behaviour: | ||
84 | </p> | ||
85 | |||
86 | <h3 id="opt_j"><tt>-j cmd[=value]</tt></h3> | ||
87 | <p> | ||
88 | This option performs a LuaJIT control command. LuaJIT has a small | ||
89 | but extensible set of control commands. It's easy to add your own. | ||
90 | </p> | ||
91 | <p> | ||
92 | The command is first searched for in the <tt>jit.*</tt> library. | ||
93 | If no matching function is found, a module named <tt>jit.<cmd></tt> | ||
94 | is loaded. The module table must provide a <tt>start()</tt> function. | ||
95 | </p> | ||
96 | <p> | ||
97 | For the <tt>-j cmd</tt> form the function is called without an argument. | ||
98 | Otherwise the <tt>value</tt> is passed as the first argument (a string). | ||
99 | </p> | ||
100 | <p> | ||
101 | Here are the built-in LuaJIT control commands: | ||
102 | </p> | ||
103 | <ul> | ||
104 | <li id="j_on"><tt>-j on</tt> — Turns the JIT engine on (default).</li> | ||
105 | <li id="j_off"><tt>-j off</tt> — Turns the JIT engine off.</li> | ||
106 | <li id="j_debug"><tt>-j debug[=level]</tt> — Set debug level. See | ||
107 | <a href="luajit_api.html#jit_debug">jit.debug()</a>.</li> | ||
108 | </ul> | ||
109 | <p> | ||
110 | The following control commands are loaded from add-on modules: | ||
111 | </p> | ||
112 | <ul> | ||
113 | <li id="j_trace"><tt>-j trace[=file]</tt> — Trace the progress of the JIT compiler.</li> | ||
114 | <li id="j_dumphints"><tt>-j dumphints[=file]</tt> — Dump bytecode + hints before compilation.</li> | ||
115 | <li id="j_dump"><tt>-j dump[=file]</tt> — 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> | ||
123 | This option loads and runs the optimizer module <tt>jit.opt</tt>. | ||
124 | The optimizer generates hints for the compiler backend to improve | ||
125 | the performance of the compiled code. The optimizer slows down | ||
126 | compilation slightly, but the end result should make up for it | ||
127 | in almost every case. | ||
128 | </p> | ||
129 | <p> | ||
130 | The <tt>-O</tt> form sets the default optimizer level, which is | ||
131 | currently <tt>2</tt> (this may change in future versions | ||
132 | of LuaJIT). | ||
133 | </p> | ||
134 | <p> | ||
135 | The <tt>-Olevel</tt> form explicitly sets the optimizer level: | ||
136 | </p> | ||
137 | <ul> | ||
138 | <li><tt>-O0</tt> — disable the optimizer but leave it attached.</li> | ||
139 | <li><tt>-O1</tt> — perform standard optimizations (like hints for table lookups).</li> | ||
140 | <li><tt>-O2</tt> — 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> | ||
144 | The <tt>-Oext</tt> form loads optimizer extension modules | ||
145 | from <tt>jit.opt_<ext></tt>. | ||
146 | </p> | ||
147 | --> | ||
148 | <br class="flush"> | ||
149 | </div> | ||
150 | <div id="foot"> | ||
151 | <hr class="hide"> | ||
152 | Copyright © 2005-2011 Mike Pall | ||
153 | <span class="noprint"> | ||
154 | · | ||
155 | <a href="contact.html">Contact</a> | ||
156 | </span> | ||
157 | </div> | ||
158 | </body> | ||
159 | </html> | ||