summaryrefslogtreecommitdiff
path: root/doc/faq.html
diff options
context:
space:
mode:
authorMike Pall <mike>2023-08-21 02:28:49 +0200
committerMike Pall <mike>2023-08-21 02:28:49 +0200
commitc34594681909cac98d44629863df2c7afd93eaf0 (patch)
tree494edfb290b2354cd738e07751c58d65d6b1c1c2 /doc/faq.html
parent158a284cc9c33ade9054df976018401e4996cfbd (diff)
downloadluajit-c34594681909cac98d44629863df2c7afd93eaf0.tar.gz
luajit-c34594681909cac98d44629863df2c7afd93eaf0.tar.bz2
luajit-c34594681909cac98d44629863df2c7afd93eaf0.zip
Update documentation for switch to rolling releases.
Diffstat (limited to 'doc/faq.html')
-rw-r--r--doc/faq.html191
1 files changed, 0 insertions, 191 deletions
diff --git a/doc/faq.html b/doc/faq.html
deleted file mode 100644
index f160fffe..00000000
--- a/doc/faq.html
+++ /dev/null
@@ -1,191 +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>Frequently Asked Questions (FAQ)</title>
5<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6<meta name="Copyright" content="Copyright (C) 2005-2023">
7<meta name="Language" content="en">
8<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
9<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
10<style type="text/css">
11dd { margin-left: 1.5em; }
12</style>
13</head>
14<body>
15<div id="site">
16<a href="https://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
17</div>
18<div id="head">
19<h1>Frequently Asked Questions (FAQ)</h1>
20</div>
21<div id="nav">
22<ul><li>
23<a href="luajit.html">LuaJIT</a>
24<ul><li>
25<a href="https://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
26</li><li>
27<a href="install.html">Installation</a>
28</li><li>
29<a href="running.html">Running</a>
30</li></ul>
31</li><li>
32<a href="extensions.html">Extensions</a>
33<ul><li>
34<a href="ext_ffi.html">FFI Library</a>
35<ul><li>
36<a href="ext_ffi_tutorial.html">FFI Tutorial</a>
37</li><li>
38<a href="ext_ffi_api.html">ffi.* API</a>
39</li><li>
40<a href="ext_ffi_semantics.html">FFI Semantics</a>
41</li></ul>
42</li><li>
43<a href="ext_jit.html">jit.* Library</a>
44</li><li>
45<a href="ext_c_api.html">Lua/C API</a>
46</li></ul>
47</li><li>
48<a href="status.html">Status</a>
49</li><li>
50<a class="current" href="faq.html">FAQ</a>
51</li><li>
52<a href="https://luajit.org/list.html">Mailing List <span class="ext">&raquo;</span></a>
53</li></ul>
54</div>
55<div id="main">
56<dl id="info">
57<dt>Q: Where can I learn more about LuaJIT and Lua?</dt>
58<dd>
59<ul style="padding: 0;">
60<li>The <a href="https://luajit.org/list.html"><span class="ext">&raquo;</span>&nbsp;LuaJIT mailing list</a> focuses on topics
61related to LuaJIT.</li>
62<li>News about Lua itself can be found at the
63<a href="https://www.lua.org/lua-l.html"><span class="ext">&raquo;</span>&nbsp;Lua mailing list</a>.
64The mailing list archives are worth checking out for older postings
65about LuaJIT.</li>
66<li>The <a href="https://lua.org"><span class="ext">&raquo;</span>&nbsp;main Lua.org site</a> has complete
67<a href="https://www.lua.org/docs.html"><span class="ext">&raquo;</span>&nbsp;documentation</a> of the language
68and links to books and papers about Lua.</li>
69<li>The community-managed <a href="http://lua-users.org/wiki/"><span class="ext">&raquo;</span>&nbsp;Lua Wiki</a>
70has information about diverse topics.</li>
71</ul></dd>
72</dl>
73
74<dl id="tech">
75<dt>Q: Where can I learn more about the compiler technology used by LuaJIT?</dt>
76<dd>
77Please use the following Google Scholar searches to find relevant papers:<br>
78Search for: <a href="https://scholar.google.com/scholar?q=Trace+Compiler"><span class="ext">&raquo;</span>&nbsp;Trace Compiler</a><br>
79Search for: <a href="https://scholar.google.com/scholar?q=JIT+Compiler"><span class="ext">&raquo;</span>&nbsp;JIT Compiler</a><br>
80Search for: <a href="https://scholar.google.com/scholar?q=Dynamic+Language+Optimizations"><span class="ext">&raquo;</span>&nbsp;Dynamic Language Optimizations</a><br>
81Search for: <a href="https://scholar.google.com/scholar?q=SSA+Form"><span class="ext">&raquo;</span>&nbsp;SSA Form</a><br>
82Search for: <a href="https://scholar.google.com/scholar?q=Linear+Scan+Register+Allocation"><span class="ext">&raquo;</span>&nbsp;Linear Scan Register Allocation</a><br>
83Here is a list of the <a href="http://lua-users.org/lists/lua-l/2009-11/msg00089.html"><span class="ext">&raquo;</span>&nbsp;innovative features in LuaJIT</a>.<br>
84And, you know, reading the source is of course the only way to enlightenment.
85</dd>
86</dl>
87
88<dl id="arg">
89<dt>Q: Why do I get this error: "attempt to index global 'arg' (a nil value)"?<br>
90Q: My vararg functions fail after switching to LuaJIT!</dt>
91<dd>LuaJIT is compatible to the Lua 5.1 language standard. It doesn't
92support the implicit <tt>arg</tt> parameter for old-style vararg
93functions from Lua 5.0.<br>Please convert your code to the
94<a href="https://www.lua.org/manual/5.1/manual.html#2.5.9"><span class="ext">&raquo;</span>&nbsp;Lua 5.1
95vararg syntax</a>.</dd>
96</dl>
97
98<dl id="x87">
99<dt>Q: Why do I get this error: "bad FPU precision"?<br>
100<dt>Q: I get weird behavior after initializing Direct3D.<br>
101<dt>Q: Some FPU operations crash after I load a Delphi DLL.<br>
102</dt>
103<dd>
104
105DirectX/Direct3D (up to version 9) sets the x87 FPU to single-precision
106mode by default. This violates the Windows ABI and interferes with the
107operation of many programs &mdash; LuaJIT is affected, too. Please make
108sure you always use the <tt>D3DCREATE_FPU_PRESERVE</tt> flag when
109initializing Direct3D.<br>
110
111Direct3D version 10 or higher do not show this behavior anymore.
112Consider testing your application with older versions, too.<br>
113
114Similarly, the Borland/Delphi runtime modifies the FPU control word and
115enables FP exceptions. Of course, this violates the Windows ABI, too.
116Please check the Delphi docs for the Set8087CW method.</dd>
117</dl>
118
119<dl id="ctrlc">
120<dt>Q: Sometimes Ctrl-C fails to stop my Lua program. Why?</dt>
121<dd>The interrupt signal handler sets a Lua debug hook. But this is
122ignored by compiled code. If your program is running in a tight loop
123and never falls back to the interpreter, the debug hook never runs and
124can't throw the "interrupted!" error.<br>
125You have to press Ctrl-C twice to stop your program. That's similar
126to when it's stuck running inside a C function under the Lua interpreter.</dd>
127</dl>
128
129<dl id="order">
130<dt>Q: Table iteration with <tt>pairs()</tt> does not result in the same order?</dt>
131<dd>The order of table iteration is explicitly <b>undefined</b> by
132the Lua language standard.<br>
133Different Lua implementations or versions may use different orders for
134otherwise identical tables. Different ways of constructing a table may
135result in different orders, too.<br>
136Due to improved VM security, LuaJIT 2.1 may even use a different order
137on separate VM invocations or when string keys are newly interned.<br><br>
138If your program relies on a deterministic order, it has a bug. Rewrite it,
139so it doesn't rely on the key order. Or sort the table keys, if you must.</dd>
140</dl>
141
142<dl id="sandbox">
143<dt>Q: Can Lua code be safely sandboxed?</dt>
144<dd>
145Maybe for an extremely restricted subset of Lua and if you relentlessly
146scrutinize every single interface function you offer to the untrusted code.<br>
147
148Although Lua provides some sandboxing functionality (<tt>setfenv()</tt>, hooks),
149it's very hard to get this right even for the Lua core libraries. Of course,
150you'll need to inspect any extension library, too. And there are libraries
151that are inherently unsafe, e.g. the <a href="ext_ffi.html">FFI library</a>.<br>
152
153More reading material at the <a href="http://lua-users.org/wiki/SandBoxes"><span class="ext">&raquo;</span>&nbsp;Lua Wiki</a> and <a href="https://en.wikipedia.org/wiki/Sandbox_(computer_security)"><span class="ext">&raquo;</span>&nbsp;Wikipedia</a>.<br><br>
154
155Relatedly, <b>loading untrusted bytecode is not safe!</b><br>
156
157It's trivial to crash the Lua or LuaJIT VM with maliciously crafted bytecode.
158This is well known and there's no bytecode verification on purpose, so please
159don't report a bug about it. Check the <tt>mode</tt> parameter for the
160<tt>load*()</tt> functions to disable loading of bytecode.<br><br>
161
162<b>In general, the only promising approach is to sandbox Lua code at the
163process level and not the VM level.</b>
164</dd>
165</dl>
166
167<dl id="arch">
168<dt>Q: Lua runs everywhere. Why doesn't LuaJIT support my CPU?</dt>
169<dd>Because it's a compiler &mdash; it needs to generate native
170machine code. This means the code generator must be ported to each
171architecture. And the fast interpreter is written in assembler and
172must be ported, too. This is quite an undertaking.<br>
173The <a href="install.html">install documentation</a> shows the supported
174architectures.<br>
175Other architectures may follow based on sufficient user demand and
176market-relevance of the architecture. Sponsoring is required to develop
177the port itself, to integrate it and to continuously maintain it in the
178actively developed branches.</dd>
179</dl>
180<br class="flush">
181</div>
182<div id="foot">
183<hr class="hide">
184Copyright &copy; 2005-2023
185<span class="noprint">
186&middot;
187<a href="contact.html">Contact</a>
188</span>
189</div>
190</body>
191</html>