diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/luajit-2.0/doc/running.html | 313 |
1 files changed, 0 insertions, 313 deletions
diff --git a/libraries/luajit-2.0/doc/running.html b/libraries/luajit-2.0/doc/running.html deleted file mode 100644 index e2afdee..0000000 --- a/libraries/luajit-2.0/doc/running.html +++ /dev/null | |||
@@ -1,313 +0,0 @@ | |||
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 | <style type="text/css"> | ||
12 | table.opt { | ||
13 | line-height: 1.2; | ||
14 | } | ||
15 | tr.opthead td { | ||
16 | font-weight: bold; | ||
17 | } | ||
18 | td.flag_name { | ||
19 | width: 4em; | ||
20 | } | ||
21 | td.flag_level { | ||
22 | width: 2em; | ||
23 | text-align: center; | ||
24 | } | ||
25 | td.param_name { | ||
26 | width: 6em; | ||
27 | } | ||
28 | td.param_default { | ||
29 | width: 4em; | ||
30 | text-align: right; | ||
31 | } | ||
32 | </style> | ||
33 | </head> | ||
34 | <body> | ||
35 | <div id="site"> | ||
36 | <a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a> | ||
37 | </div> | ||
38 | <div id="head"> | ||
39 | <h1>Running LuaJIT</h1> | ||
40 | </div> | ||
41 | <div id="nav"> | ||
42 | <ul><li> | ||
43 | <a href="luajit.html">LuaJIT</a> | ||
44 | <ul><li> | ||
45 | <a href="install.html">Installation</a> | ||
46 | </li><li> | ||
47 | <a class="current" href="running.html">Running</a> | ||
48 | </li></ul> | ||
49 | </li><li> | ||
50 | <a href="extensions.html">Extensions</a> | ||
51 | <ul><li> | ||
52 | <a href="ext_ffi.html">FFI Library</a> | ||
53 | <ul><li> | ||
54 | <a href="ext_ffi_tutorial.html">FFI Tutorial</a> | ||
55 | </li><li> | ||
56 | <a href="ext_ffi_api.html">ffi.* API</a> | ||
57 | </li><li> | ||
58 | <a href="ext_ffi_semantics.html">FFI Semantics</a> | ||
59 | </li></ul> | ||
60 | </li><li> | ||
61 | <a href="ext_jit.html">jit.* Library</a> | ||
62 | </li><li> | ||
63 | <a href="ext_c_api.html">Lua/C API</a> | ||
64 | </li></ul> | ||
65 | </li><li> | ||
66 | <a href="status.html">Status</a> | ||
67 | <ul><li> | ||
68 | <a href="changes.html">Changes</a> | ||
69 | </li></ul> | ||
70 | </li><li> | ||
71 | <a href="faq.html">FAQ</a> | ||
72 | </li><li> | ||
73 | <a href="http://luajit.org/performance.html">Performance <span class="ext">»</span></a> | ||
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 has only a single stand-alone executable, called <tt>luajit</tt> on | ||
81 | POSIX systems or <tt>luajit.exe</tt> on Windows. It can be used to run simple | ||
82 | Lua statements or whole Lua applications from the command line. It has an | ||
83 | interactive mode, too. | ||
84 | </p> | ||
85 | <p class="indent" style="color: #c00000;"> | ||
86 | Note: the beta test releases only install under the versioned name on | ||
87 | POSIX systems (to avoid overwriting a previous version). You either need | ||
88 | to type <tt>luajit-2.0.0-beta9</tt> to start it or create a symlink | ||
89 | with a command like this: | ||
90 | </p> | ||
91 | <pre class="code" style="color: #c00000;"> | ||
92 | sudo ln -sf luajit-2.0.0-beta9 /usr/local/bin/luajit | ||
93 | </pre> | ||
94 | <p> | ||
95 | Unlike previous versions <b>optimization is turned on by default</b> in | ||
96 | LuaJIT 2.0!<br>It's no longer necessary to use <tt>luajit -O</tt>. | ||
97 | </p> | ||
98 | |||
99 | <h2 id="options">Command Line Options</h2> | ||
100 | <p> | ||
101 | The <tt>luajit</tt> stand-alone executable is just a slightly modified | ||
102 | version of the regular <tt>lua</tt> stand-alone executable. | ||
103 | It supports the same basic options, too. <tt>luajit -h</tt> | ||
104 | prints a short list of the available options. Please have a look at the | ||
105 | <a href="http://www.lua.org/manual/5.1/manual.html#6"><span class="ext">»</span> Lua manual</a> | ||
106 | for details. | ||
107 | </p> | ||
108 | <p> | ||
109 | LuaJIT has some additional options: | ||
110 | </p> | ||
111 | |||
112 | <h3 id="opt_b"><tt>-b[options] input output</tt></h3> | ||
113 | <p> | ||
114 | This option saves or lists bytecode. The following additional options | ||
115 | are accepted: | ||
116 | </p> | ||
117 | <ul> | ||
118 | <li><tt>-l</tt> — Only list bytecode.</li> | ||
119 | <li><tt>-s</tt> — Strip debug info (this is the default).</li> | ||
120 | <li><tt>-g</tt> — Keep debug info.</li> | ||
121 | <li><tt>-n name</tt> — Set module name (default: auto-detect from input name)</li> | ||
122 | <li><tt>-t type</tt> — Set output file type (default: auto-detect from output name).</li> | ||
123 | <li><tt>-a arch</tt> — Override architecture for object files (default: native).</li> | ||
124 | <li><tt>-o os</tt> — Override OS for object files (default: native).</li> | ||
125 | <li><tt>-e chunk</tt> — Use chunk string as input.</li> | ||
126 | <li><tt>-</tt> (a single minus sign) — Use stdin as input and/or stdout as output.</li> | ||
127 | </ul> | ||
128 | <p> | ||
129 | The output file type is auto-detected from the extension of the output | ||
130 | file name: | ||
131 | </p> | ||
132 | <ul> | ||
133 | <li><tt>c</tt> — C source file, exported bytecode data.</li> | ||
134 | <li><tt>h</tt> — C header file, static bytecode data.</li> | ||
135 | <li><tt>obj</tt> or <tt>o</tt> — Object file, exported bytecode data | ||
136 | (OS- and architecture-specific).</li> | ||
137 | <li><tt>raw</tt> or any other extension — Raw bytecode file (portable). | ||
138 | </ul> | ||
139 | <p> | ||
140 | Notes: | ||
141 | </p> | ||
142 | <ul> | ||
143 | <li>See also <a href="extensions.html#string_dump">string.dump()</a> | ||
144 | for information on bytecode portability and compatibility.</li> | ||
145 | <li>A file in raw bytecode format is auto-detected and can be loaded like | ||
146 | any Lua source file. E.g. directly from the command line or with | ||
147 | <tt>loadfile()</tt>, <tt>dofile()</tt> etc.</li> | ||
148 | <li>To statically embed the bytecode of a module in your application, | ||
149 | generate an object file and just link it with your application.</li> | ||
150 | <li>On most ELF-based systems (e.g. Linux) you need to explicitly export the | ||
151 | global symbols when linking your application, e.g. with: <tt>-Wl,-E</tt></li> | ||
152 | <li><tt>require()</tt> tries to load embedded bytecode data from exported | ||
153 | symbols (in <tt>*.exe</tt> or <tt>lua51.dll</tt> on Windows) and from | ||
154 | shared libraries in <tt>package.cpath</tt>.</li> | ||
155 | </ul> | ||
156 | <p> | ||
157 | Typical usage examples: | ||
158 | </p> | ||
159 | <pre class="code"> | ||
160 | luajit -b test.lua test.out # Save bytecode to test.out | ||
161 | luajit -bg test.lua test.out # Keep debug info | ||
162 | luajit -be "print('hello world')" test.out # Save cmdline script | ||
163 | |||
164 | luajit -bl test.lua # List to stdout | ||
165 | luajit -bl test.lua test.txt # List to test.txt | ||
166 | luajit -ble "print('hello world')" # List cmdline script | ||
167 | |||
168 | luajit -b test.lua test.obj # Generate object file | ||
169 | # Link test.obj with your application and load it with require("test") | ||
170 | </pre> | ||
171 | |||
172 | <h3 id="opt_j"><tt>-j cmd[=arg[,arg...]]</tt></h3> | ||
173 | <p> | ||
174 | This option performs a LuaJIT control command or activates one of the | ||
175 | loadable extension modules. The command is first looked up in the | ||
176 | <tt>jit.*</tt> library. If no matching function is found, a module | ||
177 | named <tt>jit.<cmd></tt> is loaded and the <tt>start()</tt> | ||
178 | function of the module is called with the specified arguments (if | ||
179 | any). The space between <tt>-j</tt> and <tt>cmd</tt> is optional. | ||
180 | </p> | ||
181 | <p> | ||
182 | Here are the available LuaJIT control commands: | ||
183 | </p> | ||
184 | <ul> | ||
185 | <li id="j_on"><tt>-jon</tt> — Turns the JIT compiler on (default).</li> | ||
186 | <li id="j_off"><tt>-joff</tt> — Turns the JIT compiler off (only use the interpreter).</li> | ||
187 | <li id="j_flush"><tt>-jflush</tt> — Flushes the whole cache of compiled code.</li> | ||
188 | <li id="j_v"><tt>-jv</tt> — Shows verbose information about the progress of the JIT compiler.</li> | ||
189 | <li id="j_dump"><tt>-jdump</tt> — Dumps the code and structures used in various compiler stages.</li> | ||
190 | </ul> | ||
191 | <p> | ||
192 | The <tt>-jv</tt> and <tt>-jdump</tt> commands are extension modules | ||
193 | written in Lua. They are mainly used for debugging the JIT compiler | ||
194 | itself. For a description of their options and output format, please | ||
195 | read the comment block at the start of their source. | ||
196 | They can be found in the <tt>lib</tt> directory of the source | ||
197 | distribution or installed under the <tt>jit</tt> directory. By default | ||
198 | this is <tt>/usr/local/share/luajit-2.0.0-beta9/jit</tt> on POSIX | ||
199 | systems. | ||
200 | </p> | ||
201 | |||
202 | <h3 id="opt_O"><tt>-O[level]</tt><br> | ||
203 | <tt>-O[+]flag</tt> <tt>-O-flag</tt><br> | ||
204 | <tt>-Oparam=value</tt></h3> | ||
205 | <p> | ||
206 | This options allows fine-tuned control of the optimizations used by | ||
207 | the JIT compiler. This is mainly intended for debugging LuaJIT itself. | ||
208 | Please note that the JIT compiler is extremely fast (we are talking | ||
209 | about the microsecond to millisecond range). Disabling optimizations | ||
210 | doesn't have any visible impact on its overhead, but usually generates | ||
211 | code that runs slower. | ||
212 | </p> | ||
213 | <p> | ||
214 | The first form sets an optimization level — this enables a | ||
215 | specific mix of optimization flags. <tt>-O0</tt> turns off all | ||
216 | optimizations and higher numbers enable more optimizations. Omitting | ||
217 | the level (i.e. just <tt>-O</tt>) sets the default optimization level, | ||
218 | which is <tt>-O3</tt> in the current version. | ||
219 | </p> | ||
220 | <p> | ||
221 | The second form adds or removes individual optimization flags. | ||
222 | The third form sets a parameter for the VM or the JIT compiler | ||
223 | to a specific value. | ||
224 | </p> | ||
225 | <p> | ||
226 | You can either use this option multiple times (like <tt>-Ocse | ||
227 | -O-dce -Ohotloop=10</tt>) or separate several settings with a comma | ||
228 | (like <tt>-O+cse,-dce,hotloop=10</tt>). The settings are applied from | ||
229 | left to right and later settings override earlier ones. You can freely | ||
230 | mix the three forms, but note that setting an optimization level | ||
231 | overrides all earlier flags. | ||
232 | </p> | ||
233 | <p> | ||
234 | Here are the available flags and at what optimization levels they | ||
235 | are enabled: | ||
236 | </p> | ||
237 | <table class="opt"> | ||
238 | <tr class="opthead"> | ||
239 | <td class="flag_name">Flag</td> | ||
240 | <td class="flag_level">-O1</td> | ||
241 | <td class="flag_level">-O2</td> | ||
242 | <td class="flag_level">-O3</td> | ||
243 | <td class="flag_desc"> </td> | ||
244 | </tr> | ||
245 | <tr class="odd separate"> | ||
246 | <td class="flag_name">fold</td><td class="flag_level">•</td><td class="flag_level">•</td><td class="flag_level">•</td><td class="flag_desc">Constant Folding, Simplifications and Reassociation</td></tr> | ||
247 | <tr class="even"> | ||
248 | <td class="flag_name">cse</td><td class="flag_level">•</td><td class="flag_level">•</td><td class="flag_level">•</td><td class="flag_desc">Common-Subexpression Elimination</td></tr> | ||
249 | <tr class="odd"> | ||
250 | <td class="flag_name">dce</td><td class="flag_level">•</td><td class="flag_level">•</td><td class="flag_level">•</td><td class="flag_desc">Dead-Code Elimination</td></tr> | ||
251 | <tr class="even"> | ||
252 | <td class="flag_name">narrow</td><td class="flag_level"> </td><td class="flag_level">•</td><td class="flag_level">•</td><td class="flag_desc">Narrowing of numbers to integers</td></tr> | ||
253 | <tr class="odd"> | ||
254 | <td class="flag_name">loop</td><td class="flag_level"> </td><td class="flag_level">•</td><td class="flag_level">•</td><td class="flag_desc">Loop Optimizations (code hoisting)</td></tr> | ||
255 | <tr class="even"> | ||
256 | <td class="flag_name">fwd</td><td class="flag_level"> </td><td class="flag_level"> </td><td class="flag_level">•</td><td class="flag_desc">Load Forwarding (L2L) and Store Forwarding (S2L)</td></tr> | ||
257 | <tr class="odd"> | ||
258 | <td class="flag_name">dse</td><td class="flag_level"> </td><td class="flag_level"> </td><td class="flag_level">•</td><td class="flag_desc">Dead-Store Elimination</td></tr> | ||
259 | <tr class="even"> | ||
260 | <td class="flag_name">abc</td><td class="flag_level"> </td><td class="flag_level"> </td><td class="flag_level">•</td><td class="flag_desc">Array Bounds Check Elimination</td></tr> | ||
261 | <tr class="odd"> | ||
262 | <td class="flag_name">fuse</td><td class="flag_level"> </td><td class="flag_level"> </td><td class="flag_level">•</td><td class="flag_desc">Fusion of operands into instructions</td></tr> | ||
263 | </table> | ||
264 | <p> | ||
265 | Here are the parameters and their default settings: | ||
266 | </p> | ||
267 | <table class="opt"> | ||
268 | <tr class="opthead"> | ||
269 | <td class="param_name">Parameter</td> | ||
270 | <td class="param_default">Default</td> | ||
271 | <td class="param_desc"> </td> | ||
272 | </tr> | ||
273 | <tr class="odd separate"> | ||
274 | <td class="param_name">maxtrace</td><td class="param_default">1000</td><td class="param_desc">Max. number of traces in the cache</td></tr> | ||
275 | <tr class="even"> | ||
276 | <td class="param_name">maxrecord</td><td class="param_default">4000</td><td class="param_desc">Max. number of recorded IR instructions</td></tr> | ||
277 | <tr class="odd"> | ||
278 | <td class="param_name">maxirconst</td><td class="param_default">500</td><td class="param_desc">Max. number of IR constants of a trace</td></tr> | ||
279 | <tr class="even"> | ||
280 | <td class="param_name">maxside</td><td class="param_default">100</td><td class="param_desc">Max. number of side traces of a root trace</td></tr> | ||
281 | <tr class="odd"> | ||
282 | <td class="param_name">maxsnap</td><td class="param_default">500</td><td class="param_desc">Max. number of snapshots for a trace</td></tr> | ||
283 | <tr class="even separate"> | ||
284 | <td class="param_name">hotloop</td><td class="param_default">56</td><td class="param_desc">Number of iterations to detect a hot loop or hot call</td></tr> | ||
285 | <tr class="odd"> | ||
286 | <td class="param_name">hotexit</td><td class="param_default">10</td><td class="param_desc">Number of taken exits to start a side trace</td></tr> | ||
287 | <tr class="even"> | ||
288 | <td class="param_name">tryside</td><td class="param_default">4</td><td class="param_desc">Number of attempts to compile a side trace</td></tr> | ||
289 | <tr class="odd separate"> | ||
290 | <td class="param_name">instunroll</td><td class="param_default">4</td><td class="param_desc">Max. unroll factor for instable loops</td></tr> | ||
291 | <tr class="even"> | ||
292 | <td class="param_name">loopunroll</td><td class="param_default">15</td><td class="param_desc">Max. unroll factor for loop ops in side traces</td></tr> | ||
293 | <tr class="odd"> | ||
294 | <td class="param_name">callunroll</td><td class="param_default">3</td><td class="param_desc">Max. unroll factor for pseudo-recursive calls</td></tr> | ||
295 | <tr class="even"> | ||
296 | <td class="param_name">recunroll</td><td class="param_default">2</td><td class="param_desc">Min. unroll factor for true recursion</td></tr> | ||
297 | <tr class="odd separate"> | ||
298 | <td class="param_name">sizemcode</td><td class="param_default">32</td><td class="param_desc">Size of each machine code area in KBytes (Windows: 64K)</td></tr> | ||
299 | <tr class="even"> | ||
300 | <td class="param_name">maxmcode</td><td class="param_default">512</td><td class="param_desc">Max. total size of all machine code areas in KBytes</td></tr> | ||
301 | </table> | ||
302 | <br class="flush"> | ||
303 | </div> | ||
304 | <div id="foot"> | ||
305 | <hr class="hide"> | ||
306 | Copyright © 2005-2011 Mike Pall | ||
307 | <span class="noprint"> | ||
308 | · | ||
309 | <a href="contact.html">Contact</a> | ||
310 | </span> | ||
311 | </div> | ||
312 | </body> | ||
313 | </html> | ||