Fix LuaJIT API docs for LUAJIT_MODE_*.
[luajit-2.0/celess22.git] / doc / faq.html
blobafeff940c438ee7c036f49c0bda9b1a3131ab314
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <title>Frequently Asked Questions (FAQ)</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-2017, 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 dd { margin-left: 1.5em; }
13 </style>
14 </head>
15 <body>
16 <div id="site">
17 <a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
18 </div>
19 <div id="head">
20 <h1>Frequently Asked Questions (FAQ)</h1>
21 </div>
22 <div id="nav">
23 <ul><li>
24 <a href="luajit.html">LuaJIT</a>
25 <ul><li>
26 <a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
27 </li><li>
28 <a href="install.html">Installation</a>
29 </li><li>
30 <a href="running.html">Running</a>
31 </li></ul>
32 </li><li>
33 <a href="extensions.html">Extensions</a>
34 <ul><li>
35 <a href="ext_ffi.html">FFI Library</a>
36 <ul><li>
37 <a href="ext_ffi_tutorial.html">FFI Tutorial</a>
38 </li><li>
39 <a href="ext_ffi_api.html">ffi.* API</a>
40 </li><li>
41 <a href="ext_ffi_semantics.html">FFI Semantics</a>
42 </li></ul>
43 </li><li>
44 <a href="ext_jit.html">jit.* Library</a>
45 </li><li>
46 <a href="ext_c_api.html">Lua/C API</a>
47 </li></ul>
48 </li><li>
49 <a href="status.html">Status</a>
50 <ul><li>
51 <a href="changes.html">Changes</a>
52 </li></ul>
53 </li><li>
54 <a class="current" href="faq.html">FAQ</a>
55 </li><li>
56 <a href="http://luajit.org/performance.html">Performance <span class="ext">&raquo;</span></a>
57 </li><li>
58 <a href="http://wiki.luajit.org/">Wiki <span class="ext">&raquo;</span></a>
59 </li><li>
60 <a href="http://luajit.org/list.html">Mailing List <span class="ext">&raquo;</span></a>
61 </li></ul>
62 </div>
63 <div id="main">
64 <dl>
65 <dt>Q: Where can I learn more about LuaJIT and Lua?</dt>
66 <dd>
67 <ul style="padding: 0;">
68 <li>The <a href="http://luajit.org/list.html"><span class="ext">&raquo;</span>&nbsp;LuaJIT mailing list</a> focuses on topics
69 related to LuaJIT.</li>
70 <li>The <a href="http://wiki.luajit.org/"><span class="ext">&raquo;</span>&nbsp;LuaJIT wiki</a> gathers community
71 resources about LuaJIT.</li>
72 <li>News about Lua itself can be found at the
73 <a href="http://www.lua.org/lua-l.html"><span class="ext">&raquo;</span>&nbsp;Lua mailing list</a>.
74 The mailing list archives are worth checking out for older postings
75 about LuaJIT.</li>
76 <li>The <a href="http://lua.org"><span class="ext">&raquo;</span>&nbsp;main Lua.org site</a> has complete
77 <a href="http://www.lua.org/docs.html"><span class="ext">&raquo;</span>&nbsp;documentation</a> of the language
78 and links to books and papers about Lua.</li>
79 <li>The community-managed <a href="http://lua-users.org/wiki/"><span class="ext">&raquo;</span>&nbsp;Lua Wiki</a>
80 has information about diverse topics.</li>
81 </ul>
82 </dl>
84 <dl>
85 <dt>Q: Where can I learn more about the compiler technology used by LuaJIT?</dt>
86 <dd>
87 I'm planning to write more documentation about the internals of LuaJIT.
88 In the meantime, please use the following Google Scholar searches
89 to find relevant papers:<br>
90 Search for: <a href="http://scholar.google.com/scholar?q=Trace+Compiler"><span class="ext">&raquo;</span>&nbsp;Trace Compiler</a><br>
91 Search for: <a href="http://scholar.google.com/scholar?q=JIT+Compiler"><span class="ext">&raquo;</span>&nbsp;JIT Compiler</a><br>
92 Search for: <a href="http://scholar.google.com/scholar?q=Dynamic+Language+Optimizations"><span class="ext">&raquo;</span>&nbsp;Dynamic Language Optimizations</a><br>
93 Search for: <a href="http://scholar.google.com/scholar?q=SSA+Form"><span class="ext">&raquo;</span>&nbsp;SSA Form</a><br>
94 Search for: <a href="http://scholar.google.com/scholar?q=Linear+Scan+Register+Allocation"><span class="ext">&raquo;</span>&nbsp;Linear Scan Register Allocation</a><br>
95 Here is a list of the <a href="http://article.gmane.org/gmane.comp.lang.lua.general/58908"><span class="ext">&raquo;</span>&nbsp;innovative features in LuaJIT</a>.<br>
96 And, you know, reading the source is of course the only way to enlightenment. :-)
97 </dd>
98 </dl>
100 <dl>
101 <dt>Q: Why do I get this error: "attempt to index global 'arg' (a nil value)"?<br>
102 Q: My vararg functions fail after switching to LuaJIT!</dt>
103 <dd>LuaJIT is compatible to the Lua 5.1 language standard. It doesn't
104 support the implicit <tt>arg</tt> parameter for old-style vararg
105 functions from Lua 5.0.<br>Please convert your code to the
106 <a href="http://www.lua.org/manual/5.1/manual.html#2.5.9"><span class="ext">&raquo;</span>&nbsp;Lua 5.1
107 vararg syntax</a>.</dd>
108 </dl>
110 <dl>
111 <dt>Q: Why do I get this error: "bad FPU precision"?<br>
112 <dt>Q: I get weird behavior after initializing Direct3D.<br>
113 <dt>Q: Some FPU operations crash after I load a Delphi DLL.<br>
114 </dt>
115 <dd>
117 DirectX/Direct3D (up to version 9) sets the x87 FPU to single-precision
118 mode by default. This violates the Windows ABI and interferes with the
119 operation of many programs &mdash; LuaJIT is affected, too. Please make
120 sure you always use the <tt>D3DCREATE_FPU_PRESERVE</tt> flag when
121 initializing Direct3D.<br>
123 Direct3D version 10 or higher do not show this behavior anymore.
124 Consider testing your application with older versions, too.<br>
126 Similarly, the Borland/Delphi runtime modifies the FPU control word and
127 enables FP exceptions. Of course this violates the Windows ABI, too.
128 Please check the Delphi docs for the Set8087CW method.
130 </dl>
132 <dl>
133 <dt>Q: Sometimes Ctrl-C fails to stop my Lua program. Why?</dt>
134 <dd>The interrupt signal handler sets a Lua debug hook. But this is
135 currently ignored by compiled code (this will eventually be fixed). If
136 your program is running in a tight loop and never falls back to the
137 interpreter, the debug hook never runs and can't throw the
138 "interrupted!" error.<br> In the meantime you have to press Ctrl-C
139 twice to get stop your program. That's similar to when it's stuck
140 running inside a C function under the Lua interpreter.</dd>
141 </dl>
143 <dl>
144 <dt>Q: Why doesn't my favorite power-patch for Lua apply against LuaJIT?</dt>
145 <dd>Because it's a completely redesigned VM and has very little code
146 in common with Lua anymore. Also, if the patch introduces changes to
147 the Lua semantics, these would need to be reflected everywhere in the
148 VM, from the interpreter up to all stages of the compiler.<br> Please
149 use only standard Lua language constructs. For many common needs you
150 can use source transformations or use wrapper or proxy functions.
151 The compiler will happily optimize away such indirections.</dd>
152 </dl>
154 <dl>
155 <dt>Q: Lua runs everywhere. Why doesn't LuaJIT support my CPU?</dt>
156 <dd>Because it's a compiler &mdash; it needs to generate native
157 machine code. This means the code generator must be ported to each
158 architecture. And the fast interpreter is written in assembler and
159 must be ported, too. This is quite an undertaking.<br>
160 The <a href="install.html">install documentation</a> shows the supported
161 architectures. Other architectures will follow based on sufficient user
162 demand and/or sponsoring.</dd>
163 </dl>
165 <dl>
166 <dt>Q: When will feature X be added? When will the next version be released?</dt>
167 <dd>When it's ready.<br>
168 C'mon, it's open source &mdash; I'm doing it on my own time and you're
169 getting it for free. You can either contribute a patch or sponsor
170 the development of certain features, if they are important to you.
171 </dd>
172 </dl>
173 <br class="flush">
174 </div>
175 <div id="foot">
176 <hr class="hide">
177 Copyright &copy; 2005-2017 Mike Pall
178 <span class="noprint">
179 &middot;
180 <a href="contact.html">Contact</a>
181 </span>
182 </div>
183 </body>
184 </html>