blob: bc9105b2515a1b066b59d31b3139ef1dac245217 (
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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Running LuaJIT</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2011, Mike Pall">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
</head>
<body>
<div id="site">
<a href="http://luajit.org/"><span>Lua<span id="logo">JIT</span></span></a>
</div>
<div id="head">
<h1>Running LuaJIT</h1>
</div>
<div id="nav">
<ul><li>
<a href="index.html">Index</a>
</li><li>
<a href="luajit.html">LuaJIT</a>
<ul><li>
<a href="luajit_features.html">Features</a>
</li><li>
<a href="luajit_install.html">Installation</a>
</li><li>
<a class="current" href="luajit_run.html">Running</a>
</li><li>
<a href="luajit_api.html">API Extensions</a>
</li><li>
<a href="luajit_intro.html">Introduction</a>
</li><li>
<a href="luajit_performance.html">Performance</a>
</li><li>
<a href="luajit_debug.html">Debugging</a>
</li><li>
<a href="luajit_changes.html">Changes</a>
</li></ul>
</li><li>
<a href="coco.html">Coco</a>
<ul><li>
<a href="coco_portability.html">Portability</a>
</li><li>
<a href="coco_api.html">API Extensions</a>
</li><li>
<a href="coco_changes.html">Changes</a>
</li></ul>
</li><li>
<a href="dynasm.html">DynASM</a>
<ul><li>
<a href="dynasm_features.html">Features</a>
</li><li>
<a href="dynasm_examples.html">Examples</a>
</li></ul>
</li><li>
<a href="http://luajit.org/download.html">Download <span class="ext">»</span></a>
</li></ul>
</div>
<div id="main">
<p>
LuaJIT has only a single stand-alone executable, called <tt>luajit</tt>.
It can be used to run simple Lua statements or whole Lua applications
from the command line. It has an interactive mode, too.
</p>
<p>
<em>Note: The optimizer is not activated by default because it resides
in an external module
(see <a href="luajit_install.html">Installing LuaJIT</a>).
It's recommended to always use the optimizer, i.e.:</em> <tt>luajit -O</tt>
</p>
<h2 id="options">Command Line Options</h2>
<p>
The <tt>luajit</tt> stand-alone executable is just a slightly modified
version of the regular <tt>lua</tt> stand-alone executable.
It supports the same basic options, too. Please have a look at the
<a href="../doc/lua.html">Manual Page</a>
for the regular <tt>lua</tt> stand-alone executable.
</p>
<p>
Two additional options control LuaJIT behaviour:
</p>
<h3 id="opt_j"><tt>-j cmd[=value]</tt></h3>
<p>
This option performs a LuaJIT control command. LuaJIT has a small
but extensible set of control commands. It's easy to add your own.
</p>
<p>
The command is first searched for in the <tt>jit.*</tt> library.
If no matching function is found, a module named <tt>jit.<cmd></tt>
is loaded. The module table must provide a <tt>start()</tt> function.
</p>
<p>
For the <tt>-j cmd</tt> form the function is called without an argument.
Otherwise the <tt>value</tt> is passed as the first argument (a string).
</p>
<p>
Here are the built-in LuaJIT control commands:
</p>
<ul>
<li id="j_on"><tt>-j on</tt> — Turns the JIT engine on (default).</li>
<li id="j_off"><tt>-j off</tt> — Turns the JIT engine off.</li>
<li id="j_debug"><tt>-j debug[=level]</tt> — Set debug level. See
<a href="luajit_api.html#jit_debug">jit.debug()</a>.</li>
</ul>
<p>
The following control commands are loaded from add-on modules:
</p>
<ul>
<li id="j_trace"><tt>-j trace[=file]</tt> — Trace the progress of the JIT compiler.</li>
<li id="j_dumphints"><tt>-j dumphints[=file]</tt> — Dump bytecode + hints before compilation.</li>
<li id="j_dump"><tt>-j dump[=file]</tt> — Dump machine code after compilation.</li>
</ul>
<!--
<h3 id="opt_O"><tt>-O[level|ext]</tt></h3>
-->
<h3 id="opt_O"><tt>-O[level]</tt></h3>
<p>
This option loads and runs the optimizer module <tt>jit.opt</tt>.
The optimizer generates hints for the compiler backend to improve
the performance of the compiled code. The optimizer slows down
compilation slightly, but the end result should make up for it
in almost every case.
</p>
<p>
The <tt>-O</tt> form sets the default optimizer level, which is
currently <tt>2</tt> (this may change in future versions
of LuaJIT).
</p>
<p>
The <tt>-Olevel</tt> form explicitly sets the optimizer level:
</p>
<ul>
<li><tt>-O0</tt> — disable the optimizer but leave it attached.</li>
<li><tt>-O1</tt> — perform standard optimizations (like hints for table lookups).</li>
<li><tt>-O2</tt> — like <tt>-O1</tt> but also loads <tt>jit.opt_inline</tt> to enable result hints and inlining for standard library functions.</li>
</ul>
<!--
<p>
The <tt>-Oext</tt> form loads optimizer extension modules
from <tt>jit.opt_<ext></tt>.
</p>
-->
<br class="flush">
</div>
<div id="foot">
<hr class="hide">
Copyright © 2005-2011 Mike Pall
<span class="noprint">
·
<a href="contact.html">Contact</a>
</span>
</div>
</body>
</html>
|