LuaJIT

# LuaJIT Change History

This is a list of changes between the released versions of LuaJIT.
The current stable version is LuaJIT 2.0.4.

Please check the » Online Change History to see whether newer versions are available.

## LuaJIT 2.0.4 — 2015-05-14

- Fix stack check in narrowing optimization.
- Fix Lua/C API typecheck error for special indexes.
- Fix string to number conversion.
- Fix lexer error for chunks without tokens.
- Don't compile `IR_RETF` after `CALLT` to ff with-side effects.
- Fix `BC_UCLO`/`BC_JMP` join optimization in Lua parser.
- Fix corner case in string to number conversion.
- Gracefully handle `lua_error()` for a suspended coroutine.
- Avoid error messages when building with Clang.
- Fix snapshot #0 handling for traces with a stack check on entry.
- Fix fused constant loads under high register pressure.
- Invalidate backpropagation cache after DCE.
- Fix ABC elimination.
- Fix debug info for main chunk of stripped bytecode.
- Fix FOLD rule for `string.sub(s, ...) == k`.
- Fix FOLD rule for `STRREF` of `SNEW`.
- Fix frame traversal while searching for error function.
- Prevent GC estimate miscalculation due to buffer growth.
- Prevent adding side traces for stack checks.
- Fix top slot calculation for snapshots with continuations.
- Fix check for reuse of SCEV results in `FORL`.
- Add PS Vita port.
- Fix compatibility issues with Illumos.
- Fix DragonFly build (unsupported).
- OpenBSD/x86: Better executable memory allocation for W^X mode.
- x86: Fix argument checks for `ipairs()` iterator.
- x86: `lj_math_random_step()` clobbers XMM regs on OSX Clang.
- x86: Fix code generation for unused result of `math.random()`.
- x64: Allow building with `LUAJIT_USE_SYSMALLOC` and `LUAJIT_USE_VALGRIND`.
- x86/x64: Fix argument check for bit shifts.
- x86/x64: Fix code generation for fused test/arith ops.
- ARM: Fix write barrier check in `BC_USETS`.
- PPC: Fix red zone overflow in machine code generation.
- PPC: Don't use `mcrxr` on PPE.
- Various archs: Fix excess stack growth in interpreter.
- FFI: Fix FOLD rule for `TOBIT` + `CONV num.u32`.
- FFI: Prevent DSE across `ffi.string()`.
- FFI: No meta fallback when indexing pointer to incomplete struct.
- FFI: Fix initialization of unions of subtypes.
- FFI: Fix cdata vs. non-cdata arithmetic and comparisons.
- FFI: Fix `__index`/`__newindex` metamethod resolution for ctypes.
- FFI: Fix compilation of reference field access.
- FFI: Fix frame traversal for backtraces with FFI callbacks.
- FFI: Fix recording of indexing a struct pointer ctype object itself.
- FFI: Allow non-scalar cdata to be compared for equality by address.
- FFI: Fix pseudo type conversions for type punning.

## LuaJIT 2.0.3 — 2014-03-12

- Add PS4 port.
- Add support for multilib distro builds.
- Fix OSX build.
- Fix MinGW build.
- Fix Xbox 360 build.
- Improve ULOAD forwarding for open upvalues.
- Fix GC steps threshold handling when called by JIT-compiled code.
- Fix argument checks for `math.deg()` and `math.rad()`.
- Fix `jit.flush(func|true)`.
- Respect `jit.off(func)` when returning to a function, too.
- Fix compilation of `string.byte(s, nil, n)`.
- Fix line number for relocated bytecode after closure fixup
- Fix frame traversal for backtraces.
- Fix ABC elimination.
- Fix handling of redundant PHIs.
- Fix snapshot restore for exit to function header.
- Fix type punning alias analysis for constified pointers
- Fix call unroll checks in the presence of metamethod frames.
- Fix initial maxslot for down-recursive traces.
- Prevent BASE register coalescing if parent uses `IR_RETF`.
- Don't purge modified function from stack slots in `BC_RET`.
- Fix recording of `BC_VARG`.
- Don't access dangling reference to reallocated IR.
- Fix frame depth display for bytecode dump in `-jdump`.
- ARM: Fix register allocation when rematerializing FPRs.
- x64: Fix store to upvalue for lightuserdata values.
- FFI: Add missing GC steps for callback argument conversions.
- FFI: Properly unload loaded DLLs.
- FFI: Fix argument checks for `ffi.string()`.
- FFI/x64: Fix passing of vector arguments to calls.
- FFI: Rehash finalizer table after GC cycle, if needed.
- FFI: Fix `cts->L` for cdata unsinking in snapshot restore.

## LuaJIT 2.0.2 — 2013-06-03

- Fix memory access check for fast string interning.
- Fix MSVC intrinsics for older versions.
- Add missing GC steps for `io.*` functions.
- Fix spurious red zone overflows in machine code generation.
- Fix jump-range constrained mcode allocation.
- Inhibit DSE for implicit loads via calls.
- Fix builtin string to number conversion for overflow digits.
- Fix optional argument handling while recording builtins.
- Fix optional argument handling in `table.concat()`.
- Add partial support for building with MingW64 GCC 4.8-SEH.
- Add missing PHI barrier to `string.sub(str, a, b) == kstr` FOLD rule.
- Fix compatibility issues with Illumos.
- ARM: Fix cache flush/sync for exit stubs of JIT-compiled code.
- MIPS: Fix cache flush/sync for JIT-compiled code jump area.
- PPC: Add `plt` suffix for external calls from assembler code.
- FFI: Fix snapshot substitution in SPLIT pass.
- FFI/x86: Fix register allocation for 64 bit comparisons.
- FFI: Fix tailcall in lowest frame to C function with bool result.
- FFI: Ignore `long` type specifier in `ffi.istype()`.
- FFI: Fix calling conventions for 32 bit OSX and iOS simulator (struct returns).
- FFI: Fix calling conventions for ARM hard-float EABI (nested structs).
- FFI: Improve error messages for arithmetic and comparison operators.
- FFI: Insert no-op type conversion for pointer to integer cast.
- FFI: Fix unroll limit for `ffi.fill()`.
- FFI: Must sink `XBAR` together with `XSTORE`s.
- FFI: Preserve intermediate string for `const char *` conversion.

## LuaJIT 2.0.1 — 2013-02-19

- Don't clear frame for out-of-memory error.
- Leave hook when resume catches error thrown from hook.
- Add missing GC steps for template table creation.
- Fix discharge order of comparisons in Lua parser.
- Improve buffer handling for `io.read()`.
- OSX: Add support for Mach-O object files to `-b` option.
- Fix PS3 port.
- Fix/enable Xbox 360 port.
- x86/x64: Always mark ref for shift count as non-weak.
- x64: Don't fuse implicitly 32-to-64 extended operands.
- ARM: Fix armhf call argument handling.
- ARM: Fix code generation for integer math.min/math.max.
- PPC/e500: Fix `lj_vm_floor()` for Inf/NaN.
- FFI: Change priority of table initializer variants for structs.
- FFI: Fix code generation for bool call result check on x86/x64.
- FFI: Load FFI library on-demand for bytecode with cdata literals.
- FFI: Fix handling of qualified transparent structs/unions.

## LuaJIT 2.0.0 — 2012-11-08

- Correctness and completeness:
  - Fix Android/x86 build.
  - Fix recording of equality comparisons with `__eq` metamethods.
  - Fix detection of immutable upvalues.
  - Replace error with PANIC for callbacks from JIT-compiled code.
  - Fix builtin string to number conversion for `INT_MIN`.
  - Don't create unneeded array part for template tables.
  - Fix `CONV.num.int` sinking.
  - Don't propagate implicitly widened number to index metamethods.
  - ARM: Fix ordered comparisons of number vs. non-number.
  - FFI: Fix code generation for replay of sunk float fields.
  - FFI: Fix signedness of bool.
  - FFI: Fix recording of bool call result check on x86/x64.
  - FFI: Fix stack-adjustment for `__thiscall` callbacks.

## LuaJIT 2.0.0-beta11 — 2012-10-16

- New features:
  - Use ARM VFP instructions, if available (build-time detection).
  - Add support for ARM hard-float EABI (`armhf`).
  - Add PS3 port.
  - Add many features from Lua 5.2, e.g. `goto`/labels. Refer to this list.
  - FFI: Add parameterized C types.
  - FFI: Add support for copy constructors.
  - FFI: Equality comparisons never raise an error (treat as unequal instead).
  - FFI: Box all accessed or returned enums.
  - FFI: Check for `__new` metamethod when calling a constructor.
  - FFI: Handle `__pairs`/`__ipairs` metamethods for cdata objects.
  - FFI: Convert `io.*` file handle to `FILE *` pointer (but as a `void *`).
  - FFI: Detect and support type punning through unions.
  - FFI: Improve various error messages.
- Build-system reorganization:
  - Reorganize directory layout:
    `lib/*` → `src/jit/*`
    `src/buildvm_*.dasc` → `src/vm_*.dasc`
    `src/buildvm_*.h` → removed
    `src/buildvm*` → `src/host/*`
  - Add minified Lua interpreter plus Lua BitOp (`minilua`) to run DynASM.
  - Change DynASM bit operations to use Lua BitOp
  - Translate only `vm_*.dasc` for detected target architecture.
  - Improve target detection for `msvcbuild.bat`.
  - Fix build issues on Cygwin and MinGW with optional MSys.
  - Handle cross-compiles with FPU/no-FPU or hard-fp/soft-fp ABI mismatch.
  - Remove some library functions for no-JIT/no-FFI builds.
  - Add uninstall target to top-level Makefile.
- Correctness and completeness:
  - Preserve snapshot #0 PC for all traces.
  - Fix argument checks for `coroutine.create()`.
  - Command line prints version and JIT status to `stdout`, not `stderr`.
  - Fix userdata `__gc` separations at Lua state close.
  - Fix `TDUP` to `HLOAD` forwarding for `LJ_DUALNUM` builds.
  - Fix buffer check in bytecode writer.
  - Make `os.date()` thread-safe.
  - Add missing declarations for MSVC intrinsics.
  - Fix dispatch table modifications for return hooks.
  - Workaround for MSVC conversion bug (`double` → `uint32_t` → `int32_t`).
  - Fix FOLD rule `(i-j)-i => 0-j`.
  - Never use DWARF unwinder on Windows.
  - Fix shrinking of direct mapped blocks in builtin allocator.
  - Limit recursion depth in `string.match()` et al.
  - Fix late despecialization of `ITERN` after loop has been entered.
  - Fix `'f'` and `'L'` options for `debug.getinfo()` and `lua_getinfo()`.
  - Fix `package.searchpath()`.
  - OSX: Change dylib names to be consistent with other platforms.
  - Android: Workaround for broken `sprintf("%g", -0.0)`.
  - x86: Remove support for ancient CPUs without `CMOV` (before Pentium Pro).
  - x86: Fix register allocation for calls returning register pair.
  - x86/x64: Fix fusion of unsigned byte comparisons with swapped operands.
  - ARM: Fix `tonumber()` argument check.
  - ARM: Fix modulo operator and `math.floor()`/`math.ceil()` for `inf`/`nan`.
  - ARM: Invoke SPLIT pass for leftover `IR_TOBIT`.
  - ARM: Fix BASE register coalescing.
  - PPC: Fix interpreter state setup in callbacks.
  - PPC: Fix `string.sub()` range check.
  - MIPS: Support generation of MIPS/MIPSEL bytecode object files.
  - MIPS: Fix calls to `floor()`/`ceil()``/trunc()`.
  - ARM/PPC: Detect more target architecture variants.
  - ARM/PPC/e500/MIPS: Fix tailcalls from fast functions, esp. `tostring()`.
  - ARM/PPC/MIPS: Fix rematerialization of FP constants.
  - FFI: Don't call `FreeLibrary()` on our own EXE/DLL.
  - FFI: Resolve metamethods for constructors, too.
  - FFI: Properly disable callbacks on iOS (would require executable memory).
  - FFI: Fix cdecl string parsing during recording.
  - FFI: Show address pointed to for `tostring(ref)`, too.
  - FFI: Fix alignment of C call argument/return structure.
  - FFI: Initialize all fields of standard types.
  - FFI: Fix callback handling when new C types are declared in callback.
  - FFI: Fix recording of constructors for pointers.
  - FFI: Always resolve metamethods for pointers to structs.
  - FFI: Correctly propagate alignment when interning nested types.
- Structural and performance enhancements:
  - Add allocation sinking and store sinking optimization.
  - Constify immutable upvalues.
  - Add builtin string to integer or FP number conversion. Improves cross-platform consistency and correctness.
  - Create string hash slots in template tables for non-const values, too. Avoids later table resizes.
  - Eliminate `HREFK` guard for template table references.
  - Add various new FOLD rules.
  - Don't use stack unwinding for `lua_yield()` (slow on x64).
  - ARM, PPC, MIPS: Improve `XLOAD` operand fusion and register hinting.
  - PPC, MIPS: Compile `math.sqrt()` to sqrt instruction, if available.
  - FFI: Fold `KPTR` + constant offset in SPLIT pass.
  - FFI: Optimize/inline `ffi.copy()` and `ffi.fill()`.
  - FFI: Compile and optimize array/struct copies.
  - FFI: Compile `ffi.typeof(cdata|ctype)`, `ffi.sizeof()`, `ffi.alignof()`, `ffi.offsetof()` and `ffi.gc()`.

## LuaJIT 2.0.0-beta10 — 2012-05-09

- New features:
  - The MIPS of LuaJIT is complete. It requires a CPU conforming to the MIPS32 R1 architecture with hardware FPU. O32 hard-fp ABI, little-endian or big-endian.
  - Auto-detect target arch via cross-compiler. No need for `TARGET=arch` anymore.
  - Make DynASM compatible with Lua 5.2.
  - From Lua 5.2: Try `__tostring` metamethod on non-string error messages..
- Correctness and completeness:
  - Fix parsing of hex literals with exponents.
  - Fix bytecode dump for certain number constants.
  - Fix argument type in error message for relative arguments.
  - Fix argument error handling on Lua stacks without a frame.
  - Add missing mcode limit check in assembler backend.
  - Fix compilation on OpenBSD.
  - Avoid recursive GC steps after GC-triggered trace exit.
  - Replace `<unwind.h>` definitions with our own.
  - Fix OSX build issues. Bump minimum required OSX version to 10.4.
  - Fix discharge order of comparisons in Lua parser.
  - Ensure running `__gc` of userdata created in `__gc` at state close.
  - Limit number of userdata `__gc` separations at state close.
  - Fix bytecode `JMP` slot range when optimizing `and`/`or` with constant LHS.
  - Fix DSE of `USTORE`.
  - Make `lua_concat()` work from C hook with partial frame.
  - Add required PHIs for implicit conversions, e.g. via `XREF` forwarding.
  - Add more comparison variants to Valgrind suppressions file.
  - Disable loading bytecode with an extra header (BOM or `#!`).
  - Fix PHI stack slot syncing.
  - ARM: Reorder type/value tests to silence Valgrind.
  - ARM: Fix register allocation for `ldrd`-optimized `HREFK`.
  - ARM: Fix conditional branch fixup for `OBAR`.
  - ARM: Invoke SPLIT pass for `double` args in FFI call.
  - ARM: Handle all `CALL*` ops with `double` results in SPLIT pass.
  - ARM: Fix rejoin of `POW` in SPLIT pass.
  - ARM: Fix compilation of `math.sinh`, `math.cosh`, `math.tanh`.
  - ARM, PPC: Avoid pointless arg clearing in `BC_IFUNCF`.
  - PPC: Fix resume after yield from hook.
  - PPC: Fix argument checking for `rawget()`.
  - PPC: Fix fusion of floating-point `XLOAD`/`XSTORE`.
  - PPC: Fix `HREFK` code generation for huge tables.
  - PPC: Use builtin D-Cache/I-Cache sync code.
- FFI library:
  - Ignore empty statements in `ffi.cdef()`.
  - Ignore number parsing errors while skipping definitions.
  - Don't touch frame in callbacks with tailcalls to fast functions.
  - Fix library unloading on POSIX systems.
  - Finalize cdata before userdata when closing the state.
  - Change `ffi.load()` library name resolution for Cygwin.
  - Fix resolving of function name redirects on Windows/x86.
  - Fix symbol resolving error messages on Windows.
  - Fix blacklisting of C functions calling callbacks.
  - Fix result type of pointer difference.
  - Use correct PC in FFI metamethod error message.
  - Allow `'typedef _Bool int BOOL;'` for the Windows API.
  - Don't record test for bool result of call, if ignored.

## LuaJIT 2.0.0-beta9 — 2011-12-14

- New features:
  - PPC port of LuaJIT is complete. Default is the dual-number port (usually faster). Single-number port selectable via `src/Makefile` at build time.
  - Add FFI callback support.
  - Extend `-b` to generate `.c`, `.h` or `.obj/.o` files with embedded bytecode.
  - Allow loading embedded bytecode with `require()`.
  - From Lua 5.2: Change to `'\z'` escape. Reject undefined escape sequences.
- Correctness and completeness:
  - Fix OSX 10.7 build. Fix `install_name` and versioning on OSX.
  - Fix iOS build.
  - Install `dis_arm.lua`, too.
  - Mark installed shared library as executable.
  - Add debug option to `msvcbuild.bat` and improve error handling.
  - Fix data-flow analysis for iterators.
  - Fix forced unwinding triggered by external unwinder.
  - Record missing `for` loop slot loads (return to lower frame).
  - Always use ANSI variants of Windows system functions.
  - Fix GC barrier for multi-result table constructor (`TSETM`).
  - Fix/add various FOLD rules.
  - Add potential PHI for number conversions due to type instability.
  - Do not eliminate PHIs only referenced from other PHIs.
  - Correctly anchor implicit number to string conversions in Lua/C API.
  - Fix various stack limit checks.
  - x64: Use thread-safe exceptions for external unwinding (GCC platforms).
  - x64: Fix result type of cdata index conversions.
  - x64: Fix `math.random()` and `bit.bswap()` code generation.
  - x64: Fix `lightuserdata` comparisons.
  - x64: Always extend stack-passed arguments to pointer size.
  - ARM: Many fixes to code generation backend.
  - PPC/e500: Fix dispatch for binop metamethods.
  - PPC/e500: Save/restore condition registers when entering/leaving the VM.
  - PPC/e500: Fix write barrier in stores of strings to upvalues.
- FFI library:
  - Fix C comment parsing.
  - Fix snapshot optimization for cdata comparisons.
  - Fix recording of const/enum lookups in namespaces.
  - Fix call argument and return handling for `I8/U8/I16/U16` types.
  - Fix unfused loads of float fields.
  - Fix `ffi.string()` recording.
  - Save `GetLastError()` around `ffi.load()` and symbol resolving, too.
  - Improve ld script detection in `ffi.load()`.
  - Record loads/stores to external variables in namespaces.
  - Compile calls to stdcall, fastcall and vararg functions.
  - Treat function ctypes like pointers in comparisons.
  - Resolve `__call` metamethod for pointers, too.
  - Record C function calls with bool return values.
  - Record `ffi.errno()`.
  - x86: Fix number to `uint32_t` conversion rounding.
  - x86: Fix 64 bit arithmetic in assembler backend.
  - x64: Fix struct-by-value calling conventions.
  - ARM: Ensure invocation of SPLIT pass for float conversions.
- Structural and performance enhancements:
  - Display trace types with `-jv` and `-jdump`.
  - Record isolated calls. But prefer recording loops over calls.
  - Specialize to prototype for non-monomorphic functions. Solves the trace-explosion problem for closure-heavy programming styles.
  - Always generate a portable `vmdef.lua`. Easier for distros.

## LuaJIT 2.0.0-beta8 — 2011-06-23

- New features:
  - Soft-float ARM port of LuaJIT is complete.
  - Add support for bytecode loading/saving and `-b` command line option.
  - From Lua 5.2: `__len` metamethod for tables (disabled by default).
- Correctness and completeness:
  - ARM: Misc. fixes for interpreter.
  - x86/x64: Fix `bit.*` argument checking in interpreter.
  - Catch early out-of-memory in memory allocator initialization.
  - Fix data-flow analysis for paths leading to an upvalue close.
  - Fix check for missing arguments in `string.format()`.
  - Fix Solaris/x86 build (note: not a supported target).
  - Fix recording of loops with instable directions in side traces.
  - x86/x64: Fix fusion of comparisons with `u8`/`u16` `XLOAD`.
  - x86/x64: Fix register allocation for variable shifts.
- FFI library:
  - Add `ffi.errno()`. Save `errno`/`GetLastError()` around allocations etc.
  - Fix `__gc` for VLA/VLS cdata objects.
  - Fix recording of casts from 32 bit cdata pointers to integers.
  - `tonumber(cdata)` returns `nil` for non-numbers.
  - Show address pointed to for `tostring(pointer)`.
  - Print `NULL` pointers as `"cdata<... *>: NULL"`.
  - Support `__tostring` metamethod for pointers to structs, too.
- Structural and performance enhancements:
  - More tuning for loop unrolling heuristics.
  - Flatten and compress in-memory debug info (saves ~70%).

## LuaJIT 2.0.0-beta7 — 2011-05-05

- New features:
  - ARM port of the LuaJIT interpreter is complete.
  - FFI library: Add `ffi.gc()`, `ffi.metatype()`, `ffi.istype()`.
  - FFI library: Resolve ld script redirection in `ffi.load()`.
  - From Lua 5.2: `package.searchpath()`, `fp:read("*L")`, `load(string)`.
  - From Lua 5.2, disabled by default: empty statement, `table.unpack()`, modified `coroutine.running()`.
- Correctness and completeness:
  - FFI library: numerous fixes.
  - Fix type mismatches in store-to-load forwarding.
  - Fix error handling within metamethods.
  - Fix `table.maxn()`.
  - Improve accuracy of `x^-k` on x64.
  - Fix code generation for Intel Atom in x64 mode.
  - Fix narrowing of POW.
  - Fix recording of retried fast functions.
  - Fix code generation for `bit.bnot()` and multiplies.
  - Fix error location within cpcall frames.
  - Add workaround for old libgcc unwind bug.
  - Fix `lua_yield()` and `getmetatable(lightuserdata)` on x64.
  - Misc. fixes for PPC/e500 interpreter.
  - Fix stack slot updates for down-recursion.
- Structural and performance enhancements:
  - Add dual-number mode (int/double) for the VM. Enabled for ARM.
  - Improve narrowing of arithmetic operators and `for` loops.
  - Tune loop unrolling heuristics and increase trace recorder limits.
  - Eliminate dead slots in snapshots using bytecode data-flow analysis.
  - Avoid phantom stores to proxy tables.
  - Optimize lookups in empty proxy tables.
  - Improve bytecode optimization of `and`/`or` operators.

## LuaJIT 2.0.0-beta6 — 2011-02-11

- New features:
  - PowerPC/e500v2 port of the LuaJIT interpreter is complete.
  - Various minor features from Lua 5.2: Hex escapes in literals, `'\*'` escape, reversible `string.format("%q",s)`, `"%g"` pattern, `table.sort` checks callbacks, `os.exit(status|true|false[,close])`.
  - Lua 5.2 `__pairs` and `__ipairs` metamethods (disabled by default).
  - Initial release of the FFI library.
- Correctness and completeness:
  - Fix `string.format()` for non-finite numbers.
  - Fix memory leak when compiled to use the built-in allocator.
  - x86/x64: Fix unnecessary resize in `TSETM` bytecode.
  - Fix various GC issues with traces and `jit.flush()`.
  - x64: Fix fusion of indexes for array references.
  - x86/x64: Fix stack overflow handling for coroutine results.
  - Enable low-2GB memory allocation on FreeBSD/x64.
  - Fix `collectgarbage("count")` result if more than 2GB is in use.
  - Fix parsing of hex floats.
  - x86/x64: Fix loop branch inversion with trailing `HREF+NE/EQ`.
  - Add `jit.os` string.
  - `coroutine.create()` permits running C functions, too.
  - Fix OSX build to work with newer ld64 versions.
  - Fix bytecode optimization of `and`/`or` operators.
- Structural and performance enhancements:
  - Emit specialized bytecode for `pairs()`/`next()`.
  - Improve bytecode coalescing of `nil` constants.
  - Compile calls to vararg functions.
  - Compile `select()`.
  - Improve alias analysis, esp. for loads from allocations.
  - Tuning of various compiler heuristics.
  - Refactor and extend IR conversion instructions.
  - x86/x64: Various backend enhancements related to the FFI.
  - Add SPLIT pass to split 64 bit IR instructions for 32 bit CPUs.

## LuaJIT 2.0.0-beta5 — 2010-08-24

- Correctness and completeness:
  - Fix trace exit dispatch to function headers.
  - Fix Windows and OSX builds with LUAJIT_DISABLE_JIT.
  - Reorganize and fix placement of generated machine code on x64.
  - Fix TNEW in x64 interpreter.
  - Do not eliminate PHIs for values only referenced from side exits.
  - OS-independent canonicalization of strings for non-finite numbers.
  - Fix `string.char()` range check on x64.
  - Fix `tostring()` resolving within `print()`.
  - Fix error handling for `next()`.
  - Fix passing of constant arguments to external calls on x64.
  - Fix interpreter argument check for two-argument SSE math functions.
  - Fix C frame chain corruption caused by `lua_cpcall()`.
  - Fix return from `pcall()` within active hook.
- Structural and performance enhancements:
  - Replace on-trace GC frame syncing with interpreter exit.
  - Improve hash lookup specialization by not removing dead keys during GC.
  - Turn traces into true GC objects.
  - Avoid starting a GC cycle immediately after library init.
  - Add weak guards to improve dead-code elimination.
  - Speed up string interning.

## LuaJIT 2.0.0-beta4 — 2010-03-28

- Correctness and completeness:
  - Fix precondition for on-trace creation of table keys.
  - Fix `{f()}` on x64 when table is resized.
  - Fix folding of ordered comparisons with same references.
  - Fix snapshot restores for multi-result bytecodes.
  - Fix potential hang when recording bytecode with nested closures.
  - Fix recording of `getmetatable()`, `tonumber()` and bad argument types.
  - Fix SLOAD fusion across returns to lower frames.
- Structural and performance enhancements:
  - Add array bounds check elimination. `-Oabc` is enabled by default.
  - More tuning for x64, e.g. smaller table objects.

## LuaJIT 2.0.0-beta3 — 2010-03-07

- LuaJIT x64 port:
  - Port integrated memory allocator to Linux/x64, Windows/x64 and OSX/x64.
  - Port interpreter and JIT compiler to x64.
  - Port DynASM to x64.
  - Many 32/64 bit cleanups in the VM.
  - Allow building the interpreter with either x87 or SSE2 arithmetics.
  - Add external unwinding and C++ exception interop (default on x64).
- Correctness and completeness:
  - Fix constructor bytecode generation for certain conditional values.
  - Fix some cases of ordered string comparisons.
  - Fix `lua_tocfunction()`.
  - Fix cutoff register in JMP bytecode for some conditional expressions.
  - Fix PHI marking algorithm for references from variant slots.
  - Fix `package.cpath` for non-default PREFIX.
  - Fix DWARF2 frame unwind information for interpreter on OSX.
  - Drive the GC forward on string allocations in the parser.
  - Implement call/return hooks (zero-cost if disabled).
  - Implement yield from C hooks.
  - Disable JIT compiler on older non-SSE2 CPUs instead of aborting.
- Structural and performance enhancements:
  - Compile recursive code (tail-, up- and down-recursion).
  - Improve heuristics for bytecode penalties and blacklisting.
  - Split CALL/FUNC recording and clean up fast function call semantics.
  - Major redesign of internal function call handling.
  - Improve FOR loop const specialization and integerness checks.
  - Switch to pre-initialized stacks. Avoid frame-clearing.
  - Colocation of prototypes and related data: bytecode, constants, debug info.
  - Cleanup parser and streamline bytecode generation.
  - Add support for weak IR references to register allocator.
  - Switch to compressed, extensible snapshots.
  - Compile returns to frames below the start frame.
  - Improve alias analysis of upvalues using a disambiguation hash value.
  - Compile floor/ceil/trunc to SSE2 helper calls or SSE4.1 instructions.
  - Add generic C call handling to IR and backend.
  - Improve KNUM fuse vs. load heuristics.
  - Compile various `io.*()` functions.
  - Compile `math.sinh()`, `math.cosh()`, `math.tanh()` and `math.random()`.

## LuaJIT 2.0.0-beta2 — 2009-11-09

- Reorganize build system. Build static+shared library on POSIX.
- Allow C++ exception conversion on all platforms using a wrapper function.
- Automatically catch C++ exceptions and rethrow Lua error (DWARF2 only).
- Check for the correct x87 FPU precision at strategic points.
- Always use wrappers for libm functions.
- Resurrect metamethod name strings before copying them.
- Mark current trace, even if compiler is idle.
- Ensure FILE metatable is created only once.
- Fix type comparisons when different integer types are involved.
- Fix `getmetatable()` recording.
- Fix TDUP with dead keys in template table.
- `jit.flush(tr)` returns status. Prevent manual flush of a trace that's still linked.
- Improve register allocation heuristics for invariant references.
- Compile the push/pop variants of `table.insert()` and `table.remove()`.
- Compatibility with MSVC `link /debug`.
- Fix `lua_iscfunction()`.
- Fix `math.random()` when compiled with `-fpic` (OSX).
- Fix `table.maxn()`.
- Bump `MACOSX_DEPLOYMENT_TARGET` to `10.4`
- `luaL_check*()` and `luaL_opt*()` now support negative arguments, too.
  This matches the behavior of Lua 5.1, but not the specification.

## LuaJIT 2.0.0-beta1 — 2009-10-31

- This is the first public release of LuaJIT 2.0.
- The whole VM has been rewritten from the ground up, so there's no point in listing differences over earlier versions.

## LuaJIT 1.1.8 — 2012-04-16

- Merged with Lua 5.1.5. Also integrated fixes for all » » currently known bugs in Lua 5.1.5.

## LuaJIT 1.1.7 — 2011-05-05

- Added fixes for the » currently known bugs in Lua 5.1.4.

## LuaJIT 1.1.6 — 2010-03-28

- Added fixes for the » currently known bugs in Lua 5.1.4.
- Removed wrong GC check in `jit_createstate()`. Thanks to Tim Mensch.
- Fixed bad assertions while compiling `table.insert()` and `table.remove()`.

## LuaJIT 1.1.5 — 2008-10-25

- Merged with Lua 5.1.4. Fixes all » known bugs in Lua 5.1.3.

## LuaJIT 1.1.4 — 2008-02-05

- Merged with Lua 5.1.3. Fixes all » known bugs in Lua 5.1.2.
- Fixed possible (but unlikely) stack corruption while compiling `k^x` expressions.
- Fixed DynASM template for cmpss instruction.

## LuaJIT 1.1.3 — 2007-05-24

- Merged with Lua 5.1.2. Fixes all » known bugs in Lua 5.1.1.
- Merged pending Lua 5.1.x fixes: "return -nil" bug, spurious count hook call.
- Remove a (sometimes) wrong assertion in `luaJIT_findpc()`.
- DynASM now allows labels for displacements and `.aword`.
- Fix some compiler warnings for DynASM glue (internal API change).
- Correct naming for SSSE3 (temporarily known as SSE4) in DynASM and x86 disassembler.
- The loadable debug modules now handle redirection to stdout (e.g. `-j trace=-`).

## LuaJIT 1.1.2 — 2006-06-24

- Fix MSVC inline assembly: use only local variables with `lua_number2int()`.
- Fix "attempt to call a thread value" bug on Mac OS X: make values of consts used as lightuserdata keys unique to avoid joining by the compiler/linker.

## LuaJIT 1.1.1 — 2006-06-20

- Merged with Lua 5.1.1. Fixes all » known bugs in Lua 5.1.
- Enforce (dynamic) linker error for EXE/DLL version mismatches.
- Minor changes to DynASM: faster pre-processing, smaller encoding for some immediates.

This release is in sync with Coco 1.1.1 (see the » Coco Change History).

## LuaJIT 1.1.0 — 2006-03-13

- Merged with Lua 5.1 (final).
- New JIT call frame setup:
  - The C stack is kept 16 byte aligned (faster). Mandatory for Mac OS X on Intel, too.
  - Faster calling conventions for internal C helper functions.
  - Better instruction scheduling for function prologue, OP_CALL and OP_RETURN.
- Miscellaneous optimizations:
  - Faster loads of FP constants. Remove narrow-to-wide store-to-load forwarding stalls.
  - Use (scalar) SSE2 ops (if the CPU supports it) to speed up slot moves and FP to integer conversions.
  - Optimized the two-argument form of `OP_CONCAT` (`a..b`).
  - Inlined `OP_MOD` (`a%b`). With better accuracy than the C variant, too.
  - Inlined `OP_POW` (`a^b`). Unroll `x^k` or use `k^x = 2^(log2(k)*x)` or call `pow()`.
- Changes in the optimizer:
  - Improved hinting for table keys derived from table values (`t1[t2[x]]`).
  - Lookup hinting now works with arbitrary object types and supports index chains, too.
  - Generate type hints for arithmetic and comparison operators, OP_LEN, OP_CONCAT and OP_FORPREP.
  - Remove several hint definitions in favour of a generic COMBINE hint.
  - Complete rewrite of `jit.opt_inline` module (ex `jit.opt_lib`).
- Use adaptive deoptimization:
  - If runtime verification of a contract fails, the affected instruction is recompiled and patched on-the-fly. Regular programs will trigger deoptimization only occasionally.
  - This avoids generating code for uncommon fallback cases most of the time. Generated code is up to 30% smaller compared to LuaJIT 1.0.3.
  - Deoptimization is used for many opcodes and contracts:
    - OP_CALL, OP_TAILCALL: type mismatch for callable.
    - Inlined calls: closure mismatch, parameter number and type mismatches.
    - OP_GETTABLE, OP_SETTABLE: table or key type and range mismatches.
    - All arithmetic and comparison operators, OP_LEN, OP_CONCAT, OP_FORPREP: operand type and range mismatches.
  - Complete redesign of the debug and traceback info (bytecode ↔ mcode) to support deoptimization. Much more flexible and needs only 50% of the space.
  - The modules `jit.trace`, `jit.dumphints` and `jit.dump` handle deoptimization.
- Inlined many popular library functions (for commonly used arguments only):
  - Most `math.*` functions (the 18 most used ones) [2x-10x faster].
  - `string.len`, `string.sub` and `string.char` [2x-10x faster].
  - `table.insert`, `table.remove` and `table.getn` [3x-5x faster].
  - `coroutine.yield` and `coroutine.resume` [3x-5x faster].
  - `pairs`, `ipairs` and the corresponding iterators [8x-15x faster].
- Changes in the core and loadable modules and the stand-alone executable:
  - Added `jit.version`, `jit.version_num` and `jit.arch`.
  - Reorganized some internal API functions (`jit.util.*mcode*`).
  - The `-j dump` output now shows JSUB names, too.
  - New x86 disassembler module written in pure Lua. No dependency on ndisasm anymore. Flexible API, very compact (500 lines) and complete (x87, MMX, SSE, SSE2, SSE3, SSSE3, privileged instructions).
  - `luajit -v` prints the LuaJIT version and copyright on a separate line.
- Added SSE, SSE2, SSE3 and SSSE3 support to DynASM.
- Miscellaneous doc changes. Added a section about embedding LuaJIT.

This release is in sync with Coco 1.1.0 (see the » Coco Change History).

## LuaJIT 1.0.3 — 2005-09-08

- Even more docs.
- Unified closure checks in `jit.*`.
- Fixed some range checks in `jit.util.*`.
- Fixed __newindex call originating from `jit_settable_str()`.
- Merged with Lua 5.1 alpha (including early bug fixes).

This is the first public release of LuaJIT.

## LuaJIT 1.0.2 — 2005-09-02

- Add support for flushing the Valgrind translation cache
  (`MYCFLAGS= -DUSE_VALGRIND`).
- Add support for freeing executable mcode memory to the `mmap()`-based variant for POSIX systems.
- Reorganized the C function signature handling in `jit.opt_lib`.
- Changed to index-based hints for inlining C functions. Still no support in the backend for inlining.
- Hardcode `HEAP_CREATE_ENABLE_EXECUTE` value if undefined.
- Misc. changes to the `jit.*` modules.
- Misc. changes to the Makefiles.
- Lots of new docs.
- Complete doc reorg.

Not released because Lua 5.1 alpha came out today.

## LuaJIT 1.0.1 — 2005-08-31

- Missing GC step in `OP_CONCAT`.
- Fix result handling for C –> JIT calls.
- Detect CPU feature bits.
- Encode conditional moves (`fucomip`) only when supported.
- Add fallback instructions for FP compares.
- Add support for `LUA_COMPAT_VARARG`. Still disabled by default.
- MSVC needs a specific place for the `CALLBACK` attribute (David Burgess).
- Misc. doc updates.

Interim non-public release. Special thanks to Adam D. Moss for reporting most of the bugs.

## LuaJIT 1.0.0 — 2005-08-29

This is the initial non-public release of LuaJIT.

Copyright © 2005-2015 Mike Pall · Contact