📄 luajit_run.html
字号:
<!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-2007, 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 applicationsfrom the command line. It has an interactive mode, too.</p><p><em>Note: The optimizer is not activated by default because it residesin 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 modifiedversion 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 smallbut 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 improvethe performance of the compiled code. The optimizer slows downcompilation slightly, but the end result should make up for itin almost every case.</p><p>The <tt>-O</tt> form sets the default optimizer level, which iscurrently <tt>2</tt> (this may change in future versionsof 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 modulesfrom <tt>jit.opt_<ext></tt>.</p>--><br class="flush"></div><div id="foot"><hr class="hide">Copyright © 2005-2007 Mike Pall<span class="noprint">·<a href="contact.html">Contact</a></span></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -