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/luajit_api.html | |
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 '')
-rw-r--r-- | libraries/LuaJIT-1.1.7/jitdoc/luajit_api.html | 372 |
1 files changed, 372 insertions, 0 deletions
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> | ||