From abd5cbe0a68af28f4194b82c2b038c87b4ff81cd Mon Sep 17 00:00:00 2001
From: Ronan Collobert
Date: Tue, 18 Apr 2017 10:41:57 -0700
Subject: Squashed 'luajit-2.1/' changes from 3a0b2a90..dc5eb65c
dc5eb65c Merge branch 'master' into v2.1
02b4b1e5 Add workaround for MSVC 2015 stdio changes.
ed54eace MIPS64: Fix stores of MULTRES.
58aaac3c MIPS64: Fix write barrier in BC_USETV.
18efb331 ARM64: Fix stores to vmstate.
cced1786 Document added C API extensions from Lua 5.2/5.3.
de26f76e From Lua 5.2: Add lua_tonumberx() and lua_tointegerx().
2b8de8cf From Lua 5.2: Add luaL_setmetatable().
cde968f9 From Lua 5.2: Add luaL_testudata().
f2e2a3f7 From Lua 5.3: Add lua_isyieldable().
ef23b70e From Lua 5.2: Add lua_copy().
c67a0982 From Lua 5.2: Add lua_version().
9c685f70 Refactor with LUA_OK.
22dfa632 Allow building on Haiku OS.
7c7843e8 Merge branch 'master' into v2.1
247b3624 OSX: Fix build with recent XCode.
de97b9d5 Add some more changes and extensions from Lua 5.2.
dc320ca7 Remove old Lua 5.0 compatibility defines.
c29afcb1 Merge branch 'master' into v2.1
e205ad0c FFI: Fix FOLD rules for int64_t comparisons.
3143b218 ARM64: Add big-endian support.
78f5f1ce x64/LJ_GC64: Fix emit_loadk64().
024ade79 LJ_GC64: Fix BC_CALLM snapshot handling.
fa126c5f x64/LJ_GC64: Fix assembly of CNEWI with 64 bit constant pointer.
779a1eb8 ARM64: Fix Nintendo Switch build.
0cf78854 ARM64: Fix XLOAD/XSTORE with FP operand.
de5568e0 Remove Lua 5.0 compatibility defines.
d3e36e79 Merge branch 'master' into v2.1
f50bf758 Remove unnecessary mcode alloc pointer check.
d62459fc Limit mcode alloc probing, depending on the available pool size.
4e308361 Fix overly restrictive range calculation in mcode allocation.
ff648369 Fix out-of-scope goto handling in parser.
3ab9f5a1 Remove internal __mode = "K" and replace with safe check.
eef77a6d Fix annoying warning, due to deterministic binutils configuration.
a9740d9e DynASM: Fix warning.
a25c0b99 MIPS64, part 2: Add MIPS64 hard-float JIT compiler backend.
4416e885 Fix FOLD rules for math.abs() and FP negation.
019fb9d1 Fix soft-float math.abs() and negation.
130d1dc5 x64/LJ_GC64: Fix warning for DUALNUM build.
f640ec71 x64/LJ_GC64: Fix (currently unused) integer stores in asm_tvptr().
0a46ef1a ARM64: Cleanup and de-cargo-cult TValue store generation.
d0759e41 Merge branch 'master' into v2.1
892d370e MIPS: Don't use RID_GP as a scratch register.
ee33a1f9 MIPS: Fix emitted code for U32 to float conversion.
1abd7799 MIPS: Backport workaround for compact unwind tables.
6bf3e4d6 Make checkptrGC() actually work.
5aa02013 ARM64: Fix AREF/HREF/UREF fusion.
bd7e42e5 Fix extension docs about package.searchers.
71ff7ef8 Merge branch 'master' into v2.1
b93a1dd0 Bump copyright date to 2017.
c94b921f LJ_GC64: Add build options and install instructions.
c1981676 Add some more extensions from Lua 5.2/5.3.
ed4ce98a Merge branch 'master' into v2.1
a1e13fa6 Fix HTML formatting.
12c0df41 Merge branch 'master' into v2.1
a2013dd3 Fix cross-endian jit.bcsave for MIPS target.
8e5d7bec ARM64: Remove unused variables in disassembler.
ebec2530 ARM64: Fuse BOR/BXOR and BNOT into ORN/EON.
3cfa9cb2 Merge branch 'master' into v2.1
fb61f7cb Add "proto" field to jit.util.funcinfo().
19738074 Add "proto" field to jit.util.funcinfo().
4ccd876a ARM64: Use the correct FUSE check.
44b99ff1 ARM64: Fuse BOR(BSHL, BSHR) into EXTR/ROR.
ec2756ba Add missing FOLD rule for 64 bit shift+BAND simplification.
986854cb ARM64: Fix code generation for S19 offsets.
3975b6c9 ARM64: Fuse various BAND/BSHL/BSHR/BSAR combinations.
2772cbc3 ARM64: Fuse FP multiply-add/sub.
bfeb1167 ARM64: Fuse XLOAD/XSTORE with STRREF/ADD/BSHL/CONV.
2ac2cd46 ARM64: Reorganize operand extension definitions.
48b00297 ARM64: Add missing ldrb/strb instructions to disassembler.
22511fbe ARM64: Fix pc-relative loads of consts. Cleanup branch codegen.
3ad2bbf5 ARM64: Make use of tbz/tbnz and cbz/cbnz.
6538c8a1 Document 47 bit limit for lightuserdata.
d7243e1d Eliminate use of lightuserdata derived from static data pointers.
81259898 ARM64: Emit more efficient trace exits.
1131fa22 Merge branch 'master' into v2.1
c3cae041 Update contact info.
a5665446 Generalize deferred constant handling in backend to 64 bit.
2b77da35 ARM64: Reject special case in emit_isk13().
7a0c3a11 ARM64: Allow full VA range for mcode allocation.
04b60707 ARM64: Add JIT compiler backend.
13642b75 Whitespace.
202713a6 Fix amalgamated build.
e577db52 Increase range of GG_State loads via IR_FLOAD with REF_NIL.
5400c1e4 MIPS: Fix TSETR barrier.
7a58a8fb Report parent of stitched trace.
716f2dae LJ_GC64: Various followup fixes.
bdcaf4bf LJ_GC64: Fix HREF for pointers.
6a25014c LJ_FR2: Fix slot 1 handling.
3f43f094 Merge branch 'master' into v2.1
a68c4118 Fix GC step size calculation.
54b78e7c LJ_GC64: Various fixes.
63465fe7 LJ_GC64: Fix jit.on/off.
cf80edbb Fix -jp=a mode for builtins.
f27b2509 Merge branch 'master' into v2.1
fcc82448 ARM: Fix BLX encoding for Thumb interworking calls.
4ca39095 Merge branch 'master' into v2.1
8ada57eb Looks like COLORTERM has gone out of fashion.
1a9a2643 Merge branch 'master' into v2.1
9910deda Initialize uv->immutable for upvalues of loaded chunks.
03b03ef6 Windows/x86: Add MSVC flags for debug build with exception interop.
f6f838f8 Merge branch 'master' into v2.1
02b9b559 Revert "OSX: Switch to Clang as the default compiler."
972a1a4c Fix exit status for 'luajit -b'.
c98660c8 Must preserve J->fold.ins (fins) around call to lj_ir_ksimd().
22e8e079 Merge branch 'master' into v2.1
d41469c1 Emit bytecode in .c/.h files with unsigned char type.
92d9ff21 Set arg table before evaluating LUA_INIT and -e chunks.
6be5ffdf Adjust comment with defines.
73740462 Merge branch 'master' into v2.1
b74ddaf1 Fix for cdata vs. non-cdata arithmetics/comparisons.
37b377de Merge branch 'master' into v2.1
1914de71 Fix unused vars etc. in internal Lua files.
01e47549 Properly clean up state before restart of trace assembly.
ce30766b Merge branch 'master' into v2.1
aef4eddd Drop leftover regs in 'for' iterator assignment, too.
287a5347 MIPS: Support MIPS16 interlinking.
f5983437 x64/LJ_GC64: Fix code generation for IR_KNULL call argument.
a88dc579 Merge branch 'master' into v2.1
a7bec69a Fix PHI remarking in SINK pass.
ce1ad870 LJ_GC64: Set correct nil value when clearing a cdata finalizer.
cc05e791 LJ_GC64: Ensure all IR slot fields are initialized.
58ca1657 LJ_GC64: Allow optional use of the system memory allocator.
7d434023 Merge branch 'master' into v2.1
32063075 Fix Valgrind suppressions.
1c0454c6 Merge branch 'master' into v2.1
a5f8a481 Don't try to record outermost pcall() return to lower frame.
384ce2f9 MIPS: Fix build failures and warnings.
56fe899a Proper fix for LJ_GC64 changes to asm_href().
d9986fba MIPS64, part 1: Add MIPS64 support to interpreter.
e3c4c9af DynASM/MIPS: Add missing MIPS64 instructions.
5e2b609b Fix compiler warning.
e77638f9 x64/LJ_GC64: Fix __call metamethod for tailcall.
6360f6e1 Fix collateral damage from LJ_GC64 changes to asm_href().
9fa843ae Cleanup install docs.
3f1031c3 Use MAP_TRYFIXED for the probing memory allocator, if available.
bfe2a353 Merge branch 'master' into v2.1
747feb6e x86: Don't spill an explicit REF_BASE in the IR.
2868715d x64/LJ_GC64: Add missing backend support and enable JIT compilation.
6c8258d7 LJ_FR2: Add support for trace recording and snapshots.
8f868a9d LJ_GC64: Update IR type sizes.
f26679c7 LJ_GC64: Add support for 64 bit GCobj constants in the IR.
9e99ccc3 Strip out old infrastructure for 64 bit constants.
7fb75ccc Embed 64 bit constants directly in the IR, using two slots.
a4067978 Always walk IR constants in ascending order.
3152ed98 Simplify GCtrace * reference embedding for trace stitching.
a657fa01 Make the IR immovable after assembly.
51358765 Add ra_addrename().
ccae3338 Load SIMD constants with IR_FLOAD from GG_State.
786dbb2e Add IR_FLOAD with REF_NIL for field loads from GG_State.
cfa188f1 Move common 32/64 bit in-memory FP constants to jit_State.
1931b38d LJ_GC64: Introduce IRT_PGC.
475a6ae3 Merge branch 'master' into v2.1
37e1e703 Add guard for obscure aliasing between open upvalues and SSA slots.
d4f3b113 Workaround for MinGW headers lacking some exception definitions.
4fe400cf Merge branch 'master' into v2.1
5837c2a2 Remove assumption that lj_math_random_step() doesn't clobber FPRs.
573daa9c Fix dependencies.
35b09e69 Windows/x86: Add full exception interoperability.
6a997320 Merge branch 'master' into v2.1
f05280e4 x86/x64: Fix instruction length decoder.
221268b1 Use the GDB JIT API in a thread-safe manner.
ac42037d Constrain value range of lj_ir_kptr() to unsigned 32 bit pointers.
d8ac6230 Merge branch 'master' into v2.1
7b26e9c9 Fix GCC 6 -Wmisleading-indentation warnings.
344fe5f0 Merge branch 'master' into v2.1
2f0001fa Fix handling of non-numeric strings in arithmetic coercions.
4c6498d2 Merge branch 'master' into v2.1
cc4f5d05 Whitespace.
d13d4209 Merge branch 'master' into v2.1
73680a5f x86/x64: Search for exit jumps with instruction length decoder.
0c6fdc10 Rewrite memory block allocator.
101115dd Merge branch 'master' into v2.1
e5b5e079 MIPS: Fix BC_ISNEXT fallback path.
096a7cf4 x64/LJ_GC64: Fix BC_UCLO check for fast-path.
ac9193cf x86: Improve disassembly of BMI2 instructions.
d150fbf4 Merge branch 'master' into v2.1
1c6fd13d Fix recording of select(n, ...) with off-trace varargs
25b37794 Merge branch 'master' into v2.1
4ab6367b Cygwin: Allow cross-builds to non-Cygwin targets.
296f0ca8 Windows/x64/LJ_GC64: Fix math.frexp() and math.modf() (again).
6e623b99 Merge branch 'master' into v2.1
62af1015 MIPS: Fix use of ffgccheck delay slots in interpreter.
892887e5 x86: Generate BMI2 shifts and rotates, if available.
6801e716 x86: Detect BMI2 instruction support.
c24c8e53 x64/LJ_GC64: Fix JIT glue code in interpreter.
d7145616 Merge branch 'master' into v2.1
9531eb23 Windows: Remove intermediate files at end of build.
e03e5979 Fix compiler warnings.
df7bb5bb Merge branch 'master' into v2.1
e23fc108 Fix display of NULL (light)userdata in -jdump.
c7305408 Fix formatting of some small denormals at low precision.
713e3405 Merge branch 'master' into v2.1
7e05355a Fix install for cross-builds.
cf3e01e1 Merge branch 'master' into v2.1
ddadbe80 Fix compiler warnings.
be255929 ARM: Fix build problem with external frame unwinding.
64c6da6b MIPS soft-float: Fix code generation for HREF.
75d046db DynASM/x86: Add ADX instructions.
3e4a1967 RELEASE LuaJIT-2.1.0-beta2
82900761 Update changelog.
f4231949 Merge branch 'master' into v2.1
db1b399a Bump copyright date to 2016.
6f3eed9f Fix Android/x86 build.
1c45c6a6 Fix build with JIT disabled.
18f6aa97 Use internal implementation for converting FP numbers to strings.
339a1fd6 Windows/x64/LJ_GC64: Fix math.frexp() and math.modf().
6cb38f78 Merge branch 'master' into v2.1
a4438896 Don't allocate unused 2nd result register in JIT compiler backend.
f547a142 MIPS: Add soft-float support to JIT compiler backend.
825dcdc4 Generalize LJ_SOFTFP dependencies in lj_asm.c.
bfbcd72e PS4: Switch default build to amalgamated and LJ_GC64 mode.
60de2f3d MIPS: Switch to dual-number mode. Fix soft-float interpreter.
2f6b2967 Add proper DynASM dependency.
89982b78 FFI: Parse #line NN and #NN.
39eddd3b Always merge snapshots without instructions inbetween.
04d28068 Rollback due to HREFK + load fwd must restore guardemit state.
22e7b00d DynASM/x64: Fix for full VREG support.
52ebe02c x86: Disassemble AES instructions.
5ce6399e x86: Improve disassembly of AVX shift instructions.
cfae3846 DynASM/x86: Add AVX AES instructions.
f61148c4 ARM: Add external frame unwinding.
a687a60e DynASM/x64: Add full VREG support.
20f4141b FFI: Properly unsink non-standard cdata allocations.
0345f361 MIPS soft-float, part 2: Add soft-float FFI support.
3f5c7242 MIPS soft-float, part 1: Add soft-float support to interpreter.
126e55d4 Merge branch 'master' into v2.1
3d4c9f96 FFI: Fix SPLIT pass for CONV i64.u64.
git-subtree-dir: luajit-2.1
git-subtree-split: dc5eb65ccf8e0e944531c7407d4fff65247b784b
---
COPYRIGHT | 2 +-
Makefile | 37 +-
README | 4 +-
doc/bluequad-print.css | 2 +-
doc/bluequad.css | 2 +-
doc/changes.html | 22 +-
doc/contact.html | 13 +-
doc/ext_c_api.html | 4 +-
doc/ext_ffi.html | 4 +-
doc/ext_ffi_api.html | 4 +-
doc/ext_ffi_semantics.html | 4 +-
doc/ext_ffi_tutorial.html | 4 +-
doc/ext_jit.html | 6 +-
doc/ext_profiler.html | 4 +-
doc/extensions.html | 67 +-
doc/faq.html | 4 +-
doc/install.html | 115 +-
doc/luajit.html | 10 +-
doc/running.html | 4 +-
doc/status.html | 21 +-
dynasm/dasm_arm.h | 2 +-
dynasm/dasm_arm.lua | 2 +-
dynasm/dasm_arm64.h | 2 +-
dynasm/dasm_arm64.lua | 2 +-
dynasm/dasm_mips.h | 13 +-
dynasm/dasm_mips.lua | 77 +-
dynasm/dasm_mips64.lua | 12 +
dynasm/dasm_ppc.h | 2 +-
dynasm/dasm_ppc.lua | 2 +-
dynasm/dasm_proto.h | 2 +-
dynasm/dasm_x64.lua | 2 +-
dynasm/dasm_x86.h | 36 +-
dynasm/dasm_x86.lua | 119 +-
dynasm/dynasm.lua | 4 +-
etc/luajit.1 | 2 +-
etc/luajit.pc | 2 +-
src/Makefile | 35 +-
src/Makefile.dep | 36 +-
src/host/buildvm.c | 4 +-
src/host/buildvm.h | 2 +-
src/host/buildvm_asm.c | 22 +-
src/host/buildvm_fold.c | 4 +-
src/host/buildvm_lib.c | 2 +-
src/host/buildvm_libbc.h | 17 +-
src/host/buildvm_peobj.c | 30 +-
src/host/genlibbc.lua | 2 +-
src/host/genminilua.lua | 11 +-
src/host/minilua.c | 2 +-
src/jit/bc.lua | 2 +-
src/jit/bcsave.lua | 16 +-
src/jit/dis_arm.lua | 4 +-
src/jit/dis_arm64.lua | 1216 +++++++++++
src/jit/dis_arm64be.lua | 12 +
src/jit/dis_mips.lua | 55 +-
src/jit/dis_mips64.lua | 17 +
src/jit/dis_mips64el.lua | 17 +
src/jit/dis_mipsel.lua | 2 +-
src/jit/dis_ppc.lua | 4 +-
src/jit/dis_x64.lua | 2 +-
src/jit/dis_x86.lua | 20 +-
src/jit/dump.lua | 29 +-
src/jit/p.lua | 5 +-
src/jit/v.lua | 4 +-
src/jit/zone.lua | 2 +-
src/lauxlib.h | 34 +-
src/lib_aux.c | 65 +-
src/lib_base.c | 20 +-
src/lib_bit.c | 2 +-
src/lib_debug.c | 10 +-
src/lib_ffi.c | 9 +-
src/lib_init.c | 2 +-
src/lib_io.c | 16 +-
src/lib_jit.c | 18 +-
src/lib_math.c | 6 +-
src/lib_os.c | 2 +-
src/lib_package.c | 37 +-
src/lib_string.c | 6 +-
src/lib_table.c | 22 +-
src/lj.supp | 6 +-
src/lj_alloc.c | 257 ++-
src/lj_api.c | 115 +-
src/lj_arch.h | 93 +-
src/lj_asm.c | 240 ++-
src/lj_asm.h | 2 +-
src/lj_asm_arm.h | 49 +-
src/lj_asm_arm64.h | 2022 ++++++++++++++++++
src/lj_asm_mips.h | 1028 +++++++--
src/lj_asm_ppc.h | 39 +-
src/lj_asm_x86.h | 672 +++++-
src/lj_bc.c | 2 +-
src/lj_bc.h | 2 +-
src/lj_bcdump.h | 2 +-
src/lj_bcread.c | 2 +-
src/lj_bcwrite.c | 2 +-
src/lj_buf.c | 6 +-
src/lj_buf.h | 4 +-
src/lj_carith.c | 2 +-
src/lj_carith.h | 2 +-
src/lj_ccall.c | 228 +-
src/lj_ccall.h | 30 +-
src/lj_ccallback.c | 109 +-
src/lj_ccallback.h | 2 +-
src/lj_cconv.c | 2 +-
src/lj_cconv.h | 2 +-
src/lj_cdata.c | 21 +-
src/lj_cdata.h | 4 +-
src/lj_clib.c | 10 +-
src/lj_clib.h | 2 +-
src/lj_cparse.c | 48 +-
src/lj_cparse.h | 2 +-
src/lj_crecord.c | 35 +-
src/lj_crecord.h | 2 +-
src/lj_ctype.c | 16 +-
src/lj_ctype.h | 16 +-
src/lj_debug.c | 2 +-
src/lj_debug.h | 2 +-
src/lj_def.h | 15 +-
src/lj_dispatch.c | 6 +-
src/lj_dispatch.h | 26 +-
src/lj_emit_arm.h | 9 +-
src/lj_emit_arm64.h | 419 ++++
src/lj_emit_mips.h | 128 +-
src/lj_emit_ppc.h | 8 +-
src/lj_emit_x86.h | 141 +-
src/lj_err.c | 137 +-
src/lj_err.h | 2 +-
src/lj_errmsg.h | 2 +-
src/lj_ff.h | 2 +-
src/lj_ffrecord.c | 107 +-
src/lj_ffrecord.h | 2 +-
src/lj_frame.h | 44 +-
src/lj_func.c | 6 +-
src/lj_func.h | 2 +-
src/lj_gc.c | 23 +-
src/lj_gc.h | 2 +-
src/lj_gdbjit.c | 32 +-
src/lj_gdbjit.h | 2 +-
src/lj_ir.c | 165 +-
src/lj_ir.h | 47 +-
src/lj_ircall.h | 80 +-
src/lj_iropt.h | 18 +-
src/lj_jit.h | 76 +-
src/lj_lex.c | 2 +-
src/lj_lex.h | 2 +-
src/lj_lib.c | 2 +-
src/lj_lib.h | 2 +-
src/lj_load.c | 2 +-
src/lj_mcode.c | 21 +-
src/lj_mcode.h | 2 +-
src/lj_meta.c | 16 +-
src/lj_meta.h | 2 +-
src/lj_obj.c | 2 +-
src/lj_obj.h | 10 +-
src/lj_opt_dce.c | 2 +-
src/lj_opt_fold.c | 60 +-
src/lj_opt_loop.c | 2 +-
src/lj_opt_mem.c | 6 +-
src/lj_opt_narrow.c | 46 +-
src/lj_opt_sink.c | 17 +-
src/lj_opt_split.c | 26 +-
src/lj_parse.c | 16 +-
src/lj_parse.h | 2 +-
src/lj_profile.c | 2 +-
src/lj_profile.h | 2 +-
src/lj_record.c | 334 +--
src/lj_record.h | 2 +-
src/lj_snap.c | 107 +-
src/lj_snap.h | 2 +-
src/lj_state.c | 12 +-
src/lj_state.h | 4 +-
src/lj_str.c | 2 +-
src/lj_str.h | 2 +-
src/lj_strfmt.c | 118 +-
src/lj_strfmt.h | 8 +-
src/lj_strfmt_num.c | 592 ++++++
src/lj_strscan.c | 2 +-
src/lj_strscan.h | 2 +-
src/lj_tab.c | 3 +-
src/lj_tab.h | 2 +-
src/lj_target.h | 6 +-
src/lj_target_arm.h | 2 +-
src/lj_target_arm64.h | 246 ++-
src/lj_target_mips.h | 161 +-
src/lj_target_ppc.h | 2 +-
src/lj_target_x86.h | 25 +-
src/lj_trace.c | 81 +-
src/lj_trace.h | 3 +-
src/lj_traceerr.h | 2 +-
src/lj_udata.c | 2 +-
src/lj_udata.h | 2 +-
src/lj_vm.h | 12 +-
src/lj_vmevent.c | 2 +-
src/lj_vmevent.h | 2 +-
src/lj_vmmath.c | 30 +-
src/ljamalg.c | 3 +-
src/lua.h | 10 +-
src/luaconf.h | 10 +-
src/luajit.c | 123 +-
src/luajit.h | 8 +-
src/lualib.h | 2 +-
src/msvcbuild.bat | 16 +-
src/ps4build.bat | 32 +-
src/vm_arm.dasc | 13 +-
src/vm_arm64.dasc | 287 ++-
src/vm_mips.dasc | 2249 ++++++++++++++------
src/vm_mips64.dasc | 5062 ++++++++++++++++++++++++++++++++++++++++++++
src/vm_ppc.dasc | 2 +-
src/vm_x64.dasc | 53 +-
src/vm_x86.dasc | 81 +-
209 files changed, 16348 insertions(+), 2635 deletions(-)
create mode 100644 dynasm/dasm_mips64.lua
create mode 100644 src/jit/dis_arm64.lua
create mode 100644 src/jit/dis_arm64be.lua
create mode 100644 src/jit/dis_mips64.lua
create mode 100644 src/jit/dis_mips64el.lua
create mode 100644 src/lj_asm_arm64.h
create mode 100644 src/lj_emit_arm64.h
create mode 100644 src/lj_strfmt_num.c
create mode 100644 src/vm_mips64.dasc
diff --git a/COPYRIGHT b/COPYRIGHT
index 1ef7df6..6ed4002 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -1,7 +1,7 @@
===============================================================================
LuaJIT -- a Just-In-Time Compiler for Lua. http://luajit.org/
-Copyright (C) 2005-2015 Mike Pall. All rights reserved.
+Copyright (C) 2005-2017 Mike Pall. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/Makefile b/Makefile
index 8ce773e..e6472e0 100644
--- a/Makefile
+++ b/Makefile
@@ -10,13 +10,13 @@
# For MSVC, please follow the instructions given in src/msvcbuild.bat.
# For MinGW and Cygwin, cd to src and run make with the Makefile there.
#
-# Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
+# Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
##############################################################################
MAJVER= 2
MINVER= 1
RELVER= 0
-PREREL= -beta1
+PREREL= -beta2
VERSION= $(MAJVER).$(MINVER).$(RELVER)$(PREREL)
ABIVER= 5.1
@@ -47,17 +47,18 @@ INSTALL_PKGCONFIG= $(INSTALL_LIB)/pkgconfig
INSTALL_TNAME= luajit-$(VERSION)
INSTALL_TSYMNAME= luajit
INSTALL_ANAME= libluajit-$(ABIVER).a
-INSTALL_SONAME= libluajit-$(ABIVER).so.$(MAJVER).$(MINVER).$(RELVER)
-INSTALL_SOSHORT= libluajit-$(ABIVER).so
-INSTALL_DYLIBNAME= libluajit-$(ABIVER).$(MAJVER).$(MINVER).$(RELVER).dylib
+INSTALL_SOSHORT1= libluajit-$(ABIVER).so
+INSTALL_SOSHORT2= libluajit-$(ABIVER).so.$(MAJVER)
+INSTALL_SONAME= $(INSTALL_SOSHORT2).$(MINVER).$(RELVER)
INSTALL_DYLIBSHORT1= libluajit-$(ABIVER).dylib
INSTALL_DYLIBSHORT2= libluajit-$(ABIVER).$(MAJVER).dylib
+INSTALL_DYLIBNAME= libluajit-$(ABIVER).$(MAJVER).$(MINVER).$(RELVER).dylib
INSTALL_PCNAME= luajit.pc
INSTALL_STATIC= $(INSTALL_LIB)/$(INSTALL_ANAME)
INSTALL_DYN= $(INSTALL_LIB)/$(INSTALL_SONAME)
-INSTALL_SHORT1= $(INSTALL_LIB)/$(INSTALL_SOSHORT)
-INSTALL_SHORT2= $(INSTALL_LIB)/$(INSTALL_SOSHORT)
+INSTALL_SHORT1= $(INSTALL_LIB)/$(INSTALL_SOSHORT1)
+INSTALL_SHORT2= $(INSTALL_LIB)/$(INSTALL_SOSHORT2)
INSTALL_T= $(INSTALL_BIN)/$(INSTALL_TNAME)
INSTALL_TSYM= $(INSTALL_BIN)/$(INSTALL_TSYMNAME)
INSTALL_PC= $(INSTALL_PKGCONFIG)/$(INSTALL_PCNAME)
@@ -85,16 +86,22 @@ FILE_MAN= luajit.1
FILE_PC= luajit.pc
FILES_INC= lua.h lualib.h lauxlib.h luaconf.h lua.hpp luajit.h
FILES_JITLIB= bc.lua bcsave.lua dump.lua p.lua v.lua zone.lua \
- dis_x86.lua dis_x64.lua dis_arm.lua dis_ppc.lua \
- dis_mips.lua dis_mipsel.lua vmdef.lua
+ dis_x86.lua dis_x64.lua dis_arm.lua dis_arm64.lua \
+ dis_arm64be.lua dis_ppc.lua dis_mips.lua dis_mipsel.lua \
+ dis_mips64.lua dis_mips64el.lua vmdef.lua
ifeq (,$(findstring Windows,$(OS)))
- ifeq (Darwin,$(shell uname -s))
- INSTALL_SONAME= $(INSTALL_DYLIBNAME)
- INSTALL_SHORT1= $(INSTALL_LIB)/$(INSTALL_DYLIBSHORT1)
- INSTALL_SHORT2= $(INSTALL_LIB)/$(INSTALL_DYLIBSHORT2)
- LDCONFIG= :
- endif
+ HOST_SYS:= $(shell uname -s)
+else
+ HOST_SYS= Windows
+endif
+TARGET_SYS?= $(HOST_SYS)
+
+ifeq (Darwin,$(TARGET_SYS))
+ INSTALL_SONAME= $(INSTALL_DYLIBNAME)
+ INSTALL_SOSHORT1= $(INSTALL_DYLIBSHORT1)
+ INSTALL_SOSHORT2= $(INSTALL_DYLIBSHORT2)
+ LDCONFIG= :
endif
##############################################################################
diff --git a/README b/README
index ca70dd8..719e611 100644
--- a/README
+++ b/README
@@ -1,11 +1,11 @@
-README for LuaJIT 2.1.0-beta1
+README for LuaJIT 2.1.0-beta2
-----------------------------
LuaJIT is a Just-In-Time (JIT) compiler for the Lua programming language.
Project Homepage: http://luajit.org/
-LuaJIT is Copyright (C) 2005-2015 Mike Pall.
+LuaJIT is Copyright (C) 2005-2017 Mike Pall.
LuaJIT is free software, released under the MIT license.
See full Copyright Notice in the COPYRIGHT file or in luajit.h.
diff --git a/doc/bluequad-print.css b/doc/bluequad-print.css
index 07f5c84..62e1c16 100644
--- a/doc/bluequad-print.css
+++ b/doc/bluequad-print.css
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004-2015 Mike Pall.
+/* Copyright (C) 2004-2017 Mike Pall.
*
* You are welcome to use the general ideas of this design for your own sites.
* But please do not steal the stylesheet, the layout or the color scheme.
diff --git a/doc/bluequad.css b/doc/bluequad.css
index ae53143..be2c4bf 100644
--- a/doc/bluequad.css
+++ b/doc/bluequad.css
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004-2015 Mike Pall.
+/* Copyright (C) 2004-2017 Mike Pall.
*
* You are welcome to use the general ideas of this design for your own sites.
* But please do not steal the stylesheet, the layout or the color scheme.
diff --git a/doc/changes.html b/doc/changes.html
index 826cd24..426b18f 100644
--- a/doc/changes.html
+++ b/doc/changes.html
@@ -4,7 +4,7 @@
LuaJIT Change History
-
+
@@ -74,6 +74,19 @@ to see whether newer versions are available.
+
LuaJIT 2.1.0-beta2 — 2016-03-03
+
+
Enable trace stitching.
+
Use internal implementation for converting FP numbers to strings.
+
Parse Unicode escape '\u{XX...}' in string literals.
+
Add MIPS soft-float support.
+
Switch MIPS port to dual-number mode.
+
x86/x64: Add support for AES-NI, AVX and AVX2 to DynASM.
+
FFI: Add ssize_t declaration.
+
FFI: Parse #line NN and #NN.
+
Various minor fixes.
+
+
LuaJIT 2.1.0-beta1 — 2015-08-25
This is a brief summary of the major changes in LuaJIT 2.1 compared to 2.0.
@@ -86,12 +99,11 @@ Please take a look at the commit history for more details.
Add LJ_GC64 mode: 64 bit GC object references (really: 47 bit). Interpreter-only for now.
Add LJ_FR2 mode: Two-slot frame info. Required by LJ_GC64 mode.
Add table.new() and table.clear().
-
Parse Unicode escape '\u{XX...}' in string literals.
Note: LJ_GC64 mode requires a different frame layout, which implies
a different, incompatible bytecode format for ports that use this mode (e.g.
-ARM64). This may be rectified in the future.
+ARM64 or MIPS64) or when explicitly enabled for x64. This may be rectified
+in the future.
table.new(narray, nhash) allocates a pre-sized table
@@ -291,8 +292,8 @@ enabled:
load(string|reader [, chunkname [,mode [,env]]]).
loadstring() is an alias for load().
loadfile(filename [,mode [,env]]).
-
math.log(x [,base]).
-
string.rep(s, n [,sep]).
+
math.log(x [,base]).
+
string.rep(s, n [,sep]).
string.format(): %q reversible.
%s checks __tostring.
%a and "%A added.
@@ -311,6 +312,26 @@ indexes for varargs.
debug.getupvalue() and debug.setupvalue() handle
C functions.
Note: this provides only partial compatibility with Lua 5.2 at the
@@ -349,6 +372,13 @@ break the Lua/C API and ABI (e.g. _ENV).
LuaJIT supports some extensions from Lua 5.3:
Unicode escape '\u{XX...}' embeds the UTF-8 encoding in string literals.
+
The argument table arg can be read (and modified) by LUA_INIT and -e chunks.
+
io.read() and file:read() accept formats with or without a leading *.
+
table.move(a1, f, e, t [,a2]).
+
coroutine.isyieldable().
+
Lua/C API extensions:
+lua_isyieldable()
+
C++ Exception Interoperability
@@ -365,25 +395,30 @@ the toolchain used to compile LuaJIT:
POSIX/x64, DWARF2 unwinding
-
GCC 4.3+
+
GCC 4.3+, Clang
Full
+
ARM -DLUAJIT_UNWIND_EXTERNAL
+
GCC, Clang
+
Full
+
+
Other platforms, DWARF2 unwinding
-
GCC
+
GCC, Clang
Limited
-
+
Windows/x64
MSVC or WinSDK
Full
-
+
Windows/x86
Any
-
No
+
Full
-
+
Other platforms
Other compilers
No
@@ -432,20 +467,12 @@ C++ destructors.
Lua errors cannot be caught on the C++ side.
Throwing Lua errors across C++ frames will not call
C++ destructors.
-
Additionally, on Windows/x86 with SEH-based C++ exceptions:
-it's not safe to throw a Lua error across any frames containing
-a C++ function with any try/catch construct or using variables with
-(implicit) destructors. This also applies to any functions which may be
-inlined in such a function. It doesn't matter whether lua_error()
-is called inside or outside of a try/catch or whether any object actually
-needs to be destroyed: the SEH chain is corrupted and this will eventually
-lead to the termination of the process.
@@ -175,6 +175,14 @@ MSVC or WinSDK.
Please read the instructions given in these files, before changing
any settings.
+
+LuaJIT on x64 currently uses 32 bit GC objects by default.
+LJ_GC64 mode may be explicitly enabled:
+add XCFLAGS=-DLUAJIT_ENABLE_GC64 to the make command or run
+msvcbuild gc64 for MSVC/WinSDK. Please check the note
+about the bytecode format
+differences, too.
+
POSIX Systems (Linux, OSX, *BSD etc.)
Prerequisites
@@ -202,7 +210,7 @@ which is probably the default on your system, anyway. Simply run:
make
-This always builds a native x86, x64 or PPC binary, depending on the host OS
+This always builds a native binary, depending on the host OS
you're running this command on. Check the section on
cross-compilation for more options.
@@ -333,22 +341,36 @@ directory where luajit.exe is installed
Cross-compiling LuaJIT
+First, let's clear up some terminology:
+
+
+
Host: This is your development system, usually based on a x64 or x86 CPU.
+
Target: This is the target system you want LuaJIT to run on, e.g. Android/ARM.
+
Toolchain: This comprises a C compiler, linker, assembler and a matching C library.
+
Host (or system) toolchain: This is the toolchain used to build native binaries for your host system.
+
Cross-compile toolchain: This is the toolchain used to build binaries for the target system. They can only be run on the target system.
+
+
The GNU Makefile-based build system allows cross-compiling on any host
-for any supported target, as long as both architectures have the same
-pointer size. If you want to cross-compile to any 32 bit target on an
-x64 OS, you need to install the multilib development package (e.g.
-libc6-dev-i386 on Debian/Ubuntu) and build a 32 bit host part
-(HOST_CC="gcc -m32").
+for any supported target:
+
+
Yes, you need a toolchain for both your host and your target!
+
Both host and target architectures must have the same pointer size.
+
E.g. if you want to cross-compile to a 32 bit target on a 64 bit host, you need to install the multilib development package (e.g. libc6-dev-i386 on Debian/Ubuntu) and build a 32 bit host part (HOST_CC="gcc -m32").
+
64 bit targets always require compilation on a 64 bit host.
+
You need to specify TARGET_SYS whenever the host OS and the
-target OS differ, or you'll get assembler or linker errors. E.g. if
-you're compiling on a Windows or OSX host for embedded Linux or Android,
-you need to add TARGET_SYS=Linux to the examples below. For a
-minimal target OS, you may need to disable the built-in allocator in
-src/Makefile and use TARGET_SYS=Other. The examples
-below only show some popular targets — please check the comments
-in src/Makefile for more details.
+target OS differ, or you'll get assembler or linker errors:
+
+
+
E.g. if you're compiling on a Windows or OSX host for embedded Linux or Android, you need to add TARGET_SYS=Linux to the examples below.
+
For a minimal target OS, you may need to disable the built-in allocator in src/Makefile and use TARGET_SYS=Other.
+
Don't forget to specify the same TARGET_SYS for the install step, too.
+
+
+Here are some examples where host and target have the same CPU:
# Cross-compile to a 32 bit binary on a multilib x64 OS
@@ -366,38 +388,47 @@ use the canonical toolchain triplets for Linux.
Since there's often no easy way to detect CPU features at runtime, it's
-important to compile with the proper CPU or architecture settings. You
-can specify these when building the toolchain yourself. Or add
--mcpu=... or -march=... to TARGET_CFLAGS. For
-ARM it's important to have the correct -mfloat-abi=... setting,
-too. Otherwise LuaJIT may not run at the full performance of your target
-CPU.
+important to compile with the proper CPU or architecture settings:
+
+
+
The best way to get consistent results is to specify the correct settings when building the toolchain yourself.
+
For a pre-built, generic toolchain add -mcpu=... or -march=... and other necessary flags to TARGET_CFLAGS.
+
For ARM it's important to have the correct -mfloat-abi=... setting, too. Otherwise LuaJIT may not run at the full performance of your target CPU.
+
For MIPS it's important to select a supported ABI (o32 on MIPS32, n64 on MIPS64) and consistently compile your project either with hard-float or soft-float compiler settings.
+
+
+Here are some examples for targets with a different CPU than the host:
# ARM soft-float
make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabi- \
TARGET_CFLAGS="-mfloat-abi=soft"
-# ARM soft-float ABI with VFP (example for Cortex-A8)
+# ARM soft-float ABI with VFP (example for Cortex-A9)
make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabi- \
- TARGET_CFLAGS="-mcpu=cortex-a8 -mfloat-abi=softfp"
+ TARGET_CFLAGS="-mcpu=cortex-a9 -mfloat-abi=softfp"
-# ARM hard-float ABI with VFP (armhf, requires recent toolchain)
+# ARM hard-float ABI with VFP (armhf, most modern toolchains)
make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabihf-
-# ARM64 (requires x64 host)
+# ARM64
make CROSS=aarch64-linux-
# PPC
make HOST_CC="gcc -m32" CROSS=powerpc-linux-gnu-
-# MIPS big-endian
+# MIPS32 big-endian
make HOST_CC="gcc -m32" CROSS=mips-linux-
-# MIPS little-endian
+# MIPS32 little-endian
make HOST_CC="gcc -m32" CROSS=mipsel-linux-
+
+# MIPS64 big-endian
+make CROSS=mips-linux- TARGET_CFLAGS="-mips64r2 -mabi=64"
+# MIPS64 little-endian
+make CROSS=mipsel-linux- TARGET_CFLAGS="-mips64r2 -mabi=64"
-You can cross-compile for Android using the » Android NDK.
+You can cross-compile for Android using the Android NDK.
The environment variables need to match the install locations and the
desired target platform. E.g. Android 4.0 corresponds to ABI level 14.
For details check the folder docs in the NDK directory.
@@ -411,7 +442,7 @@ to build/deploy or which lowest common denominator you want to pick:
# Android/ARM, armeabi (ARMv5TE soft-float), Android 2.2+ (Froyo)
NDK=/opt/android/ndk
NDKABI=8
-NDKVER=$NDK/toolchains/arm-linux-androideabi-4.6
+NDKVER=$NDK/toolchains/arm-linux-androideabi-4.9
NDKP=$NDKVER/prebuilt/linux-x86/bin/arm-linux-androideabi-
NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-arm"
make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF"
@@ -419,16 +450,16 @@ make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF"
# Android/ARM, armeabi-v7a (ARMv7 VFP), Android 4.0+ (ICS)
NDK=/opt/android/ndk
NDKABI=14
-NDKVER=$NDK/toolchains/arm-linux-androideabi-4.6
+NDKVER=$NDK/toolchains/arm-linux-androideabi-4.9
NDKP=$NDKVER/prebuilt/linux-x86/bin/arm-linux-androideabi-
NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-arm"
NDKARCH="-march=armv7-a -mfloat-abi=softfp -Wl,--fix-cortex-a8"
make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF $NDKARCH"
-# Android/MIPS, mips (MIPS32R1 hard-float), Android 4.0+ (ICS)
+# Android/MIPS, mipsel (MIPS32R1 hard-float), Android 4.0+ (ICS)
NDK=/opt/android/ndk
NDKABI=14
-NDKVER=$NDK/toolchains/mipsel-linux-android-4.6
+NDKVER=$NDK/toolchains/mipsel-linux-android-4.9
NDKP=$NDKVER/prebuilt/linux-x86/bin/mipsel-linux-android-
NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-mips"
make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF"
@@ -436,7 +467,7 @@ make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF"
# Android/x86, x86 (i686 SSE3), Android 4.0+ (ICS)
NDK=/opt/android/ndk
NDKABI=14
-NDKVER=$NDK/toolchains/x86-4.6
+NDKVER=$NDK/toolchains/x86-4.9
NDKP=$NDKVER/prebuilt/linux-x86/bin/i686-linux-android-
NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-x86"
make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF"
@@ -456,14 +487,15 @@ Or use Android. :-p
ISDKP=$(xcrun --sdk iphoneos --show-sdk-path)
ICC=$(xcrun --sdk iphoneos --find clang)
ISDKF="-arch armv7 -isysroot $ISDKP"
-make HOST_CC="clang -m32 -arch i386" CROSS="$(dirname $ICC)/" \
- TARGET_FLAGS="$ISDKF" TARGET_SYS=iOS
+make DEFAULT_CC=clang HOST_CC="clang -m32 -arch i386" \
+ CROSS="$(dirname $ICC)/" TARGET_FLAGS="$ISDKF" TARGET_SYS=iOS
# iOS/ARM64
ISDKP=$(xcrun --sdk iphoneos --show-sdk-path)
ICC=$(xcrun --sdk iphoneos --find clang)
ISDKF="-arch arm64 -isysroot $ISDKP"
-make CROSS="$(dirname $ICC)/" TARGET_FLAGS="$ISDKF" TARGET_SYS=iOS
+make DEFAULT_CC=clang CROSS="$(dirname $ICC)/" \
+ TARGET_FLAGS="$ISDKF" TARGET_SYS=iOS
Cross-compiling for consoles
@@ -560,14 +592,11 @@ intend to load Lua/C modules at runtime.
If you're building a 64 bit application on OSX which links directly or
-indirectly against LuaJIT, you need to link your main executable
-with these flags:
+indirectly against LuaJIT which is not built for LJ_GC64 mode,
+you need to link your main executable with these flags:
-pagezero_size 10000 -image_base 100000000
-Also, it's recommended to rebase all (self-compiled) shared libraries
-which are loaded at runtime on OSX/x64 (e.g. C extension modules for Lua).
-See: man rebase
Additional hints for initializing LuaJIT using the C API functions:
@@ -653,7 +682,7 @@ to me (the upstream) and not you (the package maintainer), anyway.
-Some checks are missing in the JIT-compiled code for obscure situations
-with open upvalues aliasing one of the SSA slots later on (or
-vice versa). Bonus points, if you can find a real world test case for
-this.
-
-
Currently some out-of-memory errors from on-trace code are not
handled correctly. The error may fall through an on-trace
pcall or it may be passed on to the function set with
lua_atpanic on x64. This issue will be fixed with the new
garbage collector.
+
+LuaJIT on 64 bit systems provides a limited range of 47 bits for the
+legacy lightuserdata data type.
+This is only relevant on x64 systems which use the negative part of the
+virtual address space in user mode, e.g. Solaris/x64, and on ARM64 systems
+configured with a 48 bit or 52 bit VA.
+Avoid using lightuserdata to hold pointers that may point outside
+of that range, e.g. variables on the stack. In general, avoid this data
+type for new code and replace it with (much more performant) FFI bindings.
+FFI cdata pointers can address the full 64 bit range.
+