summaryrefslogtreecommitdiff
path: root/pod/luajit-2.1/faq.pod
blob: f49df08166f6480bc6a65509ec8d0c4e6c808d5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
=pod

LuaJIT

=head1 Frequently Asked Questions (FAQ)

=over

=item * LuaJIT

=over

=item * Download E<rchevron>

=item * Installation

=item * Running

=back

=item * Extensions

=over

=item * FFI Library

=over

=item * FFI Tutorial

=item * ffi.* API

=item * FFI Semantics

=back

=item * jit.* Library

=item * Lua/C API

=item * Profiler

=back

=item * Status

=over

=item * Changes

=back

=item * FAQ

=item * Performance E<rchevron>

=item * Wiki E<rchevron>

=item * Mailing List E<rchevron>

=back

=over

=item Q: Where can I learn more about LuaJIT and Lua?

=over

=item * The E<rchevron> LuaJIT mailing list focuses on topics related
to LuaJIT.

=item * The E<rchevron> LuaJIT wiki gathers community resources about
LuaJIT.

=item * News about Lua itself can be found at the E<rchevron> Lua
mailing list. The mailing list archives are worth checking out for
older postings about LuaJIT.

=item * The E<rchevron> main Lua.org site has complete E<rchevron>
documentation of the language and links to books and papers about Lua.

=item * The community-managed E<rchevron> Lua Wiki has information
about diverse topics.

=back

=back

=over

=item Q: Where can I learn more about the compiler technology used by
LuaJIT?

I'm planning to write more documentation about the internals of LuaJIT.
In the meantime, please use the following Google Scholar searches to
find relevant papers:

Search for: E<rchevron> Trace Compiler

Search for: E<rchevron> JIT Compiler

Search for: E<rchevron> Dynamic Language Optimizations

Search for: E<rchevron> SSA Form

Search for: E<rchevron> Linear Scan Register Allocation

Here is a list of the E<rchevron> innovative features in LuaJIT.

And, you know, reading the source is of course the only way to
enlightenment. :-)

=back

=over

=item Q: Why do I get this error: "attempt to index global 'arg' (a nil
value)"?

Q: My vararg functions fail after switching to LuaJIT!

LuaJIT is compatible to the Lua 5.1 language standard. It doesn't
support the implicit C<arg> parameter for old-style vararg functions
from Lua 5.0.

Please convert your code to the E<rchevron> Lua 5.1 vararg syntax.

=back

=over

=item Q: Why do I get this error: "bad FPU precision"?

=item Q: I get weird behavior after initializing Direct3D.

=item Q: Some FPU operations crash after I load a Delphi DLL.

DirectX/Direct3D (up to version 9) sets the x87 FPU to single-precision
mode by default. This violates the Windows ABI and interferes with the
operation of many programs E<mdash> LuaJIT is affected, too. Please
make sure you always use the C<D3DCREATE_FPU_PRESERVE> flag when
initializing Direct3D.

Direct3D version 10 or higher do not show this behavior anymore.
Consider testing your application with older versions, too.

Similarly, the Borland/Delphi runtime modifies the FPU control word and
enables FP exceptions. Of course this violates the Windows ABI, too.
Please check the Delphi docs for the Set8087CW method.

=back

=over

=item Q: Sometimes Ctrl-C fails to stop my Lua program. Why?

The interrupt signal handler sets a Lua debug hook. But this is
currently ignored by compiled code (this will eventually be fixed). If
your program is running in a tight loop and never falls back to the
interpreter, the debug hook never runs and can't throw the
"interrupted!" error.

In the meantime you have to press Ctrl-C twice to get stop your
program. That's similar to when it's stuck running inside a C function
under the Lua interpreter.

=back

=over

=item Q: Why doesn't my favorite power-patch for Lua apply against
LuaJIT?

Because it's a completely redesigned VM and has very little code in
common with Lua anymore. Also, if the patch introduces changes to the
Lua semantics, these would need to be reflected everywhere in the VM,
from the interpreter up to all stages of the compiler.

Please use only standard Lua language constructs. For many common needs
you can use source transformations or use wrapper or proxy functions.
The compiler will happily optimize away such indirections.

=back

=over

=item Q: Lua runs everywhere. Why doesn't LuaJIT support my CPU?

Because it's a compiler E<mdash> it needs to generate native machine
code. This means the code generator must be ported to each
architecture. And the fast interpreter is written in assembler and must
be ported, too. This is quite an undertaking.

The install documentation shows the supported architectures. Other
architectures will follow based on sufficient user demand and/or
sponsoring.

=back

=over

=item Q: When will feature X be added? When will the next version be
released?

When it's ready.

C'mon, it's open source E<mdash> I'm doing it on my own time and you're
getting it for free. You can either contribute a patch or sponsor the
development of certain features, if they are important to you.

=back

----

Copyright E<copy> 2005-2017 Mike Pall E<middot> Contact

=cut

#Pod::HTML2Pod conversion notes:
#From file faq.html
# 7685 bytes of input
#Mon May 14 13:19:16 2018 agentzh
# No a_name switch not specified, so will not try to render <a name='...'>
# No a_href switch not specified, so will not try to render <a href='...'>