LuaJIT | |
Author: | Mike Pall |
Latest Release Version: | 2.0.5 (later v2.1.ROLLING is also updated, e.g. in 2023) |
Programming Language: | C, Lua |
Operating System: | Unix-like, MacOS, Windows, iOS, Android, PlayStation |
Platform: | x86, X86-64, PowerPC, ARM, MIPS[1] |
Genre: | Just-in-time compiler |
License: | MIT License[2] |
Screenshot Alt: | "LuaJIT REPL running on Windows 10 |
Logo Alt: | The logo used for the LuaJIT compiler project |
Logo Caption: | The logo featured on the LuaJIT website. |
LuaJIT is a tracing just-in-time compiler for the Lua programming language. Mike Pall, a primary maintainer of the project had resigned in 2015, resorting only to occasional patching to the future 2.1 version.[3]
The LuaJIT project was started in 2005 by developer Mike Pall, released under the MIT open source license.[4]
The second major release of the compiler, 2.0.0, featured major performance increases.[5]
The latest release, 2.0.5 is released in 2017. However, Mike Pall, the creator and maintainer recommends using the tip of the v2.1 branch, and does not believe in releases.[6]
LuaJIT is often the fastest Lua runtime.[12] LuaJIT has also been named the fastest implementation of a dynamic programming language.[13] [14]
LuaJIT includes a Foreign Function Interface compatible with C data structures. Its use is encouraged for numerical computation.[15]
LuaJIT is a tracing just-in-time compiler. LuaJIT chooses loops and function calls as trace anchors to begin recording possible hot paths. Function calls will require twice as many invocations to begin recording as a loop. Once LuaJIT begins recording, all control flow, including jumps and calls, are inlined to form a linear trace. All executed bytecode instructions are stored and incrementally converted into LuaJIT's static single-assignment intermediate representation. LuaJIT's trace compiler is often capable of inlining and removing dispatches from object orientation, operators, and type modifications.[16]
LuaJIT uses two types of internal representation. A stack-based bytecode is used for the interpreter, and a static single-assignment form is used for the just-in-time compiler. The interpreter bytecode is frequently patched by the JIT compiler, often to begin executing a compiled trace or to mark a segment of bytecode for causing too many trace aborts.[14]
local x = 0
for i=1,1e4 do x = x + 11 if i%10
LuaJIT adds several extensions to its base implementation, Lua 5.1, most of which do not break compatibility.[17]
DynASM | |
Developer: | Mike Pall |
Programming Language: | Lua, C[22] |
Platform: | x86, X86-64, PowerPC, ARM, MIPS |
Genre: | Preprocessor, Linker |
License: | MIT License |
DynASM is a lightweight preprocessor for C that provides its own flavor of inline assembler, independent of the C compiler. DynASM replaces assembly code in C files with runtime writes to a 'code buffer', such that a developer may generate and then evoke code at runtime from a C program. It was created for LuaJIT 1.0.0 to make developing the just-in-time compiler easier.
DynASM includes a bare-bones C header file which is used at compile time for logic the preprocessor generates. The actual preprocessor is written in Lua.