diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/LuaJIT-1.1.7/jitdoc/luajit_features.html | 226 |
1 files changed, 0 insertions, 226 deletions
diff --git a/libraries/LuaJIT-1.1.7/jitdoc/luajit_features.html b/libraries/LuaJIT-1.1.7/jitdoc/luajit_features.html deleted file mode 100644 index b4e896f..0000000 --- a/libraries/LuaJIT-1.1.7/jitdoc/luajit_features.html +++ /dev/null | |||
@@ -1,226 +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>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> | ||