From 897c1eb2ac56c5fe4f8a26b0026955bbe3ddc93e Mon Sep 17 00:00:00 2001
From: luigi
Date: Wed, 9 Sep 2015 10:17:54 +0000
Subject: [PATCH] sync with TL 38329
git-svn-id: https://foundry.supelec.fr/svn/luatex/trunk@5290 0b2b3880-5936-4365-a048-eb17d2e5a6bf
---
source/build-aux/texinfo.tex | 117 +-
source/libs/README | 8 +-
source/libs/luajit/ChangeLog | 6 +
.../LuaJIT-2.0.4-PATCHES/patch-06-ppc-darwin | 26 -
source/libs/luajit/LuaJIT-2.0.4/src/lib_bit.c | 74 -
source/libs/luajit/LuaJIT-2.0.4/src/lj_lex.c | 482 --
source/libs/luajit/LuaJIT-2.0.4/src/lj_str.h | 50 -
source/libs/luajit/LuaJIT-2.0.4/src/vm_ppcspe.dasc | 3691 ---------------
.../ChangeLog | 8 +
.../patch-01-LuaJITTeX | 57 +-
.../patch-05-LuaJITTeX | 28 +-
.../LuaJIT-2.1.0-beta1-PATCHES/patch-06-ppc-darwin | 24 +
.../{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/COPYRIGHT | 0
.../{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/Makefile | 24 +-
.../{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/README | 4 +-
.../doc/bluequad-print.css | 0
.../doc/bluequad.css | 0
.../doc/changes.html | 284 +-
.../doc/contact.html | 2 +
.../doc/ext_c_api.html | 2 +
.../doc/ext_ffi.html | 2 +
.../doc/ext_ffi_api.html | 8 +-
.../doc/ext_ffi_semantics.html | 24 +-
.../doc/ext_ffi_tutorial.html | 2 +
.../doc/ext_jit.html | 4 +-
.../LuaJIT-2.1.0-beta1/doc/ext_profiler.html | 365 ++
.../doc/extensions.html | 42 +-
.../doc/faq.html | 2 +
.../doc/img/contact.png | Bin
.../doc/install.html | 33 +-
.../doc/luajit.html | 6 +-
.../doc/running.html | 3 +
.../doc/status.html | 2 +
.../dynasm/dasm_arm.h | 0
.../dynasm/dasm_arm.lua | 0
.../dynasm/dasm_arm64.h} | 142 +-
.../LuaJIT-2.1.0-beta1/dynasm/dasm_arm64.lua | 1166 +++++
.../dynasm/dasm_mips.h | 0
.../dynasm/dasm_mips.lua | 0
.../dynasm/dasm_ppc.h | 13 +-
.../dynasm/dasm_ppc.lua | 698 ++-
.../dynasm/dasm_proto.h | 0
.../dynasm/dasm_x64.lua | 0
.../dynasm/dasm_x86.h | 0
.../dynasm/dasm_x86.lua | 0
.../dynasm/dynasm.lua | 0
.../etc/luajit.1 | 0
.../etc/luajit.pc | 6 +-
.../src/Makefile | 71 +-
.../src/Makefile.dep | 200 +-
.../src/host/README | 0
.../src/host/buildvm.c | 24 +-
.../src/host/buildvm.h | 1 +
.../src/host/buildvm_asm.c | 50 +-
.../src/host/buildvm_fold.c | 0
.../src/host/buildvm_lib.c | 61 +-
.../LuaJIT-2.1.0-beta1/src/host/buildvm_libbc.h | 45 +
.../src/host/buildvm_peobj.c | 0
.../LuaJIT-2.1.0-beta1/src/host/genlibbc.lua | 197 +
.../src/host/genminilua.lua | 0
.../src/host/minilua.c | 0
.../src/jit/bc.lua | 19 +-
.../src/jit/bcsave.lua | 24 +-
.../src/jit/dis_arm.lua | 18 +-
.../src/jit/dis_mips.lua | 30 +-
.../src/jit/dis_mipsel.lua | 15 +-
.../src/jit/dis_ppc.lua | 18 +-
.../src/jit/dis_x64.lua | 15 +-
.../src/jit/dis_x86.lua | 38 +-
.../src/jit/dump.lua | 29 +-
.../libs/luajit/LuaJIT-2.1.0-beta1/src/jit/p.lua | 310 ++
.../src/jit/v.lua | 15 +-
.../luajit/LuaJIT-2.1.0-beta1/src/jit/zone.lua | 45 +
.../src/lauxlib.h | 0
.../src/lib_aux.c | 0
.../src/lib_base.c | 81 +-
.../libs/luajit/LuaJIT-2.1.0-beta1/src/lib_bit.c | 180 +
.../src/lib_debug.c | 2 +-
.../src/lib_ffi.c | 45 +-
.../src/lib_init.c | 0
.../src/lib_io.c | 46 +-
.../src/lib_jit.c | 154 +-
.../src/lib_math.c | 11 +-
.../src/lib_os.c | 37 +-
.../src/lib_package.c | 14 +-
.../src/lib_string.c | 448 +-
.../src/lib_table.c | 167 +-
.../src/lj.supp | 0
.../src/lj_alloc.c | 12 +-
.../src/lj_alloc.h | 0
.../src/lj_api.c | 132 +-
.../src/lj_arch.h | 160 +-
.../src/lj_asm.c | 492 +-
.../src/lj_asm.h | 0
.../src/lj_asm_arm.h | 442 +-
.../src/lj_asm_mips.h | 364 +-
.../src/lj_asm_ppc.h | 374 +-
.../src/lj_asm_x86.h | 576 +--
.../src/lj_bc.c | 0
.../src/lj_bc.h | 4 +
.../src/lj_bcdump.h | 6 +-
.../src/lj_bcread.c | 143 +-
.../src/lj_bcwrite.c | 229 +-
source/libs/luajit/LuaJIT-2.1.0-beta1/src/lj_buf.c | 234 +
source/libs/luajit/LuaJIT-2.1.0-beta1/src/lj_buf.h | 105 +
.../src/lj_carith.c | 76 +
.../src/lj_carith.h | 10 +
.../src/lj_ccall.c | 158 +-
.../src/lj_ccall.h | 27 +-
.../src/lj_ccallback.c | 110 +-
.../src/lj_ccallback.h | 0
.../src/lj_cconv.c | 0
.../src/lj_cconv.h | 0
.../src/lj_cdata.c | 29 +-
.../src/lj_cdata.h | 5 +-
.../src/lj_char.c | 0
.../src/lj_char.h | 0
.../src/lj_clib.c | 29 +-
.../src/lj_clib.h | 0
.../src/lj_cparse.c | 56 +-
.../src/lj_cparse.h | 0
.../src/lj_crecord.c | 239 +-
.../src/lj_crecord.h | 7 +
.../src/lj_ctype.c | 15 +-
.../src/lj_ctype.h | 2 +-
.../src/lj_debug.c | 186 +-
.../src/lj_debug.h | 8 +-
.../src/lj_def.h | 22 +-
.../src/lj_dispatch.c | 81 +-
.../src/lj_dispatch.h | 23 +-
.../src/lj_emit_arm.h | 16 +-
.../src/lj_emit_mips.h | 16 +-
.../src/lj_emit_ppc.h | 16 +-
.../src/lj_emit_x86.h | 24 +-
.../src/lj_err.c | 74 +-
.../src/lj_err.h | 0
.../src/lj_errmsg.h | 5 +-
.../src/lj_ff.h | 0
.../src/lj_ffrecord.c | 575 ++-
.../src/lj_ffrecord.h | 0
.../src/lj_frame.h | 120 +-
.../src/lj_func.c | 0
.../src/lj_func.h | 0
.../src/lj_gc.c | 66 +-
.../src/lj_gc.h | 10 +-
.../src/lj_gdbjit.c | 18 +-
.../src/lj_gdbjit.h | 0
.../src/lj_ir.c | 10 +-
.../src/lj_ir.h | 34 +-
.../src/lj_ircall.h | 138 +-
.../src/lj_iropt.h | 0
.../src/lj_jit.h | 47 +-
source/libs/luajit/LuaJIT-2.1.0-beta1/src/lj_lex.c | 482 ++
.../src/lj_lex.h | 17 +-
.../src/lj_lib.c | 75 +-
.../src/lj_lib.h | 29 +-
.../src/lj_load.c | 4 +-
.../src/lj_mcode.c | 0
.../src/lj_mcode.h | 0
.../src/lj_meta.c | 125 +-
.../src/lj_meta.h | 1 +
.../src/lj_obj.c | 17 +-
.../src/lj_obj.h | 182 +-
.../src/lj_opt_dce.c | 0
.../src/lj_opt_fold.c | 286 +-
.../src/lj_opt_loop.c | 29 +-
.../src/lj_opt_mem.c | 23 +-
.../src/lj_opt_narrow.c | 10 +-
.../src/lj_opt_sink.c | 0
.../src/lj_opt_split.c | 131 +-
.../src/lj_parse.c | 189 +-
.../src/lj_parse.h | 0
.../luajit/LuaJIT-2.1.0-beta1/src/lj_profile.c | 368 ++
.../luajit/LuaJIT-2.1.0-beta1/src/lj_profile.h | 21 +
.../src/lj_record.c | 390 +-
.../src/lj_record.h | 1 +
.../src/lj_snap.c | 22 +-
.../src/lj_snap.h | 0
.../src/lj_state.c | 33 +-
.../src/lj_state.h | 0
.../src/lj_str.c | 212 +-
source/libs/luajit/LuaJIT-2.1.0-beta1/src/lj_str.h | 27 +
.../libs/luajit/LuaJIT-2.1.0-beta1/src/lj_strfmt.c | 554 +++
.../libs/luajit/LuaJIT-2.1.0-beta1/src/lj_strfmt.h | 125 +
.../src/lj_strscan.c | 57 +-
.../src/lj_strscan.h | 0
.../src/lj_tab.c | 53 +-
.../src/lj_tab.h | 5 +-
.../src/lj_target.h | 2 +
.../src/lj_target_arm.h | 4 -
.../LuaJIT-2.1.0-beta1/src/lj_target_arm64.h | 97 +
.../src/lj_target_mips.h | 3 +
.../src/lj_target_ppc.h | 2 +-
.../src/lj_target_x86.h | 7 +-
.../src/lj_trace.c | 73 +-
.../src/lj_trace.h | 1 +
.../src/lj_traceerr.h | 4 +-
.../src/lj_udata.c | 0
.../src/lj_udata.h | 0
.../src/lj_vm.h | 18 +-
.../src/lj_vmevent.c | 1 +
.../src/lj_vmevent.h | 0
.../src/lj_vmmath.c | 32 +-
.../src/ljamalg.c | 3 +
.../{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lua.h | 0
.../src/lua.hpp | 0
.../src/luaconf.h | 2 +-
.../src/luajit.c | 13 +-
.../src/luajit.h | 15 +-
.../src/lualib.h | 0
.../src/msvcbuild.bat | 1 +
.../src/ps4build.bat | 4 +-
.../src/psvitabuild.bat | 0
.../src/vm_arm.dasc | 331 +-
.../luajit/LuaJIT-2.1.0-beta1/src/vm_arm64.dasc | 3764 +++++++++++++++
.../src/vm_mips.dasc | 390 +-
.../src/vm_ppc.dasc | 376 +-
.../libs/luajit/LuaJIT-2.1.0-beta1/src/vm_x64.dasc | 4902 ++++++++++++++++++++
.../src/vm_x86.dasc | 1593 ++-----
.../src/xb1build.bat} | 51 +-
.../src/xedkbuild.bat | 0
source/libs/luajit/Makefile.am | 26 +-
source/libs/luajit/Makefile.in | 132 +-
source/libs/luajit/configure | 252 +-
source/libs/luajit/configure.ac | 10 +-
source/libs/luajit/include/Makefile.in | 2 +
source/libs/luajit/m4/lj-system.m4 | 29 +-
source/libs/luajit/native/configure | 24 +-
source/libs/luajit/version.ac | 2 +-
source/m4/ChangeLog | 9 +
source/m4/kpse-lib-version.m4 | 8 +-
source/m4/kpse-pkgs.m4 | 1 +
source/texk/README | 5 +-
source/texk/texlive/linked_scripts/Makefile.am | 1 +
source/texk/texlive/linked_scripts/Makefile.in | 1 +
235 files changed, 21059 insertions(+), 9940 deletions(-)
delete mode 100644 source/libs/luajit/LuaJIT-2.0.4-PATCHES/patch-06-ppc-darwin
delete mode 100644 source/libs/luajit/LuaJIT-2.0.4/src/lib_bit.c
delete mode 100644 source/libs/luajit/LuaJIT-2.0.4/src/lj_lex.c
delete mode 100644 source/libs/luajit/LuaJIT-2.0.4/src/lj_str.h
delete mode 100644 source/libs/luajit/LuaJIT-2.0.4/src/vm_ppcspe.dasc
rename source/libs/luajit/{LuaJIT-2.0.4-PATCHES => LuaJIT-2.1.0-beta1-PATCHES}/ChangeLog (88%)
rename source/libs/luajit/{LuaJIT-2.0.4-PATCHES => LuaJIT-2.1.0-beta1-PATCHES}/patch-01-LuaJITTeX (69%)
rename source/libs/luajit/{LuaJIT-2.0.4-PATCHES => LuaJIT-2.1.0-beta1-PATCHES}/patch-05-LuaJITTeX (77%)
create mode 100644 source/libs/luajit/LuaJIT-2.1.0-beta1-PATCHES/patch-06-ppc-darwin
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/COPYRIGHT (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/Makefile (87%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/README (86%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/doc/bluequad-print.css (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/doc/bluequad.css (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/doc/changes.html (80%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/doc/contact.html (98%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/doc/ext_c_api.html (99%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/doc/ext_ffi.html (99%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/doc/ext_ffi_api.html (98%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/doc/ext_ffi_semantics.html (98%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/doc/ext_ffi_tutorial.html (99%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/doc/ext_jit.html (98%)
create mode 100644 source/libs/luajit/LuaJIT-2.1.0-beta1/doc/ext_profiler.html
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/doc/extensions.html (89%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/doc/faq.html (99%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/doc/img/contact.png (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/doc/install.html (97%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/doc/luajit.html (97%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/doc/running.html (98%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/doc/status.html (98%)
copy source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/dynasm/dasm_arm.h (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/dynasm/dasm_arm.lua (100%)
rename source/libs/luajit/{LuaJIT-2.0.4/dynasm/dasm_arm.h => LuaJIT-2.1.0-beta1/dynasm/dasm_arm64.h} (79%)
create mode 100644 source/libs/luajit/LuaJIT-2.1.0-beta1/dynasm/dasm_arm64.lua
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/dynasm/dasm_mips.h (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/dynasm/dasm_mips.lua (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/dynasm/dasm_ppc.h (97%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/dynasm/dasm_ppc.lua (63%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/dynasm/dasm_proto.h (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/dynasm/dasm_x64.lua (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/dynasm/dasm_x86.h (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/dynasm/dasm_x86.lua (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/dynasm/dynasm.lua (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/etc/luajit.1 (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/etc/luajit.pc (89%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/Makefile (94%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/Makefile.dep (57%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/host/README (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/host/buildvm.c (96%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/host/buildvm.h (98%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/host/buildvm_asm.c (85%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/host/buildvm_fold.c (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/host/buildvm_lib.c (87%)
create mode 100644 source/libs/luajit/LuaJIT-2.1.0-beta1/src/host/buildvm_libbc.h
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/host/buildvm_peobj.c (100%)
create mode 100644 source/libs/luajit/LuaJIT-2.1.0-beta1/src/host/genlibbc.lua
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/host/genminilua.lua (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/host/minilua.c (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/jit/bc.lua (96%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/jit/bcsave.lua (96%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/jit/dis_arm.lua (98%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/jit/dis_mips.lua (96%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/jit/dis_mipsel.lua (75%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/jit/dis_ppc.lua (98%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/jit/dis_x64.lua (76%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/jit/dis_x86.lua (98%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/jit/dump.lua (96%)
create mode 100644 source/libs/luajit/LuaJIT-2.1.0-beta1/src/jit/p.lua
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/jit/v.lua (94%)
create mode 100644 source/libs/luajit/LuaJIT-2.1.0-beta1/src/jit/zone.lua
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lauxlib.h (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lib_aux.c (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lib_base.c (90%)
create mode 100644 source/libs/luajit/LuaJIT-2.1.0-beta1/src/lib_bit.c
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lib_debug.c (99%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lib_ffi.c (95%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lib_init.c (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lib_io.c (93%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lib_jit.c (82%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lib_math.c (96%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lib_os.c (91%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lib_package.c (97%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lib_string.c (62%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lib_table.c (73%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj.supp (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_alloc.c (99%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_alloc.h (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_api.c (92%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_arch.h (79%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_asm.c (83%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_asm.h (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_asm_arm.h (89%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_asm_mips.h (87%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_asm_ppc.h (89%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_asm_x86.h (86%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_bc.c (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_bc.h (98%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_bcdump.h (92%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_bcread.c (81%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_bcwrite.c (57%)
create mode 100644 source/libs/luajit/LuaJIT-2.1.0-beta1/src/lj_buf.c
create mode 100644 source/libs/luajit/LuaJIT-2.1.0-beta1/src/lj_buf.h
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_carith.c (81%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_carith.h (60%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_ccall.c (87%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_ccall.h (93%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_ccallback.c (89%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_ccallback.h (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_cconv.c (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_cconv.h (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_cdata.c (93%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_cdata.h (92%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_char.c (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_char.h (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_clib.c (91%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_clib.h (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_cparse.c (97%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_cparse.h (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_crecord.c (87%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_crecord.h (78%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_ctype.c (98%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_ctype.h (99%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_debug.c (77%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_debug.h (86%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_def.h (93%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_dispatch.c (87%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_dispatch.h (84%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_emit_arm.h (96%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_emit_mips.h (92%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_emit_ppc.h (92%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_emit_x86.h (93%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_err.c (94%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_err.h (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_errmsg.h (97%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_ff.h (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_ffrecord.c (61%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_ffrecord.h (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_frame.h (64%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_func.c (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_func.h (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_gc.c (94%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_gc.h (93%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_gdbjit.c (98%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_gdbjit.h (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_ir.c (97%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_ir.h (94%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_ircall.h (62%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_iropt.h (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_jit.h (92%)
create mode 100644 source/libs/luajit/LuaJIT-2.1.0-beta1/src/lj_lex.c
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_lex.h (86%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_lib.c (77%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_lib.h (85%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_load.c (98%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_mcode.c (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_mcode.h (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_meta.c (83%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_meta.h (95%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_obj.c (69%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_obj.h (87%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_opt_dce.c (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_opt_fold.c (88%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_opt_loop.c (96%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_opt_mem.c (98%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_opt_narrow.c (98%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_opt_sink.c (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_opt_split.c (87%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_parse.c (94%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_parse.h (100%)
create mode 100644 source/libs/luajit/LuaJIT-2.1.0-beta1/src/lj_profile.c
create mode 100644 source/libs/luajit/LuaJIT-2.1.0-beta1/src/lj_profile.h
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_record.c (85%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_record.h (95%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_snap.c (97%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_snap.h (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_state.c (91%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_state.h (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_str.c (54%)
create mode 100644 source/libs/luajit/LuaJIT-2.1.0-beta1/src/lj_str.h
create mode 100644 source/libs/luajit/LuaJIT-2.1.0-beta1/src/lj_strfmt.c
create mode 100644 source/libs/luajit/LuaJIT-2.1.0-beta1/src/lj_strfmt.h
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_strscan.c (90%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_strscan.h (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_tab.c (93%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_tab.h (89%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_target.h (99%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_target_arm.h (98%)
create mode 100644 source/libs/luajit/LuaJIT-2.1.0-beta1/src/lj_target_arm64.h
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_target_mips.h (98%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_target_ppc.h (99%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_target_x86.h (99%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_trace.c (92%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_trace.h (95%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_traceerr.h (95%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_udata.c (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_udata.h (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_vm.h (91%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_vmevent.c (97%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_vmevent.h (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lj_vmmath.c (71%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/ljamalg.c (97%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lua.h (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lua.hpp (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/luaconf.h (99%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/luajit.c (98%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/luajit.h (81%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/lualib.h (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/msvcbuild.bat (95%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/ps4build.bat (94%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/psvitabuild.bat (100%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/vm_arm.dasc (95%)
create mode 100644 source/libs/luajit/LuaJIT-2.1.0-beta1/src/vm_arm64.dasc
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/vm_mips.dasc (94%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/vm_ppc.dasc (95%)
create mode 100644 source/libs/luajit/LuaJIT-2.1.0-beta1/src/vm_x64.dasc
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/vm_x86.dasc (84%)
copy source/libs/luajit/{LuaJIT-2.0.4/src/xedkbuild.bat => LuaJIT-2.1.0-beta1/src/xb1build.bat} (62%)
rename source/libs/luajit/{LuaJIT-2.0.4 => LuaJIT-2.1.0-beta1}/src/xedkbuild.bat (100%)
diff --git a/source/build-aux/texinfo.tex b/source/build-aux/texinfo.tex
index c9baa11df..e70ea2858 100644
--- a/source/build-aux/texinfo.tex
+++ b/source/build-aux/texinfo.tex
@@ -3,7 +3,7 @@
% Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
%
-\def\texinfoversion{2015-08-27.20}
+\def\texinfoversion{2015-09-04.11}
%
% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@@ -4667,6 +4667,28 @@ end
\let\indexlbrace\relax
\let\indexrbrace\relax
+{\catcode`\@=0
+\catcode`\\=13
+ @gdef@backslashdisappear{@def\{}}
+}
+
+{
+\catcode`\<=13
+\catcode`\-=13
+ \gdef\indexnonalnumdisappear{%
+ \backslashdisappear
+ \def-{}%
+ \def<{}%
+ }
+
+ \gdef\indexnonalnumreappear{%
+ \useindexbackslash
+ \let-\normaldash
+ \let<\normalless
+ }
+}
+
+
% \indexnofonts is used when outputting the strings to sort the index
% by, and when constructing control sequence names. It eliminates all
% control sequences and just writes whatever the best ASCII sort string
@@ -4828,13 +4850,23 @@ end
% Definition for writing index entry text.
\def\sortas#1{\ignorespaces}%
-% Definition for writing index entry sort key. @sortas{} must occur at
+% Definition for writing index entry sort key. Should occur at the at
% the beginning of the index entry, like
-% @cindex @sortas{september} \september
-\def\indexwritesortas#1#2\endofindexentry{#1}
+% @cindex @sortas{september} \september
+% The \ignorespaces takes care of following space, but there's no way
+% to remove space before it.
+{
+\catcode`\-=13
+\gdef\indexwritesortas{%
+ \begingroup
+ \indexnonalnumreappear
+ \indexwritesortasxxx}
+\gdef\indexwritesortasxxx#1{%
+ \xdef\indexsortkey{#1}\endgroup}
+}
-% Write the entry in \toks0 to the index file:
+% Write the entry in \toks0 to the index file.
%
\def\dosubindwrite{%
% Put the index entry in the margin if desired.
@@ -4849,10 +4881,15 @@ end
% Get the string to sort by, by processing the index entry with all
% font commands turned off.
{\indexnofonts
- \def\endofindexentry{}%
+ \xdef\indexsortkey{}%
\let\sortas=\indexwritesortas
- \edef\temp{\the\toks0 \noexpand\endofindexentry}%
- \xdef\indexsortkey{\temp}%
+ \indexnonalnumdisappear
+ \edef\temp{\the\toks0}%
+ \setbox\dummybox = \hbox{\temp}% Make sure to execute any \sortas
+ \ifx\indexsortkey\empty
+ \xdef\indexsortkey{\temp}%
+ \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi
+ \fi
}%
%
% Set up the complete index entry, with both the sort key and
@@ -4866,6 +4903,7 @@ end
}%
\temp
}
+\newbox\dummybox % used above
% Take care of unwanted page breaks/skips around a whatsit:
%
@@ -5026,11 +5064,10 @@ end
% These macros are used by the sorted index file itself.
% Change them to control the appearance of the index.
-\let\normalhyphen=-
{\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13
\catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13
\catcode`\$=3
-\gdef\initialfonts{%
+\gdef\initialglyphs{%
% Some changes for non-alphabetic characters. Using the glyphs from the
% math fonts looks more consistent than the typewriter font used elsewhere
% for these characters.
@@ -5040,12 +5077,11 @@ end
% Can't get bold backslash so don't use bold forward slash
\catcode`\/=13
\def/{{\secrmnotbold \normalslash}}%
- \catcode`\-=13
- \def-{{\normalhyphen\normalhyphen}}%
+ \def-{{\normaldash\normaldash}}% en dash `--'
\let^=\normalcaret
\let~=\normaltilde
\def\_{%
- \leavevmode \kern.07em \vbox{\hrule width.33em height.06ex}\kern .07em }
+ \leavevmode \kern.07em \vbox{\hrule width.33em height.06ex}\kern .07em }%
\def|{$\vert$}%
\def<{$\less$}%
\def>{$\gtr$}%
@@ -5054,7 +5090,7 @@ end
\def\initial{%
\bgroup
- \initialfonts
+ \initialglyphs
\initialx
}
@@ -5261,7 +5297,7 @@ end
}
% The double-column output routine for all double-column pages except
-% the last.
+% the last, which is done by \balancecolumns.
%
\def\doublecolumnout{%
\splittopskip=\topskip \splitmaxdepth=\maxdepth
@@ -5343,7 +5379,8 @@ end
\pagegoal = \vsize
}
%
-% Only called for the last of the double column material.
+% Only called for the last of the double column material. \doublecolumnout
+% does the others.
\def\balancecolumns{%
\setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
\dimen@ = \ht0
@@ -5351,26 +5388,33 @@ end
\advance\dimen@ by-\baselineskip
\ifdim\dimen@<14\baselineskip
% Don't split a short final column in two.
- \global\setbox1 = \copy0
- \global\setbox3 = \vbox{}%
+ \setbox2=\vbox{}%
\else
- \divide\dimen@ by 2 % target to split to
- %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}%
- \splittopskip = \topskip
- % Loop until we get a decent breakpoint.
- {%
- \vbadness = 10000
- \loop
- \global\setbox3 = \copy0
- \global\setbox1 = \vsplit3 to \dimen@
- \ifdim\ht3>\dimen@
- \global\advance\dimen@ by 1pt
- \repeat
- }%
+ \divide\dimen@ by 2 % target to split to
+ \dimen@ii = \dimen@
+ \splittopskip = \topskip
+ % Loop until the second column is no higher than the first
+ {%
+ \vbadness = 10000
+ \loop
+ \global\setbox3 = \copy0
+ \global\setbox1 = \vsplit3 to \dimen@
+ \ifdim\ht3>\dimen@
+ \global\advance\dimen@ by 1pt
+ \repeat
+ }%
+ \multiply\dimen@ii by 4
+ \divide\dimen@ii by 5
+ \ifdim\ht3<\dimen@ii
+ % Column heights are too different, so don't make their bottoms
+ % flush with each other
+ \setbox0=\vbox to\dimen@{\unvbox1\vfill}%
+ \setbox2=\vbox to\dimen@{\unvbox3\vfill}%
+ \else
+ \setbox0=\vbox to\dimen@{\unvbox1}%
+ \setbox2=\vbox to\dimen@{\unvbox3}%
+ \fi
\fi
- %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}%
- \setbox0=\vbox to\dimen@{\unvbox1\vfill}%
- \setbox2=\vbox to\dimen@{\unvbox3\vfill}%
%
\pagesofar
}
@@ -10321,6 +10365,8 @@ directory should work if nowhere else does.}
\catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr
\catcode`\+=\active \def+{{\tt \char 43}}
\catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
+\catcode`\-=\active \let-=\normaldash
+
% used for headline/footline in the output routine, in case the page
% breaks in the middle of an @tex block.
@@ -10376,8 +10422,7 @@ directory should work if nowhere else does.}
@gdef@otherbackslash{@let\=@realbackslash}
% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
-% the literal character `\'. Also revert - to its normal character, in
-% case the active - from code has slipped in.
+% the literal character `\'.
%
{@catcode`- = @active
@gdef@normalturnoffactive{%
diff --git a/source/libs/README b/source/libs/README
index 5d18f22e8..d55285050 100644
--- a/source/libs/README
+++ b/source/libs/README
@@ -1,4 +1,4 @@
-$Id: README 38252 2015-08-31 07:58:01Z peter $
+$Id: README 38316 2015-09-07 10:07:39Z peter $
Public domain. Originally created by Karl Berry, 2005.
Libraries we compile for TeX Live.
@@ -24,7 +24,7 @@ gmp 6.0.0 - checked 25mar14
graphite2 1.3.1 - checked 31aug15
http://sourceforge.net/projects/silgraphite/files/graphite2/
-harfbuzz 1.0.2 - checked 20aug15
+harfbuzz 1.0.3 - checked 2sep15
http://www.freedesktop.org/software/harfbuzz/release/
icu 55.1 (release) - checked 12apr15
@@ -40,8 +40,8 @@ libpng 1.6.18 - checked 1aug15
lua 5.2.3 - checked 11mar15
http://www.lua.org/ftp/
-luajit 2.0.4 - checked 12jun15
- http://luajit.org/download/LuaJIT-2.0.4.tar.gz
+luajit 2.1.0-beta1 - checked 7sep15
+ http://luajit.org/download/LuaJIT-2.1.0-beta1.tar.gz
mpfr 3.1.3 - checked 20jun15
http://ftp.gnu.org/gnu/mpfr/
diff --git a/source/libs/luajit/ChangeLog b/source/libs/luajit/ChangeLog
index 782d9c0b1..ddf72b85f 100644
--- a/source/libs/luajit/ChangeLog
+++ b/source/libs/luajit/ChangeLog
@@ -1,3 +1,9 @@
+2015-09-07 Peter Breitenlohner
+
+ Import LuaJIT-2.1.0-beta1.
+ * version.ac: Adjusted.
+ * Makefile.am, configure.ac, m4/lj-system.m4: Adapted.
+
2015-07-06 Peter Breitenlohner
* Makefile.am: Better dependencies for 'make check'.
diff --git a/source/libs/luajit/LuaJIT-2.0.4-PATCHES/patch-06-ppc-darwin b/source/libs/luajit/LuaJIT-2.0.4-PATCHES/patch-06-ppc-darwin
deleted file mode 100644
index 35ed49523..000000000
--- a/source/libs/luajit/LuaJIT-2.0.4-PATCHES/patch-06-ppc-darwin
+++ /dev/null
@@ -1,26 +0,0 @@
-diff -ur -x lbitlib.c LuaJIT-2.0.4.orig/src/host/buildvm.c LuaJIT-2.0.4/src/host/buildvm.c
---- LuaJIT-2.0.4.orig/src/host/buildvm.c 2015-05-14 20:30:00.000000000 +0200
-+++ LuaJIT-2.0.4/src/host/buildvm.c 2015-06-12 11:06:32.000000000 +0200
-@@ -113,7 +113,7 @@
- name[0] = '@';
- else
- *p = '\0';
--#elif (LJ_TARGET_PPC || LJ_TARGET_PPCSPE) && !LJ_TARGET_CONSOLE
-+#elif ((LJ_TARGET_PPC && !LJ_TARGET_OSX) || LJ_TARGET_PPCSPE) && !LJ_TARGET_CONSOLE
- /* Keep @plt. */
- #else
- *p = '\0';
-diff -ur -x lbitlib.c LuaJIT-2.0.4.orig/src/lj_arch.h LuaJIT-2.0.4/src/lj_arch.h
---- LuaJIT-2.0.4.orig/src/lj_arch.h 2015-05-14 20:30:00.000000000 +0200
-+++ LuaJIT-2.0.4/src/lj_arch.h 2015-06-12 11:06:32.000000000 +0200
-@@ -301,7 +301,7 @@
- #if __GNUC__ < 4
- #error "Need at least GCC 4.0 or newer"
- #endif
--#elif LJ_TARGET_ARM
-+#elif LJ_TARGET_ARM || LJ_TARGET_PPC
- #if (__GNUC__ < 4) || ((__GNUC__ == 4) && __GNUC_MINOR__ < 2)
- #error "Need at least GCC 4.2 or newer"
- #endif
-Only in LuaJIT-2.0.4/src: lj_arch.h.orig
-Only in LuaJIT-2.0.4/src: Makefile.orig
diff --git a/source/libs/luajit/LuaJIT-2.0.4/src/lib_bit.c b/source/libs/luajit/LuaJIT-2.0.4/src/lib_bit.c
deleted file mode 100644
index 583e04b0c..000000000
--- a/source/libs/luajit/LuaJIT-2.0.4/src/lib_bit.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
-** Bit manipulation library.
-** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
-*/
-
-#define lib_bit_c
-#define LUA_LIB
-
-#include "lua.h"
-#include "lauxlib.h"
-#include "lualib.h"
-
-#include "lj_obj.h"
-#include "lj_err.h"
-#include "lj_str.h"
-#include "lj_lib.h"
-
-/* ------------------------------------------------------------------------ */
-
-#define LJLIB_MODULE_bit
-
-LJLIB_ASM(bit_tobit) LJLIB_REC(bit_unary IR_TOBIT)
-{
- lj_lib_checknumber(L, 1);
- return FFH_RETRY;
-}
-LJLIB_ASM_(bit_bnot) LJLIB_REC(bit_unary IR_BNOT)
-LJLIB_ASM_(bit_bswap) LJLIB_REC(bit_unary IR_BSWAP)
-
-LJLIB_ASM(bit_lshift) LJLIB_REC(bit_shift IR_BSHL)
-{
- lj_lib_checknumber(L, 1);
- lj_lib_checkbit(L, 2);
- return FFH_RETRY;
-}
-LJLIB_ASM_(bit_rshift) LJLIB_REC(bit_shift IR_BSHR)
-LJLIB_ASM_(bit_arshift) LJLIB_REC(bit_shift IR_BSAR)
-LJLIB_ASM_(bit_rol) LJLIB_REC(bit_shift IR_BROL)
-LJLIB_ASM_(bit_ror) LJLIB_REC(bit_shift IR_BROR)
-
-LJLIB_ASM(bit_band) LJLIB_REC(bit_nary IR_BAND)
-{
- int i = 0;
- do { lj_lib_checknumber(L, ++i); } while (L->base+i < L->top);
- return FFH_RETRY;
-}
-LJLIB_ASM_(bit_bor) LJLIB_REC(bit_nary IR_BOR)
-LJLIB_ASM_(bit_bxor) LJLIB_REC(bit_nary IR_BXOR)
-
-/* ------------------------------------------------------------------------ */
-
-LJLIB_CF(bit_tohex)
-{
- uint32_t b = (uint32_t)lj_lib_checkbit(L, 1);
- int32_t i, n = L->base+1 >= L->top ? 8 : lj_lib_checkbit(L, 2);
- const char *hexdigits = "0123456789abcdef";
- char buf[8];
- if (n < 0) { n = -n; hexdigits = "0123456789ABCDEF"; }
- if (n > 8) n = 8;
- for (i = n; --i >= 0; ) { buf[i] = hexdigits[b & 15]; b >>= 4; }
- lua_pushlstring(L, buf, (size_t)n);
- return 1;
-}
-
-/* ------------------------------------------------------------------------ */
-
-#include "lj_libdef.h"
-
-LUALIB_API int luaopen_bit(lua_State *L)
-{
- LJ_LIB_REG(L, LUA_BITLIBNAME, bit);
- return 1;
-}
-
diff --git a/source/libs/luajit/LuaJIT-2.0.4/src/lj_lex.c b/source/libs/luajit/LuaJIT-2.0.4/src/lj_lex.c
deleted file mode 100644
index e1dc3cdfd..000000000
--- a/source/libs/luajit/LuaJIT-2.0.4/src/lj_lex.c
+++ /dev/null
@@ -1,482 +0,0 @@
-/*
-** Lexical analyzer.
-** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
-**
-** Major portions taken verbatim or adapted from the Lua interpreter.
-** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h
-*/
-
-#define lj_lex_c
-#define LUA_CORE
-
-#include "lj_obj.h"
-#include "lj_gc.h"
-#include "lj_err.h"
-#include "lj_str.h"
-#if LJ_HASFFI
-#include "lj_tab.h"
-#include "lj_ctype.h"
-#include "lj_cdata.h"
-#include "lualib.h"
-#endif
-#include "lj_state.h"
-#include "lj_lex.h"
-#include "lj_parse.h"
-#include "lj_char.h"
-#include "lj_strscan.h"
-
-/* Lua lexer token names. */
-static const char *const tokennames[] = {
-#define TKSTR1(name) #name,
-#define TKSTR2(name, sym) #sym,
-TKDEF(TKSTR1, TKSTR2)
-#undef TKSTR1
-#undef TKSTR2
- NULL
-};
-
-/* -- Buffer handling ----------------------------------------------------- */
-
-#define char2int(c) ((int)(uint8_t)(c))
-#define next(ls) \
- (ls->current = (ls->n--) > 0 ? char2int(*ls->p++) : fillbuf(ls))
-#define save_and_next(ls) (save(ls, ls->current), next(ls))
-#define currIsNewline(ls) (ls->current == '\n' || ls->current == '\r')
-#define END_OF_STREAM (-1)
-
-static int fillbuf(LexState *ls)
-{
- size_t sz;
- const char *buf = ls->rfunc(ls->L, ls->rdata, &sz);
- if (buf == NULL || sz == 0) return END_OF_STREAM;
- ls->n = (MSize)sz - 1;
- ls->p = buf;
- return char2int(*(ls->p++));
-}
-
-static LJ_NOINLINE void save_grow(LexState *ls, int c)
-{
- MSize newsize;
- if (ls->sb.sz >= LJ_MAX_STR/2)
- lj_lex_error(ls, 0, LJ_ERR_XELEM);
- newsize = ls->sb.sz * 2;
- lj_str_resizebuf(ls->L, &ls->sb, newsize);
- ls->sb.buf[ls->sb.n++] = (char)c;
-}
-
-static LJ_AINLINE void save(LexState *ls, int c)
-{
- if (LJ_UNLIKELY(ls->sb.n + 1 > ls->sb.sz))
- save_grow(ls, c);
- else
- ls->sb.buf[ls->sb.n++] = (char)c;
-}
-
-static void inclinenumber(LexState *ls)
-{
- int old = ls->current;
- lua_assert(currIsNewline(ls));
- next(ls); /* skip `\n' or `\r' */
- if (currIsNewline(ls) && ls->current != old)
- next(ls); /* skip `\n\r' or `\r\n' */
- if (++ls->linenumber >= LJ_MAX_LINE)
- lj_lex_error(ls, ls->token, LJ_ERR_XLINES);
-}
-
-/* -- Scanner for terminals ----------------------------------------------- */
-
-/* Parse a number literal. */
-static void lex_number(LexState *ls, TValue *tv)
-{
- StrScanFmt fmt;
- int c, xp = 'e';
- lua_assert(lj_char_isdigit(ls->current));
- if ((c = ls->current) == '0') {
- save_and_next(ls);
- if ((ls->current | 0x20) == 'x') xp = 'p';
- }
- while (lj_char_isident(ls->current) || ls->current == '.' ||
- ((ls->current == '-' || ls->current == '+') && (c | 0x20) == xp)) {
- c = ls->current;
- save_and_next(ls);
- }
- save(ls, '\0');
- fmt = lj_strscan_scan((const uint8_t *)ls->sb.buf, tv,
- (LJ_DUALNUM ? STRSCAN_OPT_TOINT : STRSCAN_OPT_TONUM) |
- (LJ_HASFFI ? (STRSCAN_OPT_LL|STRSCAN_OPT_IMAG) : 0));
- if (LJ_DUALNUM && fmt == STRSCAN_INT) {
- setitype(tv, LJ_TISNUM);
- } else if (fmt == STRSCAN_NUM) {
- /* Already in correct format. */
-#if LJ_HASFFI
- } else if (fmt != STRSCAN_ERROR) {
- lua_State *L = ls->L;
- GCcdata *cd;
- lua_assert(fmt == STRSCAN_I64 || fmt == STRSCAN_U64 || fmt == STRSCAN_IMAG);
- if (!ctype_ctsG(G(L))) {
- ptrdiff_t oldtop = savestack(L, L->top);
- luaopen_ffi(L); /* Load FFI library on-demand. */
- L->top = restorestack(L, oldtop);
- }
- if (fmt == STRSCAN_IMAG) {
- cd = lj_cdata_new_(L, CTID_COMPLEX_DOUBLE, 2*sizeof(double));
- ((double *)cdataptr(cd))[0] = 0;
- ((double *)cdataptr(cd))[1] = numV(tv);
- } else {
- cd = lj_cdata_new_(L, fmt==STRSCAN_I64 ? CTID_INT64 : CTID_UINT64, 8);
- *(uint64_t *)cdataptr(cd) = tv->u64;
- }
- lj_parse_keepcdata(ls, tv, cd);
-#endif
- } else {
- lua_assert(fmt == STRSCAN_ERROR);
- lj_lex_error(ls, TK_number, LJ_ERR_XNUMBER);
- }
-}
-
-static int skip_sep(LexState *ls)
-{
- int count = 0;
- int s = ls->current;
- lua_assert(s == '[' || s == ']');
- save_and_next(ls);
- while (ls->current == '=') {
- save_and_next(ls);
- count++;
- }
- return (ls->current == s) ? count : (-count) - 1;
-}
-
-static void read_long_string(LexState *ls, TValue *tv, int sep)
-{
- save_and_next(ls); /* skip 2nd `[' */
- if (currIsNewline(ls)) /* string starts with a newline? */
- inclinenumber(ls); /* skip it */
- for (;;) {
- switch (ls->current) {
- case END_OF_STREAM:
- lj_lex_error(ls, TK_eof, tv ? LJ_ERR_XLSTR : LJ_ERR_XLCOM);
- break;
- case ']':
- if (skip_sep(ls) == sep) {
- save_and_next(ls); /* skip 2nd `]' */
- goto endloop;
- }
- break;
- case '\n':
- case '\r':
- save(ls, '\n');
- inclinenumber(ls);
- if (!tv) lj_str_resetbuf(&ls->sb); /* avoid wasting space */
- break;
- default:
- if (tv) save_and_next(ls);
- else next(ls);
- break;
- }
- } endloop:
- if (tv) {
- GCstr *str = lj_parse_keepstr(ls, ls->sb.buf + (2 + (MSize)sep),
- ls->sb.n - 2*(2 + (MSize)sep));
- setstrV(ls->L, tv, str);
- }
-}
-
-static void read_string(LexState *ls, int delim, TValue *tv)
-{
- save_and_next(ls);
- while (ls->current != delim) {
- switch (ls->current) {
- case END_OF_STREAM:
- lj_lex_error(ls, TK_eof, LJ_ERR_XSTR);
- continue;
- case '\n':
- case '\r':
- lj_lex_error(ls, TK_string, LJ_ERR_XSTR);
- continue;
- case '\\': {
- int c = next(ls); /* Skip the '\\'. */
- switch (c) {
- case 'a': c = '\a'; break;
- case 'b': c = '\b'; break;
- case 'f': c = '\f'; break;
- case 'n': c = '\n'; break;
- case 'r': c = '\r'; break;
- case 't': c = '\t'; break;
- case 'v': c = '\v'; break;
- case 'x': /* Hexadecimal escape '\xXX'. */
- c = (next(ls) & 15u) << 4;
- if (!lj_char_isdigit(ls->current)) {
- if (!lj_char_isxdigit(ls->current)) goto err_xesc;
- c += 9 << 4;
- }
- c += (next(ls) & 15u);
- if (!lj_char_isdigit(ls->current)) {
- if (!lj_char_isxdigit(ls->current)) goto err_xesc;
- c += 9;
- }
- break;
- case 'z': /* Skip whitespace. */
- next(ls);
- while (lj_char_isspace(ls->current))
- if (currIsNewline(ls)) inclinenumber(ls); else next(ls);
- continue;
- case '\n': case '\r': save(ls, '\n'); inclinenumber(ls); continue;
- case '\\': case '\"': case '\'': break;
- case END_OF_STREAM: continue;
- default:
- if (!lj_char_isdigit(c))
- goto err_xesc;
- c -= '0'; /* Decimal escape '\ddd'. */
- if (lj_char_isdigit(next(ls))) {
- c = c*10 + (ls->current - '0');
- if (lj_char_isdigit(next(ls))) {
- c = c*10 + (ls->current - '0');
- if (c > 255) {
- err_xesc:
- lj_lex_error(ls, TK_string, LJ_ERR_XESC);
- }
- next(ls);
- }
- }
- save(ls, c);
- continue;
- }
- save(ls, c);
- next(ls);
- continue;
- }
- default:
- save_and_next(ls);
- break;
- }
- }
- save_and_next(ls); /* skip delimiter */
- setstrV(ls->L, tv, lj_parse_keepstr(ls, ls->sb.buf + 1, ls->sb.n - 2));
-}
-
-/* -- Main lexical scanner ------------------------------------------------ */
-
-static int llex(LexState *ls, TValue *tv)
-{
- lj_str_resetbuf(&ls->sb);
- for (;;) {
- if (lj_char_isident(ls->current)) {
- GCstr *s;
- if (lj_char_isdigit(ls->current)) { /* Numeric literal. */
- lex_number(ls, tv);
- return TK_number;
- }
- /* Identifier or reserved word. */
- do {
- save_and_next(ls);
- } while (lj_char_isident(ls->current));
- s = lj_parse_keepstr(ls, ls->sb.buf, ls->sb.n);
- setstrV(ls->L, tv, s);
- if (s->reserved > 0) /* Reserved word? */
- return TK_OFS + s->reserved;
- return TK_name;
- }
- switch (ls->current) {
- case '\n':
- case '\r':
- inclinenumber(ls);
- continue;
- case ' ':
- case '\t':
- case '\v':
- case '\f':
- next(ls);
- continue;
- case '-':
- next(ls);
- if (ls->current != '-') return '-';
- /* else is a comment */
- next(ls);
- if (ls->current == '[') {
- int sep = skip_sep(ls);
- lj_str_resetbuf(&ls->sb); /* `skip_sep' may dirty the buffer */
- if (sep >= 0) {
- read_long_string(ls, NULL, sep); /* long comment */
- lj_str_resetbuf(&ls->sb);
- continue;
- }
- }
- /* else short comment */
- while (!currIsNewline(ls) && ls->current != END_OF_STREAM)
- next(ls);
- continue;
- case '[': {
- int sep = skip_sep(ls);
- if (sep >= 0) {
- read_long_string(ls, tv, sep);
- return TK_string;
- } else if (sep == -1) {
- return '[';
- } else {
- lj_lex_error(ls, TK_string, LJ_ERR_XLDELIM);
- continue;
- }
- }
- case '=':
- next(ls);
- if (ls->current != '=') return '='; else { next(ls); return TK_eq; }
- case '<':
- next(ls);
- if (ls->current != '=') return '<'; else { next(ls); return TK_le; }
- case '>':
- next(ls);
- if (ls->current != '=') return '>'; else { next(ls); return TK_ge; }
- case '~':
- next(ls);
- if (ls->current != '=') return '~'; else { next(ls); return TK_ne; }
- case ':':
- next(ls);
- if (ls->current != ':') return ':'; else { next(ls); return TK_label; }
- case '"':
- case '\'':
- read_string(ls, ls->current, tv);
- return TK_string;
- case '.':
- save_and_next(ls);
- if (ls->current == '.') {
- next(ls);
- if (ls->current == '.') {
- next(ls);
- return TK_dots; /* ... */
- }
- return TK_concat; /* .. */
- } else if (!lj_char_isdigit(ls->current)) {
- return '.';
- } else {
- lex_number(ls, tv);
- return TK_number;
- }
- case END_OF_STREAM:
- return TK_eof;
- default: {
- int c = ls->current;
- next(ls);
- return c; /* Single-char tokens (+ - / ...). */
- }
- }
- }
-}
-
-/* -- Lexer API ----------------------------------------------------------- */
-
-/* Setup lexer state. */
-int lj_lex_setup(lua_State *L, LexState *ls)
-{
- int header = 0;
- ls->L = L;
- ls->fs = NULL;
- ls->n = 0;
- ls->p = NULL;
- ls->vstack = NULL;
- ls->sizevstack = 0;
- ls->vtop = 0;
- ls->bcstack = NULL;
- ls->sizebcstack = 0;
- ls->token = 0;
- ls->lookahead = TK_eof; /* No look-ahead token. */
- ls->linenumber = 1;
- ls->lastline = 1;
- lj_str_resizebuf(ls->L, &ls->sb, LJ_MIN_SBUF);
- next(ls); /* Read-ahead first char. */
- if (ls->current == 0xef && ls->n >= 2 && char2int(ls->p[0]) == 0xbb &&
- char2int(ls->p[1]) == 0xbf) { /* Skip UTF-8 BOM (if buffered). */
- ls->n -= 2;
- ls->p += 2;
- next(ls);
- header = 1;
- }
- if (ls->current == '#') { /* Skip POSIX #! header line. */
- do {
- next(ls);
- if (ls->current == END_OF_STREAM) return 0;
- } while (!currIsNewline(ls));
- inclinenumber(ls);
- header = 1;
- }
- if (ls->current == LUA_SIGNATURE[0]) { /* Bytecode dump. */
- if (header) {
- /*
- ** Loading bytecode with an extra header is disabled for security
- ** reasons. This may circumvent the usual check for bytecode vs.
- ** Lua code by looking at the first char. Since this is a potential
- ** security violation no attempt is made to echo the chunkname either.
- */
- setstrV(L, L->top++, lj_err_str(L, LJ_ERR_BCBAD));
- lj_err_throw(L, LUA_ERRSYNTAX);
- }
- return 1;
- }
- return 0;
-}
-
-/* Cleanup lexer state. */
-void lj_lex_cleanup(lua_State *L, LexState *ls)
-{
- global_State *g = G(L);
- lj_mem_freevec(g, ls->bcstack, ls->sizebcstack, BCInsLine);
- lj_mem_freevec(g, ls->vstack, ls->sizevstack, VarInfo);
- lj_str_freebuf(g, &ls->sb);
-}
-
-void lj_lex_next(LexState *ls)
-{
- ls->lastline = ls->linenumber;
- if (LJ_LIKELY(ls->lookahead == TK_eof)) { /* No lookahead token? */
- ls->token = llex(ls, &ls->tokenval); /* Get next token. */
- } else { /* Otherwise return lookahead token. */
- ls->token = ls->lookahead;
- ls->lookahead = TK_eof;
- ls->tokenval = ls->lookaheadval;
- }
-}
-
-LexToken lj_lex_lookahead(LexState *ls)
-{
- lua_assert(ls->lookahead == TK_eof);
- ls->lookahead = llex(ls, &ls->lookaheadval);
- return ls->lookahead;
-}
-
-const char *lj_lex_token2str(LexState *ls, LexToken token)
-{
- if (token > TK_OFS)
- return tokennames[token-TK_OFS-1];
- else if (!lj_char_iscntrl(token))
- return lj_str_pushf(ls->L, "%c", token);
- else
- return lj_str_pushf(ls->L, "char(%d)", token);
-}
-
-void lj_lex_error(LexState *ls, LexToken token, ErrMsg em, ...)
-{
- const char *tok;
- va_list argp;
- if (token == 0) {
- tok = NULL;
- } else if (token == TK_name || token == TK_string || token == TK_number) {
- save(ls, '\0');
- tok = ls->sb.buf;
- } else {
- tok = lj_lex_token2str(ls, token);
- }
- va_start(argp, em);
- lj_err_lex(ls->L, ls->chunkname, tok, ls->linenumber, em, argp);
- va_end(argp);
-}
-
-void lj_lex_init(lua_State *L)
-{
- uint32_t i;
- for (i = 0; i < TK_RESERVED; i++) {
- GCstr *s = lj_str_newz(L, tokennames[i]);
- fixstring(s); /* Reserved words are never collected. */
- s->reserved = (uint8_t)(i+1);
- }
-}
-
diff --git a/source/libs/luajit/LuaJIT-2.0.4/src/lj_str.h b/source/libs/luajit/LuaJIT-2.0.4/src/lj_str.h
deleted file mode 100644
index 99697051d..000000000
--- a/source/libs/luajit/LuaJIT-2.0.4/src/lj_str.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-** String handling.
-** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
-*/
-
-#ifndef _LJ_STR_H
-#define _LJ_STR_H
-
-#include
-
-#include "lj_obj.h"
-
-/* String interning. */
-LJ_FUNC int32_t LJ_FASTCALL lj_str_cmp(GCstr *a, GCstr *b);
-LJ_FUNC void lj_str_resize(lua_State *L, MSize newmask);
-LJ_FUNCA GCstr *lj_str_new(lua_State *L, const char *str, size_t len);
-LJ_FUNC void LJ_FASTCALL lj_str_free(global_State *g, GCstr *s);
-
-#define lj_str_newz(L, s) (lj_str_new(L, s, strlen(s)))
-#define lj_str_newlit(L, s) (lj_str_new(L, "" s, sizeof(s)-1))
-
-/* Type conversions. */
-LJ_FUNC size_t LJ_FASTCALL lj_str_bufnum(char *s, cTValue *o);
-LJ_FUNC char * LJ_FASTCALL lj_str_bufint(char *p, int32_t k);
-LJ_FUNCA GCstr * LJ_FASTCALL lj_str_fromnum(lua_State *L, const lua_Number *np);
-LJ_FUNC GCstr * LJ_FASTCALL lj_str_fromint(lua_State *L, int32_t k);
-LJ_FUNCA GCstr * LJ_FASTCALL lj_str_fromnumber(lua_State *L, cTValue *o);
-
-#define LJ_STR_INTBUF (1+10)
-#define LJ_STR_NUMBUF LUAI_MAXNUMBER2STR
-
-/* String formatting. */
-LJ_FUNC const char *lj_str_pushvf(lua_State *L, const char *fmt, va_list argp);
-LJ_FUNC const char *lj_str_pushf(lua_State *L, const char *fmt, ...)
-#if defined(__GNUC__)
- __attribute__ ((format (printf, 2, 3)))
-#endif
- ;
-
-/* Resizable string buffers. Struct definition in lj_obj.h. */
-LJ_FUNC char *lj_str_needbuf(lua_State *L, SBuf *sb, MSize sz);
-
-#define lj_str_initbuf(sb) ((sb)->buf = NULL, (sb)->sz = 0)
-#define lj_str_resetbuf(sb) ((sb)->n = 0)
-#define lj_str_resizebuf(L, sb, size) \
- ((sb)->buf = (char *)lj_mem_realloc(L, (sb)->buf, (sb)->sz, (size)), \
- (sb)->sz = (size))
-#define lj_str_freebuf(g, sb) lj_mem_free(g, (void *)(sb)->buf, (sb)->sz)
-
-#endif
diff --git a/source/libs/luajit/LuaJIT-2.0.4/src/vm_ppcspe.dasc b/source/libs/luajit/LuaJIT-2.0.4/src/vm_ppcspe.dasc
deleted file mode 100644
index 53ea2d965..000000000
--- a/source/libs/luajit/LuaJIT-2.0.4/src/vm_ppcspe.dasc
+++ /dev/null
@@ -1,3691 +0,0 @@
-|// Low-level VM code for PowerPC/e500 CPUs.
-|// Bytecode interpreter, fast functions and helper functions.
-|// Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
-|
-|.arch ppc
-|.section code_op, code_sub
-|
-|.actionlist build_actionlist
-|.globals GLOB_
-|.globalnames globnames
-|.externnames extnames
-|
-|// Note: The ragged indentation of the instructions is intentional.
-|// The starting columns indicate data dependencies.
-|
-|//-----------------------------------------------------------------------
-|
-|// Fixed register assignments for the interpreter.
-|// Don't use: r1 = sp, r2 and r13 = reserved and/or small data area ptr
-|
-|// The following must be C callee-save (but BASE is often refetched).
-|.define BASE, r14 // Base of current Lua stack frame.
-|.define KBASE, r15 // Constants of current Lua function.
-|.define PC, r16 // Next PC.
-|.define DISPATCH, r17 // Opcode dispatch table.
-|.define LREG, r18 // Register holding lua_State (also in SAVE_L).
-|.define MULTRES, r19 // Size of multi-result: (nresults+1)*8.
-|
-|// Constants for vectorized type-comparisons (hi+low GPR). C callee-save.
-|.define TISNUM, r22
-|.define TISSTR, r23
-|.define TISTAB, r24
-|.define TISFUNC, r25
-|.define TISNIL, r26
-|.define TOBIT, r27
-|.define ZERO, TOBIT // Zero in lo word.
-|
-|// The following temporaries are not saved across C calls, except for RA.
-|.define RA, r20 // Callee-save.
-|.define RB, r10
-|.define RC, r11
-|.define RD, r12
-|.define INS, r7 // Overlaps CARG5.
-|
-|.define TMP0, r0
-|.define TMP1, r8
-|.define TMP2, r9
-|.define TMP3, r6 // Overlaps CARG4.
-|
-|// Saved temporaries.
-|.define SAVE0, r21
-|
-|// Calling conventions.
-|.define CARG1, r3
-|.define CARG2, r4
-|.define CARG3, r5
-|.define CARG4, r6 // Overlaps TMP3.
-|.define CARG5, r7 // Overlaps INS.
-|
-|.define CRET1, r3
-|.define CRET2, r4
-|
-|// Stack layout while in interpreter. Must match with lj_frame.h.
-|.define SAVE_LR, 188(sp)
-|.define CFRAME_SPACE, 184 // Delta for sp.
-|// Back chain for sp: 184(sp) <-- sp entering interpreter
-|.define SAVE_r31, 176(sp) // 64 bit register saves.
-|.define SAVE_r30, 168(sp)
-|.define SAVE_r29, 160(sp)
-|.define SAVE_r28, 152(sp)
-|.define SAVE_r27, 144(sp)
-|.define SAVE_r26, 136(sp)
-|.define SAVE_r25, 128(sp)
-|.define SAVE_r24, 120(sp)
-|.define SAVE_r23, 112(sp)
-|.define SAVE_r22, 104(sp)
-|.define SAVE_r21, 96(sp)
-|.define SAVE_r20, 88(sp)
-|.define SAVE_r19, 80(sp)
-|.define SAVE_r18, 72(sp)
-|.define SAVE_r17, 64(sp)
-|.define SAVE_r16, 56(sp)
-|.define SAVE_r15, 48(sp)
-|.define SAVE_r14, 40(sp)
-|.define SAVE_CR, 36(sp)
-|.define UNUSED1, 32(sp)
-|.define SAVE_ERRF, 28(sp) // 32 bit C frame info.
-|.define SAVE_NRES, 24(sp)
-|.define SAVE_CFRAME, 20(sp)
-|.define SAVE_L, 16(sp)
-|.define SAVE_PC, 12(sp)
-|.define SAVE_MULTRES, 8(sp)
-|// Next frame lr: 4(sp)
-|// Back chain for sp: 0(sp) <-- sp while in interpreter
-|
-|.macro save_, reg; evstdd reg, SAVE_..reg; .endmacro
-|.macro rest_, reg; evldd reg, SAVE_..reg; .endmacro
-|
-|.macro saveregs
-| stwu sp, -CFRAME_SPACE(sp)
-| save_ r14; save_ r15; save_ r16; save_ r17; save_ r18; save_ r19
-| mflr r0; mfcr r12
-| save_ r20; save_ r21; save_ r22; save_ r23; save_ r24; save_ r25
-| stw r0, SAVE_LR; stw r12, SAVE_CR
-| save_ r26; save_ r27; save_ r28; save_ r29; save_ r30; save_ r31
-|.endmacro
-|
-|.macro restoreregs
-| lwz r0, SAVE_LR; lwz r12, SAVE_CR
-| rest_ r14; rest_ r15; rest_ r16; rest_ r17; rest_ r18; rest_ r19
-| mtlr r0; mtcrf 0x38, r12
-| rest_ r20; rest_ r21; rest_ r22; rest_ r23; rest_ r24; rest_ r25
-| rest_ r26; rest_ r27; rest_ r28; rest_ r29; rest_ r30; rest_ r31
-| addi sp, sp, CFRAME_SPACE
-|.endmacro
-|
-|// Type definitions. Some of these are only used for documentation.
-|.type L, lua_State, LREG
-|.type GL, global_State
-|.type TVALUE, TValue
-|.type GCOBJ, GCobj
-|.type STR, GCstr
-|.type TAB, GCtab
-|.type LFUNC, GCfuncL
-|.type CFUNC, GCfuncC
-|.type PROTO, GCproto
-|.type UPVAL, GCupval
-|.type NODE, Node
-|.type NARGS8, int
-|.type TRACE, GCtrace
-|
-|//-----------------------------------------------------------------------
-|
-|// These basic macros should really be part of DynASM.
-|.macro srwi, rx, ry, n; rlwinm rx, ry, 32-n, n, 31; .endmacro
-|.macro slwi, rx, ry, n; rlwinm rx, ry, n, 0, 31-n; .endmacro
-|.macro rotlwi, rx, ry, n; rlwinm rx, ry, n, 0, 31; .endmacro
-|.macro rotlw, rx, ry, rn; rlwnm rx, ry, rn, 0, 31; .endmacro
-|.macro subi, rx, ry, i; addi rx, ry, -i; .endmacro
-|
-|// Trap for not-yet-implemented parts.
-|.macro NYI; tw 4, sp, sp; .endmacro
-|
-|//-----------------------------------------------------------------------
-|
-|// Access to frame relative to BASE.
-|.define FRAME_PC, -8
-|.define FRAME_FUNC, -4
-|
-|// Instruction decode.
-|.macro decode_OP4, dst, ins; rlwinm dst, ins, 2, 22, 29; .endmacro
-|.macro decode_RA8, dst, ins; rlwinm dst, ins, 27, 21, 28; .endmacro
-|.macro decode_RB8, dst, ins; rlwinm dst, ins, 11, 21, 28; .endmacro
-|.macro decode_RC8, dst, ins; rlwinm dst, ins, 19, 21, 28; .endmacro
-|.macro decode_RD8, dst, ins; rlwinm dst, ins, 19, 13, 28; .endmacro
-|
-|.macro decode_OP1, dst, ins; rlwinm dst, ins, 0, 24, 31; .endmacro
-|.macro decode_RD4, dst, ins; rlwinm dst, ins, 18, 14, 29; .endmacro
-|
-|// Instruction fetch.
-|.macro ins_NEXT1
-| lwz INS, 0(PC)
-| addi PC, PC, 4
-|.endmacro
-|// Instruction decode+dispatch.
-|.macro ins_NEXT2
-| decode_OP4 TMP1, INS
-| decode_RB8 RB, INS
-| decode_RD8 RD, INS
-| lwzx TMP0, DISPATCH, TMP1
-| decode_RA8 RA, INS
-| decode_RC8 RC, INS
-| mtctr TMP0
-| bctr
-|.endmacro
-|.macro ins_NEXT
-| ins_NEXT1
-| ins_NEXT2
-|.endmacro
-|
-|// Instruction footer.
-|.if 1
-| // Replicated dispatch. Less unpredictable branches, but higher I-Cache use.
-| .define ins_next, ins_NEXT
-| .define ins_next_, ins_NEXT
-| .define ins_next1, ins_NEXT1
-| .define ins_next2, ins_NEXT2
-|.else
-| // Common dispatch. Lower I-Cache use, only one (very) unpredictable branch.
-| // Affects only certain kinds of benchmarks (and only with -j off).
-| .macro ins_next
-| b ->ins_next
-| .endmacro
-| .macro ins_next1
-| .endmacro
-| .macro ins_next2
-| b ->ins_next
-| .endmacro
-| .macro ins_next_
-| ->ins_next:
-| ins_NEXT
-| .endmacro
-|.endif
-|
-|// Call decode and dispatch.
-|.macro ins_callt
-| // BASE = new base, RB = LFUNC/CFUNC, RC = nargs*8, FRAME_PC(BASE) = PC
-| lwz PC, LFUNC:RB->pc
-| lwz INS, 0(PC)
-| addi PC, PC, 4
-| decode_OP4 TMP1, INS
-| decode_RA8 RA, INS
-| lwzx TMP0, DISPATCH, TMP1
-| add RA, RA, BASE
-| mtctr TMP0
-| bctr
-|.endmacro
-|
-|.macro ins_call
-| // BASE = new base, RB = LFUNC/CFUNC, RC = nargs*8, PC = caller PC
-| stw PC, FRAME_PC(BASE)
-| ins_callt
-|.endmacro
-|
-|//-----------------------------------------------------------------------
-|
-|// Macros to test operand types.
-|.macro checknum, reg; evcmpltu reg, TISNUM; .endmacro
-|.macro checkstr, reg; evcmpeq reg, TISSTR; .endmacro
-|.macro checktab, reg; evcmpeq reg, TISTAB; .endmacro
-|.macro checkfunc, reg; evcmpeq reg, TISFUNC; .endmacro
-|.macro checknil, reg; evcmpeq reg, TISNIL; .endmacro
-|.macro checkok, label; blt label; .endmacro
-|.macro checkfail, label; bge label; .endmacro
-|.macro checkanyfail, label; bns label; .endmacro
-|.macro checkallok, label; bso label; .endmacro
-|
-|.macro branch_RD
-| srwi TMP0, RD, 1
-| add PC, PC, TMP0
-| addis PC, PC, -(BCBIAS_J*4 >> 16)
-|.endmacro
-|
-|// Assumes DISPATCH is relative to GL.
-#define DISPATCH_GL(field) (GG_DISP2G + (int)offsetof(global_State, field))
-#define DISPATCH_J(field) (GG_DISP2J + (int)offsetof(jit_State, field))
-|
-#define PC2PROTO(field) ((int)offsetof(GCproto, field)-(int)sizeof(GCproto))
-|
-|.macro hotloop
-| NYI
-|.endmacro
-|
-|.macro hotcall
-| NYI
-|.endmacro
-|
-|// Set current VM state. Uses TMP0.
-|.macro li_vmstate, st; li TMP0, ~LJ_VMST_..st; .endmacro
-|.macro st_vmstate; stw TMP0, DISPATCH_GL(vmstate)(DISPATCH); .endmacro
-|
-|// Move table write barrier back. Overwrites mark and tmp.
-|.macro barrierback, tab, mark, tmp
-| lwz tmp, DISPATCH_GL(gc.grayagain)(DISPATCH)
-| // Assumes LJ_GC_BLACK is 0x04.
-| rlwinm mark, mark, 0, 30, 28 // black2gray(tab)
-| stw tab, DISPATCH_GL(gc.grayagain)(DISPATCH)
-| stb mark, tab->marked
-| stw tmp, tab->gclist
-|.endmacro
-|
-|//-----------------------------------------------------------------------
-
-/* Generate subroutines used by opcodes and other parts of the VM. */
-/* The .code_sub section should be last to help static branch prediction. */
-static void build_subroutines(BuildCtx *ctx)
-{
- |.code_sub
- |
- |//-----------------------------------------------------------------------
- |//-- Return handling ----------------------------------------------------
- |//-----------------------------------------------------------------------
- |
- |->vm_returnp:
- | // See vm_return. Also: TMP2 = previous base.
- | andi. TMP0, PC, FRAME_P
- | evsplati TMP1, LJ_TTRUE
- | beq ->cont_dispatch
- |
- | // Return from pcall or xpcall fast func.
- | lwz PC, FRAME_PC(TMP2) // Fetch PC of previous frame.
- | mr BASE, TMP2 // Restore caller base.
- | // Prepending may overwrite the pcall frame, so do it at the end.
- | stwu TMP1, FRAME_PC(RA) // Prepend true to results.
- |
- |->vm_returnc:
- | addi RD, RD, 8 // RD = (nresults+1)*8.
- | andi. TMP0, PC, FRAME_TYPE
- | cmpwi cr1, RD, 0
- | li CRET1, LUA_YIELD
- | beq cr1, ->vm_unwind_c_eh
- | mr MULTRES, RD
- | beq ->BC_RET_Z // Handle regular return to Lua.
- |
- |->vm_return:
- | // BASE = base, RA = resultptr, RD/MULTRES = (nresults+1)*8, PC = return
- | // TMP0 = PC & FRAME_TYPE
- | cmpwi TMP0, FRAME_C
- | rlwinm TMP2, PC, 0, 0, 28
- | li_vmstate C
- | sub TMP2, BASE, TMP2 // TMP2 = previous base.
- | bne ->vm_returnp
- |
- | addic. TMP1, RD, -8
- | stw TMP2, L->base
- | lwz TMP2, SAVE_NRES
- | subi BASE, BASE, 8
- | st_vmstate
- | slwi TMP2, TMP2, 3
- | beq >2
- |1:
- | addic. TMP1, TMP1, -8
- | evldd TMP0, 0(RA)
- | addi RA, RA, 8
- | evstdd TMP0, 0(BASE)
- | addi BASE, BASE, 8
- | bne <1
- |
- |2:
- | cmpw TMP2, RD // More/less results wanted?
- | bne >6
- |3:
- | stw BASE, L->top // Store new top.
- |
- |->vm_leave_cp:
- | lwz TMP0, SAVE_CFRAME // Restore previous C frame.
- | li CRET1, 0 // Ok return status for vm_pcall.
- | stw TMP0, L->cframe
- |
- |->vm_leave_unw:
- | restoreregs
- | blr
- |
- |6:
- | ble >7 // Less results wanted?
- | // More results wanted. Check stack size and fill up results with nil.
- | lwz TMP1, L->maxstack
- | cmplw BASE, TMP1
- | bge >8
- | evstdd TISNIL, 0(BASE)
- | addi RD, RD, 8
- | addi BASE, BASE, 8
- | b <2
- |
- |7: // Less results wanted.
- | sub TMP0, RD, TMP2
- | cmpwi TMP2, 0 // LUA_MULTRET+1 case?
- | sub TMP0, BASE, TMP0 // Subtract the difference.
- | iseleq BASE, BASE, TMP0 // Either keep top or shrink it.
- | b <3
- |
- |8: // Corner case: need to grow stack for filling up results.
- | // This can happen if:
- | // - A C function grows the stack (a lot).
- | // - The GC shrinks the stack in between.
- | // - A return back from a lua_call() with (high) nresults adjustment.
- | stw BASE, L->top // Save current top held in BASE (yes).
- | mr SAVE0, RD
- | mr CARG2, TMP2
- | mr CARG1, L
- | bl extern lj_state_growstack // (lua_State *L, int n)
- | lwz TMP2, SAVE_NRES
- | mr RD, SAVE0
- | slwi TMP2, TMP2, 3
- | lwz BASE, L->top // Need the (realloced) L->top in BASE.
- | b <2
- |
- |->vm_unwind_c: // Unwind C stack, return from vm_pcall.
- | // (void *cframe, int errcode)
- | mr sp, CARG1
- | mr CRET1, CARG2
- |->vm_unwind_c_eh: // Landing pad for external unwinder.
- | lwz L, SAVE_L
- | li TMP0, ~LJ_VMST_C
- | lwz GL:TMP1, L->glref
- | stw TMP0, GL:TMP1->vmstate
- | b ->vm_leave_unw
- |
- |->vm_unwind_ff: // Unwind C stack, return from ff pcall.
- | // (void *cframe)
- | rlwinm sp, CARG1, 0, 0, 29
- |->vm_unwind_ff_eh: // Landing pad for external unwinder.
- | lwz L, SAVE_L
- | evsplati TISNUM, LJ_TISNUM+1 // Setup type comparison constants.
- | evsplati TISFUNC, LJ_TFUNC
- | lus TOBIT, 0x4338
- | evsplati TISTAB, LJ_TTAB
- | li TMP0, 0
- | lwz BASE, L->base
- | evmergelo TOBIT, TOBIT, TMP0
- | lwz DISPATCH, L->glref // Setup pointer to dispatch table.
- | evsplati TISSTR, LJ_TSTR
- | li TMP1, LJ_TFALSE
- | evsplati TISNIL, LJ_TNIL
- | li_vmstate INTERP
- | lwz PC, FRAME_PC(BASE) // Fetch PC of previous frame.
- | la RA, -8(BASE) // Results start at BASE-8.
- | addi DISPATCH, DISPATCH, GG_G2DISP
- | stw TMP1, 0(RA) // Prepend false to error message.
- | li RD, 16 // 2 results: false + error message.
- | st_vmstate
- | b ->vm_returnc
- |
- |//-----------------------------------------------------------------------
- |//-- Grow stack for calls -----------------------------------------------
- |//-----------------------------------------------------------------------
- |
- |->vm_growstack_c: // Grow stack for C function.
- | li CARG2, LUA_MINSTACK
- | b >2
- |
- |->vm_growstack_l: // Grow stack for Lua function.
- | // BASE = new base, RA = BASE+framesize*8, RC = nargs*8, PC = first PC
- | add RC, BASE, RC
- | sub RA, RA, BASE
- | stw BASE, L->base
- | addi PC, PC, 4 // Must point after first instruction.
- | stw RC, L->top
- | srwi CARG2, RA, 3
- |2:
- | // L->base = new base, L->top = top
- | stw PC, SAVE_PC
- | mr CARG1, L
- | bl extern lj_state_growstack // (lua_State *L, int n)
- | lwz BASE, L->base
- | lwz RC, L->top
- | lwz LFUNC:RB, FRAME_FUNC(BASE)
- | sub RC, RC, BASE
- | // BASE = new base, RB = LFUNC/CFUNC, RC = nargs*8, FRAME_PC(BASE) = PC
- | ins_callt // Just retry the call.
- |
- |//-----------------------------------------------------------------------
- |//-- Entry points into the assembler VM ---------------------------------
- |//-----------------------------------------------------------------------
- |
- |->vm_resume: // Setup C frame and resume thread.
- | // (lua_State *L, TValue *base, int nres1 = 0, ptrdiff_t ef = 0)
- | saveregs
- | mr L, CARG1
- | lwz DISPATCH, L->glref // Setup pointer to dispatch table.
- | mr BASE, CARG2
- | lbz TMP1, L->status
- | stw L, SAVE_L
- | li PC, FRAME_CP
- | addi TMP0, sp, CFRAME_RESUME
- | addi DISPATCH, DISPATCH, GG_G2DISP
- | stw CARG3, SAVE_NRES
- | cmplwi TMP1, 0
- | stw CARG3, SAVE_ERRF
- | stw TMP0, L->cframe
- | stw CARG3, SAVE_CFRAME
- | stw CARG1, SAVE_PC // Any value outside of bytecode is ok.
- | beq >3
- |
- | // Resume after yield (like a return).
- | mr RA, BASE
- | lwz BASE, L->base
- | evsplati TISNUM, LJ_TISNUM+1 // Setup type comparison constants.
- | lwz TMP1, L->top
- | evsplati TISFUNC, LJ_TFUNC
- | lus TOBIT, 0x4338
- | evsplati TISTAB, LJ_TTAB
- | lwz PC, FRAME_PC(BASE)
- | li TMP2, 0
- | evsplati TISSTR, LJ_TSTR
- | sub RD, TMP1, BASE
- | evmergelo TOBIT, TOBIT, TMP2
- | stb CARG3, L->status
- | andi. TMP0, PC, FRAME_TYPE
- | li_vmstate INTERP
- | addi RD, RD, 8
- | evsplati TISNIL, LJ_TNIL
- | mr MULTRES, RD
- | st_vmstate
- | beq ->BC_RET_Z
- | b ->vm_return
- |
- |->vm_pcall: // Setup protected C frame and enter VM.
- | // (lua_State *L, TValue *base, int nres1, ptrdiff_t ef)
- | saveregs
- | li PC, FRAME_CP
- | stw CARG4, SAVE_ERRF
- | b >1
- |
- |->vm_call: // Setup C frame and enter VM.
- | // (lua_State *L, TValue *base, int nres1)
- | saveregs
- | li PC, FRAME_C
- |
- |1: // Entry point for vm_pcall above (PC = ftype).
- | lwz TMP1, L:CARG1->cframe
- | stw CARG3, SAVE_NRES
- | mr L, CARG1
- | stw CARG1, SAVE_L
- | mr BASE, CARG2
- | stw sp, L->cframe // Add our C frame to cframe chain.
- | lwz DISPATCH, L->glref // Setup pointer to dispatch table.
- | stw CARG1, SAVE_PC // Any value outside of bytecode is ok.
- | stw TMP1, SAVE_CFRAME
- | addi DISPATCH, DISPATCH, GG_G2DISP
- |
- |3: // Entry point for vm_cpcall/vm_resume (BASE = base, PC = ftype).
- | lwz TMP2, L->base // TMP2 = old base (used in vmeta_call).
- | evsplati TISNUM, LJ_TISNUM+1 // Setup type comparison constants.
- | lwz TMP1, L->top
- | evsplati TISFUNC, LJ_TFUNC
- | add PC, PC, BASE
- | evsplati TISTAB, LJ_TTAB
- | lus TOBIT, 0x4338
- | li TMP0, 0
- | sub PC, PC, TMP2 // PC = frame delta + frame type
- | evsplati TISSTR, LJ_TSTR
- | sub NARGS8:RC, TMP1, BASE
- | evmergelo TOBIT, TOBIT, TMP0
- | li_vmstate INTERP
- | evsplati TISNIL, LJ_TNIL
- | st_vmstate
- |
- |->vm_call_dispatch:
- | // TMP2 = old base, BASE = new base, RC = nargs*8, PC = caller PC
- | li TMP0, -8
- | evlddx LFUNC:RB, BASE, TMP0
- | checkfunc LFUNC:RB
- | checkfail ->vmeta_call
- |
- |->vm_call_dispatch_f:
- | ins_call
- | // BASE = new base, RB = func, RC = nargs*8, PC = caller PC
- |
- |->vm_cpcall: // Setup protected C frame, call C.
- | // (lua_State *L, lua_CFunction func, void *ud, lua_CPFunction cp)
- | saveregs
- | mr L, CARG1
- | lwz TMP0, L:CARG1->stack
- | stw CARG1, SAVE_L
- | lwz TMP1, L->top
- | stw CARG1, SAVE_PC // Any value outside of bytecode is ok.
- | sub TMP0, TMP0, TMP1 // Compute -savestack(L, L->top).
- | lwz TMP1, L->cframe
- | stw sp, L->cframe // Add our C frame to cframe chain.
- | li TMP2, 0
- | stw TMP0, SAVE_NRES // Neg. delta means cframe w/o frame.
- | stw TMP2, SAVE_ERRF // No error function.
- | stw TMP1, SAVE_CFRAME
- | mtctr CARG4
- | bctrl // (lua_State *L, lua_CFunction func, void *ud)
- | mr. BASE, CRET1
- | lwz DISPATCH, L->glref // Setup pointer to dispatch table.
- | li PC, FRAME_CP
- | addi DISPATCH, DISPATCH, GG_G2DISP
- | bne <3 // Else continue with the call.
- | b ->vm_leave_cp // No base? Just remove C frame.
- |
- |//-----------------------------------------------------------------------
- |//-- Metamethod handling ------------------------------------------------
- |//-----------------------------------------------------------------------
- |
- |// The lj_meta_* functions (except for lj_meta_cat) don't reallocate the
- |// stack, so BASE doesn't need to be reloaded across these calls.
- |
- |//-- Continuation dispatch ----------------------------------------------
- |
- |->cont_dispatch:
- | // BASE = meta base, RA = resultptr, RD = (nresults+1)*8
- | lwz TMP0, -12(BASE) // Continuation.
- | mr RB, BASE
- | mr BASE, TMP2 // Restore caller BASE.
- | lwz LFUNC:TMP1, FRAME_FUNC(TMP2)
- | cmplwi TMP0, 0
- | lwz PC, -16(RB) // Restore PC from [cont|PC].
- | beq >1
- | subi TMP2, RD, 8
- | lwz TMP1, LFUNC:TMP1->pc
- | evstddx TISNIL, RA, TMP2 // Ensure one valid arg.
- | lwz KBASE, PC2PROTO(k)(TMP1)
- | // BASE = base, RA = resultptr, RB = meta base
- | mtctr TMP0
- | bctr // Jump to continuation.
- |
- |1: // Tail call from C function.
- | subi TMP1, RB, 16
- | sub RC, TMP1, BASE
- | b ->vm_call_tail
- |
- |->cont_cat: // RA = resultptr, RB = meta base
- | lwz INS, -4(PC)
- | subi CARG2, RB, 16
- | decode_RB8 SAVE0, INS
- | evldd TMP0, 0(RA)
- | add TMP1, BASE, SAVE0
- | stw BASE, L->base
- | cmplw TMP1, CARG2
- | sub CARG3, CARG2, TMP1
- | decode_RA8 RA, INS
- | evstdd TMP0, 0(CARG2)
- | bne ->BC_CAT_Z
- | evstddx TMP0, BASE, RA
- | b ->cont_nop
- |
- |//-- Table indexing metamethods -----------------------------------------
- |
- |->vmeta_tgets1:
- | evmergelo STR:RC, TISSTR, STR:RC
- | la CARG3, DISPATCH_GL(tmptv)(DISPATCH)
- | decode_RB8 RB, INS
- | evstdd STR:RC, 0(CARG3)
- | add CARG2, BASE, RB
- | b >1
- |
- |->vmeta_tgets:
- | evmergelo TAB:RB, TISTAB, TAB:RB
- | la CARG2, DISPATCH_GL(tmptv)(DISPATCH)
- | evmergelo STR:RC, TISSTR, STR:RC
- | evstdd TAB:RB, 0(CARG2)
- | la CARG3, DISPATCH_GL(tmptv2)(DISPATCH)
- | evstdd STR:RC, 0(CARG3)
- | b >1
- |
- |->vmeta_tgetb: // TMP0 = index
- | efdcfsi TMP0, TMP0
- | decode_RB8 RB, INS
- | la CARG3, DISPATCH_GL(tmptv)(DISPATCH)
- | add CARG2, BASE, RB
- | evstdd TMP0, 0(CARG3)
- | b >1
- |
- |->vmeta_tgetv:
- | decode_RB8 RB, INS
- | decode_RC8 RC, INS
- | add CARG2, BASE, RB
- | add CARG3, BASE, RC
- |1:
- | stw BASE, L->base
- | mr CARG1, L
- | stw PC, SAVE_PC
- | bl extern lj_meta_tget // (lua_State *L, TValue *o, TValue *k)
- | // Returns TValue * (finished) or NULL (metamethod).
- | cmplwi CRET1, 0
- | beq >3
- | evldd TMP0, 0(CRET1)
- | evstddx TMP0, BASE, RA
- | ins_next
- |
- |3: // Call __index metamethod.
- | // BASE = base, L->top = new base, stack = cont/func/t/k
- | subfic TMP1, BASE, FRAME_CONT
- | lwz BASE, L->top
- | stw PC, -16(BASE) // [cont|PC]
- | add PC, TMP1, BASE
- | lwz LFUNC:RB, FRAME_FUNC(BASE) // Guaranteed to be a function here.
- | li NARGS8:RC, 16 // 2 args for func(t, k).
- | b ->vm_call_dispatch_f
- |
- |//-----------------------------------------------------------------------
- |
- |->vmeta_tsets1:
- | evmergelo STR:RC, TISSTR, STR:RC
- | la CARG3, DISPATCH_GL(tmptv)(DISPATCH)
- | decode_RB8 RB, INS
- | evstdd STR:RC, 0(CARG3)
- | add CARG2, BASE, RB
- | b >1
- |
- |->vmeta_tsets:
- | evmergelo TAB:RB, TISTAB, TAB:RB
- | la CARG2, DISPATCH_GL(tmptv)(DISPATCH)
- | evmergelo STR:RC, TISSTR, STR:RC
- | evstdd TAB:RB, 0(CARG2)
- | la CARG3, DISPATCH_GL(tmptv2)(DISPATCH)
- | evstdd STR:RC, 0(CARG3)
- | b >1
- |
- |->vmeta_tsetb: // TMP0 = index
- | efdcfsi TMP0, TMP0
- | decode_RB8 RB, INS
- | la CARG3, DISPATCH_GL(tmptv)(DISPATCH)
- | add CARG2, BASE, RB
- | evstdd TMP0, 0(CARG3)
- | b >1
- |
- |->vmeta_tsetv:
- | decode_RB8 RB, INS
- | decode_RC8 RC, INS
- | add CARG2, BASE, RB
- | add CARG3, BASE, RC
- |1:
- | stw BASE, L->base
- | mr CARG1, L
- | stw PC, SAVE_PC
- | bl extern lj_meta_tset // (lua_State *L, TValue *o, TValue *k)
- | // Returns TValue * (finished) or NULL (metamethod).
- | cmplwi CRET1, 0
- | evlddx TMP0, BASE, RA
- | beq >3
- | // NOBARRIER: lj_meta_tset ensures the table is not black.
- | evstdd TMP0, 0(CRET1)
- | ins_next
- |
- |3: // Call __newindex metamethod.
- | // BASE = base, L->top = new base, stack = cont/func/t/k/(v)
- | subfic TMP1, BASE, FRAME_CONT
- | lwz BASE, L->top
- | stw PC, -16(BASE) // [cont|PC]
- | add PC, TMP1, BASE
- | lwz LFUNC:RB, FRAME_FUNC(BASE) // Guaranteed to be a function here.
- | li NARGS8:RC, 24 // 3 args for func(t, k, v)
- | evstdd TMP0, 16(BASE) // Copy value to third argument.
- | b ->vm_call_dispatch_f
- |
- |//-- Comparison metamethods ---------------------------------------------
- |
- |->vmeta_comp:
- | mr CARG1, L
- | subi PC, PC, 4
- | add CARG2, BASE, RA
- | stw PC, SAVE_PC
- | add CARG3, BASE, RD
- | stw BASE, L->base
- | decode_OP1 CARG4, INS
- | bl extern lj_meta_comp // (lua_State *L, TValue *o1, *o2, int op)
- | // Returns 0/1 or TValue * (metamethod).
- |3:
- | cmplwi CRET1, 1
- | bgt ->vmeta_binop
- |4:
- | lwz INS, 0(PC)
- | addi PC, PC, 4
- | decode_RD4 TMP2, INS
- | addis TMP3, PC, -(BCBIAS_J*4 >> 16)
- | add TMP2, TMP2, TMP3
- | isellt PC, PC, TMP2
- |->cont_nop:
- | ins_next
- |
- |->cont_ra: // RA = resultptr
- | lwz INS, -4(PC)
- | evldd TMP0, 0(RA)
- | decode_RA8 TMP1, INS
- | evstddx TMP0, BASE, TMP1
- | b ->cont_nop
- |
- |->cont_condt: // RA = resultptr
- | lwz TMP0, 0(RA)
- | li TMP1, LJ_TTRUE
- | cmplw TMP1, TMP0 // Branch if result is true.
- | b <4
- |
- |->cont_condf: // RA = resultptr
- | lwz TMP0, 0(RA)
- | li TMP1, LJ_TFALSE
- | cmplw TMP0, TMP1 // Branch if result is false.
- | b <4
- |
- |->vmeta_equal:
- | // CARG2, CARG3, CARG4 are already set by BC_ISEQV/BC_ISNEV.
- | subi PC, PC, 4
- | stw BASE, L->base
- | mr CARG1, L
- | stw PC, SAVE_PC
- | bl extern lj_meta_equal // (lua_State *L, GCobj *o1, *o2, int ne)
- | // Returns 0/1 or TValue * (metamethod).
- | b <3
- |
- |//-- Arithmetic metamethods ---------------------------------------------
- |
- |->vmeta_arith_vn:
- | add CARG3, BASE, RB
- | add CARG4, KBASE, RC
- | b >1
- |
- |->vmeta_arith_nv:
- | add CARG3, KBASE, RC
- | add CARG4, BASE, RB
- | b >1
- |
- |->vmeta_unm:
- | add CARG3, BASE, RD
- | mr CARG4, CARG3
- | b >1
- |
- |->vmeta_arith_vv:
- | add CARG3, BASE, RB
- | add CARG4, BASE, RC
- |1:
- | add CARG2, BASE, RA
- | stw BASE, L->base
- | mr CARG1, L
- | stw PC, SAVE_PC
- | decode_OP1 CARG5, INS // Caveat: CARG5 overlaps INS.
- | bl extern lj_meta_arith // (lua_State *L, TValue *ra,*rb,*rc, BCReg op)
- | // Returns NULL (finished) or TValue * (metamethod).
- | cmplwi CRET1, 0
- | beq ->cont_nop
- |
- | // Call metamethod for binary op.
- |->vmeta_binop:
- | // BASE = old base, CRET1 = new base, stack = cont/func/o1/o2
- | sub TMP1, CRET1, BASE
- | stw PC, -16(CRET1) // [cont|PC]
- | mr TMP2, BASE
- | addi PC, TMP1, FRAME_CONT
- | mr BASE, CRET1
- | li NARGS8:RC, 16 // 2 args for func(o1, o2).
- | b ->vm_call_dispatch
- |
- |->vmeta_len:
-#if LJ_52
- | mr SAVE0, CARG1
-#endif
- | add CARG2, BASE, RD
- | stw BASE, L->base
- | mr CARG1, L
- | stw PC, SAVE_PC
- | bl extern lj_meta_len // (lua_State *L, TValue *o)
- | // Returns NULL (retry) or TValue * (metamethod base).
-#if LJ_52
- | cmplwi CRET1, 0
- | bne ->vmeta_binop // Binop call for compatibility.
- | mr CARG1, SAVE0
- | b ->BC_LEN_Z
-#else
- | b ->vmeta_binop // Binop call for compatibility.
-#endif
- |
- |//-- Call metamethod ----------------------------------------------------
- |
- |->vmeta_call: // Resolve and call __call metamethod.
- | // TMP2 = old base, BASE = new base, RC = nargs*8
- | mr CARG1, L
- | stw TMP2, L->base // This is the callers base!
- | subi CARG2, BASE, 8
- | stw PC, SAVE_PC
- | add CARG3, BASE, RC
- | mr SAVE0, NARGS8:RC
- | bl extern lj_meta_call // (lua_State *L, TValue *func, TValue *top)
- | lwz LFUNC:RB, FRAME_FUNC(BASE) // Guaranteed to be a function here.
- | addi NARGS8:RC, SAVE0, 8 // Got one more argument now.
- | ins_call
- |
- |->vmeta_callt: // Resolve __call for BC_CALLT.
- | // BASE = old base, RA = new base, RC = nargs*8
- | mr CARG1, L
- | stw BASE, L->base
- | subi CARG2, RA, 8
- | stw PC, SAVE_PC
- | add CARG3, RA, RC
- | mr SAVE0, NARGS8:RC
- | bl extern lj_meta_call // (lua_State *L, TValue *func, TValue *top)
- | lwz TMP1, FRAME_PC(BASE)
- | addi NARGS8:RC, SAVE0, 8 // Got one more argument now.
- | lwz LFUNC:RB, FRAME_FUNC(RA) // Guaranteed to be a function here.
- | b ->BC_CALLT_Z
- |
- |//-- Argument coercion for 'for' statement ------------------------------
- |
- |->vmeta_for:
- | mr CARG1, L
- | stw BASE, L->base
- | mr CARG2, RA
- | stw PC, SAVE_PC
- | mr SAVE0, INS
- | bl extern lj_meta_for // (lua_State *L, TValue *base)
- |.if JIT
- | decode_OP1 TMP0, SAVE0
- |.endif
- | decode_RA8 RA, SAVE0
- |.if JIT
- | cmpwi TMP0, BC_JFORI
- |.endif
- | decode_RD8 RD, SAVE0
- |.if JIT
- | beq =>BC_JFORI
- |.endif
- | b =>BC_FORI
- |
- |//-----------------------------------------------------------------------
- |//-- Fast functions -----------------------------------------------------
- |//-----------------------------------------------------------------------
- |
- |.macro .ffunc, name
- |->ff_ .. name:
- |.endmacro
- |
- |.macro .ffunc_1, name
- |->ff_ .. name:
- | cmplwi NARGS8:RC, 8
- | evldd CARG1, 0(BASE)
- | blt ->fff_fallback
- |.endmacro
- |
- |.macro .ffunc_2, name
- |->ff_ .. name:
- | cmplwi NARGS8:RC, 16
- | evldd CARG1, 0(BASE)
- | evldd CARG2, 8(BASE)
- | blt ->fff_fallback
- |.endmacro
- |
- |.macro .ffunc_n, name
- | .ffunc_1 name
- | checknum CARG1
- | checkfail ->fff_fallback
- |.endmacro
- |
- |.macro .ffunc_nn, name
- | .ffunc_2 name
- | evmergehi TMP0, CARG1, CARG2
- | checknum TMP0
- | checkanyfail ->fff_fallback
- |.endmacro
- |
- |// Inlined GC threshold check. Caveat: uses TMP0 and TMP1.
- |.macro ffgccheck
- | lwz TMP0, DISPATCH_GL(gc.total)(DISPATCH)
- | lwz TMP1, DISPATCH_GL(gc.threshold)(DISPATCH)
- | cmplw TMP0, TMP1
- | bgel ->fff_gcstep
- |.endmacro
- |
- |//-- Base library: checks -----------------------------------------------
- |
- |.ffunc assert
- | cmplwi NARGS8:RC, 8
- | evldd TMP0, 0(BASE)
- | blt ->fff_fallback
- | evaddw TMP1, TISNIL, TISNIL // Synthesize LJ_TFALSE.
- | la RA, -8(BASE)
- | evcmpltu cr1, TMP0, TMP1
- | lwz PC, FRAME_PC(BASE)
- | bge cr1, ->fff_fallback
- | evstdd TMP0, 0(RA)
- | addi RD, NARGS8:RC, 8 // Compute (nresults+1)*8.
- | beq ->fff_res // Done if exactly 1 argument.
- | li TMP1, 8
- | subi RC, RC, 8
- |1:
- | cmplw TMP1, RC
- | evlddx TMP0, BASE, TMP1
- | evstddx TMP0, RA, TMP1
- | addi TMP1, TMP1, 8
- | bne <1
- | b ->fff_res
- |
- |.ffunc type
- | cmplwi NARGS8:RC, 8
- | lwz CARG1, 0(BASE)
- | blt ->fff_fallback
- | li TMP2, ~LJ_TNUMX
- | cmplw CARG1, TISNUM
- | not TMP1, CARG1
- | isellt TMP1, TMP2, TMP1
- | slwi TMP1, TMP1, 3
- | la TMP2, CFUNC:RB->upvalue
- | evlddx STR:CRET1, TMP2, TMP1
- | b ->fff_restv
- |
- |//-- Base library: getters and setters ---------------------------------
- |
- |.ffunc_1 getmetatable
- | checktab CARG1
- | evmergehi TMP1, CARG1, CARG1
- | checkfail >6
- |1: // Field metatable must be at same offset for GCtab and GCudata!
- | lwz TAB:RB, TAB:CARG1->metatable
- |2:
- | evmr CRET1, TISNIL
- | cmplwi TAB:RB, 0
- | lwz STR:RC, DISPATCH_GL(gcroot[GCROOT_MMNAME+MM_metatable])(DISPATCH)
- | beq ->fff_restv
- | lwz TMP0, TAB:RB->hmask
- | evmergelo CRET1, TISTAB, TAB:RB // Use metatable as default result.
- | lwz TMP1, STR:RC->hash
- | lwz NODE:TMP2, TAB:RB->node
- | evmergelo STR:RC, TISSTR, STR:RC
- | and TMP1, TMP1, TMP0 // idx = str->hash & tab->hmask
- | slwi TMP0, TMP1, 5
- | slwi TMP1, TMP1, 3
- | sub TMP1, TMP0, TMP1
- | add NODE:TMP2, NODE:TMP2, TMP1 // node = tab->node + (idx*32-idx*8)
- |3: // Rearranged logic, because we expect _not_ to find the key.
- | evldd TMP0, NODE:TMP2->key
- | evldd TMP1, NODE:TMP2->val
- | evcmpeq TMP0, STR:RC
- | lwz NODE:TMP2, NODE:TMP2->next
- | checkallok >5
- | cmplwi NODE:TMP2, 0
- | beq ->fff_restv // Not found, keep default result.
- | b <3
- |5:
- | checknil TMP1
- | checkok ->fff_restv // Ditto for nil value.
- | evmr CRET1, TMP1 // Return value of mt.__metatable.
- | b ->fff_restv
- |
- |6:
- | cmpwi TMP1, LJ_TUDATA
- | not TMP1, TMP1
- | beq <1
- | checknum CARG1
- | slwi TMP1, TMP1, 2
- | li TMP2, 4*~LJ_TNUMX
- | isellt TMP1, TMP2, TMP1
- | la TMP2, DISPATCH_GL(gcroot[GCROOT_BASEMT])(DISPATCH)
- | lwzx TAB:RB, TMP2, TMP1
- | b <2
- |
- |.ffunc_2 setmetatable
- | // Fast path: no mt for table yet and not clearing the mt.
- | evmergehi TMP0, TAB:CARG1, TAB:CARG2
- | checktab TMP0
- | checkanyfail ->fff_fallback
- | lwz TAB:TMP1, TAB:CARG1->metatable
- | cmplwi TAB:TMP1, 0
- | lbz TMP3, TAB:CARG1->marked
- | bne ->fff_fallback
- | andi. TMP0, TMP3, LJ_GC_BLACK // isblack(table)
- | stw TAB:CARG2, TAB:CARG1->metatable
- | beq ->fff_restv
- | barrierback TAB:CARG1, TMP3, TMP0
- | b ->fff_restv
- |
- |.ffunc rawget
- | cmplwi NARGS8:RC, 16
- | evldd CARG2, 0(BASE)
- | blt ->fff_fallback
- | checktab CARG2
- | la CARG3, 8(BASE)
- | checkfail ->fff_fallback
- | mr CARG1, L
- | bl extern lj_tab_get // (lua_State *L, GCtab *t, cTValue *key)
- | // Returns cTValue *.
- | evldd CRET1, 0(CRET1)
- | b ->fff_restv
- |
- |//-- Base library: conversions ------------------------------------------
- |
- |.ffunc tonumber
- | // Only handles the number case inline (without a base argument).
- | cmplwi NARGS8:RC, 8
- | evldd CARG1, 0(BASE)
- | bne ->fff_fallback // Exactly one argument.
- | checknum CARG1
- | checkok ->fff_restv
- | b ->fff_fallback
- |
- |.ffunc_1 tostring
- | // Only handles the string or number case inline.
- | checkstr CARG1
- | // A __tostring method in the string base metatable is ignored.
- | checkok ->fff_restv // String key?
- | // Handle numbers inline, unless a number base metatable is present.
- | lwz TMP0, DISPATCH_GL(gcroot[GCROOT_BASEMT_NUM])(DISPATCH)
- | checknum CARG1
- | cmplwi cr1, TMP0, 0
- | stw BASE, L->base // Add frame since C call can throw.
- | crand 4*cr0+eq, 4*cr0+lt, 4*cr1+eq
- | stw PC, SAVE_PC // Redundant (but a defined value).
- | bne ->fff_fallback
- | ffgccheck
- | mr CARG1, L
- | mr CARG2, BASE
- | bl extern lj_str_fromnum // (lua_State *L, lua_Number *np)
- | // Returns GCstr *.
- | evmergelo STR:CRET1, TISSTR, STR:CRET1
- | b ->fff_restv
- |
- |//-- Base library: iterators -------------------------------------------
- |
- |.ffunc next
- | cmplwi NARGS8:RC, 8
- | evldd CARG2, 0(BASE)
- | blt ->fff_fallback
- | evstddx TISNIL, BASE, NARGS8:RC // Set missing 2nd arg to nil.
- | checktab TAB:CARG2
- | lwz PC, FRAME_PC(BASE)
- | checkfail ->fff_fallback
- | stw BASE, L->base // Add frame since C call can throw.
- | mr CARG1, L
- | stw BASE, L->top // Dummy frame length is ok.
- | la CARG3, 8(BASE)
- | stw PC, SAVE_PC
- | bl extern lj_tab_next // (lua_State *L, GCtab *t, TValue *key)
- | // Returns 0 at end of traversal.
- | cmplwi CRET1, 0
- | evmr CRET1, TISNIL
- | beq ->fff_restv // End of traversal: return nil.
- | evldd TMP0, 8(BASE) // Copy key and value to results.
- | la RA, -8(BASE)
- | evldd TMP1, 16(BASE)
- | evstdd TMP0, 0(RA)
- | li RD, (2+1)*8
- | evstdd TMP1, 8(RA)
- | b ->fff_res
- |
- |.ffunc_1 pairs
- | checktab TAB:CARG1
- | lwz PC, FRAME_PC(BASE)
- | checkfail ->fff_fallback
-#if LJ_52
- | lwz TAB:TMP2, TAB:CARG1->metatable
- | evldd CFUNC:TMP0, CFUNC:RB->upvalue[0]
- | cmplwi TAB:TMP2, 0
- | la RA, -8(BASE)
- | bne ->fff_fallback
-#else
- | evldd CFUNC:TMP0, CFUNC:RB->upvalue[0]
- | la RA, -8(BASE)
-#endif
- | evstdd TISNIL, 8(BASE)
- | li RD, (3+1)*8
- | evstdd CFUNC:TMP0, 0(RA)
- | b ->fff_res
- |
- |.ffunc_2 ipairs_aux
- | checktab TAB:CARG1
- | lwz PC, FRAME_PC(BASE)
- | checkfail ->fff_fallback
- | checknum CARG2
- | lus TMP3, 0x3ff0
- | checkfail ->fff_fallback
- | efdctsi TMP2, CARG2
- | lwz TMP0, TAB:CARG1->asize
- | evmergelo TMP3, TMP3, ZERO
- | lwz TMP1, TAB:CARG1->array
- | efdadd CARG2, CARG2, TMP3
- | addi TMP2, TMP2, 1
- | la RA, -8(BASE)
- | cmplw TMP0, TMP2
- | slwi TMP3, TMP2, 3
- | evstdd CARG2, 0(RA)
- | ble >2 // Not in array part?
- | evlddx TMP1, TMP1, TMP3
- |1:
- | checknil TMP1
- | li RD, (0+1)*8
- | checkok ->fff_res // End of iteration, return 0 results.
- | li RD, (2+1)*8
- | evstdd TMP1, 8(RA)
- | b ->fff_res
- |2: // Check for empty hash part first. Otherwise call C function.
- | lwz TMP0, TAB:CARG1->hmask
- | cmplwi TMP0, 0
- | li RD, (0+1)*8
- | beq ->fff_res
- | mr CARG2, TMP2
- | bl extern lj_tab_getinth // (GCtab *t, int32_t key)
- | // Returns cTValue * or NULL.
- | cmplwi CRET1, 0
- | li RD, (0+1)*8
- | beq ->fff_res
- | evldd TMP1, 0(CRET1)
- | b <1
- |
- |.ffunc_1 ipairs
- | checktab TAB:CARG1
- | lwz PC, FRAME_PC(BASE)
- | checkfail ->fff_fallback
-#if LJ_52
- | lwz TAB:TMP2, TAB:CARG1->metatable
- | evldd CFUNC:TMP0, CFUNC:RB->upvalue[0]
- | cmplwi TAB:TMP2, 0
- | la RA, -8(BASE)
- | bne ->fff_fallback
-#else
- | evldd CFUNC:TMP0, CFUNC:RB->upvalue[0]
- | la RA, -8(BASE)
-#endif
- | evsplati TMP1, 0
- | li RD, (3+1)*8
- | evstdd TMP1, 8(BASE)
- | evstdd CFUNC:TMP0, 0(RA)
- | b ->fff_res
- |
- |//-- Base library: catch errors ----------------------------------------
- |
- |.ffunc pcall
- | cmplwi NARGS8:RC, 8
- | lbz TMP3, DISPATCH_GL(hookmask)(DISPATCH)
- | blt ->fff_fallback
- | mr TMP2, BASE
- | la BASE, 8(BASE)
- | // Remember active hook before pcall.
- | rlwinm TMP3, TMP3, 32-HOOK_ACTIVE_SHIFT, 31, 31
- | subi NARGS8:RC, NARGS8:RC, 8
- | addi PC, TMP3, 8+FRAME_PCALL
- | b ->vm_call_dispatch
- |
- |.ffunc_2 xpcall
- | lbz TMP3, DISPATCH_GL(hookmask)(DISPATCH)
- | mr TMP2, BASE
- | checkfunc CARG2 // Traceback must be a function.
- | checkfail ->fff_fallback
- | la BASE, 16(BASE)
- | // Remember active hook before pcall.
- | rlwinm TMP3, TMP3, 32-HOOK_ACTIVE_SHIFT, 31, 31
- | evstdd CARG2, 0(TMP2) // Swap function and traceback.
- | subi NARGS8:RC, NARGS8:RC, 16
- | evstdd CARG1, 8(TMP2)
- | addi PC, TMP3, 16+FRAME_PCALL
- | b ->vm_call_dispatch
- |
- |//-- Coroutine library --------------------------------------------------
- |
- |.macro coroutine_resume_wrap, resume
- |.if resume
- |.ffunc_1 coroutine_resume
- | evmergehi TMP0, L:CARG1, L:CARG1
- |.else
- |.ffunc coroutine_wrap_aux
- | lwz L:CARG1, CFUNC:RB->upvalue[0].gcr
- |.endif
- |.if resume
- | cmpwi TMP0, LJ_TTHREAD
- | bne ->fff_fallback
- |.endif
- | lbz TMP0, L:CARG1->status
- | lwz TMP1, L:CARG1->cframe
- | lwz CARG2, L:CARG1->top
- | cmplwi cr0, TMP0, LUA_YIELD
- | lwz TMP2, L:CARG1->base
- | cmplwi cr1, TMP1, 0
- | lwz TMP0, L:CARG1->maxstack
- | cmplw cr7, CARG2, TMP2
- | lwz PC, FRAME_PC(BASE)
- | crorc 4*cr6+lt, 4*cr0+gt, 4*cr1+eq // st>LUA_YIELD || cframe!=0
- | add TMP2, CARG2, NARGS8:RC
- | crandc 4*cr6+gt, 4*cr7+eq, 4*cr0+eq // base==top && st!=LUA_YIELD
- | cmplw cr1, TMP2, TMP0
- | cror 4*cr6+lt, 4*cr6+lt, 4*cr6+gt
- | stw PC, SAVE_PC
- | cror 4*cr6+lt, 4*cr6+lt, 4*cr1+gt // cond1 || cond2 || stackov
- | stw BASE, L->base
- | blt cr6, ->fff_fallback
- |1:
- |.if resume
- | addi BASE, BASE, 8 // Keep resumed thread in stack for GC.
- | subi NARGS8:RC, NARGS8:RC, 8
- | subi TMP2, TMP2, 8
- |.endif
- | stw TMP2, L:CARG1->top
- | li TMP1, 0
- | stw BASE, L->top
- |2: // Move args to coroutine.
- | cmpw TMP1, NARGS8:RC
- | evlddx TMP0, BASE, TMP1
- | beq >3
- | evstddx TMP0, CARG2, TMP1
- | addi TMP1, TMP1, 8
- | b <2
- |3:
- | li CARG3, 0
- | mr L:SAVE0, L:CARG1
- | li CARG4, 0
- | bl ->vm_resume // (lua_State *L, TValue *base, 0, 0)
- | // Returns thread status.
- |4:
- | lwz TMP2, L:SAVE0->base
- | cmplwi CRET1, LUA_YIELD
- | lwz TMP3, L:SAVE0->top
- | li_vmstate INTERP
- | lwz BASE, L->base
- | st_vmstate
- | bgt >8
- | sub RD, TMP3, TMP2
- | lwz TMP0, L->maxstack
- | cmplwi RD, 0
- | add TMP1, BASE, RD
- | beq >6 // No results?
- | cmplw TMP1, TMP0
- | li TMP1, 0
- | bgt >9 // Need to grow stack?
- |
- | subi TMP3, RD, 8
- | stw TMP2, L:SAVE0->top // Clear coroutine stack.
- |5: // Move results from coroutine.
- | cmplw TMP1, TMP3
- | evlddx TMP0, TMP2, TMP1
- | evstddx TMP0, BASE, TMP1
- | addi TMP1, TMP1, 8
- | bne <5
- |6:
- | andi. TMP0, PC, FRAME_TYPE
- |.if resume
- | li TMP1, LJ_TTRUE
- | la RA, -8(BASE)
- | stw TMP1, -8(BASE) // Prepend true to results.
- | addi RD, RD, 16
- |.else
- | mr RA, BASE
- | addi RD, RD, 8
- |.endif
- |7:
- | stw PC, SAVE_PC
- | mr MULTRES, RD
- | beq ->BC_RET_Z
- | b ->vm_return
- |
- |8: // Coroutine returned with error (at co->top-1).
- |.if resume
- | andi. TMP0, PC, FRAME_TYPE
- | la TMP3, -8(TMP3)
- | li TMP1, LJ_TFALSE
- | evldd TMP0, 0(TMP3)
- | stw TMP3, L:SAVE0->top // Remove error from coroutine stack.
- | li RD, (2+1)*8
- | stw TMP1, -8(BASE) // Prepend false to results.
- | la RA, -8(BASE)
- | evstdd TMP0, 0(BASE) // Copy error message.
- | b <7
- |.else
- | mr CARG1, L
- | mr CARG2, L:SAVE0
- | bl extern lj_ffh_coroutine_wrap_err // (lua_State *L, lua_State *co)
- |.endif
- |
- |9: // Handle stack expansion on return from yield.
- | mr CARG1, L
- | srwi CARG2, RD, 3
- | bl extern lj_state_growstack // (lua_State *L, int n)
- | li CRET1, 0
- | b <4
- |.endmacro
- |
- | coroutine_resume_wrap 1 // coroutine.resume
- | coroutine_resume_wrap 0 // coroutine.wrap
- |
- |.ffunc coroutine_yield
- | lwz TMP0, L->cframe
- | add TMP1, BASE, NARGS8:RC
- | stw BASE, L->base
- | andi. TMP0, TMP0, CFRAME_RESUME
- | stw TMP1, L->top
- | li CRET1, LUA_YIELD
- | beq ->fff_fallback
- | stw ZERO, L->cframe
- | stb CRET1, L->status
- | b ->vm_leave_unw
- |
- |//-- Math library -------------------------------------------------------
- |
- |.ffunc_n math_abs
- | efdabs CRET1, CARG1
- | // Fallthrough.
- |
- |->fff_restv:
- | // CRET1 = TValue result.
- | lwz PC, FRAME_PC(BASE)
- | la RA, -8(BASE)
- | evstdd CRET1, 0(RA)
- |->fff_res1:
- | // RA = results, PC = return.
- | li RD, (1+1)*8
- |->fff_res:
- | // RA = results, RD = (nresults+1)*8, PC = return.
- | andi. TMP0, PC, FRAME_TYPE
- | mr MULTRES, RD
- | bne ->vm_return
- | lwz INS, -4(PC)
- | decode_RB8 RB, INS
- |5:
- | cmplw RB, RD // More results expected?
- | decode_RA8 TMP0, INS
- | bgt >6
- | ins_next1
- | // Adjust BASE. KBASE is assumed to be set for the calling frame.
- | sub BASE, RA, TMP0
- | ins_next2
- |
- |6: // Fill up results with nil.
- | subi TMP1, RD, 8
- | addi RD, RD, 8
- | evstddx TISNIL, RA, TMP1
- | b <5
- |
- |.macro math_extern, func
- | .ffunc math_ .. func
- | cmplwi NARGS8:RC, 8
- | evldd CARG2, 0(BASE)
- | blt ->fff_fallback
- | checknum CARG2
- | evmergehi CARG1, CARG2, CARG2
- | checkfail ->fff_fallback
- | bl extern func@plt
- | evmergelo CRET1, CRET1, CRET2
- | b ->fff_restv
- |.endmacro
- |
- |.macro math_extern2, func
- | .ffunc math_ .. func
- | cmplwi NARGS8:RC, 16
- | evldd CARG2, 0(BASE)
- | evldd CARG4, 8(BASE)
- | blt ->fff_fallback
- | evmergehi CARG1, CARG4, CARG2
- | checknum CARG1
- | evmergehi CARG3, CARG4, CARG4
- | checkanyfail ->fff_fallback
- | bl extern func@plt
- | evmergelo CRET1, CRET1, CRET2
- | b ->fff_restv
- |.endmacro
- |
- |.macro math_round, func
- | .ffunc math_ .. func
- | cmplwi NARGS8:RC, 8
- | evldd CARG2, 0(BASE)
- | blt ->fff_fallback
- | checknum CARG2
- | evmergehi CARG1, CARG2, CARG2
- | checkfail ->fff_fallback
- | lwz PC, FRAME_PC(BASE)
- | bl ->vm_..func.._hilo;
- | la RA, -8(BASE)
- | evstdd CRET2, 0(RA)
- | b ->fff_res1
- |.endmacro
- |
- | math_round floor
- | math_round ceil
- |
- | math_extern sqrt
- |
- |.ffunc math_log
- | cmplwi NARGS8:RC, 8
- | evldd CARG2, 0(BASE)
- | bne ->fff_fallback // Need exactly 1 argument.
- | checknum CARG2
- | evmergehi CARG1, CARG2, CARG2
- | checkfail ->fff_fallback
- | bl extern log@plt
- | evmergelo CRET1, CRET1, CRET2
- | b ->fff_restv
- |
- | math_extern log10
- | math_extern exp
- | math_extern sin
- | math_extern cos
- | math_extern tan
- | math_extern asin
- | math_extern acos
- | math_extern atan
- | math_extern sinh
- | math_extern cosh
- | math_extern tanh
- | math_extern2 pow
- | math_extern2 atan2
- | math_extern2 fmod
- |
- |->ff_math_deg:
- |.ffunc_n math_rad
- | evldd CARG2, CFUNC:RB->upvalue[0]
- | efdmul CRET1, CARG1, CARG2
- | b ->fff_restv
- |
- |.ffunc math_ldexp
- | cmplwi NARGS8:RC, 16
- | evldd CARG2, 0(BASE)
- | evldd CARG4, 8(BASE)
- | blt ->fff_fallback
- | evmergehi CARG1, CARG4, CARG2
- | checknum CARG1
- | checkanyfail ->fff_fallback
- | efdctsi CARG3, CARG4
- | bl extern ldexp@plt
- | evmergelo CRET1, CRET1, CRET2
- | b ->fff_restv
- |
- |.ffunc math_frexp
- | cmplwi NARGS8:RC, 8
- | evldd CARG2, 0(BASE)
- | blt ->fff_fallback
- | checknum CARG2
- | evmergehi CARG1, CARG2, CARG2
- | checkfail ->fff_fallback
- | la CARG3, DISPATCH_GL(tmptv)(DISPATCH)
- | lwz PC, FRAME_PC(BASE)
- | bl extern frexp@plt
- | lwz TMP1, DISPATCH_GL(tmptv)(DISPATCH)
- | evmergelo CRET1, CRET1, CRET2
- | efdcfsi CRET2, TMP1
- | la RA, -8(BASE)
- | evstdd CRET1, 0(RA)
- | li RD, (2+1)*8
- | evstdd CRET2, 8(RA)
- | b ->fff_res
- |
- |.ffunc math_modf
- | cmplwi NARGS8:RC, 8
- | evldd CARG2, 0(BASE)
- | blt ->fff_fallback
- | checknum CARG2
- | evmergehi CARG1, CARG2, CARG2
- | checkfail ->fff_fallback
- | la CARG3, -8(BASE)
- | lwz PC, FRAME_PC(BASE)
- | bl extern modf@plt
- | evmergelo CRET1, CRET1, CRET2
- | la RA, -8(BASE)
- | evstdd CRET1, 0(BASE)
- | li RD, (2+1)*8
- | b ->fff_res
- |
- |.macro math_minmax, name, cmpop
- | .ffunc_1 name
- | checknum CARG1
- | li TMP1, 8
- | checkfail ->fff_fallback
- |1:
- | evlddx CARG2, BASE, TMP1
- | cmplw cr1, TMP1, NARGS8:RC
- | checknum CARG2
- | bge cr1, ->fff_restv // Ok, since CRET1 = CARG1.
- | checkfail ->fff_fallback
- | cmpop CARG2, CARG1
- | addi TMP1, TMP1, 8
- | crmove 4*cr0+lt, 4*cr0+gt
- | evsel CARG1, CARG2, CARG1
- | b <1
- |.endmacro
- |
- | math_minmax math_min, efdtstlt
- | math_minmax math_max, efdtstgt
- |
- |//-- String library -----------------------------------------------------
- |
- |.ffunc_1 string_len
- | checkstr STR:CARG1
- | checkfail ->fff_fallback
- | lwz TMP0, STR:CARG1->len
- | efdcfsi CRET1, TMP0
- | b ->fff_restv
- |
- |.ffunc string_byte // Only handle the 1-arg case here.
- | cmplwi NARGS8:RC, 8
- | evldd STR:CARG1, 0(BASE)
- | bne ->fff_fallback // Need exactly 1 argument.
- | checkstr STR:CARG1
- | la RA, -8(BASE)
- | checkfail ->fff_fallback
- | lwz TMP0, STR:CARG1->len
- | li RD, (0+1)*8
- | lbz TMP1, STR:CARG1[1] // Access is always ok (NUL at end).
- | li TMP2, (1+1)*8
- | cmplwi TMP0, 0
- | lwz PC, FRAME_PC(BASE)
- | efdcfsi CRET1, TMP1
- | iseleq RD, RD, TMP2
- | evstdd CRET1, 0(RA)
- | b ->fff_res
- |
- |.ffunc string_char // Only handle the 1-arg case here.
- | ffgccheck
- | cmplwi NARGS8:RC, 8
- | evldd CARG1, 0(BASE)
- | bne ->fff_fallback // Exactly 1 argument.
- | checknum CARG1
- | la CARG2, DISPATCH_GL(tmptv)(DISPATCH)
- | checkfail ->fff_fallback
- | efdctsiz TMP0, CARG1
- | li CARG3, 1
- | cmplwi TMP0, 255
- | stb TMP0, 0(CARG2)
- | bgt ->fff_fallback
- |->fff_newstr:
- | mr CARG1, L
- | stw BASE, L->base
- | stw PC, SAVE_PC
- | bl extern lj_str_new // (lua_State *L, char *str, size_t l)
- | // Returns GCstr *.
- | lwz BASE, L->base
- | evmergelo STR:CRET1, TISSTR, STR:CRET1
- | b ->fff_restv
- |
- |.ffunc string_sub
- | ffgccheck
- | cmplwi NARGS8:RC, 16
- | evldd CARG3, 16(BASE)
- | evldd STR:CARG1, 0(BASE)
- | blt ->fff_fallback
- | evldd CARG2, 8(BASE)
- | li TMP2, -1
- | beq >1
- | checknum CARG3
- | checkfail ->fff_fallback
- | efdctsiz TMP2, CARG3
- |1:
- | checknum CARG2
- | checkfail ->fff_fallback
- | checkstr STR:CARG1
- | efdctsiz TMP1, CARG2
- | checkfail ->fff_fallback
- | lwz TMP0, STR:CARG1->len
- | cmplw TMP0, TMP2 // len < end? (unsigned compare)
- | add TMP3, TMP2, TMP0
- | blt >5
- |2:
- | cmpwi TMP1, 0 // start <= 0?
- | add TMP3, TMP1, TMP0
- | ble >7
- |3:
- | sub. CARG3, TMP2, TMP1
- | addi CARG2, STR:CARG1, #STR-1
- | addi CARG3, CARG3, 1
- | add CARG2, CARG2, TMP1
- | isellt CARG3, r0, CARG3
- | b ->fff_newstr
- |
- |5: // Negative end or overflow.
- | cmpw TMP0, TMP2
- | addi TMP3, TMP3, 1
- | iselgt TMP2, TMP3, TMP0 // end = end > len ? len : end+len+1
- | b <2
- |
- |7: // Negative start or underflow.
- | cmpwi cr1, TMP3, 0
- | iseleq TMP1, r0, TMP3
- | isel TMP1, r0, TMP1, 4*cr1+lt
- | addi TMP1, TMP1, 1 // start = 1 + (start ? start+len : 0)
- | b <3
- |
- |.ffunc string_rep // Only handle the 1-char case inline.
- | ffgccheck
- | cmplwi NARGS8:RC, 16
- | evldd CARG1, 0(BASE)
- | evldd CARG2, 8(BASE)
- | bne ->fff_fallback // Exactly 2 arguments.
- | checknum CARG2
- | checkfail ->fff_fallback
- | checkstr STR:CARG1
- | efdctsiz CARG3, CARG2
- | checkfail ->fff_fallback
- | lwz TMP0, STR:CARG1->len
- | cmpwi CARG3, 0
- | lwz TMP1, DISPATCH_GL(tmpbuf.sz)(DISPATCH)
- | ble >2 // Count <= 0? (or non-int)
- | cmplwi TMP0, 1
- | subi TMP2, CARG3, 1
- | blt >2 // Zero length string?
- | cmplw cr1, TMP1, CARG3
- | bne ->fff_fallback // Fallback for > 1-char strings.
- | lbz TMP0, STR:CARG1[1]
- | lwz CARG2, DISPATCH_GL(tmpbuf.buf)(DISPATCH)
- | blt cr1, ->fff_fallback
- |1: // Fill buffer with char. Yes, this is suboptimal code (do you care?).
- | cmplwi TMP2, 0
- | stbx TMP0, CARG2, TMP2
- | subi TMP2, TMP2, 1
- | bne <1
- | b ->fff_newstr
- |2: // Return empty string.
- | la STR:CRET1, DISPATCH_GL(strempty)(DISPATCH)
- | evmergelo CRET1, TISSTR, STR:CRET1
- | b ->fff_restv
- |
- |.ffunc string_reverse
- | ffgccheck
- | cmplwi NARGS8:RC, 8
- | evldd CARG1, 0(BASE)
- | blt ->fff_fallback
- | checkstr STR:CARG1
- | lwz TMP1, DISPATCH_GL(tmpbuf.sz)(DISPATCH)
- | checkfail ->fff_fallback
- | lwz CARG3, STR:CARG1->len
- | la CARG1, #STR(STR:CARG1)
- | lwz CARG2, DISPATCH_GL(tmpbuf.buf)(DISPATCH)
- | li TMP2, 0
- | cmplw TMP1, CARG3
- | subi TMP3, CARG3, 1
- | blt ->fff_fallback
- |1: // Reverse string copy.
- | cmpwi TMP3, 0
- | lbzx TMP1, CARG1, TMP2
- | blt ->fff_newstr
- | stbx TMP1, CARG2, TMP3
- | subi TMP3, TMP3, 1
- | addi TMP2, TMP2, 1
- | b <1
- |
- |.macro ffstring_case, name, lo
- | .ffunc name
- | ffgccheck
- | cmplwi NARGS8:RC, 8
- | evldd CARG1, 0(BASE)
- | blt ->fff_fallback
- | checkstr STR:CARG1
- | lwz TMP1, DISPATCH_GL(tmpbuf.sz)(DISPATCH)
- | checkfail ->fff_fallback
- | lwz CARG3, STR:CARG1->len
- | la CARG1, #STR(STR:CARG1)
- | lwz CARG2, DISPATCH_GL(tmpbuf.buf)(DISPATCH)
- | cmplw TMP1, CARG3
- | li TMP2, 0
- | blt ->fff_fallback
- |1: // ASCII case conversion.
- | cmplw TMP2, CARG3
- | lbzx TMP1, CARG1, TMP2
- | bge ->fff_newstr
- | subi TMP0, TMP1, lo
- | xori TMP3, TMP1, 0x20
- | cmplwi TMP0, 26
- | isellt TMP1, TMP3, TMP1
- | stbx TMP1, CARG2, TMP2
- | addi TMP2, TMP2, 1
- | b <1
- |.endmacro
- |
- |ffstring_case string_lower, 65
- |ffstring_case string_upper, 97
- |
- |//-- Table library ------------------------------------------------------
- |
- |.ffunc_1 table_getn
- | checktab CARG1
- | checkfail ->fff_fallback
- | bl extern lj_tab_len // (GCtab *t)
- | // Returns uint32_t (but less than 2^31).
- | efdcfsi CRET1, CRET1
- | b ->fff_restv
- |
- |//-- Bit library --------------------------------------------------------
- |
- |.macro .ffunc_bit, name
- | .ffunc_n bit_..name
- | efdadd CARG1, CARG1, TOBIT
- |.endmacro
- |
- |.ffunc_bit tobit
- |->fff_resbit:
- | efdcfsi CRET1, CARG1
- | b ->fff_restv
- |
- |.macro .ffunc_bit_op, name, ins
- | .ffunc_bit name
- | li TMP1, 8
- |1:
- | evlddx CARG2, BASE, TMP1
- | cmplw cr1, TMP1, NARGS8:RC
- | checknum CARG2
- | bge cr1, ->fff_resbit
- | checkfail ->fff_fallback
- | efdadd CARG2, CARG2, TOBIT
- | ins CARG1, CARG1, CARG2
- | addi TMP1, TMP1, 8
- | b <1
- |.endmacro
- |
- |.ffunc_bit_op band, and
- |.ffunc_bit_op bor, or
- |.ffunc_bit_op bxor, xor
- |
- |.ffunc_bit bswap
- | rotlwi TMP0, CARG1, 8
- | rlwimi TMP0, CARG1, 24, 0, 7
- | rlwimi TMP0, CARG1, 24, 16, 23
- | efdcfsi CRET1, TMP0
- | b ->fff_restv
- |
- |.ffunc_bit bnot
- | not TMP0, CARG1
- | efdcfsi CRET1, TMP0
- | b ->fff_restv
- |
- |.macro .ffunc_bit_sh, name, ins, shmod
- | .ffunc_nn bit_..name
- | efdadd CARG2, CARG2, TOBIT
- | efdadd CARG1, CARG1, TOBIT
- |.if shmod == 1
- | rlwinm CARG2, CARG2, 0, 27, 31
- |.elif shmod == 2
- | neg CARG2, CARG2
- |.endif
- | ins TMP0, CARG1, CARG2
- | efdcfsi CRET1, TMP0
- | b ->fff_restv
- |.endmacro
- |
- |.ffunc_bit_sh lshift, slw, 1
- |.ffunc_bit_sh rshift, srw, 1
- |.ffunc_bit_sh arshift, sraw, 1
- |.ffunc_bit_sh rol, rotlw, 0
- |.ffunc_bit_sh ror, rotlw, 2
- |
- |//-----------------------------------------------------------------------
- |
- |->fff_fallback: // Call fast function fallback handler.
- | // BASE = new base, RB = CFUNC, RC = nargs*8
- | lwz TMP3, CFUNC:RB->f
- | add TMP1, BASE, NARGS8:RC
- | lwz PC, FRAME_PC(BASE) // Fallback may overwrite PC.
- | addi TMP0, TMP1, 8*LUA_MINSTACK
- | lwz TMP2, L->maxstack
- | stw PC, SAVE_PC // Redundant (but a defined value).
- | cmplw TMP0, TMP2
- | stw BASE, L->base
- | stw TMP1, L->top
- | mr CARG1, L
- | bgt >5 // Need to grow stack.
- | mtctr TMP3
- | bctrl // (lua_State *L)
- | // Either throws an error, or recovers and returns -1, 0 or nresults+1.
- | lwz BASE, L->base
- | cmpwi CRET1, 0
- | slwi RD, CRET1, 3
- | la RA, -8(BASE)
- | bgt ->fff_res // Returned nresults+1?
- |1: // Returned 0 or -1: retry fast path.
- | lwz TMP0, L->top
- | lwz LFUNC:RB, FRAME_FUNC(BASE)
- | sub NARGS8:RC, TMP0, BASE
- | bne ->vm_call_tail // Returned -1?
- | ins_callt // Returned 0: retry fast path.
- |
- |// Reconstruct previous base for vmeta_call during tailcall.
- |->vm_call_tail:
- | andi. TMP0, PC, FRAME_TYPE
- | rlwinm TMP1, PC, 0, 0, 28
- | bne >3
- | lwz INS, -4(PC)
- | decode_RA8 TMP1, INS
- | addi TMP1, TMP1, 8
- |3:
- | sub TMP2, BASE, TMP1
- | b ->vm_call_dispatch // Resolve again for tailcall.
- |
- |5: // Grow stack for fallback handler.
- | li CARG2, LUA_MINSTACK
- | bl extern lj_state_growstack // (lua_State *L, int n)
- | lwz BASE, L->base
- | cmpw TMP0, TMP0 // Set 4*cr0+eq to force retry.
- | b <1
- |
- |->fff_gcstep: // Call GC step function.
- | // BASE = new base, RC = nargs*8
- | mflr SAVE0
- | stw BASE, L->base
- | add TMP0, BASE, NARGS8:RC
- | stw PC, SAVE_PC // Redundant (but a defined value).
- | stw TMP0, L->top
- | mr CARG1, L
- | bl extern lj_gc_step // (lua_State *L)
- | lwz BASE, L->base
- | mtlr SAVE0
- | lwz TMP0, L->top
- | sub NARGS8:RC, TMP0, BASE
- | lwz CFUNC:RB, FRAME_FUNC(BASE)
- | blr
- |
- |//-----------------------------------------------------------------------
- |//-- Special dispatch targets -------------------------------------------
- |//-----------------------------------------------------------------------
- |
- |->vm_record: // Dispatch target for recording phase.
- |.if JIT
- | NYI
- |.endif
- |
- |->vm_rethook: // Dispatch target for return hooks.
- | lbz TMP3, DISPATCH_GL(hookmask)(DISPATCH)
- | andi. TMP0, TMP3, HOOK_ACTIVE // Hook already active?
- | beq >1
- |5: // Re-dispatch to static ins.
- | addi TMP1, TMP1, GG_DISP2STATIC // Assumes decode_OP4 TMP1, INS.
- | lwzx TMP0, DISPATCH, TMP1
- | mtctr TMP0
- | bctr
- |
- |->vm_inshook: // Dispatch target for instr/line hooks.
- | lbz TMP3, DISPATCH_GL(hookmask)(DISPATCH)
- | lwz TMP2, DISPATCH_GL(hookcount)(DISPATCH)
- | andi. TMP0, TMP3, HOOK_ACTIVE // Hook already active?
- | rlwinm TMP0, TMP3, 31-LUA_HOOKLINE, 31, 0
- | bne <5
- |
- | cmpwi cr1, TMP0, 0
- | addic. TMP2, TMP2, -1
- | beq cr1, <5
- | stw TMP2, DISPATCH_GL(hookcount)(DISPATCH)
- | beq >1
- | bge cr1, <5
- |1:
- | mr CARG1, L
- | stw MULTRES, SAVE_MULTRES
- | mr CARG2, PC
- | stw BASE, L->base
- | // SAVE_PC must hold the _previous_ PC. The callee updates it with PC.
- | bl extern lj_dispatch_ins // (lua_State *L, const BCIns *pc)
- |3:
- | lwz BASE, L->base
- |4: // Re-dispatch to static ins.
- | lwz INS, -4(PC)
- | decode_OP4 TMP1, INS
- | decode_RB8 RB, INS
- | addi TMP1, TMP1, GG_DISP2STATIC
- | decode_RD8 RD, INS
- | lwzx TMP0, DISPATCH, TMP1
- | decode_RA8 RA, INS
- | decode_RC8 RC, INS
- | mtctr TMP0
- | bctr
- |
- |->cont_hook: // Continue from hook yield.
- | addi PC, PC, 4
- | lwz MULTRES, -20(RB) // Restore MULTRES for *M ins.
- | b <4
- |
- |->vm_hotloop: // Hot loop counter underflow.
- |.if JIT
- | NYI
- |.endif
- |
- |->vm_callhook: // Dispatch target for call hooks.
- | mr CARG2, PC
- |.if JIT
- | b >1
- |.endif
- |
- |->vm_hotcall: // Hot call counter underflow.
- |.if JIT
- | ori CARG2, PC, 1
- |1:
- |.endif
- | add TMP0, BASE, RC
- | stw PC, SAVE_PC
- | mr CARG1, L
- | stw BASE, L->base
- | sub RA, RA, BASE
- | stw TMP0, L->top
- | bl extern lj_dispatch_call // (lua_State *L, const BCIns *pc)
- | // Returns ASMFunction.
- | lwz BASE, L->base
- | lwz TMP0, L->top
- | stw ZERO, SAVE_PC // Invalidate for subsequent line hook.
- | sub NARGS8:RC, TMP0, BASE
- | add RA, BASE, RA
- | lwz LFUNC:RB, FRAME_FUNC(BASE)
- | mtctr CRET1
- | bctr
- |
- |//-----------------------------------------------------------------------
- |//-- Trace exit handler -------------------------------------------------
- |//-----------------------------------------------------------------------
- |
- |->vm_exit_handler:
- |.if JIT
- | NYI
- |.endif
- |->vm_exit_interp:
- |.if JIT
- | NYI
- |.endif
- |
- |//-----------------------------------------------------------------------
- |//-- Math helper functions ----------------------------------------------
- |//-----------------------------------------------------------------------
- |
- |// FP value rounding. Called by math.floor/math.ceil fast functions
- |// and from JIT code.
- |//
- |// This can be inlined if the CPU has the frin/friz/frip/frim instructions.
- |// The alternative hard-float approaches have a deep dependency chain.
- |// The resulting latency is at least 3x-7x the double-precision FP latency
- |// (e500v2: 6cy, e600: 5cy, Cell: 10cy) or around 20-70 cycles.
- |//
- |// The soft-float approach is tedious, but much faster (e500v2: ~11cy/~6cy).
- |// However it relies on a fast way to transfer the FP value to GPRs
- |// (e500v2: 0cy for lo-word, 1cy for hi-word).
- |//
- |.macro vm_round, name, mode
- | // Used temporaries: TMP0, TMP1, TMP2, TMP3.
- |->name.._efd: // Input: CARG2, output: CRET2
- | evmergehi CARG1, CARG2, CARG2
- |->name.._hilo:
- | // Input: CARG1 (hi), CARG2 (hi, lo), output: CRET2
- | rlwinm TMP2, CARG1, 12, 21, 31
- | addic. TMP2, TMP2, -1023 // exp = exponent(x) - 1023
- | li TMP1, -1
- | cmplwi cr1, TMP2, 51 // 0 <= exp <= 51?
- | subfic TMP0, TMP2, 52
- | bgt cr1, >1
- | lus TMP3, 0xfff0
- | slw TMP0, TMP1, TMP0 // lomask = -1 << (52-exp)
- | sraw TMP1, TMP3, TMP2 // himask = (int32_t)0xfff00000 >> exp
- |.if mode == 2 // trunc(x):
- | evmergelo TMP0, TMP1, TMP0
- | evand CRET2, CARG2, TMP0 // hi &= himask, lo &= lomask
- |.else
- | andc TMP2, CARG2, TMP0
- | andc TMP3, CARG1, TMP1
- | or TMP2, TMP2, TMP3 // ztest = (hi&~himask) | (lo&~lomask)
- | srawi TMP3, CARG1, 31 // signmask = (int32_t)hi >> 31
- |.if mode == 0 // floor(x):
- | and. TMP2, TMP2, TMP3 // iszero = ((ztest & signmask) == 0)
- |.else // ceil(x):
- | andc. TMP2, TMP2, TMP3 // iszero = ((ztest & ~signmask) == 0)
- |.endif
- | and CARG2, CARG2, TMP0 // lo &= lomask
- | and CARG1, CARG1, TMP1 // hi &= himask
- | subc TMP0, CARG2, TMP0
- | iseleq TMP0, CARG2, TMP0 // lo = iszero ? lo : lo-lomask
- | sube TMP1, CARG1, TMP1
- | iseleq TMP1, CARG1, TMP1 // hi = iszero ? hi : hi-himask+carry
- | evmergelo CRET2, TMP1, TMP0
- |.endif
- | blr
- |1:
- | bgtlr // Already done if >=2^52, +-inf or nan.
- |.if mode == 2 // trunc(x):
- | rlwinm TMP1, CARG1, 0, 0, 0 // hi = sign(x)
- | li TMP0, 0
- | evmergelo CRET2, TMP1, TMP0
- |.else
- | rlwinm TMP2, CARG1, 0, 1, 31
- | srawi TMP0, CARG1, 31 // signmask = (int32_t)hi >> 31
- | or TMP2, TMP2, CARG2 // ztest = abs(hi) | lo
- | lus TMP1, 0x3ff0
- |.if mode == 0 // floor(x):
- | and. TMP2, TMP2, TMP0 // iszero = ((ztest & signmask) == 0)
- |.else // ceil(x):
- | andc. TMP2, TMP2, TMP0 // iszero = ((ztest & ~signmask) == 0)
- |.endif
- | li TMP0, 0
- | iseleq TMP1, r0, TMP1
- | rlwimi CARG1, TMP1, 0, 1, 31 // hi = sign(x) | (iszero ? 0.0 : 1.0)
- | evmergelo CRET2, CARG1, TMP0
- |.endif
- | blr
- |.endmacro
- |
- |->vm_floor:
- | mflr CARG3
- | evmergelo CARG2, CARG1, CARG2
- | bl ->vm_floor_hilo
- | mtlr CARG3
- | evmergehi CRET1, CRET2, CRET2
- | blr
- |
- | vm_round vm_floor, 0
- | vm_round vm_ceil, 1
- |.if JIT
- | vm_round vm_trunc, 2
- |.else
- |->vm_trunc_efd:
- |->vm_trunc_hilo:
- |.endif
- |
- |//-----------------------------------------------------------------------
- |//-- Miscellaneous functions --------------------------------------------
- |//-----------------------------------------------------------------------
- |
- |//-----------------------------------------------------------------------
- |//-- FFI helper functions -----------------------------------------------
- |//-----------------------------------------------------------------------
- |
- |->vm_ffi_call:
- |.if FFI
- | NYI
- |.endif
- |
- |//-----------------------------------------------------------------------
-}
-
-/* Generate the code for a single instruction. */
-static void build_ins(BuildCtx *ctx, BCOp op, int defop)
-{
- int vk = 0;
- |=>defop:
-
- switch (op) {
-
- /* -- Comparison ops ---------------------------------------------------- */
-
- /* Remember: all ops branch for a true comparison, fall through otherwise. */
-
- case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT:
- | // RA = src1*8, RD = src2*8, JMP with RD = target
- | evlddx TMP0, BASE, RA
- | addi PC, PC, 4
- | evlddx TMP1, BASE, RD
- | addis TMP3, PC, -(BCBIAS_J*4 >> 16)
- | lwz TMP2, -4(PC)
- | evmergehi RB, TMP0, TMP1
- | decode_RD4 TMP2, TMP2
- | checknum RB
- | add TMP2, TMP2, TMP3
- | checkanyfail ->vmeta_comp
- | efdcmplt TMP0, TMP1
- if (op == BC_ISLE || op == BC_ISGT) {
- | efdcmpeq cr1, TMP0, TMP1
- | cror 4*cr0+gt, 4*cr0+gt, 4*cr1+gt
- }
- if (op == BC_ISLT || op == BC_ISLE) {
- | iselgt PC, TMP2, PC
- } else {
- | iselgt PC, PC, TMP2
- }
- | ins_next
- break;
-
- case BC_ISEQV: case BC_ISNEV:
- vk = op == BC_ISEQV;
- | // RA = src1*8, RD = src2*8, JMP with RD = target
- | evlddx CARG2, BASE, RA
- | addi PC, PC, 4
- | evlddx CARG3, BASE, RD
- | addis TMP3, PC, -(BCBIAS_J*4 >> 16)
- | lwz TMP2, -4(PC)
- | evmergehi RB, CARG2, CARG3
- | decode_RD4 TMP2, TMP2
- | checknum RB
- | add TMP2, TMP2, TMP3
- | checkanyfail >5
- | efdcmpeq CARG2, CARG3
- if (vk) {
- | iselgt PC, TMP2, PC
- } else {
- | iselgt PC, PC, TMP2
- }
- |1:
- | ins_next
- |
- |5: // Either or both types are not numbers.
- | evcmpeq CARG2, CARG3
- | not TMP3, RB
- | cmplwi cr1, TMP3, ~LJ_TISPRI // Primitive?
- | crorc 4*cr7+lt, 4*cr0+so, 4*cr0+lt // 1: Same tv or different type.
- | cmplwi cr6, TMP3, ~LJ_TISTABUD // Table or userdata?
- | crandc 4*cr7+gt, 4*cr0+lt, 4*cr1+gt // 2: Same type and primitive.
- | mr SAVE0, PC
- if (vk) {
- | isel PC, TMP2, PC, 4*cr7+gt
- } else {
- | isel TMP2, PC, TMP2, 4*cr7+gt
- }
- | cror 4*cr7+lt, 4*cr7+lt, 4*cr7+gt // 1 or 2.
- if (vk) {
- | isel PC, TMP2, PC, 4*cr0+so
- } else {
- | isel PC, PC, TMP2, 4*cr0+so
- }
- | blt cr7, <1 // Done if 1 or 2.
- | blt cr6, <1 // Done if not tab/ud.
- |
- | // Different tables or userdatas. Need to check __eq metamethod.
- | // Field metatable must be at same offset for GCtab and GCudata!
- | lwz TAB:TMP2, TAB:CARG2->metatable
- | li CARG4, 1-vk // ne = 0 or 1.
- | cmplwi TAB:TMP2, 0
- | beq <1 // No metatable?
- | lbz TMP2, TAB:TMP2->nomm
- | andi. TMP2, TMP2, 1<vmeta_equal // Handle __eq metamethod.
- break;
-
- case BC_ISEQS: case BC_ISNES:
- vk = op == BC_ISEQS;
- | // RA = src*8, RD = str_const*8 (~), JMP with RD = target
- | evlddx TMP0, BASE, RA
- | srwi RD, RD, 1
- | lwz INS, 0(PC)
- | subfic RD, RD, -4
- | addi PC, PC, 4
- | lwzx STR:TMP1, KBASE, RD // KBASE-4-str_const*4
- | addis TMP3, PC, -(BCBIAS_J*4 >> 16)
- | decode_RD4 TMP2, INS
- | evmergelo STR:TMP1, TISSTR, STR:TMP1
- | add TMP2, TMP2, TMP3
- | evcmpeq TMP0, STR:TMP1
- if (vk) {
- | isel PC, TMP2, PC, 4*cr0+so
- } else {
- | isel PC, PC, TMP2, 4*cr0+so
- }
- | ins_next
- break;
-
- case BC_ISEQN: case BC_ISNEN:
- vk = op == BC_ISEQN;
- | // RA = src*8, RD = num_const*8, JMP with RD = target
- | evlddx TMP0, BASE, RA
- | addi PC, PC, 4
- | evlddx TMP1, KBASE, RD
- | addis TMP3, PC, -(BCBIAS_J*4 >> 16)
- | lwz INS, -4(PC)
- | checknum TMP0
- | checkfail >5
- | efdcmpeq TMP0, TMP1
- |1:
- | decode_RD4 TMP2, INS
- | add TMP2, TMP2, TMP3
- if (vk) {
- | iselgt PC, TMP2, PC
- |5:
- } else {
- | iselgt PC, PC, TMP2
- }
- |3:
- | ins_next
- if (!vk) {
- |5:
- | decode_RD4 TMP2, INS
- | add PC, TMP2, TMP3
- | b <3
- }
- break;
-
- case BC_ISEQP: case BC_ISNEP:
- vk = op == BC_ISEQP;
- | // RA = src*8, RD = primitive_type*8 (~), JMP with RD = target
- | lwzx TMP0, BASE, RA
- | srwi TMP1, RD, 3
- | lwz INS, 0(PC)
- | addi PC, PC, 4
- | not TMP1, TMP1
- | addis TMP3, PC, -(BCBIAS_J*4 >> 16)
- | cmplw TMP0, TMP1
- | decode_RD4 TMP2, INS
- | add TMP2, TMP2, TMP3
- if (vk) {
- | iseleq PC, TMP2, PC
- } else {
- | iseleq PC, PC, TMP2
- }
- | ins_next
- break;
-
- /* -- Unary test and copy ops ------------------------------------------- */
-
- case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF:
- | // RA = dst*8 or unused, RD = src*8, JMP with RD = target
- | evlddx TMP0, BASE, RD
- | evaddw TMP1, TISNIL, TISNIL // Synthesize LJ_TFALSE.
- | lwz INS, 0(PC)
- | evcmpltu TMP0, TMP1
- | addi PC, PC, 4
- if (op == BC_IST || op == BC_ISF) {
- | addis TMP3, PC, -(BCBIAS_J*4 >> 16)
- | decode_RD4 TMP2, INS
- | add TMP2, TMP2, TMP3
- if (op == BC_IST) {
- | isellt PC, TMP2, PC
- } else {
- | isellt PC, PC, TMP2
- }
- } else {
- if (op == BC_ISTC) {
- | checkfail >1
- } else {
- | checkok >1
- }
- | addis PC, PC, -(BCBIAS_J*4 >> 16)
- | decode_RD4 TMP2, INS
- | evstddx TMP0, BASE, RA
- | add PC, PC, TMP2
- |1:
- }
- | ins_next
- break;
-
- /* -- Unary ops --------------------------------------------------------- */
-
- case BC_MOV:
- | // RA = dst*8, RD = src*8
- | ins_next1
- | evlddx TMP0, BASE, RD
- | evstddx TMP0, BASE, RA
- | ins_next2
- break;
- case BC_NOT:
- | // RA = dst*8, RD = src*8
- | ins_next1
- | lwzx TMP0, BASE, RD
- | subfic TMP1, TMP0, LJ_TTRUE
- | adde TMP0, TMP0, TMP1
- | stwx TMP0, BASE, RA
- | ins_next2
- break;
- case BC_UNM:
- | // RA = dst*8, RD = src*8
- | evlddx TMP0, BASE, RD
- | checknum TMP0
- | checkfail ->vmeta_unm
- | efdneg TMP0, TMP0
- | ins_next1
- | evstddx TMP0, BASE, RA
- | ins_next2
- break;
- case BC_LEN:
- | // RA = dst*8, RD = src*8
- | evlddx CARG1, BASE, RD
- | checkstr CARG1
- | checkfail >2
- | lwz CRET1, STR:CARG1->len
- |1:
- | ins_next1
- | efdcfsi TMP0, CRET1
- | evstddx TMP0, BASE, RA
- | ins_next2
- |2:
- | checktab CARG1
- | checkfail ->vmeta_len
-#if LJ_52
- | lwz TAB:TMP2, TAB:CARG1->metatable
- | cmplwi TAB:TMP2, 0
- | bne >9
- |3:
-#endif
- |->BC_LEN_Z:
- | bl extern lj_tab_len // (GCtab *t)
- | // Returns uint32_t (but less than 2^31).
- | b <1
-#if LJ_52
- |9:
- | lbz TMP0, TAB:TMP2->nomm
- | andi. TMP0, TMP0, 1<vmeta_len
-#endif
- break;
-
- /* -- Binary ops -------------------------------------------------------- */
-
- |.macro ins_arithpre, t0, t1
- | // RA = dst*8, RB = src1*8, RC = src2*8 | num_const*8
- ||vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
- ||switch (vk) {
- ||case 0:
- | evlddx t0, BASE, RB
- | checknum t0
- | evlddx t1, KBASE, RC
- | checkfail ->vmeta_arith_vn
- || break;
- ||case 1:
- | evlddx t1, BASE, RB
- | checknum t1
- | evlddx t0, KBASE, RC
- | checkfail ->vmeta_arith_nv
- || break;
- ||default:
- | evlddx t0, BASE, RB
- | evlddx t1, BASE, RC
- | evmergehi TMP2, t0, t1
- | checknum TMP2
- | checkanyfail ->vmeta_arith_vv
- || break;
- ||}
- |.endmacro
- |
- |.macro ins_arith, ins
- | ins_arithpre TMP0, TMP1
- | ins_next1
- | ins TMP0, TMP0, TMP1
- | evstddx TMP0, BASE, RA
- | ins_next2
- |.endmacro
-
- case BC_ADDVN: case BC_ADDNV: case BC_ADDVV:
- | ins_arith efdadd
- break;
- case BC_SUBVN: case BC_SUBNV: case BC_SUBVV:
- | ins_arith efdsub
- break;
- case BC_MULVN: case BC_MULNV: case BC_MULVV:
- | ins_arith efdmul
- break;
- case BC_DIVVN: case BC_DIVNV: case BC_DIVVV:
- | ins_arith efddiv
- break;
- case BC_MODVN:
- | ins_arithpre RD, SAVE0
- |->BC_MODVN_Z:
- | efddiv CARG2, RD, SAVE0
- | bl ->vm_floor_efd // floor(b/c)
- | efdmul TMP0, CRET2, SAVE0
- | ins_next1
- | efdsub TMP0, RD, TMP0 // b - floor(b/c)*c
- | evstddx TMP0, BASE, RA
- | ins_next2
- break;
- case BC_MODNV: case BC_MODVV:
- | ins_arithpre RD, SAVE0
- | b ->BC_MODVN_Z // Avoid 3 copies. It's slow anyway.
- break;
- case BC_POW:
- | evlddx CARG2, BASE, RB
- | evlddx CARG4, BASE, RC
- | evmergehi CARG1, CARG4, CARG2
- | checknum CARG1
- | evmergehi CARG3, CARG4, CARG4
- | checkanyfail ->vmeta_arith_vv
- | bl extern pow@plt
- | evmergelo CRET2, CRET1, CRET2
- | evstddx CRET2, BASE, RA
- | ins_next
- break;
-
- case BC_CAT:
- | // RA = dst*8, RB = src_start*8, RC = src_end*8
- | sub CARG3, RC, RB
- | stw BASE, L->base
- | add CARG2, BASE, RC
- | mr SAVE0, RB
- |->BC_CAT_Z:
- | stw PC, SAVE_PC
- | mr CARG1, L
- | srwi CARG3, CARG3, 3
- | bl extern lj_meta_cat // (lua_State *L, TValue *top, int left)
- | // Returns NULL (finished) or TValue * (metamethod).
- | cmplwi CRET1, 0
- | lwz BASE, L->base
- | bne ->vmeta_binop
- | evlddx TMP0, BASE, SAVE0 // Copy result from RB to RA.
- | evstddx TMP0, BASE, RA
- | ins_next
- break;
-
- /* -- Constant ops ------------------------------------------------------ */
-
- case BC_KSTR:
- | // RA = dst*8, RD = str_const*8 (~)
- | ins_next1
- | srwi TMP1, RD, 1
- | subfic TMP1, TMP1, -4
- | lwzx TMP0, KBASE, TMP1 // KBASE-4-str_const*4
- | evmergelo TMP0, TISSTR, TMP0
- | evstddx TMP0, BASE, RA
- | ins_next2
- break;
- case BC_KCDATA:
- |.if FFI
- | // RA = dst*8, RD = cdata_const*8 (~)
- | ins_next1
- | srwi TMP1, RD, 1
- | subfic TMP1, TMP1, -4
- | lwzx TMP0, KBASE, TMP1 // KBASE-4-cdata_const*4
- | li TMP2, LJ_TCDATA
- | evmergelo TMP0, TMP2, TMP0
- | evstddx TMP0, BASE, RA
- | ins_next2
- |.endif
- break;
- case BC_KSHORT:
- | // RA = dst*8, RD = int16_literal*8
- | srwi TMP1, RD, 3
- | extsh TMP1, TMP1
- | ins_next1
- | efdcfsi TMP0, TMP1
- | evstddx TMP0, BASE, RA
- | ins_next2
- break;
- case BC_KNUM:
- | // RA = dst*8, RD = num_const*8
- | evlddx TMP0, KBASE, RD
- | ins_next1
- | evstddx TMP0, BASE, RA
- | ins_next2
- break;
- case BC_KPRI:
- | // RA = dst*8, RD = primitive_type*8 (~)
- | srwi TMP1, RD, 3
- | not TMP0, TMP1
- | ins_next1
- | stwx TMP0, BASE, RA
- | ins_next2
- break;
- case BC_KNIL:
- | // RA = base*8, RD = end*8
- | evstddx TISNIL, BASE, RA
- | addi RA, RA, 8
- |1:
- | evstddx TISNIL, BASE, RA
- | cmpw RA, RD
- | addi RA, RA, 8
- | blt <1
- | ins_next_
- break;
-
- /* -- Upvalue and function ops ------------------------------------------ */
-
- case BC_UGET:
- | // RA = dst*8, RD = uvnum*8
- | ins_next1
- | lwz LFUNC:RB, FRAME_FUNC(BASE)
- | srwi RD, RD, 1
- | addi RD, RD, offsetof(GCfuncL, uvptr)
- | lwzx UPVAL:RB, LFUNC:RB, RD
- | lwz TMP1, UPVAL:RB->v
- | evldd TMP0, 0(TMP1)
- | evstddx TMP0, BASE, RA
- | ins_next2
- break;
- case BC_USETV:
- | // RA = uvnum*8, RD = src*8
- | lwz LFUNC:RB, FRAME_FUNC(BASE)
- | srwi RA, RA, 1
- | addi RA, RA, offsetof(GCfuncL, uvptr)
- | evlddx TMP1, BASE, RD
- | lwzx UPVAL:RB, LFUNC:RB, RA
- | lbz TMP3, UPVAL:RB->marked
- | lwz CARG2, UPVAL:RB->v
- | andi. TMP3, TMP3, LJ_GC_BLACK // isblack(uv)
- | lbz TMP0, UPVAL:RB->closed
- | evmergehi TMP2, TMP1, TMP1
- | evstdd TMP1, 0(CARG2)
- | cmplwi cr1, TMP0, 0
- | cror 4*cr0+eq, 4*cr0+eq, 4*cr1+eq
- | subi TMP2, TMP2, (LJ_TISNUM+1)
- | bne >2 // Upvalue is closed and black?
- |1:
- | ins_next
- |
- |2: // Check if new value is collectable.
- | cmplwi TMP2, LJ_TISGCV - (LJ_TISNUM+1)
- | bge <1 // tvisgcv(v)
- | lbz TMP3, GCOBJ:TMP1->gch.marked
- | andi. TMP3, TMP3, LJ_GC_WHITES // iswhite(v)
- | la CARG1, GG_DISP2G(DISPATCH)
- | // Crossed a write barrier. Move the barrier forward.
- | beq <1
- | bl extern lj_gc_barrieruv // (global_State *g, TValue *tv)
- | b <1
- break;
- case BC_USETS:
- | // RA = uvnum*8, RD = str_const*8 (~)
- | lwz LFUNC:RB, FRAME_FUNC(BASE)
- | srwi TMP1, RD, 1
- | srwi RA, RA, 1
- | subfic TMP1, TMP1, -4
- | addi RA, RA, offsetof(GCfuncL, uvptr)
- | lwzx STR:TMP1, KBASE, TMP1 // KBASE-4-str_const*4
- | lwzx UPVAL:RB, LFUNC:RB, RA
- | evmergelo STR:TMP1, TISSTR, STR:TMP1
- | lbz TMP3, UPVAL:RB->marked
- | lwz CARG2, UPVAL:RB->v
- | andi. TMP3, TMP3, LJ_GC_BLACK // isblack(uv)
- | lbz TMP3, STR:TMP1->marked
- | lbz TMP2, UPVAL:RB->closed
- | evstdd STR:TMP1, 0(CARG2)
- | bne >2
- |1:
- | ins_next
- |
- |2: // Check if string is white and ensure upvalue is closed.
- | andi. TMP3, TMP3, LJ_GC_WHITES // iswhite(str)
- | cmplwi cr1, TMP2, 0
- | cror 4*cr0+eq, 4*cr0+eq, 4*cr1+eq
- | la CARG1, GG_DISP2G(DISPATCH)
- | // Crossed a write barrier. Move the barrier forward.
- | beq <1
- | bl extern lj_gc_barrieruv // (global_State *g, TValue *tv)
- | b <1
- break;
- case BC_USETN:
- | // RA = uvnum*8, RD = num_const*8
- | ins_next1
- | lwz LFUNC:RB, FRAME_FUNC(BASE)
- | srwi RA, RA, 1
- | addi RA, RA, offsetof(GCfuncL, uvptr)
- | evlddx TMP0, KBASE, RD
- | lwzx UPVAL:RB, LFUNC:RB, RA
- | lwz TMP1, UPVAL:RB->v
- | evstdd TMP0, 0(TMP1)
- | ins_next2
- break;
- case BC_USETP:
- | // RA = uvnum*8, RD = primitive_type*8 (~)
- | ins_next1
- | lwz LFUNC:RB, FRAME_FUNC(BASE)
- | srwi RA, RA, 1
- | addi RA, RA, offsetof(GCfuncL, uvptr)
- | srwi TMP0, RD, 3
- | lwzx UPVAL:RB, LFUNC:RB, RA
- | not TMP0, TMP0
- | lwz TMP1, UPVAL:RB->v
- | stw TMP0, 0(TMP1)
- | ins_next2
- break;
-
- case BC_UCLO:
- | // RA = level*8, RD = target
- | lwz TMP1, L->openupval
- | branch_RD // Do this first since RD is not saved.
- | stw BASE, L->base
- | cmplwi TMP1, 0
- | mr CARG1, L
- | beq >1
- | add CARG2, BASE, RA
- | bl extern lj_func_closeuv // (lua_State *L, TValue *level)
- | lwz BASE, L->base
- |1:
- | ins_next
- break;
-
- case BC_FNEW:
- | // RA = dst*8, RD = proto_const*8 (~) (holding function prototype)
- | srwi TMP1, RD, 1
- | stw BASE, L->base
- | subfic TMP1, TMP1, -4
- | stw PC, SAVE_PC
- | lwzx CARG2, KBASE, TMP1 // KBASE-4-tab_const*4
- | mr CARG1, L
- | lwz CARG3, FRAME_FUNC(BASE)
- | // (lua_State *L, GCproto *pt, GCfuncL *parent)
- | bl extern lj_func_newL_gc
- | // Returns GCfuncL *.
- | lwz BASE, L->base
- | evmergelo LFUNC:CRET1, TISFUNC, LFUNC:CRET1
- | evstddx LFUNC:CRET1, BASE, RA
- | ins_next
- break;
-
- /* -- Table ops --------------------------------------------------------- */
-
- case BC_TNEW:
- case BC_TDUP:
- | // RA = dst*8, RD = (hbits|asize)*8 | tab_const*8 (~)
- | lwz TMP0, DISPATCH_GL(gc.total)(DISPATCH)
- | mr CARG1, L
- | lwz TMP1, DISPATCH_GL(gc.threshold)(DISPATCH)
- | stw BASE, L->base
- | cmplw TMP0, TMP1
- | stw PC, SAVE_PC
- | bge >5
- |1:
- if (op == BC_TNEW) {
- | rlwinm CARG2, RD, 29, 21, 31
- | rlwinm CARG3, RD, 18, 27, 31
- | cmpwi CARG2, 0x7ff
- | li TMP1, 0x801
- | iseleq CARG2, TMP1, CARG2
- | bl extern lj_tab_new // (lua_State *L, int32_t asize, uint32_t hbits)
- | // Returns Table *.
- } else {
- | srwi TMP1, RD, 1
- | subfic TMP1, TMP1, -4
- | lwzx CARG2, KBASE, TMP1 // KBASE-4-tab_const*4
- | bl extern lj_tab_dup // (lua_State *L, Table *kt)
- | // Returns Table *.
- }
- | lwz BASE, L->base
- | evmergelo TAB:CRET1, TISTAB, TAB:CRET1
- | evstddx TAB:CRET1, BASE, RA
- | ins_next
- |5:
- | mr SAVE0, RD
- | bl extern lj_gc_step_fixtop // (lua_State *L)
- | mr RD, SAVE0
- | mr CARG1, L
- | b <1
- break;
-
- case BC_GGET:
- | // RA = dst*8, RD = str_const*8 (~)
- case BC_GSET:
- | // RA = src*8, RD = str_const*8 (~)
- | lwz LFUNC:TMP2, FRAME_FUNC(BASE)
- | srwi TMP1, RD, 1
- | lwz TAB:RB, LFUNC:TMP2->env
- | subfic TMP1, TMP1, -4
- | lwzx STR:RC, KBASE, TMP1 // KBASE-4-str_const*4
- if (op == BC_GGET) {
- | b ->BC_TGETS_Z
- } else {
- | b ->BC_TSETS_Z
- }
- break;
-
- case BC_TGETV:
- | // RA = dst*8, RB = table*8, RC = key*8
- | evlddx TAB:RB, BASE, RB
- | evlddx RC, BASE, RC
- | checktab TAB:RB
- | checkfail ->vmeta_tgetv
- | checknum RC
- | checkfail >5
- | // Convert number key to integer
- | efdctsi TMP2, RC
- | lwz TMP0, TAB:RB->asize
- | efdcfsi TMP1, TMP2
- | cmplw cr0, TMP0, TMP2
- | efdcmpeq cr1, RC, TMP1
- | lwz TMP1, TAB:RB->array
- | crand 4*cr0+gt, 4*cr0+gt, 4*cr1+gt
- | slwi TMP2, TMP2, 3
- | ble ->vmeta_tgetv // Integer key and in array part?
- | evlddx TMP1, TMP1, TMP2
- | checknil TMP1
- | checkok >2
- |1:
- | evstddx TMP1, BASE, RA
- | ins_next
- |
- |2: // Check for __index if table value is nil.
- | lwz TAB:TMP2, TAB:RB->metatable
- | cmplwi TAB:TMP2, 0
- | beq <1 // No metatable: done.
- | lbz TMP0, TAB:TMP2->nomm
- | andi. TMP0, TMP0, 1<vmeta_tgetv
- |
- |5:
- | checkstr STR:RC // String key?
- | checkok ->BC_TGETS_Z
- | b ->vmeta_tgetv
- break;
- case BC_TGETS:
- | // RA = dst*8, RB = table*8, RC = str_const*8 (~)
- | evlddx TAB:RB, BASE, RB
- | srwi TMP1, RC, 1
- | checktab TAB:RB
- | subfic TMP1, TMP1, -4
- | lwzx STR:RC, KBASE, TMP1 // KBASE-4-str_const*4
- | checkfail ->vmeta_tgets1
- |->BC_TGETS_Z:
- | // TAB:RB = GCtab *, STR:RC = GCstr *, RA = dst*8
- | lwz TMP0, TAB:RB->hmask
- | lwz TMP1, STR:RC->hash
- | lwz NODE:TMP2, TAB:RB->node
- | evmergelo STR:RC, TISSTR, STR:RC
- | and TMP1, TMP1, TMP0 // idx = str->hash & tab->hmask
- | slwi TMP0, TMP1, 5
- | slwi TMP1, TMP1, 3
- | sub TMP1, TMP0, TMP1
- | add NODE:TMP2, NODE:TMP2, TMP1 // node = tab->node + (idx*32-idx*8)
- |1:
- | evldd TMP0, NODE:TMP2->key
- | evldd TMP1, NODE:TMP2->val
- | evcmpeq TMP0, STR:RC
- | checkanyfail >4
- | checknil TMP1
- | checkok >5 // Key found, but nil value?
- |3:
- | evstddx TMP1, BASE, RA
- | ins_next
- |
- |4: // Follow hash chain.
- | lwz NODE:TMP2, NODE:TMP2->next
- | cmplwi NODE:TMP2, 0
- | bne <1
- | // End of hash chain: key not found, nil result.
- | evmr TMP1, TISNIL
- |
- |5: // Check for __index if table value is nil.
- | lwz TAB:TMP2, TAB:RB->metatable
- | cmplwi TAB:TMP2, 0
- | beq <3 // No metatable: done.
- | lbz TMP0, TAB:TMP2->nomm
- | andi. TMP0, TMP0, 1<vmeta_tgets
- break;
- case BC_TGETB:
- | // RA = dst*8, RB = table*8, RC = index*8
- | evlddx TAB:RB, BASE, RB
- | srwi TMP0, RC, 3
- | checktab TAB:RB
- | checkfail ->vmeta_tgetb
- | lwz TMP1, TAB:RB->asize
- | lwz TMP2, TAB:RB->array
- | cmplw TMP0, TMP1
- | bge ->vmeta_tgetb
- | evlddx TMP1, TMP2, RC
- | checknil TMP1
- | checkok >5
- |1:
- | ins_next1
- | evstddx TMP1, BASE, RA
- | ins_next2
- |
- |5: // Check for __index if table value is nil.
- | lwz TAB:TMP2, TAB:RB->metatable
- | cmplwi TAB:TMP2, 0
- | beq <1 // No metatable: done.
- | lbz TMP2, TAB:TMP2->nomm
- | andi. TMP2, TMP2, 1<vmeta_tgetb // Caveat: preserve TMP0!
- break;
-
- case BC_TSETV:
- | // RA = src*8, RB = table*8, RC = key*8
- | evlddx TAB:RB, BASE, RB
- | evlddx RC, BASE, RC
- | checktab TAB:RB
- | checkfail ->vmeta_tsetv
- | checknum RC
- | checkfail >5
- | // Convert number key to integer
- | efdctsi TMP2, RC
- | evlddx SAVE0, BASE, RA
- | lwz TMP0, TAB:RB->asize
- | efdcfsi TMP1, TMP2
- | cmplw cr0, TMP0, TMP2
- | efdcmpeq cr1, RC, TMP1
- | lwz TMP1, TAB:RB->array
- | crand 4*cr0+gt, 4*cr0+gt, 4*cr1+gt
- | slwi TMP0, TMP2, 3
- | ble ->vmeta_tsetv // Integer key and in array part?
- | lbz TMP3, TAB:RB->marked
- | evlddx TMP2, TMP1, TMP0
- | checknil TMP2
- | checkok >3
- |1:
- | andi. TMP2, TMP3, LJ_GC_BLACK // isblack(table)
- | evstddx SAVE0, TMP1, TMP0
- | bne >7
- |2:
- | ins_next
- |
- |3: // Check for __newindex if previous value is nil.
- | lwz TAB:TMP2, TAB:RB->metatable
- | cmplwi TAB:TMP2, 0
- | beq <1 // No metatable: done.
- | lbz TMP2, TAB:TMP2->nomm
- | andi. TMP2, TMP2, 1<vmeta_tsetv
- |
- |5:
- | checkstr STR:RC // String key?
- | checkok ->BC_TSETS_Z
- | b ->vmeta_tsetv
- |
- |7: // Possible table write barrier for the value. Skip valiswhite check.
- | barrierback TAB:RB, TMP3, TMP0
- | b <2
- break;
- case BC_TSETS:
- | // RA = src*8, RB = table*8, RC = str_const*8 (~)
- | evlddx TAB:RB, BASE, RB
- | srwi TMP1, RC, 1
- | checktab TAB:RB
- | subfic TMP1, TMP1, -4
- | lwzx STR:RC, KBASE, TMP1 // KBASE-4-str_const*4
- | checkfail ->vmeta_tsets1
- |->BC_TSETS_Z:
- | // TAB:RB = GCtab *, STR:RC = GCstr *, RA = src*8
- | lwz TMP0, TAB:RB->hmask
- | lwz TMP1, STR:RC->hash
- | lwz NODE:TMP2, TAB:RB->node
- | evmergelo STR:RC, TISSTR, STR:RC
- | stb ZERO, TAB:RB->nomm // Clear metamethod cache.
- | and TMP1, TMP1, TMP0 // idx = str->hash & tab->hmask
- | evlddx SAVE0, BASE, RA
- | slwi TMP0, TMP1, 5
- | slwi TMP1, TMP1, 3
- | sub TMP1, TMP0, TMP1
- | lbz TMP3, TAB:RB->marked
- | add NODE:TMP2, NODE:TMP2, TMP1 // node = tab->node + (idx*32-idx*8)
- |1:
- | evldd TMP0, NODE:TMP2->key
- | evldd TMP1, NODE:TMP2->val
- | evcmpeq TMP0, STR:RC
- | checkanyfail >5
- | checknil TMP1
- | checkok >4 // Key found, but nil value?
- |2:
- | andi. TMP0, TMP3, LJ_GC_BLACK // isblack(table)
- | evstdd SAVE0, NODE:TMP2->val
- | bne >7
- |3:
- | ins_next
- |
- |4: // Check for __newindex if previous value is nil.
- | lwz TAB:TMP1, TAB:RB->metatable
- | cmplwi TAB:TMP1, 0
- | beq <2 // No metatable: done.
- | lbz TMP0, TAB:TMP1->nomm
- | andi. TMP0, TMP0, 1<vmeta_tsets
- |
- |5: // Follow hash chain.
- | lwz NODE:TMP2, NODE:TMP2->next
- | cmplwi NODE:TMP2, 0
- | bne <1
- | // End of hash chain: key not found, add a new one.
- |
- | // But check for __newindex first.
- | lwz TAB:TMP1, TAB:RB->metatable
- | la CARG3, DISPATCH_GL(tmptv)(DISPATCH)
- | stw PC, SAVE_PC
- | mr CARG1, L
- | cmplwi TAB:TMP1, 0
- | stw BASE, L->base
- | beq >6 // No metatable: continue.
- | lbz TMP0, TAB:TMP1->nomm
- | andi. TMP0, TMP0, 1<vmeta_tsets // 'no __newindex' flag NOT set: check.
- |6:
- | mr CARG2, TAB:RB
- | evstdd STR:RC, 0(CARG3)
- | bl extern lj_tab_newkey // (lua_State *L, GCtab *t, TValue *k)
- | // Returns TValue *.
- | lwz BASE, L->base
- | evstdd SAVE0, 0(CRET1)
- | b <3 // No 2nd write barrier needed.
- |
- |7: // Possible table write barrier for the value. Skip valiswhite check.
- | barrierback TAB:RB, TMP3, TMP0
- | b <3
- break;
- case BC_TSETB:
- | // RA = src*8, RB = table*8, RC = index*8
- | evlddx TAB:RB, BASE, RB
- | srwi TMP0, RC, 3
- | checktab TAB:RB
- | checkfail ->vmeta_tsetb
- | lwz TMP1, TAB:RB->asize
- | lwz TMP2, TAB:RB->array
- | lbz TMP3, TAB:RB->marked
- | cmplw TMP0, TMP1
- | evlddx SAVE0, BASE, RA
- | bge ->vmeta_tsetb
- | evlddx TMP1, TMP2, RC
- | checknil TMP1
- | checkok >5
- |1:
- | andi. TMP0, TMP3, LJ_GC_BLACK // isblack(table)
- | evstddx SAVE0, TMP2, RC
- | bne >7
- |2:
- | ins_next
- |
- |5: // Check for __newindex if previous value is nil.
- | lwz TAB:TMP1, TAB:RB->metatable
- | cmplwi TAB:TMP1, 0
- | beq <1 // No metatable: done.
- | lbz TMP1, TAB:TMP1->nomm
- | andi. TMP1, TMP1, 1<vmeta_tsetb // Caveat: preserve TMP0!
- |
- |7: // Possible table write barrier for the value. Skip valiswhite check.
- | barrierback TAB:RB, TMP3, TMP0
- | b <2
- break;
-
- case BC_TSETM:
- | // RA = base*8 (table at base-1), RD = num_const*8 (start index)
- | add RA, BASE, RA
- |1:
- | add TMP3, KBASE, RD
- | lwz TAB:CARG2, -4(RA) // Guaranteed to be a table.
- | addic. TMP0, MULTRES, -8
- | lwz TMP3, 4(TMP3) // Integer constant is in lo-word.
- | srwi CARG3, TMP0, 3
- | beq >4 // Nothing to copy?
- | add CARG3, CARG3, TMP3
- | lwz TMP2, TAB:CARG2->asize
- | slwi TMP1, TMP3, 3
- | lbz TMP3, TAB:CARG2->marked
- | cmplw CARG3, TMP2
- | add TMP2, RA, TMP0
- | lwz TMP0, TAB:CARG2->array
- | bgt >5
- | add TMP1, TMP1, TMP0
- | andi. TMP0, TMP3, LJ_GC_BLACK // isblack(table)
- |3: // Copy result slots to table.
- | evldd TMP0, 0(RA)
- | addi RA, RA, 8
- | cmpw cr1, RA, TMP2
- | evstdd TMP0, 0(TMP1)
- | addi TMP1, TMP1, 8
- | blt cr1, <3
- | bne >7
- |4:
- | ins_next
- |
- |5: // Need to resize array part.
- | stw BASE, L->base
- | mr CARG1, L
- | stw PC, SAVE_PC
- | mr SAVE0, RD
- | bl extern lj_tab_reasize // (lua_State *L, GCtab *t, int nasize)
- | // Must not reallocate the stack.
- | mr RD, SAVE0
- | b <1
- |
- |7: // Possible table write barrier for any value. Skip valiswhite check.
- | barrierback TAB:CARG2, TMP3, TMP0
- | b <4
- break;
-
- /* -- Calls and vararg handling ----------------------------------------- */
-
- case BC_CALLM:
- | // RA = base*8, (RB = (nresults+1)*8,) RC = extra_nargs*8
- | add NARGS8:RC, NARGS8:RC, MULTRES
- | // Fall through. Assumes BC_CALL follows.
- break;
- case BC_CALL:
- | // RA = base*8, (RB = (nresults+1)*8,) RC = (nargs+1)*8
- | evlddx LFUNC:RB, BASE, RA
- | mr TMP2, BASE
- | add BASE, BASE, RA
- | subi NARGS8:RC, NARGS8:RC, 8
- | checkfunc LFUNC:RB
- | addi BASE, BASE, 8
- | checkfail ->vmeta_call
- | ins_call
- break;
-
- case BC_CALLMT:
- | // RA = base*8, (RB = 0,) RC = extra_nargs*8
- | add NARGS8:RC, NARGS8:RC, MULTRES
- | // Fall through. Assumes BC_CALLT follows.
- break;
- case BC_CALLT:
- | // RA = base*8, (RB = 0,) RC = (nargs+1)*8
- | evlddx LFUNC:RB, BASE, RA
- | add RA, BASE, RA
- | lwz TMP1, FRAME_PC(BASE)
- | subi NARGS8:RC, NARGS8:RC, 8
- | checkfunc LFUNC:RB
- | addi RA, RA, 8
- | checkfail ->vmeta_callt
- |->BC_CALLT_Z:
- | andi. TMP0, TMP1, FRAME_TYPE // Caveat: preserve cr0 until the crand.
- | lbz TMP3, LFUNC:RB->ffid
- | xori TMP2, TMP1, FRAME_VARG
- | cmplwi cr1, NARGS8:RC, 0
- | bne >7
- |1:
- | stw LFUNC:RB, FRAME_FUNC(BASE) // Copy function down, but keep PC.
- | li TMP2, 0
- | cmplwi cr7, TMP3, 1 // (> FF_C) Calling a fast function?
- | beq cr1, >3
- |2:
- | addi TMP3, TMP2, 8
- | evlddx TMP0, RA, TMP2
- | cmplw cr1, TMP3, NARGS8:RC
- | evstddx TMP0, BASE, TMP2
- | mr TMP2, TMP3
- | bne cr1, <2
- |3:
- | crand 4*cr0+eq, 4*cr0+eq, 4*cr7+gt
- | beq >5
- |4:
- | ins_callt
- |
- |5: // Tailcall to a fast function with a Lua frame below.
- | lwz INS, -4(TMP1)
- | decode_RA8 RA, INS
- | sub TMP1, BASE, RA
- | lwz LFUNC:TMP1, FRAME_FUNC-8(TMP1)
- | lwz TMP1, LFUNC:TMP1->pc
- | lwz KBASE, PC2PROTO(k)(TMP1) // Need to prepare KBASE.
- | b <4
- |
- |7: // Tailcall from a vararg function.
- | andi. TMP0, TMP2, FRAME_TYPEP
- | bne <1 // Vararg frame below?
- | sub BASE, BASE, TMP2 // Relocate BASE down.
- | lwz TMP1, FRAME_PC(BASE)
- | andi. TMP0, TMP1, FRAME_TYPE
- | b <1
- break;
-
- case BC_ITERC:
- | // RA = base*8, (RB = (nresults+1)*8, RC = (nargs+1)*8 ((2+1)*8))
- | subi RA, RA, 24 // evldd doesn't support neg. offsets.
- | mr TMP2, BASE
- | evlddx LFUNC:RB, BASE, RA
- | add BASE, BASE, RA
- | evldd TMP0, 8(BASE)
- | evldd TMP1, 16(BASE)
- | evstdd LFUNC:RB, 24(BASE) // Copy callable.
- | checkfunc LFUNC:RB
- | evstdd TMP0, 32(BASE) // Copy state.
- | li NARGS8:RC, 16 // Iterators get 2 arguments.
- | evstdd TMP1, 40(BASE) // Copy control var.
- | addi BASE, BASE, 32
- | checkfail ->vmeta_call
- | ins_call
- break;
-
- case BC_ITERN:
- | // RA = base*8, (RB = (nresults+1)*8, RC = (nargs+1)*8 (2+1)*8)
- |.if JIT
- | // NYI: add hotloop, record BC_ITERN.
- |.endif
- | add RA, BASE, RA
- | lwz TAB:RB, -12(RA)
- | lwz RC, -4(RA) // Get index from control var.
- | lwz TMP0, TAB:RB->asize
- | lwz TMP1, TAB:RB->array
- | addi PC, PC, 4
- |1: // Traverse array part.
- | cmplw RC, TMP0
- | slwi TMP3, RC, 3
- | bge >5 // Index points after array part?
- | evlddx TMP2, TMP1, TMP3
- | checknil TMP2
- | lwz INS, -4(PC)
- | checkok >4
- | efdcfsi TMP0, RC
- | addi RC, RC, 1
- | addis TMP3, PC, -(BCBIAS_J*4 >> 16)
- | evstdd TMP2, 8(RA)
- | decode_RD4 TMP1, INS
- | stw RC, -4(RA) // Update control var.
- | add PC, TMP1, TMP3
- | evstdd TMP0, 0(RA)
- |3:
- | ins_next
- |
- |4: // Skip holes in array part.
- | addi RC, RC, 1
- | b <1
- |
- |5: // Traverse hash part.
- | lwz TMP1, TAB:RB->hmask
- | sub RC, RC, TMP0
- | lwz TMP2, TAB:RB->node
- |6:
- | cmplw RC, TMP1 // End of iteration? Branch to ITERL+1.
- | slwi TMP3, RC, 5
- | bgt <3
- | slwi RB, RC, 3
- | sub TMP3, TMP3, RB
- | evlddx RB, TMP2, TMP3
- | add NODE:TMP3, TMP2, TMP3
- | checknil RB
- | lwz INS, -4(PC)
- | checkok >7
- | evldd TMP3, NODE:TMP3->key
- | addis TMP2, PC, -(BCBIAS_J*4 >> 16)
- | evstdd RB, 8(RA)
- | add RC, RC, TMP0
- | decode_RD4 TMP1, INS
- | evstdd TMP3, 0(RA)
- | addi RC, RC, 1
- | add PC, TMP1, TMP2
- | stw RC, -4(RA) // Update control var.
- | b <3
- |
- |7: // Skip holes in hash part.
- | addi RC, RC, 1
- | b <6
- break;
-
- case BC_ISNEXT:
- | // RA = base*8, RD = target (points to ITERN)
- | add RA, BASE, RA
- | li TMP2, -24
- | evlddx CFUNC:TMP1, RA, TMP2
- | lwz TMP2, -16(RA)
- | lwz TMP3, -8(RA)
- | evmergehi TMP0, CFUNC:TMP1, CFUNC:TMP1
- | cmpwi cr0, TMP2, LJ_TTAB
- | cmpwi cr1, TMP0, LJ_TFUNC
- | cmpwi cr6, TMP3, LJ_TNIL
- | bne cr1, >5
- | lbz TMP1, CFUNC:TMP1->ffid
- | crand 4*cr0+eq, 4*cr0+eq, 4*cr6+eq
- | cmpwi cr7, TMP1, FF_next_N
- | srwi TMP0, RD, 1
- | crand 4*cr0+eq, 4*cr0+eq, 4*cr7+eq
- | add TMP3, PC, TMP0
- | bne cr0, >5
- | lus TMP1, 0xfffe
- | ori TMP1, TMP1, 0x7fff
- | stw ZERO, -4(RA) // Initialize control var.
- | stw TMP1, -8(RA)
- | addis PC, TMP3, -(BCBIAS_J*4 >> 16)
- |1:
- | ins_next
- |5: // Despecialize bytecode if any of the checks fail.
- | li TMP0, BC_JMP
- | li TMP1, BC_ITERC
- | stb TMP0, -1(PC)
- | addis PC, TMP3, -(BCBIAS_J*4 >> 16)
- | stb TMP1, 3(PC)
- | b <1
- break;
-
- case BC_VARG:
- | // RA = base*8, RB = (nresults+1)*8, RC = numparams*8
- | lwz TMP0, FRAME_PC(BASE)
- | add RC, BASE, RC
- | add RA, BASE, RA
- | addi RC, RC, FRAME_VARG
- | add TMP2, RA, RB
- | subi TMP3, BASE, 8 // TMP3 = vtop
- | sub RC, RC, TMP0 // RC = vbase
- | // Note: RC may now be even _above_ BASE if nargs was < numparams.
- | cmplwi cr1, RB, 0
- | sub. TMP1, TMP3, RC
- | beq cr1, >5 // Copy all varargs?
- | subi TMP2, TMP2, 16
- | ble >2 // No vararg slots?
- |1: // Copy vararg slots to destination slots.
- | evldd TMP0, 0(RC)
- | addi RC, RC, 8
- | evstdd TMP0, 0(RA)
- | cmplw RA, TMP2
- | cmplw cr1, RC, TMP3
- | bge >3 // All destination slots filled?
- | addi RA, RA, 8
- | blt cr1, <1 // More vararg slots?
- |2: // Fill up remainder with nil.
- | evstdd TISNIL, 0(RA)
- | cmplw RA, TMP2
- | addi RA, RA, 8
- | blt <2
- |3:
- | ins_next
- |
- |5: // Copy all varargs.
- | lwz TMP0, L->maxstack
- | li MULTRES, 8 // MULTRES = (0+1)*8
- | ble <3 // No vararg slots?
- | add TMP2, RA, TMP1
- | cmplw TMP2, TMP0
- | addi MULTRES, TMP1, 8
- | bgt >7
- |6:
- | evldd TMP0, 0(RC)
- | addi RC, RC, 8
- | evstdd TMP0, 0(RA)
- | cmplw RC, TMP3
- | addi RA, RA, 8
- | blt <6 // More vararg slots?
- | b <3
- |
- |7: // Grow stack for varargs.
- | mr CARG1, L
- | stw RA, L->top
- | sub SAVE0, RC, BASE // Need delta, because BASE may change.
- | stw BASE, L->base
- | sub RA, RA, BASE
- | stw PC, SAVE_PC
- | srwi CARG2, TMP1, 3
- | bl extern lj_state_growstack // (lua_State *L, int n)
- | lwz BASE, L->base
- | add RA, BASE, RA
- | add RC, BASE, SAVE0
- | subi TMP3, BASE, 8
- | b <6
- break;
-
- /* -- Returns ----------------------------------------------------------- */
-
- case BC_RETM:
- | // RA = results*8, RD = extra_nresults*8
- | add RD, RD, MULTRES // MULTRES >= 8, so RD >= 8.
- | // Fall through. Assumes BC_RET follows.
- break;
-
- case BC_RET:
- | // RA = results*8, RD = (nresults+1)*8
- | lwz PC, FRAME_PC(BASE)
- | add RA, BASE, RA
- | mr MULTRES, RD
- |1:
- | andi. TMP0, PC, FRAME_TYPE
- | xori TMP1, PC, FRAME_VARG
- | bne ->BC_RETV_Z
- |
- |->BC_RET_Z:
- | // BASE = base, RA = resultptr, RD = (nresults+1)*8, PC = return
- | lwz INS, -4(PC)
- | cmpwi RD, 8
- | subi TMP2, BASE, 8
- | subi RC, RD, 8
- | decode_RB8 RB, INS
- | beq >3
- | li TMP1, 0
- |2:
- | addi TMP3, TMP1, 8
- | evlddx TMP0, RA, TMP1
- | cmpw TMP3, RC
- | evstddx TMP0, TMP2, TMP1
- | beq >3
- | addi TMP1, TMP3, 8
- | evlddx TMP0, RA, TMP3
- | cmpw TMP1, RC
- | evstddx TMP0, TMP2, TMP3
- | bne <2
- |3:
- |5:
- | cmplw RB, RD
- | decode_RA8 RA, INS
- | bgt >6
- | sub BASE, TMP2, RA
- | lwz LFUNC:TMP1, FRAME_FUNC(BASE)
- | ins_next1
- | lwz TMP1, LFUNC:TMP1->pc
- | lwz KBASE, PC2PROTO(k)(TMP1)
- | ins_next2
- |
- |6: // Fill up results with nil.
- | subi TMP1, RD, 8
- | addi RD, RD, 8
- | evstddx TISNIL, TMP2, TMP1
- | b <5
- |
- |->BC_RETV_Z: // Non-standard return case.
- | andi. TMP2, TMP1, FRAME_TYPEP
- | bne ->vm_return
- | // Return from vararg function: relocate BASE down.
- | sub BASE, BASE, TMP1
- | lwz PC, FRAME_PC(BASE)
- | b <1
- break;
-
- case BC_RET0: case BC_RET1:
- | // RA = results*8, RD = (nresults+1)*8
- | lwz PC, FRAME_PC(BASE)
- | add RA, BASE, RA
- | mr MULTRES, RD
- | andi. TMP0, PC, FRAME_TYPE
- | xori TMP1, PC, FRAME_VARG
- | bne ->BC_RETV_Z
- |
- | lwz INS, -4(PC)
- | subi TMP2, BASE, 8
- | decode_RB8 RB, INS
- if (op == BC_RET1) {
- | evldd TMP0, 0(RA)
- | evstdd TMP0, 0(TMP2)
- }
- |5:
- | cmplw RB, RD
- | decode_RA8 RA, INS
- | bgt >6
- | sub BASE, TMP2, RA
- | lwz LFUNC:TMP1, FRAME_FUNC(BASE)
- | ins_next1
- | lwz TMP1, LFUNC:TMP1->pc
- | lwz KBASE, PC2PROTO(k)(TMP1)
- | ins_next2
- |
- |6: // Fill up results with nil.
- | subi TMP1, RD, 8
- | addi RD, RD, 8
- | evstddx TISNIL, TMP2, TMP1
- | b <5
- break;
-
- /* -- Loops and branches ------------------------------------------------ */
-
- case BC_FORL:
- |.if JIT
- | hotloop
- |.endif
- | // Fall through. Assumes BC_IFORL follows.
- break;
-
- case BC_JFORI:
- case BC_JFORL:
-#if !LJ_HASJIT
- break;
-#endif
- case BC_FORI:
- case BC_IFORL:
- | // RA = base*8, RD = target (after end of loop or start of loop)
- vk = (op == BC_IFORL || op == BC_JFORL);
- | add RA, BASE, RA
- | evldd TMP1, FORL_IDX*8(RA)
- | evldd TMP3, FORL_STEP*8(RA)
- | evldd TMP2, FORL_STOP*8(RA)
- if (!vk) {
- | evcmpgtu cr0, TMP1, TISNUM
- | evcmpgtu cr7, TMP3, TISNUM
- | evcmpgtu cr1, TMP2, TISNUM
- | cror 4*cr0+lt, 4*cr0+lt, 4*cr7+lt
- | cror 4*cr0+lt, 4*cr0+lt, 4*cr1+lt
- | blt ->vmeta_for
- }
- if (vk) {
- | efdadd TMP1, TMP1, TMP3
- | evstdd TMP1, FORL_IDX*8(RA)
- }
- | evcmpgts TMP3, TISNIL
- | evstdd TMP1, FORL_EXT*8(RA)
- | bge >2
- | efdcmpgt TMP1, TMP2
- |1:
- if (op != BC_JFORL) {
- | srwi RD, RD, 1
- | add RD, PC, RD
- if (op == BC_JFORI) {
- | addis PC, RD, -(BCBIAS_J*4 >> 16)
- } else {
- | addis RD, RD, -(BCBIAS_J*4 >> 16)
- }
- }
- if (op == BC_FORI) {
- | iselgt PC, RD, PC
- } else if (op == BC_IFORL) {
- | iselgt PC, PC, RD
- } else {
- | ble =>BC_JLOOP
- }
- | ins_next
- |2:
- | efdcmpgt TMP2, TMP1
- | b <1
- break;
-
- case BC_ITERL:
- |.if JIT
- | hotloop
- |.endif
- | // Fall through. Assumes BC_IITERL follows.
- break;
-
- case BC_JITERL:
-#if !LJ_HASJIT
- break;
-#endif
- case BC_IITERL:
- | // RA = base*8, RD = target
- | evlddx TMP1, BASE, RA
- | subi RA, RA, 8
- | checknil TMP1
- | checkok >1 // Stop if iterator returned nil.
- if (op == BC_JITERL) {
- | NYI
- } else {
- | branch_RD // Otherwise save control var + branch.
- | evstddx TMP1, BASE, RA
- }
- |1:
- | ins_next
- break;
-
- case BC_LOOP:
- | // RA = base*8, RD = target (loop extent)
- | // Note: RA/RD is only used by trace recorder to determine scope/extent
- | // This opcode does NOT jump, it's only purpose is to detect a hot loop.
- |.if JIT
- | hotloop
- |.endif
- | // Fall through. Assumes BC_ILOOP follows.
- break;
-
- case BC_ILOOP:
- | // RA = base*8, RD = target (loop extent)
- | ins_next
- break;
-
- case BC_JLOOP:
- |.if JIT
- | NYI
- |.endif
- break;
-
- case BC_JMP:
- | // RA = base*8 (only used by trace recorder), RD = target
- | branch_RD
- | ins_next
- break;
-
- /* -- Function headers -------------------------------------------------- */
-
- case BC_FUNCF:
- |.if JIT
- | hotcall
- |.endif
- case BC_FUNCV: /* NYI: compiled vararg functions. */
- | // Fall through. Assumes BC_IFUNCF/BC_IFUNCV follow.
- break;
-
- case BC_JFUNCF:
-#if !LJ_HASJIT
- break;
-#endif
- case BC_IFUNCF:
- | // BASE = new base, RA = BASE+framesize*8, RB = LFUNC, RC = nargs*8
- | lwz TMP2, L->maxstack
- | lbz TMP1, -4+PC2PROTO(numparams)(PC)
- | lwz KBASE, -4+PC2PROTO(k)(PC)
- | cmplw RA, TMP2
- | slwi TMP1, TMP1, 3
- | bgt ->vm_growstack_l
- | ins_next1
- |2:
- | cmplw NARGS8:RC, TMP1 // Check for missing parameters.
- | ble >3
- if (op == BC_JFUNCF) {
- | NYI
- } else {
- | ins_next2
- }
- |
- |3: // Clear missing parameters.
- | evstddx TISNIL, BASE, NARGS8:RC
- | addi NARGS8:RC, NARGS8:RC, 8
- | b <2
- break;
-
- case BC_JFUNCV:
-#if !LJ_HASJIT
- break;
-#endif
- | NYI // NYI: compiled vararg functions
- break; /* NYI: compiled vararg functions. */
-
- case BC_IFUNCV:
- | // BASE = new base, RA = BASE+framesize*8, RB = LFUNC, RC = nargs*8
- | lwz TMP2, L->maxstack
- | add TMP1, BASE, RC
- | add TMP0, RA, RC
- | stw LFUNC:RB, 4(TMP1) // Store copy of LFUNC.
- | addi TMP3, RC, 8+FRAME_VARG
- | lwz KBASE, -4+PC2PROTO(k)(PC)
- | cmplw TMP0, TMP2
- | stw TMP3, 0(TMP1) // Store delta + FRAME_VARG.
- | bge ->vm_growstack_l
- | lbz TMP2, -4+PC2PROTO(numparams)(PC)
- | mr RA, BASE
- | mr RC, TMP1
- | ins_next1
- | cmpwi TMP2, 0
- | addi BASE, TMP1, 8
- | beq >3
- |1:
- | cmplw RA, RC // Less args than parameters?
- | evldd TMP0, 0(RA)
- | bge >4
- | evstdd TISNIL, 0(RA) // Clear old fixarg slot (help the GC).
- | addi RA, RA, 8
- |2:
- | addic. TMP2, TMP2, -1
- | evstdd TMP0, 8(TMP1)
- | addi TMP1, TMP1, 8
- | bne <1
- |3:
- | ins_next2
- |
- |4: // Clear missing parameters.
- | evmr TMP0, TISNIL
- | b <2
- break;
-
- case BC_FUNCC:
- case BC_FUNCCW:
- | // BASE = new base, RA = BASE+framesize*8, RB = CFUNC, RC = nargs*8
- if (op == BC_FUNCC) {
- | lwz TMP3, CFUNC:RB->f
- } else {
- | lwz TMP3, DISPATCH_GL(wrapf)(DISPATCH)
- }
- | add TMP1, RA, NARGS8:RC
- | lwz TMP2, L->maxstack
- | add RC, BASE, NARGS8:RC
- | stw BASE, L->base
- | cmplw TMP1, TMP2
- | stw RC, L->top
- | li_vmstate C
- | mtctr TMP3
- if (op == BC_FUNCCW) {
- | lwz CARG2, CFUNC:RB->f
- }
- | mr CARG1, L
- | bgt ->vm_growstack_c // Need to grow stack.
- | st_vmstate
- | bctrl // (lua_State *L [, lua_CFunction f])
- | // Returns nresults.
- | lwz TMP1, L->top
- | slwi RD, CRET1, 3
- | lwz BASE, L->base
- | li_vmstate INTERP
- | lwz PC, FRAME_PC(BASE) // Fetch PC of caller.
- | sub RA, TMP1, RD // RA = L->top - nresults*8
- | st_vmstate
- | b ->vm_returnc
- break;
-
- /* ---------------------------------------------------------------------- */
-
- default:
- fprintf(stderr, "Error: undefined opcode BC_%s\n", bc_names[op]);
- exit(2);
- break;
- }
-}
-
-static int build_backend(BuildCtx *ctx)
-{
- int op;
-
- dasm_growpc(Dst, BC__MAX);
-
- build_subroutines(ctx);
-
- |.code_op
- for (op = 0; op < BC__MAX; op++)
- build_ins(ctx, (BCOp)op, op);
-
- return BC__MAX;
-}
-
-/* Emit pseudo frame-info for all assembler functions. */
-static void emit_asm_debug(BuildCtx *ctx)
-{
- int i;
- switch (ctx->mode) {
- case BUILD_elfasm:
- fprintf(ctx->fp, "\t.section .debug_frame,\"\",@progbits\n");
- fprintf(ctx->fp,
- ".Lframe0:\n"
- "\t.long .LECIE0-.LSCIE0\n"
- ".LSCIE0:\n"
- "\t.long 0xffffffff\n"
- "\t.byte 0x1\n"
- "\t.string \"\"\n"
- "\t.uleb128 0x1\n"
- "\t.sleb128 -4\n"
- "\t.byte 65\n"
- "\t.byte 0xc\n\t.uleb128 1\n\t.uleb128 0\n"
- "\t.align 2\n"
- ".LECIE0:\n\n");
- fprintf(ctx->fp,
- ".LSFDE0:\n"
- "\t.long .LEFDE0-.LASFDE0\n"
- ".LASFDE0:\n"
- "\t.long .Lframe0\n"
- "\t.long .Lbegin\n"
- "\t.long %d\n"
- "\t.byte 0xe\n\t.uleb128 %d\n"
- "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
- "\t.byte 0x5\n\t.uleb128 70\n\t.sleb128 37\n",
- (int)ctx->codesz, CFRAME_SIZE);
- for (i = 14; i <= 31; i++)
- fprintf(ctx->fp,
- "\t.byte %d\n\t.uleb128 %d\n"
- "\t.byte 5\n\t.uleb128 %d\n\t.uleb128 %d\n",
- 0x80+i, 1+2*(31-i), 1200+i, 2+2*(31-i));
- fprintf(ctx->fp,
- "\t.align 2\n"
- ".LEFDE0:\n\n");
- fprintf(ctx->fp, "\t.section .eh_frame,\"a\",@progbits\n");
- fprintf(ctx->fp,
- ".Lframe1:\n"
- "\t.long .LECIE1-.LSCIE1\n"
- ".LSCIE1:\n"
- "\t.long 0\n"
- "\t.byte 0x1\n"
- "\t.string \"zPR\"\n"
- "\t.uleb128 0x1\n"
- "\t.sleb128 -4\n"
- "\t.byte 65\n"
- "\t.uleb128 6\n" /* augmentation length */
- "\t.byte 0x1b\n" /* pcrel|sdata4 */
- "\t.long lj_err_unwind_dwarf-.\n"
- "\t.byte 0x1b\n" /* pcrel|sdata4 */
- "\t.byte 0xc\n\t.uleb128 1\n\t.uleb128 0\n"
- "\t.align 2\n"
- ".LECIE1:\n\n");
- fprintf(ctx->fp,
- ".LSFDE1:\n"
- "\t.long .LEFDE1-.LASFDE1\n"
- ".LASFDE1:\n"
- "\t.long .LASFDE1-.Lframe1\n"
- "\t.long .Lbegin-.\n"
- "\t.long %d\n"
- "\t.uleb128 0\n" /* augmentation length */
- "\t.byte 0xe\n\t.uleb128 %d\n"
- "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
- "\t.byte 0x5\n\t.uleb128 70\n\t.sleb128 37\n",
- (int)ctx->codesz, CFRAME_SIZE);
- for (i = 14; i <= 31; i++)
- fprintf(ctx->fp,
- "\t.byte %d\n\t.uleb128 %d\n"
- "\t.byte 5\n\t.uleb128 %d\n\t.uleb128 %d\n",
- 0x80+i, 1+2*(31-i), 1200+i, 2+2*(31-i));
- fprintf(ctx->fp,
- "\t.align 2\n"
- ".LEFDE1:\n\n");
- break;
- default:
- break;
- }
-}
-
diff --git a/source/libs/luajit/LuaJIT-2.0.4-PATCHES/ChangeLog b/source/libs/luajit/LuaJIT-2.1.0-beta1-PATCHES/ChangeLog
similarity index 88%
rename from source/libs/luajit/LuaJIT-2.0.4-PATCHES/ChangeLog
rename to source/libs/luajit/LuaJIT-2.1.0-beta1-PATCHES/ChangeLog
index fb756444b..5ef8ddb84 100644
--- a/source/libs/luajit/LuaJIT-2.0.4-PATCHES/ChangeLog
+++ b/source/libs/luajit/LuaJIT-2.1.0-beta1-PATCHES/ChangeLog
@@ -1,3 +1,11 @@
+2015-09-07 Peter Breitenlohner
+
+ Import LuaJIT-2.1.0-beta1.
+
+ * patch-01-LuaJITTeX: Adapted.
+ * patch-05-LuaJITTeX: Adapted.
+ * patch-06-ppc-darwin: Adapted.
+
2015-06-12 Peter Breitenlohner
Import LuaJIT-2.0.4.
diff --git a/source/libs/luajit/LuaJIT-2.0.4-PATCHES/patch-01-LuaJITTeX b/source/libs/luajit/LuaJIT-2.1.0-beta1-PATCHES/patch-01-LuaJITTeX
similarity index 69%
rename from source/libs/luajit/LuaJIT-2.0.4-PATCHES/patch-01-LuaJITTeX
rename to source/libs/luajit/LuaJIT-2.1.0-beta1-PATCHES/patch-01-LuaJITTeX
index db988a6a4..4853f00cc 100644
--- a/source/libs/luajit/LuaJIT-2.0.4-PATCHES/patch-01-LuaJITTeX
+++ b/source/libs/luajit/LuaJIT-2.1.0-beta1-PATCHES/patch-01-LuaJITTeX
@@ -1,6 +1,6 @@
-diff -ur -x lbitlib.c LuaJIT-2.0.4.orig/src/lauxlib.h LuaJIT-2.0.4/src/lauxlib.h
---- LuaJIT-2.0.4.orig/src/lauxlib.h 2015-05-14 20:30:00.000000000 +0200
-+++ LuaJIT-2.0.4/src/lauxlib.h 2015-06-12 11:04:08.000000000 +0200
+diff -ur LuaJIT-2.1.0-beta1.orig/src/lauxlib.h LuaJIT-2.1.0-beta1/src/lauxlib.h
+--- LuaJIT-2.1.0-beta1.orig/src/lauxlib.h 2015-08-25 23:35:00.000000000 +0200
++++ LuaJIT-2.1.0-beta1/src/lauxlib.h 2015-09-04 08:42:39.000000000 +0200
@@ -86,6 +86,32 @@
int level);
@@ -34,9 +34,9 @@ diff -ur -x lbitlib.c LuaJIT-2.0.4.orig/src/lauxlib.h LuaJIT-2.0.4/src/lauxlib.h
/*
** ===============================================================
** some useful macros
-diff -ur -x lbitlib.c LuaJIT-2.0.4.orig/src/lib_init.c LuaJIT-2.0.4/src/lib_init.c
---- LuaJIT-2.0.4.orig/src/lib_init.c 2015-05-14 20:30:00.000000000 +0200
-+++ LuaJIT-2.0.4/src/lib_init.c 2015-06-12 11:04:08.000000000 +0200
+diff -ur LuaJIT-2.1.0-beta1.orig/src/lib_init.c LuaJIT-2.1.0-beta1/src/lib_init.c
+--- LuaJIT-2.1.0-beta1.orig/src/lib_init.c 2015-08-25 23:35:00.000000000 +0200
++++ LuaJIT-2.1.0-beta1/src/lib_init.c 2015-09-04 08:42:39.000000000 +0200
@@ -26,6 +26,7 @@
{ LUA_DBLIBNAME, luaopen_debug },
{ LUA_BITLIBNAME, luaopen_bit },
@@ -45,10 +45,10 @@ diff -ur -x lbitlib.c LuaJIT-2.0.4.orig/src/lib_init.c LuaJIT-2.0.4/src/lib_init
{ NULL, NULL }
};
-diff -ur -x lbitlib.c LuaJIT-2.0.4.orig/src/lib_package.c LuaJIT-2.0.4/src/lib_package.c
---- LuaJIT-2.0.4.orig/src/lib_package.c 2015-05-14 20:30:00.000000000 +0200
-+++ LuaJIT-2.0.4/src/lib_package.c 2015-06-12 11:04:08.000000000 +0200
-@@ -354,6 +354,29 @@
+diff -ur LuaJIT-2.1.0-beta1.orig/src/lib_package.c LuaJIT-2.1.0-beta1/src/lib_package.c
+--- LuaJIT-2.1.0-beta1.orig/src/lib_package.c 2015-08-25 23:35:00.000000000 +0200
++++ LuaJIT-2.1.0-beta1/src/lib_package.c 2015-09-04 08:42:39.000000000 +0200
+@@ -362,6 +362,29 @@
return 1; /* library loaded successfully */
}
@@ -78,7 +78,7 @@ diff -ur -x lbitlib.c LuaJIT-2.0.4.orig/src/lib_package.c LuaJIT-2.0.4/src/lib_p
static int lj_cf_package_loader_croot(lua_State *L)
{
const char *filename;
-@@ -373,6 +396,21 @@
+@@ -381,6 +404,21 @@
return 1;
}
@@ -100,9 +100,9 @@ diff -ur -x lbitlib.c LuaJIT-2.0.4.orig/src/lib_package.c LuaJIT-2.0.4/src/lib_p
static int lj_cf_package_loader_preload(lua_State *L)
{
const char *name = luaL_checkstring(L, 1);
-diff -ur -x lbitlib.c LuaJIT-2.0.4.orig/src/lua.h LuaJIT-2.0.4/src/lua.h
---- LuaJIT-2.0.4.orig/src/lua.h 2015-05-14 20:30:00.000000000 +0200
-+++ LuaJIT-2.0.4/src/lua.h 2015-06-12 11:04:08.000000000 +0200
+diff -ur LuaJIT-2.1.0-beta1.orig/src/lua.h LuaJIT-2.1.0-beta1/src/lua.h
+--- LuaJIT-2.1.0-beta1.orig/src/lua.h 2015-08-25 23:35:00.000000000 +0200
++++ LuaJIT-2.1.0-beta1/src/lua.h 2015-09-04 08:42:39.000000000 +0200
@@ -348,6 +348,16 @@
const char *chunkname, const char *mode);
@@ -120,9 +120,9 @@ diff -ur -x lbitlib.c LuaJIT-2.0.4.orig/src/lua.h LuaJIT-2.0.4/src/lua.h
struct lua_Debug {
int event;
const char *name; /* (n) */
-diff -ur -x lbitlib.c LuaJIT-2.0.4.orig/src/lualib.h LuaJIT-2.0.4/src/lualib.h
---- LuaJIT-2.0.4.orig/src/lualib.h 2015-05-14 20:30:00.000000000 +0200
-+++ LuaJIT-2.0.4/src/lualib.h 2015-06-12 11:04:08.000000000 +0200
+diff -ur LuaJIT-2.1.0-beta1.orig/src/lualib.h LuaJIT-2.1.0-beta1/src/lualib.h
+--- LuaJIT-2.1.0-beta1.orig/src/lualib.h 2015-08-25 23:35:00.000000000 +0200
++++ LuaJIT-2.1.0-beta1/src/lualib.h 2015-09-04 08:42:39.000000000 +0200
@@ -22,6 +22,8 @@
#define LUA_JITLIBNAME "jit"
#define LUA_FFILIBNAME "ffi"
@@ -141,10 +141,10 @@ diff -ur -x lbitlib.c LuaJIT-2.0.4.orig/src/lualib.h LuaJIT-2.0.4/src/lualib.h
LUALIB_API void luaL_openlibs(lua_State *L);
#ifndef lua_assert
-diff -ur -x lbitlib.c LuaJIT-2.0.4.orig/src/Makefile LuaJIT-2.0.4/src/Makefile
---- LuaJIT-2.0.4.orig/src/Makefile 2015-05-14 20:30:00.000000000 +0200
-+++ LuaJIT-2.0.4/src/Makefile 2015-06-12 11:04:08.000000000 +0200
-@@ -100,7 +100,7 @@
+diff -ur LuaJIT-2.1.0-beta1.orig/src/Makefile LuaJIT-2.1.0-beta1/src/Makefile
+--- LuaJIT-2.1.0-beta1.orig/src/Makefile 2015-08-25 23:35:00.000000000 +0200
++++ LuaJIT-2.1.0-beta1/src/Makefile 2015-09-04 08:42:39.000000000 +0200
+@@ -97,7 +97,7 @@
# enabled by default. Some other features that *might* break some existing
# code (e.g. __pairs or os.execute() return values) can be enabled here.
# Note: this does not provide full compatibility with Lua 5.2 at this time.
@@ -153,7 +153,7 @@ diff -ur -x lbitlib.c LuaJIT-2.0.4.orig/src/Makefile LuaJIT-2.0.4/src/Makefile
#
# Disable the JIT compiler, i.e. turn LuaJIT into a pure interpreter.
#XCFLAGS+= -DLUAJIT_DISABLE_JIT
-@@ -448,7 +448,7 @@
+@@ -456,7 +456,7 @@
LJVM_BOUT= $(LJVM_S)
LJVM_MODE= elfasm
@@ -162,15 +162,14 @@ diff -ur -x lbitlib.c LuaJIT-2.0.4.orig/src/Makefile LuaJIT-2.0.4/src/Makefile
lib_io.o lib_os.o lib_package.o lib_debug.o lib_jit.o lib_ffi.o
LJLIB_C= $(LJLIB_O:.o=.c)
-diff -ur -x lbitlib.c LuaJIT-2.0.4.orig/src/Makefile.dep LuaJIT-2.0.4/src/Makefile.dep
---- LuaJIT-2.0.4.orig/src/Makefile.dep 2015-05-14 20:30:00.000000000 +0200
-+++ LuaJIT-2.0.4/src/Makefile.dep 2015-06-12 11:04:08.000000000 +0200
+diff -ur LuaJIT-2.1.0-beta1.orig/src/Makefile.dep LuaJIT-2.1.0-beta1/src/Makefile.dep
+--- LuaJIT-2.1.0-beta1.orig/src/Makefile.dep 2015-08-25 23:35:00.000000000 +0200
++++ LuaJIT-2.1.0-beta1/src/Makefile.dep 2015-09-04 08:46:10.000000000 +0200
@@ -6,6 +6,7 @@
lj_tab.h lj_meta.h lj_state.h lj_ctype.h lj_cconv.h lj_bc.h lj_ff.h \
lj_ffdef.h lj_dispatch.h lj_jit.h lj_ir.h lj_char.h lj_strscan.h \
- lj_lib.h lj_libdef.h
+ lj_strfmt.h lj_lib.h lj_libdef.h
+lbitlib.o: lbitlib.c lua.h luaconf.h lauxlib.h lualib.h
lib_bit.o: lib_bit.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h lj_def.h \
- lj_arch.h lj_err.h lj_errmsg.h lj_str.h lj_lib.h lj_libdef.h
- lib_debug.o: lib_debug.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h \
-Only in LuaJIT-2.0.4/src: Makefile.orig
+ lj_arch.h lj_err.h lj_errmsg.h lj_buf.h lj_gc.h lj_str.h lj_strscan.h \
+ lj_strfmt.h lj_ctype.h lj_cdata.h lj_cconv.h lj_carith.h lj_ff.h \
diff --git a/source/libs/luajit/LuaJIT-2.0.4-PATCHES/patch-05-LuaJITTeX b/source/libs/luajit/LuaJIT-2.1.0-beta1-PATCHES/patch-05-LuaJITTeX
similarity index 77%
rename from source/libs/luajit/LuaJIT-2.0.4-PATCHES/patch-05-LuaJITTeX
rename to source/libs/luajit/LuaJIT-2.1.0-beta1-PATCHES/patch-05-LuaJITTeX
index 6d091a020..3a05a52d8 100644
--- a/source/libs/luajit/LuaJIT-2.0.4-PATCHES/patch-05-LuaJITTeX
+++ b/source/libs/luajit/LuaJIT-2.1.0-beta1-PATCHES/patch-05-LuaJITTeX
@@ -1,7 +1,7 @@
-diff -ur -x lbitlib.c LuaJIT-2.0.4.orig/src/lj_def.h LuaJIT-2.0.4/src/lj_def.h
---- LuaJIT-2.0.4.orig/src/lj_def.h 2015-05-14 20:30:00.000000000 +0200
-+++ LuaJIT-2.0.4/src/lj_def.h 2015-06-12 11:05:39.000000000 +0200
-@@ -62,7 +62,7 @@
+diff -ur LuaJIT-2.1.0-beta1.orig/src/lj_def.h LuaJIT-2.1.0-beta1/src/lj_def.h
+--- LuaJIT-2.1.0-beta1.orig/src/lj_def.h 2015-08-25 23:35:00.000000000 +0200
++++ LuaJIT-2.1.0-beta1/src/lj_def.h 2015-09-04 08:51:52.000000000 +0200
+@@ -66,7 +66,7 @@
#define LJ_MAX_BCINS (1<<26) /* Max. # of bytecode instructions. */
#define LJ_MAX_SLOTS 250 /* Max. # of slots in a Lua func. */
#define LJ_MAX_LOCVAR 200 /* Max. # of local variables. */
@@ -9,11 +9,11 @@ diff -ur -x lbitlib.c LuaJIT-2.0.4.orig/src/lj_def.h LuaJIT-2.0.4/src/lj_def.h
+#define LJ_MAX_UPVAL 249 /* Max. # of upvalues. */
#define LJ_MAX_IDXCHAIN 100 /* __index/__newindex chain limit. */
- #define LJ_STACK_EXTRA 5 /* Extra stack space (metamethods). */
-diff -ur -x lbitlib.c LuaJIT-2.0.4.orig/src/lj_str.c LuaJIT-2.0.4/src/lj_str.c
---- LuaJIT-2.0.4.orig/src/lj_str.c 2015-05-14 20:30:00.000000000 +0200
-+++ LuaJIT-2.0.4/src/lj_str.c 2015-06-12 11:05:39.000000000 +0200
-@@ -90,6 +90,16 @@
+ #define LJ_STACK_EXTRA (5+2*LJ_FR2) /* Extra stack space (metamethods). */
+diff -ur LuaJIT-2.1.0-beta1.orig/src/lj_str.c LuaJIT-2.1.0-beta1/src/lj_str.c
+--- LuaJIT-2.1.0-beta1.orig/src/lj_str.c 2015-08-25 23:35:00.000000000 +0200
++++ LuaJIT-2.1.0-beta1/src/lj_str.c 2015-09-04 08:51:52.000000000 +0200
+@@ -118,6 +118,16 @@
g->strhash = newhash;
}
@@ -30,7 +30,7 @@ diff -ur -x lbitlib.c LuaJIT-2.0.4.orig/src/lj_str.c LuaJIT-2.0.4/src/lj_str.c
/* Intern a string and return string object. */
GCstr *lj_str_new(lua_State *L, const char *str, size_t lenx)
{
-@@ -98,27 +108,44 @@
+@@ -126,27 +136,44 @@
GCobj *o;
MSize len = (MSize)lenx;
MSize a, b, h = len;
@@ -92,9 +92,10 @@ diff -ur -x lbitlib.c LuaJIT-2.0.4.orig/src/lj_str.c LuaJIT-2.0.4/src/lj_str.c
/* Check if the string has already been interned. */
o = gcref(g->strhash[h & g->strmask]);
if (LJ_LIKELY((((uintptr_t)str+len-1) & (LJ_PAGESIZE-1)) <= LJ_PAGESIZE-4)) {
-diff -ur -x lbitlib.c LuaJIT-2.0.4.orig/src/lua.h LuaJIT-2.0.4/src/lua.h
---- LuaJIT-2.0.4.orig/src/lua.h 2015-06-12 11:04:08.000000000 +0200
-+++ LuaJIT-2.0.4/src/lua.h 2015-06-12 11:05:39.000000000 +0200
+Only in LuaJIT-2.1.0-beta1/src: lj_str.c.orig
+diff -ur LuaJIT-2.1.0-beta1.orig/src/lua.h LuaJIT-2.1.0-beta1/src/lua.h
+--- LuaJIT-2.1.0-beta1.orig/src/lua.h 2015-09-04 08:42:39.000000000 +0200
++++ LuaJIT-2.1.0-beta1/src/lua.h 2015-09-04 08:51:52.000000000 +0200
@@ -103,6 +103,9 @@
typedef LUA_INTEGER lua_Integer;
@@ -105,4 +106,3 @@ diff -ur -x lbitlib.c LuaJIT-2.0.4.orig/src/lua.h LuaJIT-2.0.4/src/lua.h
/*
** state manipulation
-Only in LuaJIT-2.0.4/src: Makefile.orig
diff --git a/source/libs/luajit/LuaJIT-2.1.0-beta1-PATCHES/patch-06-ppc-darwin b/source/libs/luajit/LuaJIT-2.1.0-beta1-PATCHES/patch-06-ppc-darwin
new file mode 100644
index 000000000..17f7e4a1c
--- /dev/null
+++ b/source/libs/luajit/LuaJIT-2.1.0-beta1-PATCHES/patch-06-ppc-darwin
@@ -0,0 +1,24 @@
+diff -ur LuaJIT-2.1.0-beta1.orig/src/host/buildvm.c LuaJIT-2.1.0-beta1/src/host/buildvm.c
+--- LuaJIT-2.1.0-beta1.orig/src/host/buildvm.c 2015-08-25 23:35:00.000000000 +0200
++++ LuaJIT-2.1.0-beta1/src/host/buildvm.c 2015-09-04 09:03:00.000000000 +0200
+@@ -113,7 +113,7 @@
+ name[0] = '@';
+ else
+ *p = '\0';
+-#elif LJ_TARGET_PPC && !LJ_TARGET_CONSOLE
++#elif LJ_TARGET_PPC && !LJ_TARGET_OSX && !LJ_TARGET_CONSOLE
+ /* Keep @plt etc. */
+ #else
+ *p = '\0';
+diff -ur LuaJIT-2.1.0-beta1.orig/src/lj_arch.h LuaJIT-2.1.0-beta1/src/lj_arch.h
+--- LuaJIT-2.1.0-beta1.orig/src/lj_arch.h 2015-08-25 23:35:00.000000000 +0200
++++ LuaJIT-2.1.0-beta1/src/lj_arch.h 2015-09-04 08:58:07.000000000 +0200
+@@ -324,7 +324,7 @@
+ #if __GNUC__ < 4
+ #error "Need at least GCC 4.0 or newer"
+ #endif
+-#elif LJ_TARGET_ARM
++#elif LJ_TARGET_ARM || LJ_TARGET_PPC
+ #if (__GNUC__ < 4) || ((__GNUC__ == 4) && __GNUC_MINOR__ < 2)
+ #error "Need at least GCC 4.2 or newer"
+ #endif
diff --git a/source/libs/luajit/LuaJIT-2.0.4/COPYRIGHT b/source/libs/luajit/LuaJIT-2.1.0-beta1/COPYRIGHT
similarity index 100%
rename from source/libs/luajit/LuaJIT-2.0.4/COPYRIGHT
rename to source/libs/luajit/LuaJIT-2.1.0-beta1/COPYRIGHT
diff --git a/source/libs/luajit/LuaJIT-2.0.4/Makefile b/source/libs/luajit/LuaJIT-2.1.0-beta1/Makefile
similarity index 87%
rename from source/libs/luajit/LuaJIT-2.0.4/Makefile
rename to source/libs/luajit/LuaJIT-2.1.0-beta1/Makefile
index 0cbe741a4..8ce773e39 100644
--- a/source/libs/luajit/LuaJIT-2.0.4/Makefile
+++ b/source/libs/luajit/LuaJIT-2.1.0-beta1/Makefile
@@ -14,9 +14,10 @@
##############################################################################
MAJVER= 2
-MINVER= 0
-RELVER= 4
-VERSION= $(MAJVER).$(MINVER).$(RELVER)
+MINVER= 1
+RELVER= 0
+PREREL= -beta1
+VERSION= $(MAJVER).$(MINVER).$(RELVER)$(PREREL)
ABIVER= 5.1
##############################################################################
@@ -83,8 +84,9 @@ FILE_SO= libluajit.so
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 v.lua dump.lua dis_x86.lua dis_x64.lua dis_arm.lua \
- dis_ppc.lua dis_mips.lua dis_mipsel.lua bcsave.lua vmdef.lua
+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
ifeq (,$(findstring Windows,$(OS)))
ifeq (Darwin,$(shell uname -s))
@@ -109,7 +111,7 @@ install: $(INSTALL_DEP)
$(MKDIR) $(INSTALL_DIRS)
cd src && $(INSTALL_X) $(FILE_T) $(INSTALL_T)
cd src && test -f $(FILE_A) && $(INSTALL_F) $(FILE_A) $(INSTALL_STATIC) || :
- $(RM) $(INSTALL_TSYM) $(INSTALL_DYN) $(INSTALL_SHORT1) $(INSTALL_SHORT2)
+ $(RM) $(INSTALL_DYN) $(INSTALL_SHORT1) $(INSTALL_SHORT2)
cd src && test -f $(FILE_SO) && \
$(INSTALL_X) $(FILE_SO) $(INSTALL_DYN) && \
$(LDCONFIG) $(INSTALL_LIB) && \
@@ -121,12 +123,18 @@ install: $(INSTALL_DEP)
$(RM) $(FILE_PC).tmp
cd src && $(INSTALL_F) $(FILES_INC) $(INSTALL_INC)
cd src/jit && $(INSTALL_F) $(FILES_JITLIB) $(INSTALL_JITLIB)
- $(SYMLINK) $(INSTALL_TNAME) $(INSTALL_TSYM)
@echo "==== Successfully installed LuaJIT $(VERSION) to $(PREFIX) ===="
+ @echo ""
+ @echo "Note: the development releases deliberately do NOT install a symlink for luajit"
+ @echo "You can do this now by running this command (with sudo):"
+ @echo ""
+ @echo " $(SYMLINK) $(INSTALL_TNAME) $(INSTALL_TSYM)"
+ @echo ""
+
uninstall:
@echo "==== Uninstalling LuaJIT $(VERSION) from $(PREFIX) ===="
- $(UNINSTALL) $(INSTALL_TSYM) $(INSTALL_T) $(INSTALL_STATIC) $(INSTALL_DYN) $(INSTALL_SHORT1) $(INSTALL_SHORT2) $(INSTALL_MAN)/$(FILE_MAN) $(INSTALL_PC)
+ $(UNINSTALL) $(INSTALL_T) $(INSTALL_STATIC) $(INSTALL_DYN) $(INSTALL_SHORT1) $(INSTALL_SHORT2) $(INSTALL_MAN)/$(FILE_MAN) $(INSTALL_PC)
for file in $(FILES_JITLIB); do \
$(UNINSTALL) $(INSTALL_JITLIB)/$$file; \
done
diff --git a/source/libs/luajit/LuaJIT-2.0.4/README b/source/libs/luajit/LuaJIT-2.1.0-beta1/README
similarity index 86%
rename from source/libs/luajit/LuaJIT-2.0.4/README
rename to source/libs/luajit/LuaJIT-2.1.0-beta1/README
index 44366af51..ca70dd8ed 100644
--- a/source/libs/luajit/LuaJIT-2.0.4/README
+++ b/source/libs/luajit/LuaJIT-2.1.0-beta1/README
@@ -1,5 +1,5 @@
-README for LuaJIT 2.0.4
------------------------
+README for LuaJIT 2.1.0-beta1
+-----------------------------
LuaJIT is a Just-In-Time (JIT) compiler for the Lua programming language.
diff --git a/source/libs/luajit/LuaJIT-2.0.4/doc/bluequad-print.css b/source/libs/luajit/LuaJIT-2.1.0-beta1/doc/bluequad-print.css
similarity index 100%
rename from source/libs/luajit/LuaJIT-2.0.4/doc/bluequad-print.css
rename to source/libs/luajit/LuaJIT-2.1.0-beta1/doc/bluequad-print.css
diff --git a/source/libs/luajit/LuaJIT-2.0.4/doc/bluequad.css b/source/libs/luajit/LuaJIT-2.1.0-beta1/doc/bluequad.css
similarity index 100%
rename from source/libs/luajit/LuaJIT-2.0.4/doc/bluequad.css
rename to source/libs/luajit/LuaJIT-2.1.0-beta1/doc/bluequad.css
diff --git a/source/libs/luajit/LuaJIT-2.0.4/doc/changes.html b/source/libs/luajit/LuaJIT-2.1.0-beta1/doc/changes.html
similarity index 80%
rename from source/libs/luajit/LuaJIT-2.0.4/doc/changes.html
rename to source/libs/luajit/LuaJIT-2.1.0-beta1/doc/changes.html
index d7b83ce68..64dc4c2ad 100644
--- a/source/libs/luajit/LuaJIT-2.0.4/doc/changes.html
+++ b/source/libs/luajit/LuaJIT-2.1.0-beta1/doc/changes.html
@@ -44,6 +44,8 @@ div.major { max-width: 600px; padding: 1em; margin: 1em 0 1em 0; }
jit.* Library
Lua/C API
+
+Profiler
Status
@@ -72,6 +74,59 @@ to see whether newer versions are available.
+
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.
+Please take a look at the commit history for more details.
+
+
+- Changes to the VM core:
+
+- Add low-overhead profiler (-jp).
+- 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 binary number literals (0bxxx).
+
+- Improvements to the JIT compiler:
+
+- Add trace stitching (disabled for now).
+- Compile various builtins: string.char(), string.reverse(), string.lower(), string.upper(), string.rep(), string.format(), table.concat(), bit.tohex(), getfenv(0), debug.getmetatable().
+- Compile string.find() for fixed string searches (no patterns).
+- Compile BC_TSETM, e.g. {1,2,3,f()}.
+- Compile string concatenations (BC_CAT).
+- Compile __concat metamethod.
+- Various minor optimizations.
+
+- Internal Changes:
+
+- Add support for embedding LuaJIT bytecode for builtins.
+- Replace various builtins with embedded bytecode.
+- Refactor string buffers and string formatting.
+- Remove obsolete non-truncating number to integer conversions.
+
+- Ports:
+
+- Add Xbox One port (LJ_GC64 mode).
+- ARM64: Add port of the interpreter (LJ_GC64 mode).
+- x64: Add separate port of the interpreter to LJ_GC64 mode.
+- x86/x64: Drop internal x87 math functions. Use libm functions.
+- x86: Remove x87 support from interpreter. SSE2 is mandatory now.
+- PPC/e500: Drop support for this architecture.
+
+- FFI library:
+
+- FFI: Add 64 bit bitwise operations.
+- FFI: Compile VLA/VLS and large cdata allocations with default initialization.
+- FFI: Compile conversions from functions to function pointers.
+- FFI: Compile lightuserdata to void * conversion.
+- FFI: Compile ffi.gc(cdata, nil), too.
+- FFI: Add ffi.typeinfo().
+
+
+
+
+
LuaJIT 2.0.4 — 2015-05-14
- Fix stack check in narrowing optimization.
@@ -735,235 +790,6 @@ This matches the behavior of Lua 5.1, but not the specification.
no point in listing differences over earlier versions.
-
-
-
LuaJIT 1.1.8 — 2012-04-16
-
-
-
LuaJIT 1.1.7 — 2011-05-05
-
-
-
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
-
-
-
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.
-
-