diff options
author | Mike Pall <mike> | 2021-01-02 21:17:01 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2021-01-02 21:17:01 +0100 |
commit | ee855749a188d3d13bba9a0e58f430e138e641ae (patch) | |
tree | 429ef17b62a88682f920d95a6dec28cd4f7f7789 | |
parent | 56c04accf975bff2519c34721dccbbdb7b8e6963 (diff) | |
download | luajit-ee855749a188d3d13bba9a0e58f430e138e641ae.tar.gz luajit-ee855749a188d3d13bba9a0e58f430e138e641ae.tar.bz2 luajit-ee855749a188d3d13bba9a0e58f430e138e641ae.zip |
Documentation cleanup.
-rw-r--r-- | doc/faq.html | 61 | ||||
-rw-r--r-- | doc/install.html | 33 | ||||
-rw-r--r-- | doc/luajit.html | 2 | ||||
-rw-r--r-- | doc/status.html | 15 |
4 files changed, 49 insertions, 62 deletions
diff --git a/doc/faq.html b/doc/faq.html index a7144670..843480fc 100644 --- a/doc/faq.html +++ b/doc/faq.html | |||
@@ -78,16 +78,14 @@ has information about diverse topics.</li> | |||
78 | <dl id="tech"> | 78 | <dl id="tech"> |
79 | <dt>Q: Where can I learn more about the compiler technology used by LuaJIT?</dt> | 79 | <dt>Q: Where can I learn more about the compiler technology used by LuaJIT?</dt> |
80 | <dd> | 80 | <dd> |
81 | I'm planning to write more documentation about the internals of LuaJIT. | 81 | Please use the following Google Scholar searches to find relevant papers:<br> |
82 | In the meantime, please use the following Google Scholar searches | ||
83 | to find relevant papers:<br> | ||
84 | Search for: <a href="https://scholar.google.com/scholar?q=Trace+Compiler"><span class="ext">»</span> Trace Compiler</a><br> | 82 | Search for: <a href="https://scholar.google.com/scholar?q=Trace+Compiler"><span class="ext">»</span> Trace Compiler</a><br> |
85 | Search for: <a href="https://scholar.google.com/scholar?q=JIT+Compiler"><span class="ext">»</span> JIT Compiler</a><br> | 83 | Search for: <a href="https://scholar.google.com/scholar?q=JIT+Compiler"><span class="ext">»</span> JIT Compiler</a><br> |
86 | Search for: <a href="https://scholar.google.com/scholar?q=Dynamic+Language+Optimizations"><span class="ext">»</span> Dynamic Language Optimizations</a><br> | 84 | Search for: <a href="https://scholar.google.com/scholar?q=Dynamic+Language+Optimizations"><span class="ext">»</span> Dynamic Language Optimizations</a><br> |
87 | Search for: <a href="https://scholar.google.com/scholar?q=SSA+Form"><span class="ext">»</span> SSA Form</a><br> | 85 | Search for: <a href="https://scholar.google.com/scholar?q=SSA+Form"><span class="ext">»</span> SSA Form</a><br> |
88 | Search for: <a href="https://scholar.google.com/scholar?q=Linear+Scan+Register+Allocation"><span class="ext">»</span> Linear Scan Register Allocation</a><br> | 86 | Search for: <a href="https://scholar.google.com/scholar?q=Linear+Scan+Register+Allocation"><span class="ext">»</span> Linear Scan Register Allocation</a><br> |
89 | Here is a list of the <a href="http://lua-users.org/lists/lua-l/2009-11/msg00089.html"><span class="ext">»</span> innovative features in LuaJIT</a>.<br> | 87 | Here is a list of the <a href="http://lua-users.org/lists/lua-l/2009-11/msg00089.html"><span class="ext">»</span> innovative features in LuaJIT</a>.<br> |
90 | And, you know, reading the source is of course the only way to enlightenment. :-) | 88 | And, you know, reading the source is of course the only way to enlightenment. |
91 | </dd> | 89 | </dd> |
92 | </dl> | 90 | </dl> |
93 | 91 | ||
@@ -126,12 +124,11 @@ Please check the Delphi docs for the Set8087CW method. | |||
126 | <dl id="ctrlc"> | 124 | <dl id="ctrlc"> |
127 | <dt>Q: Sometimes Ctrl-C fails to stop my Lua program. Why?</dt> | 125 | <dt>Q: Sometimes Ctrl-C fails to stop my Lua program. Why?</dt> |
128 | <dd>The interrupt signal handler sets a Lua debug hook. But this is | 126 | <dd>The interrupt signal handler sets a Lua debug hook. But this is |
129 | currently ignored by compiled code (this will eventually be fixed). If | 127 | ignored by compiled code. If your program is running in a tight loop |
130 | your program is running in a tight loop and never falls back to the | 128 | and never falls back to the interpreter, the debug hook never runs and |
131 | interpreter, the debug hook never runs and can't throw the | 129 | can't throw the "interrupted!" error.<br> |
132 | "interrupted!" error.<br> In the meantime you have to press Ctrl-C | 130 | You have to press Ctrl-C twice to get stop your program. That's similar |
133 | twice to get stop your program. That's similar to when it's stuck | 131 | to when it's stuck running inside a C function under the Lua interpreter.</dd> |
134 | running inside a C function under the Lua interpreter.</dd> | ||
135 | </dl> | 132 | </dl> |
136 | 133 | ||
137 | <dl id="sandbox"> | 134 | <dl id="sandbox"> |
@@ -145,28 +142,18 @@ it's very hard to get this right even for the Lua core libraries. Of course, | |||
145 | you'll need to inspect any extension library, too. And there are libraries | 142 | you'll need to inspect any extension library, too. And there are libraries |
146 | that are inherently unsafe, e.g. the <a href="ext_ffi.html">FFI library</a>.<br> | 143 | that are inherently unsafe, e.g. the <a href="ext_ffi.html">FFI library</a>.<br> |
147 | 144 | ||
148 | Relatedly, <b>loading untrusted bytecode is not safe!</b> It's trivial | 145 | More reading material at the <a href="http://lua-users.org/wiki/SandBoxes"><span class="ext">»</span> Lua Wiki</a> and <a href="https://en.wikipedia.org/wiki/Sandbox_(computer_security)"><span class="ext">»</span> Wikipedia</a>.<br><br> |
149 | to crash the Lua or LuaJIT VM with maliciously crafted bytecode. This is | ||
150 | well known and there's no bytecode verification on purpose, so please | ||
151 | don't report a bug about it. Check the <tt>mode</tt> parameter for the | ||
152 | <tt>load*()</tt> functions to disable loading of bytecode.<br> | ||
153 | 146 | ||
154 | In general, the only promising approach is to sandbox Lua code at the | 147 | Relatedly, <b>loading untrusted bytecode is not safe!</b><br> |
155 | process level and not the VM level.<br> | ||
156 | 148 | ||
157 | More reading material at the <a href="http://lua-users.org/wiki/SandBoxes"><span class="ext">»</span> Lua Wiki</a> and <a href="https://en.wikipedia.org/wiki/Sandbox_(computer_security)"><span class="ext">»</span> Wikipedia</a>. | 149 | It's trivial to crash the Lua or LuaJIT VM with maliciously crafted bytecode. |
158 | </dd> | 150 | This is well known and there's no bytecode verification on purpose, so please |
159 | </dl> | 151 | don't report a bug about it. Check the <tt>mode</tt> parameter for the |
152 | <tt>load*()</tt> functions to disable loading of bytecode.<br><br> | ||
160 | 153 | ||
161 | <dl id="patches"> | 154 | <b>In general, the only promising approach is to sandbox Lua code at the |
162 | <dt>Q: Why doesn't my favorite power-patch for Lua apply against LuaJIT?</dt> | 155 | process level and not the VM level.</b> |
163 | <dd>Because it's a completely redesigned VM and has very little code | 156 | </dd> |
164 | in common with Lua anymore. Also, if the patch introduces changes to | ||
165 | the Lua semantics, these would need to be reflected everywhere in the | ||
166 | VM, from the interpreter up to all stages of the compiler.<br> Please | ||
167 | use only standard Lua language constructs. For many common needs you | ||
168 | can use source transformations or use wrapper or proxy functions. | ||
169 | The compiler will happily optimize away such indirections.</dd> | ||
170 | </dl> | 157 | </dl> |
171 | 158 | ||
172 | <dl id="arch"> | 159 | <dl id="arch"> |
@@ -176,17 +163,11 @@ machine code. This means the code generator must be ported to each | |||
176 | architecture. And the fast interpreter is written in assembler and | 163 | architecture. And the fast interpreter is written in assembler and |
177 | must be ported, too. This is quite an undertaking.<br> | 164 | must be ported, too. This is quite an undertaking.<br> |
178 | The <a href="install.html">install documentation</a> shows the supported | 165 | The <a href="install.html">install documentation</a> shows the supported |
179 | architectures. Other architectures will follow based on sufficient user | 166 | architectures.<br> |
180 | demand and/or sponsoring.</dd> | 167 | Other architectures may follow based on sufficient user demand and |
181 | </dl> | 168 | market-relevance of the architecture. Sponsoring is required to develop |
182 | 169 | the port itself, to integrate it and to continuously maintain it in the | |
183 | <dl id="when"> | 170 | actively developed branches.</dd> |
184 | <dt>Q: When will feature X be added? When will the next version be released?</dt> | ||
185 | <dd>When it's ready.<br> | ||
186 | C'mon, it's open source — I'm doing it on my own time and you're | ||
187 | getting it for free. You can either contribute a patch or sponsor | ||
188 | the development of certain features, if they are important to you. | ||
189 | </dd> | ||
190 | </dl> | 171 | </dl> |
191 | <br class="flush"> | 172 | <br class="flush"> |
192 | </div> | 173 | </div> |
diff --git a/doc/install.html b/doc/install.html index 85ca9913..6110450c 100644 --- a/doc/install.html +++ b/doc/install.html | |||
@@ -101,8 +101,8 @@ operating systems, CPUs and compilers: | |||
101 | <td class="compatcpu">CPU / OS</td> | 101 | <td class="compatcpu">CPU / OS</td> |
102 | <td class="compatos"><a href="#posix">Linux</a> or<br><a href="#android">Android</a></td> | 102 | <td class="compatos"><a href="#posix">Linux</a> or<br><a href="#android">Android</a></td> |
103 | <td class="compatos"><a href="#posix">*BSD, Other</a></td> | 103 | <td class="compatos"><a href="#posix">*BSD, Other</a></td> |
104 | <td class="compatos"><a href="#posix">OSX 10.4+</a> or<br><a href="#ios">iOS 3.0+</a></td> | 104 | <td class="compatos"><a href="#posix">macOS 10.4+</a> or<br><a href="#ios">iOS 3.0+</a></td> |
105 | <td class="compatos"><a href="#windows">Windows<br>XP/Vista/7</a></td> | 105 | <td class="compatos"><a href="#windows">Windows XP<br>or later</a></td> |
106 | </tr> | 106 | </tr> |
107 | <tr class="odd separate"> | 107 | <tr class="odd separate"> |
108 | <td class="compatcpu">x86 (32 bit)</td> | 108 | <td class="compatcpu">x86 (32 bit)</td> |
@@ -168,7 +168,7 @@ Please read the instructions given in these files, before changing | |||
168 | any settings. | 168 | any settings. |
169 | </p> | 169 | </p> |
170 | 170 | ||
171 | <h2 id="posix">POSIX Systems (Linux, OSX, *BSD etc.)</h2> | 171 | <h2 id="posix">POSIX Systems (Linux, macOS, *BSD etc.)</h2> |
172 | <h3>Prerequisites</h3> | 172 | <h3>Prerequisites</h3> |
173 | <p> | 173 | <p> |
174 | Depending on your distribution, you may need to install a package for | 174 | Depending on your distribution, you may need to install a package for |
@@ -176,8 +176,9 @@ GCC, the development headers and/or a complete SDK. E.g. on a current | |||
176 | Debian/Ubuntu, install <tt>libc6-dev</tt> with the package manager. | 176 | Debian/Ubuntu, install <tt>libc6-dev</tt> with the package manager. |
177 | </p> | 177 | </p> |
178 | <p> | 178 | <p> |
179 | Download the current source package of LuaJIT (pick the .tar.gz), | 179 | The recommended way to fetch the latest version is to do a pull from |
180 | if you haven't already done so. Move it to a directory of your choice, | 180 | the git repository. Alternatively download the latest source package of |
181 | LuaJIT (pick the .tar.gz). Move it to a directory of your choice, | ||
181 | open a terminal window and change to this directory. Now unpack the archive | 182 | open a terminal window and change to this directory. Now unpack the archive |
182 | and change to the newly created directory: | 183 | and change to the newly created directory: |
183 | </p> | 184 | </p> |
@@ -207,7 +208,7 @@ You can add an extra prefix to the search paths by appending the | |||
207 | make PREFIX=/home/myself/lj2 | 208 | make PREFIX=/home/myself/lj2 |
208 | </pre> | 209 | </pre> |
209 | <p> | 210 | <p> |
210 | Note for OSX: you must set the <tt>MACOSX_DEPLOYMENT_TARGET</tt> | 211 | Note for macOS: you must set the <tt>MACOSX_DEPLOYMENT_TARGET</tt> |
211 | environment variable to a value supported by your toolchain. | 212 | environment variable to a value supported by your toolchain. |
212 | </p> | 213 | </p> |
213 | <h3>Installing LuaJIT</h3> | 214 | <h3>Installing LuaJIT</h3> |
@@ -241,8 +242,9 @@ GCC plus the required development headers. | |||
241 | Or install Microsoft's Visual Studio (MSVC). | 242 | Or install Microsoft's Visual Studio (MSVC). |
242 | </p> | 243 | </p> |
243 | <p> | 244 | <p> |
244 | Next, download the source package and unpack it using an archive manager | 245 | Next, pull from the git repository or download the source package and |
245 | (e.g. the Windows Explorer) to a directory of your choice. | 246 | unpack it using an archive manager (e.g. the Windows Explorer) to |
247 | a directory of your choice. | ||
246 | </p> | 248 | </p> |
247 | <h3>Building with MSVC</h3> | 249 | <h3>Building with MSVC</h3> |
248 | <p> | 250 | <p> |
@@ -260,8 +262,8 @@ Then follow the installation instructions below. | |||
260 | <h3>Building with MinGW or Cygwin</h3> | 262 | <h3>Building with MinGW or Cygwin</h3> |
261 | <p> | 263 | <p> |
262 | Open a command prompt window and make sure the MinGW or Cygwin programs | 264 | Open a command prompt window and make sure the MinGW or Cygwin programs |
263 | are in your path. Then <tt>cd</tt> to the directory where | 265 | are in your path. Then <tt>cd</tt> to the directory of the git repository |
264 | you've unpacked the sources and run this command for MinGW: | 266 | or where you've unpacked the sources. Then run this command for MinGW: |
265 | </p> | 267 | </p> |
266 | <pre class="code"> | 268 | <pre class="code"> |
267 | mingw32-make | 269 | mingw32-make |
@@ -302,7 +304,7 @@ x64 OS, you need to install the multilib development package (e.g. | |||
302 | <p> | 304 | <p> |
303 | You need to specify <tt>TARGET_SYS</tt> whenever the host OS and the | 305 | You need to specify <tt>TARGET_SYS</tt> whenever the host OS and the |
304 | target OS differ, or you'll get assembler or linker errors. E.g. if | 306 | target OS differ, or you'll get assembler or linker errors. E.g. if |
305 | you're compiling on a Windows or OSX host for embedded Linux or Android, | 307 | you're compiling on a Windows or macOS host for embedded Linux or Android, |
306 | you need to add <tt>TARGET_SYS=Linux</tt> to the examples below. For a | 308 | you need to add <tt>TARGET_SYS=Linux</tt> to the examples below. For a |
307 | minimal target OS, you may need to disable the built-in allocator in | 309 | minimal target OS, you may need to disable the built-in allocator in |
308 | <tt>src/Makefile</tt> and use <tt>TARGET_SYS=Other</tt>. Don't forget to | 310 | <tt>src/Makefile</tt> and use <tt>TARGET_SYS=Other</tt>. Don't forget to |
@@ -461,15 +463,14 @@ intend to load Lua/C modules at runtime. | |||
461 | </li></ul> | 463 | </li></ul> |
462 | </li> | 464 | </li> |
463 | <li> | 465 | <li> |
464 | If you're building a 64 bit application on OSX which links directly or | 466 | <i>Important: this relates to LuaJIT 2.0 only — use LuaJIT 2.1 to |
467 | avoid these complications.</i><br> | ||
468 | If you're building a 64 bit application on macOS which links directly or | ||
465 | indirectly against LuaJIT, you need to link your main executable | 469 | indirectly against LuaJIT, you need to link your main executable |
466 | with these flags: | 470 | with these flags: |
467 | <pre class="code"> | 471 | <pre class="code"> |
468 | -pagezero_size 10000 -image_base 100000000 | 472 | -pagezero_size 10000 -image_base 100000000 |
469 | </pre> | 473 | </pre> |
470 | Also, it's recommended to <tt>rebase</tt> all (self-compiled) shared libraries | ||
471 | which are loaded at runtime on OSX/x64 (e.g. C extension modules for Lua). | ||
472 | See: <tt>man rebase</tt> | ||
473 | </li> | 474 | </li> |
474 | </ul> | 475 | </ul> |
475 | <p>Additional hints for initializing LuaJIT using the C API functions:</p> | 476 | <p>Additional hints for initializing LuaJIT using the C API functions:</p> |
@@ -479,7 +480,7 @@ See: <tt>man rebase</tt> | |||
479 | for embedding Lua or LuaJIT into your application.</li> | 480 | for embedding Lua or LuaJIT into your application.</li> |
480 | <li>Make sure you use <tt>luaL_newstate</tt>. Avoid using | 481 | <li>Make sure you use <tt>luaL_newstate</tt>. Avoid using |
481 | <tt>lua_newstate</tt>, since this uses the (slower) default memory | 482 | <tt>lua_newstate</tt>, since this uses the (slower) default memory |
482 | allocator from your system (no support for this on x64).</li> | 483 | allocator from your system (no support for this on 64 bit architectures).</li> |
483 | <li>Make sure you use <tt>luaL_openlibs</tt> and not the old Lua 5.0 style | 484 | <li>Make sure you use <tt>luaL_openlibs</tt> and not the old Lua 5.0 style |
484 | of calling <tt>luaopen_base</tt> etc. directly.</li> | 485 | of calling <tt>luaopen_base</tt> etc. directly.</li> |
485 | <li>To change or extend the list of standard libraries to load, copy | 486 | <li>To change or extend the list of standard libraries to load, copy |
diff --git a/doc/luajit.html b/doc/luajit.html index f99aa022..d5b1c1e6 100644 --- a/doc/luajit.html +++ b/doc/luajit.html | |||
@@ -152,7 +152,7 @@ LuaJIT is Copyright © 2005-2020 Mike Pall, released under the | |||
152 | 152 | ||
153 | <h2>Compatibility</h2> | 153 | <h2>Compatibility</h2> |
154 | <table class="feature os os1"> | 154 | <table class="feature os os1"> |
155 | <tr><td>Windows</td><td>Linux</td><td>BSD</td><td>OSX</td><td>POSIX</td></tr> | 155 | <tr><td>Windows</td><td>Linux</td><td>BSD</td><td>macOS</td><td>POSIX</td></tr> |
156 | </table> | 156 | </table> |
157 | <table class="feature os os2"> | 157 | <table class="feature os os2"> |
158 | <tr><td><span style="font-size:90%;">Embedded</span></td><td>Android</td><td>iOS</td></tr> | 158 | <tr><td><span style="font-size:90%;">Embedded</span></td><td>Android</td><td>iOS</td></tr> |
diff --git a/doc/status.html b/doc/status.html index 0d357613..d28d7eb5 100644 --- a/doc/status.html +++ b/doc/status.html | |||
@@ -56,9 +56,15 @@ ul li { padding-bottom: 0.3em; } | |||
56 | </div> | 56 | </div> |
57 | <div id="main"> | 57 | <div id="main"> |
58 | <p> | 58 | <p> |
59 | <span style="color: #0000c0;">LuaJIT 2.0</span> is the current | 59 | This documentation is for LuaJIT 2.0.5. Please check the <tt>doc</tt> |
60 | <span style="color: #0000c0;">stable branch</span>. This branch is in | 60 | directory in each git branch for the version-specific documentation. |
61 | feature-freeze — new features will only be added to LuaJIT 2.1. | 61 | </p> |
62 | <p> | ||
63 | The currently developed branches are LuaJIT 2.1 and LuaJIT 2.0. | ||
64 | </p> | ||
65 | <p> | ||
66 | LuaJIT 2.0 is in feature-freeze — new features will only | ||
67 | be added to LuaJIT 2.1. | ||
62 | </p> | 68 | </p> |
63 | 69 | ||
64 | <h2>Current Status</h2> | 70 | <h2>Current Status</h2> |
@@ -86,8 +92,7 @@ in LuaJIT (no per-coroutine hooks, no tail call counting). | |||
86 | Currently some <b>out-of-memory</b> errors from <b>on-trace code</b> are not | 92 | Currently some <b>out-of-memory</b> errors from <b>on-trace code</b> are not |
87 | handled correctly. The error may fall through an on-trace | 93 | handled correctly. The error may fall through an on-trace |
88 | <tt>pcall</tt> or it may be passed on to the function set with | 94 | <tt>pcall</tt> or it may be passed on to the function set with |
89 | <tt>lua_atpanic</tt> on x64. This issue will be fixed with the new | 95 | <tt>lua_atpanic</tt> on x64. |
90 | garbage collector. | ||
91 | </li> | 96 | </li> |
92 | </ul> | 97 | </ul> |
93 | <br class="flush"> | 98 | <br class="flush"> |