From 550f07848dc63d7bf64b109f62ce3a4175e4da57 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Wed, 18 Oct 2023 21:55:57 +0800 Subject: [PATCH] update to luajit2 20231006 Signed-off-by: lhy1024 --- third_party/luajit/luajit/.gitattributes | 1 + third_party/luajit/luajit/.gitignore | 3 + third_party/luajit/luajit/.relver | 1 + third_party/luajit/luajit/.travis.yml | 61 + third_party/luajit/luajit/COPYRIGHT | 6 +- third_party/luajit/luajit/Makefile | 45 +- third_party/luajit/luajit/README | 6 +- third_party/luajit/luajit/README.md | 415 ++ .../luajit/luajit/doc/bluequad-print.css | 2 +- third_party/luajit/luajit/doc/bluequad.css | 10 +- third_party/luajit/luajit/doc/contact.html | 10 +- third_party/luajit/luajit/doc/ext_buffer.html | 14 +- third_party/luajit/luajit/doc/ext_c_api.html | 8 +- third_party/luajit/luajit/doc/ext_ffi.html | 8 +- .../luajit/luajit/doc/ext_ffi_api.html | 12 +- .../luajit/luajit/doc/ext_ffi_semantics.html | 8 +- .../luajit/luajit/doc/ext_ffi_tutorial.html | 8 +- third_party/luajit/luajit/doc/ext_jit.html | 12 +- .../luajit/luajit/doc/ext_profiler.html | 8 +- third_party/luajit/luajit/doc/extensions.html | 13 +- third_party/luajit/luajit/doc/faq.html | 195 - third_party/luajit/luajit/doc/install.html | 251 +- third_party/luajit/luajit/doc/luajit.html | 59 +- third_party/luajit/luajit/doc/running.html | 9 +- third_party/luajit/luajit/doc/status.html | 105 - .../luajit/luajit/dynasm/Examples/run.sh | 14 + .../luajit/dynasm/Examples/test_z_inst.c | 488 ++ third_party/luajit/luajit/dynasm/dasm_arm.h | 19 +- third_party/luajit/luajit/dynasm/dasm_arm.lua | 2 +- third_party/luajit/luajit/dynasm/dasm_arm64.h | 19 +- .../luajit/luajit/dynasm/dasm_arm64.lua | 9 +- third_party/luajit/luajit/dynasm/dasm_mips.h | 19 +- .../luajit/luajit/dynasm/dasm_mips.lua | 2 +- .../luajit/luajit/dynasm/dasm_mips64.lua | 2 +- third_party/luajit/luajit/dynasm/dasm_ppc.h | 19 +- third_party/luajit/luajit/dynasm/dasm_ppc.lua | 7 +- third_party/luajit/luajit/dynasm/dasm_proto.h | 2 +- third_party/luajit/luajit/dynasm/dasm_s390x.h | 542 ++ .../luajit/luajit/dynasm/dasm_s390x.lua | 1633 ++++++ third_party/luajit/luajit/dynasm/dasm_x64.lua | 2 +- third_party/luajit/luajit/dynasm/dasm_x86.h | 21 +- third_party/luajit/luajit/dynasm/dasm_x86.lua | 2 +- third_party/luajit/luajit/dynasm/dynasm.lua | 4 +- third_party/luajit/luajit/etc/luajit.1 | 2 +- third_party/luajit/luajit/etc/luajit.pc | 4 +- third_party/luajit/luajit/src/.gitignore | 2 + third_party/luajit/luajit/src/Makefile | 72 +- third_party/luajit/luajit/src/Makefile.dep | 2 +- third_party/luajit/luajit/src/host/buildvm.c | 5 +- third_party/luajit/luajit/src/host/buildvm.h | 2 +- .../luajit/luajit/src/host/buildvm_asm.c | 73 +- .../luajit/luajit/src/host/buildvm_fold.c | 2 +- .../luajit/luajit/src/host/buildvm_lib.c | 5 +- .../luajit/luajit/src/host/buildvm_peobj.c | 113 +- .../luajit/luajit/src/host/genlibbc.lua | 2 +- .../luajit/luajit/src/host/genminilua.lua | 2 +- .../luajit/luajit/src/host/genversion.lua | 45 + third_party/luajit/luajit/src/jit/bc.lua | 55 +- third_party/luajit/luajit/src/jit/bcsave.lua | 16 +- third_party/luajit/luajit/src/jit/dis_arm.lua | 2 +- .../luajit/luajit/src/jit/dis_arm64.lua | 44 +- .../luajit/luajit/src/jit/dis_arm64be.lua | 2 +- .../luajit/luajit/src/jit/dis_mips.lua | 2 +- .../luajit/luajit/src/jit/dis_mips64.lua | 2 +- .../luajit/luajit/src/jit/dis_mips64el.lua | 2 +- .../luajit/luajit/src/jit/dis_mips64r6.lua | 2 +- .../luajit/luajit/src/jit/dis_mips64r6el.lua | 2 +- .../luajit/luajit/src/jit/dis_mipsel.lua | 2 +- third_party/luajit/luajit/src/jit/dis_ppc.lua | 2 +- third_party/luajit/luajit/src/jit/dis_x64.lua | 2 +- third_party/luajit/luajit/src/jit/dis_x86.lua | 2 +- third_party/luajit/luajit/src/jit/dump.lua | 6 +- third_party/luajit/luajit/src/jit/p.lua | 3 +- third_party/luajit/luajit/src/jit/v.lua | 3 +- third_party/luajit/luajit/src/jit/zone.lua | 2 +- third_party/luajit/luajit/src/lib_aux.c | 2 +- third_party/luajit/luajit/src/lib_base.c | 72 +- third_party/luajit/luajit/src/lib_bit.c | 2 +- third_party/luajit/luajit/src/lib_buffer.c | 2 +- third_party/luajit/luajit/src/lib_debug.c | 2 +- third_party/luajit/luajit/src/lib_ffi.c | 7 +- third_party/luajit/luajit/src/lib_init.c | 2 +- third_party/luajit/luajit/src/lib_io.c | 2 +- third_party/luajit/luajit/src/lib_jit.c | 76 +- third_party/luajit/luajit/src/lib_math.c | 2 +- third_party/luajit/luajit/src/lib_os.c | 3 +- third_party/luajit/luajit/src/lib_package.c | 2 +- third_party/luajit/luajit/src/lib_string.c | 2 +- third_party/luajit/luajit/src/lib_table.c | 67 +- third_party/luajit/luajit/src/lj.supp | 41 - third_party/luajit/luajit/src/lj_api.c | 58 +- third_party/luajit/luajit/src/lj_arch.h | 67 +- third_party/luajit/luajit/src/lj_asm.c | 68 +- third_party/luajit/luajit/src/lj_asm.h | 2 +- third_party/luajit/luajit/src/lj_asm_arm.h | 16 +- third_party/luajit/luajit/src/lj_asm_arm64.h | 509 +- third_party/luajit/luajit/src/lj_asm_mips.h | 12 +- third_party/luajit/luajit/src/lj_asm_ppc.h | 10 +- third_party/luajit/luajit/src/lj_asm_x86.h | 17 +- third_party/luajit/luajit/src/lj_assert.c | 2 +- third_party/luajit/luajit/src/lj_bc.c | 2 +- third_party/luajit/luajit/src/lj_bc.h | 2 +- third_party/luajit/luajit/src/lj_bcdump.h | 2 +- third_party/luajit/luajit/src/lj_bcread.c | 2 +- third_party/luajit/luajit/src/lj_bcwrite.c | 5 +- third_party/luajit/luajit/src/lj_buf.c | 2 +- third_party/luajit/luajit/src/lj_buf.h | 2 +- third_party/luajit/luajit/src/lj_carith.c | 2 +- third_party/luajit/luajit/src/lj_carith.h | 2 +- third_party/luajit/luajit/src/lj_ccall.c | 299 +- third_party/luajit/luajit/src/lj_ccall.h | 43 +- third_party/luajit/luajit/src/lj_ccallback.c | 87 +- third_party/luajit/luajit/src/lj_ccallback.h | 2 +- third_party/luajit/luajit/src/lj_cconv.c | 2 +- third_party/luajit/luajit/src/lj_cconv.h | 2 +- third_party/luajit/luajit/src/lj_cdata.c | 2 +- third_party/luajit/luajit/src/lj_cdata.h | 2 +- third_party/luajit/luajit/src/lj_clib.c | 2 +- third_party/luajit/luajit/src/lj_clib.h | 2 +- third_party/luajit/luajit/src/lj_cparse.c | 2 +- third_party/luajit/luajit/src/lj_cparse.h | 2 +- third_party/luajit/luajit/src/lj_crecord.c | 25 +- third_party/luajit/luajit/src/lj_crecord.h | 2 +- third_party/luajit/luajit/src/lj_ctype.c | 2 +- third_party/luajit/luajit/src/lj_ctype.h | 4 +- third_party/luajit/luajit/src/lj_debug.c | 132 +- third_party/luajit/luajit/src/lj_debug.h | 14 +- third_party/luajit/luajit/src/lj_def.h | 38 +- third_party/luajit/luajit/src/lj_dispatch.c | 8 +- third_party/luajit/luajit/src/lj_dispatch.h | 2 +- third_party/luajit/luajit/src/lj_emit_arm.h | 2 +- third_party/luajit/luajit/src/lj_emit_arm64.h | 179 +- third_party/luajit/luajit/src/lj_emit_mips.h | 2 +- third_party/luajit/luajit/src/lj_emit_ppc.h | 2 +- third_party/luajit/luajit/src/lj_emit_x86.h | 2 +- third_party/luajit/luajit/src/lj_err.c | 83 +- third_party/luajit/luajit/src/lj_err.h | 2 +- third_party/luajit/luajit/src/lj_errmsg.h | 5 +- third_party/luajit/luajit/src/lj_ff.h | 2 +- third_party/luajit/luajit/src/lj_ffrecord.c | 97 +- third_party/luajit/luajit/src/lj_ffrecord.h | 2 +- third_party/luajit/luajit/src/lj_frame.h | 25 +- third_party/luajit/luajit/src/lj_func.c | 2 +- third_party/luajit/luajit/src/lj_func.h | 2 +- third_party/luajit/luajit/src/lj_gc.c | 2 +- third_party/luajit/luajit/src/lj_gc.h | 2 +- third_party/luajit/luajit/src/lj_gdbjit.c | 2 +- third_party/luajit/luajit/src/lj_gdbjit.h | 2 +- third_party/luajit/luajit/src/lj_init.c | 69 + third_party/luajit/luajit/src/lj_ir.c | 2 +- third_party/luajit/luajit/src/lj_ir.h | 8 +- third_party/luajit/luajit/src/lj_ircall.h | 8 +- third_party/luajit/luajit/src/lj_iropt.h | 8 +- third_party/luajit/luajit/src/lj_jit.h | 18 +- third_party/luajit/luajit/src/lj_lex.c | 2 +- third_party/luajit/luajit/src/lj_lex.h | 2 +- third_party/luajit/luajit/src/lj_lib.c | 11 +- third_party/luajit/luajit/src/lj_lib.h | 3 +- third_party/luajit/luajit/src/lj_load.c | 2 +- third_party/luajit/luajit/src/lj_mcode.c | 16 +- third_party/luajit/luajit/src/lj_mcode.h | 2 +- third_party/luajit/luajit/src/lj_meta.c | 2 +- third_party/luajit/luajit/src/lj_meta.h | 2 +- third_party/luajit/luajit/src/lj_obj.c | 2 +- third_party/luajit/luajit/src/lj_obj.h | 23 +- third_party/luajit/luajit/src/lj_opt_dce.c | 4 +- third_party/luajit/luajit/src/lj_opt_fold.c | 15 +- third_party/luajit/luajit/src/lj_opt_loop.c | 2 +- third_party/luajit/luajit/src/lj_opt_mem.c | 10 +- third_party/luajit/luajit/src/lj_opt_narrow.c | 2 +- third_party/luajit/luajit/src/lj_opt_sink.c | 2 +- third_party/luajit/luajit/src/lj_opt_split.c | 2 +- third_party/luajit/luajit/src/lj_parse.c | 7 +- third_party/luajit/luajit/src/lj_parse.h | 2 +- third_party/luajit/luajit/src/lj_prng.c | 2 +- third_party/luajit/luajit/src/lj_prng.h | 2 +- third_party/luajit/luajit/src/lj_profile.c | 2 +- third_party/luajit/luajit/src/lj_profile.h | 2 +- third_party/luajit/luajit/src/lj_record.c | 45 +- third_party/luajit/luajit/src/lj_record.h | 2 +- third_party/luajit/luajit/src/lj_serialize.c | 2 +- third_party/luajit/luajit/src/lj_serialize.h | 2 +- third_party/luajit/luajit/src/lj_snap.c | 20 +- third_party/luajit/luajit/src/lj_snap.h | 2 +- third_party/luajit/luajit/src/lj_state.c | 33 +- third_party/luajit/luajit/src/lj_state.h | 3 +- third_party/luajit/luajit/src/lj_str.c | 44 +- third_party/luajit/luajit/src/lj_str.h | 14 +- third_party/luajit/luajit/src/lj_str_hash.c | 309 ++ third_party/luajit/luajit/src/lj_strfmt.c | 2 +- third_party/luajit/luajit/src/lj_strfmt.h | 2 +- third_party/luajit/luajit/src/lj_strfmt_num.c | 2 +- third_party/luajit/luajit/src/lj_strscan.c | 2 +- third_party/luajit/luajit/src/lj_strscan.h | 2 +- third_party/luajit/luajit/src/lj_tab.c | 86 +- third_party/luajit/luajit/src/lj_tab.h | 7 +- third_party/luajit/luajit/src/lj_target.h | 17 +- third_party/luajit/luajit/src/lj_target_arm.h | 2 +- .../luajit/luajit/src/lj_target_arm64.h | 8 +- .../luajit/luajit/src/lj_target_mips.h | 2 +- third_party/luajit/luajit/src/lj_target_ppc.h | 16 +- .../luajit/luajit/src/lj_target_s390x.h | 81 + third_party/luajit/luajit/src/lj_target_x86.h | 6 +- third_party/luajit/luajit/src/lj_trace.c | 81 +- third_party/luajit/luajit/src/lj_trace.h | 2 +- third_party/luajit/luajit/src/lj_traceerr.h | 2 +- third_party/luajit/luajit/src/lj_udata.c | 2 +- third_party/luajit/luajit/src/lj_udata.h | 2 +- third_party/luajit/luajit/src/lj_vm.h | 8 +- third_party/luajit/luajit/src/lj_vmevent.c | 2 +- third_party/luajit/luajit/src/lj_vmevent.h | 2 +- third_party/luajit/luajit/src/lj_vmmath.c | 2 +- third_party/luajit/luajit/src/ljamalg.c | 3 +- third_party/luajit/luajit/src/lua.h | 8 + third_party/luajit/luajit/src/luaconf.h | 4 +- third_party/luajit/luajit/src/luajit.c | 2 +- .../luajit/src/{luajit.h => luajit_rolling.h} | 12 +- third_party/luajit/luajit/src/lualib.h | 3 +- third_party/luajit/luajit/src/msvcbuild.bat | 36 +- third_party/luajit/luajit/src/nxbuild.bat | 324 +- third_party/luajit/luajit/src/ps4build.bat | 4 + third_party/luajit/luajit/src/ps5build.bat | 249 +- third_party/luajit/luajit/src/psvitabuild.bat | 3 + third_party/luajit/luajit/src/vm_arm.dasc | 27 +- third_party/luajit/luajit/src/vm_arm64.dasc | 149 +- third_party/luajit/luajit/src/vm_mips.dasc | 30 +- third_party/luajit/luajit/src/vm_mips64.dasc | 31 +- third_party/luajit/luajit/src/vm_ppc.dasc | 1379 +++-- third_party/luajit/luajit/src/vm_ppc64.dasc | 4432 ----------------- third_party/luajit/luajit/src/vm_s390x.dasc | 4261 ++++++++++++++++ third_party/luajit/luajit/src/vm_x64.dasc | 49 +- third_party/luajit/luajit/src/vm_x86.dasc | 69 +- .../luajit/luajit/src/x64/test/benchmark.cxx | 360 ++ .../luajit/luajit/src/x64/test/test.cpp | 81 + .../luajit/src/x64/test/test_str_comp.lua | 67 + .../luajit/luajit/src/x64/test/test_util.cxx | 21 + .../luajit/luajit/src/x64/test/test_util.d | 107 + .../luajit/luajit/src/x64/test/test_util.hpp | 57 + third_party/luajit/luajit/src/xb1build.bat | 3 + third_party/luajit/luajit/src/xedkbuild.bat | 3 + third_party/luajit/luajit/t/TestLJ.pm | 98 + third_party/luajit/luajit/t/exdata.t | 271 + third_party/luajit/luajit/t/exdata2.t | 300 ++ third_party/luajit/luajit/t/isarr-interp.t | 152 + third_party/luajit/luajit/t/isarr-jit.t | 180 + third_party/luajit/luajit/t/isempty.t | 114 + third_party/luajit/luajit/t/iter.t | 105 + third_party/luajit/luajit/t/nkeys.t | 175 + third_party/luajit/luajit/t/prngstate.t | 76 + 249 files changed, 14228 insertions(+), 6778 deletions(-) create mode 100644 third_party/luajit/luajit/.gitattributes create mode 100644 third_party/luajit/luajit/.relver create mode 100644 third_party/luajit/luajit/.travis.yml create mode 100644 third_party/luajit/luajit/README.md delete mode 100644 third_party/luajit/luajit/doc/faq.html delete mode 100644 third_party/luajit/luajit/doc/status.html create mode 100644 third_party/luajit/luajit/dynasm/Examples/run.sh create mode 100644 third_party/luajit/luajit/dynasm/Examples/test_z_inst.c create mode 100644 third_party/luajit/luajit/dynasm/dasm_s390x.h create mode 100644 third_party/luajit/luajit/dynasm/dasm_s390x.lua create mode 100644 third_party/luajit/luajit/src/host/genversion.lua delete mode 100644 third_party/luajit/luajit/src/lj.supp create mode 100644 third_party/luajit/luajit/src/lj_init.c create mode 100644 third_party/luajit/luajit/src/lj_str_hash.c create mode 100644 third_party/luajit/luajit/src/lj_target_s390x.h rename third_party/luajit/luajit/src/{luajit.h => luajit_rolling.h} (90%) delete mode 100644 third_party/luajit/luajit/src/vm_ppc64.dasc create mode 100644 third_party/luajit/luajit/src/vm_s390x.dasc create mode 100644 third_party/luajit/luajit/src/x64/test/benchmark.cxx create mode 100644 third_party/luajit/luajit/src/x64/test/test.cpp create mode 100644 third_party/luajit/luajit/src/x64/test/test_str_comp.lua create mode 100644 third_party/luajit/luajit/src/x64/test/test_util.cxx create mode 100644 third_party/luajit/luajit/src/x64/test/test_util.d create mode 100644 third_party/luajit/luajit/src/x64/test/test_util.hpp create mode 100644 third_party/luajit/luajit/t/TestLJ.pm create mode 100644 third_party/luajit/luajit/t/exdata.t create mode 100644 third_party/luajit/luajit/t/exdata2.t create mode 100644 third_party/luajit/luajit/t/isarr-interp.t create mode 100644 third_party/luajit/luajit/t/isarr-jit.t create mode 100644 third_party/luajit/luajit/t/isempty.t create mode 100644 third_party/luajit/luajit/t/iter.t create mode 100644 third_party/luajit/luajit/t/nkeys.t create mode 100644 third_party/luajit/luajit/t/prngstate.t diff --git a/third_party/luajit/luajit/.gitattributes b/third_party/luajit/luajit/.gitattributes new file mode 100644 index 000000000..c048531e2 --- /dev/null +++ b/third_party/luajit/luajit/.gitattributes @@ -0,0 +1 @@ +/.relver export-subst diff --git a/third_party/luajit/luajit/.gitignore b/third_party/luajit/luajit/.gitignore index 1a07bf75b..9dd51e85f 100644 --- a/third_party/luajit/luajit/.gitignore +++ b/third_party/luajit/luajit/.gitignore @@ -9,3 +9,6 @@ *.dmp *.swp .tags +*~ +tags +*.swo diff --git a/third_party/luajit/luajit/.relver b/third_party/luajit/luajit/.relver new file mode 100644 index 000000000..2707647aa --- /dev/null +++ b/third_party/luajit/luajit/.relver @@ -0,0 +1 @@ +$Format:%ct$ diff --git a/third_party/luajit/luajit/.travis.yml b/third_party/luajit/luajit/.travis.yml new file mode 100644 index 000000000..9077c9426 --- /dev/null +++ b/third_party/luajit/luajit/.travis.yml @@ -0,0 +1,61 @@ +sudo: required +dist: bionic + +branches: + only: + - "v2.1-agentzh" + +os: linux +arch: + - amd64 + - arm64 + - s390x + +language: c + +compiler: + - gcc + +addons: + apt: + packages: + - axel + - cpanminus + - libtest-base-perl + - libtext-diff-perl + - libtest-longstring-perl + - liblist-moreutils-perl + - libparallel-forkmanager-perl + - libgd-dev + - libmpc-dev + - build-essential + - libgtk2.0-dev + - valgrind + +env: + global: + - JOBS=3 + - LUAJIT_PREFIX=/opt/luajit21 + - LUAJIT_SYSM_PREFIX=/opt/luajit21-sysm + - LUAJIT_COMMON_XCFLAGS="-DLUA_USE_APICHECK -DLUA_USE_ASSERT -DLUAJIT_NUMMODE=2 -O1" + - LUAJIT_COMMON_XCFLAGS=$( [ ${TRAVIS_CPU_ARCH} == "amd64" ] && echo "$LUAJIT_COMMON_XCFLAGS -msse4.2" || echo "$LUAJIT_COMMON_XCFLAGS" ) + + matrix: + - LUAJIT_XCFLAGS="$LUAJIT_COMMON_XCFLAGS" + - LUAJIT_XCFLAGS="-DLUAJIT_ENABLE_LUA52COMPAT $LUAJIT_COMMON_XCFLAGS" LUA52=1 + - LUAJIT_XCFLAGS="-DLUAJIT_USE_VALGRIND -DLUAJIT_USE_SYSMALLOC -DLUAJIT_ENABLE_LUA52COMPAT $LUAJIT_COMMON_XCFLAGS" LUA52=1 FLAGS=$( [ ${TRAVIS_CPU_ARCH} != "s390x" ] && echo '-v' ) + - LUAJIT_XCFLAGS="-DLUAJIT_DISABLE_GC64 -DLUAJIT_ENABLE_LUA52COMPAT $LUAJIT_COMMON_XCFLAGS" LUA52=1 + +install: + - git clone https://github.com/openresty/luajit2-test-suite.git ../luajit2-test-suite + +script: + - echo ${LUAJIT_COMMON_XCFLAGS} + - valgrind --version + - /usr/bin/env perl $(command -v cpanm) --sudo --notest IPC::Run3 Test::Base Test::LongString Parallel::ForkManager > build.log 2>&1 || (cat build.log && exit 1) + - cd ../luajit2 + - make -j$JOBS CCDEBUG=-g Q= PREFIX=$LUAJIT_PREFIX CC=$CC XCFLAGS="$LUAJIT_XCFLAGS" > build.log 2>&1 || (cat build.log && exit 1) + - sudo make install PREFIX=$LUAJIT_PREFIX > build.log 2>&1 || (cat build.log && exit 1) + - if [ ${TRAVIS_CPU_ARCH} == "amd64" ]; then PATH=/opt/luajit21/bin:$PATH prove -I. t; fi + - cd ../luajit2-test-suite + - ./run-tests -j 1 $FLAGS $LUAJIT_PREFIX diff --git a/third_party/luajit/luajit/COPYRIGHT b/third_party/luajit/luajit/COPYRIGHT index c74216c3e..f57d0d4cf 100644 --- a/third_party/luajit/luajit/COPYRIGHT +++ b/third_party/luajit/luajit/COPYRIGHT @@ -1,7 +1,11 @@ =============================================================================== LuaJIT -- a Just-In-Time Compiler for Lua. https://luajit.org/ -Copyright (C) 2005-2022 Mike Pall. All rights reserved. +Copyright (C) 2005-2023 Mike Pall. All rights reserved. + +Copyright (C) 2017-2018 Yichun Zhang. All rights reserved. + +Copyright (C) 2017-2018 OpenResty Inc. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/third_party/luajit/luajit/Makefile b/third_party/luajit/luajit/Makefile index b0288b4db..3aed365db 100644 --- a/third_party/luajit/luajit/Makefile +++ b/third_party/luajit/luajit/Makefile @@ -10,16 +10,21 @@ # For MSVC, please follow the instructions given in src/msvcbuild.bat. # For MinGW and Cygwin, cd to src and run make with the Makefile there. # -# Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h +# Copyright (C) 2005-2023 Mike Pall. See Copyright Notice in luajit.h ############################################################################## MAJVER= 2 MINVER= 1 -RELVER= 0 -PREREL= -beta3 -VERSION= $(MAJVER).$(MINVER).$(RELVER)$(PREREL) ABIVER= 5.1 +# LuaJIT uses rolling releases. The release version is based on the time of +# the latest git commit. The 'git' command must be available during the build. +RELVER= $(shell cat src/luajit_relver.txt 2>/dev/null || : ) +# Note: setting it with := doesn't work, since it will change during the build. + +MMVERSION= $(MAJVER).$(MINVER) +VERSION= $(MMVERSION).$(RELVER) + ############################################################################## # # Change the installation path as needed. This automatically adjusts @@ -33,10 +38,10 @@ DPREFIX= $(DESTDIR)$(PREFIX) INSTALL_BIN= $(DPREFIX)/bin INSTALL_LIB= $(DPREFIX)/$(MULTILIB) INSTALL_SHARE= $(DPREFIX)/share -INSTALL_DEFINC= $(DPREFIX)/include/luajit-$(MAJVER).$(MINVER) +INSTALL_DEFINC= $(DPREFIX)/include/luajit-$(MMVERSION) INSTALL_INC= $(INSTALL_DEFINC) -INSTALL_LJLIBD= $(INSTALL_SHARE)/luajit-$(VERSION) +INSTALL_LJLIBD= $(INSTALL_SHARE)/luajit-$(MMVERSION) INSTALL_JITLIB= $(INSTALL_LJLIBD)/jit INSTALL_LMODD= $(INSTALL_SHARE)/lua INSTALL_LMOD= $(INSTALL_LMODD)/$(ABIVER) @@ -50,10 +55,10 @@ INSTALL_TSYMNAME= luajit INSTALL_ANAME= libluajit-$(ABIVER).a INSTALL_SOSHORT1= libluajit-$(ABIVER).so INSTALL_SOSHORT2= libluajit-$(ABIVER).so.$(MAJVER) -INSTALL_SONAME= $(INSTALL_SOSHORT2).$(MINVER).$(RELVER) +INSTALL_SONAME= libluajit-$(ABIVER).so.$(VERSION) INSTALL_DYLIBSHORT1= libluajit-$(ABIVER).dylib INSTALL_DYLIBSHORT2= libluajit-$(ABIVER).$(MAJVER).dylib -INSTALL_DYLIBNAME= libluajit-$(ABIVER).$(MAJVER).$(MINVER).$(RELVER).dylib +INSTALL_DYLIBNAME= libluajit-$(ABIVER).$(VERSION).dylib INSTALL_PCNAME= luajit.pc INSTALL_STATIC= $(INSTALL_LIB)/$(INSTALL_ANAME) @@ -78,7 +83,8 @@ INSTALL_F= install -m 0644 UNINSTALL= $(RM) LDCONFIG= ldconfig -n 2>/dev/null SED_PC= sed -e "s|^prefix=.*|prefix=$(PREFIX)|" \ - -e "s|^multilib=.*|multilib=$(MULTILIB)|" + -e "s|^multilib=.*|multilib=$(MULTILIB)|" \ + -e "s|^relver=.*|relver=$(RELVER)|" ifneq ($(INSTALL_DEFINC),$(INSTALL_INC)) SED_PC+= -e "s|^includedir=.*|includedir=$(INSTALL_INC)|" endif @@ -92,7 +98,9 @@ FILES_INC= lua.h lualib.h lauxlib.h luaconf.h lua.hpp luajit.h FILES_JITLIB= bc.lua bcsave.lua dump.lua p.lua v.lua zone.lua \ dis_x86.lua dis_x64.lua dis_arm.lua dis_arm64.lua \ dis_arm64be.lua dis_ppc.lua dis_mips.lua dis_mipsel.lua \ - dis_mips64.lua dis_mips64el.lua vmdef.lua + dis_mips64.lua dis_mips64el.lua \ + dis_mips64r6.lua dis_mips64r6el.lua \ + vmdef.lua ifeq (,$(findstring Windows,$(OS))) HOST_SYS:= $(shell uname -s) @@ -113,9 +121,9 @@ endif INSTALL_DEP= src/luajit default all $(INSTALL_DEP): - @echo "==== Building LuaJIT $(VERSION) ====" + @echo "==== Building LuaJIT $(MMVERSION) ====" $(MAKE) -C src - @echo "==== Successfully built LuaJIT $(VERSION) ====" + @echo "==== Successfully built LuaJIT $(MMVERSION) ====" install: $(INSTALL_DEP) @echo "==== Installing LuaJIT $(VERSION) to $(PREFIX) ====" @@ -134,18 +142,12 @@ 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_T) $(INSTALL_STATIC) $(INSTALL_DYN) $(INSTALL_SHORT1) $(INSTALL_SHORT2) $(INSTALL_MAN)/$(FILE_MAN) $(INSTALL_PC) + $(UNINSTALL) $(INSTALL_TSYM) $(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 @@ -159,8 +161,9 @@ uninstall: ############################################################################## amalg: - @echo "Building LuaJIT $(VERSION)" + @echo "==== Building LuaJIT $(MMVERSION) (amalgamation) ====" $(MAKE) -C src amalg + @echo "==== Successfully built LuaJIT $(MMVERSION) (amalgamation) ====" clean: $(MAKE) -C src clean diff --git a/third_party/luajit/luajit/README b/third_party/luajit/luajit/README index 1faef2559..e4a692654 100644 --- a/third_party/luajit/luajit/README +++ b/third_party/luajit/luajit/README @@ -1,11 +1,11 @@ -README for LuaJIT 2.1.0-beta3 ------------------------------ +README for LuaJIT 2.1 +--------------------- LuaJIT is a Just-In-Time (JIT) compiler for the Lua programming language. Project Homepage: https://luajit.org/ -LuaJIT is Copyright (C) 2005-2022 Mike Pall. +LuaJIT is Copyright (C) 2005-2023 Mike Pall. LuaJIT is free software, released under the MIT license. See full Copyright Notice in the COPYRIGHT file or in luajit.h. diff --git a/third_party/luajit/luajit/README.md b/third_party/luajit/luajit/README.md new file mode 100644 index 000000000..4e6463e94 --- /dev/null +++ b/third_party/luajit/luajit/README.md @@ -0,0 +1,415 @@ +# Name + +openresty/luajit2 - OpenResty's maintained branch of LuaJIT. + +Table of Contents +================= + +* [Name](#name) +* [Description](#description) +* [OpenResty extensions](#openresty-extensions) + * [New Lua APIs](#new-lua-apis) + * [table.isempty](#tableisempty) + * [table.isarray](#tableisarray) + * [table.nkeys](#tablenkeys) + * [table.clone](#tableclone) + * [jit.prngstate](#jitprngstate) + * [thread.exdata](#threadexdata) + * [thread.exdata2](#threadexdata2) + * [New C API](#new-c-api) + * [lua_setexdata](#lua_setexdata) + * [lua_getexdata](#lua_getexdata) + * [lua_setexdata2](#lua_setexdata2) + * [lua_getexdata2](#lua_getexdata2) + * [lua_resetthread](#lua_resetthread) + * [New macros](#new-macros) + * [`OPENRESTY_LUAJIT`](#openresty_luajit) + * [`HAVE_LUA_RESETTHREAD`](#have_lua_resetthread) + * [Optimizations](#optimizations) + * [Updated JIT default parameters](#updated-jit-default-parameters) + * [String hashing](#string-hashing) + * [Updated bytecode options](#updated-bytecode-options) + * [New `-bL` option](#new--bl-option) + * [Updated `-bl` option](#updated--bl-option) + * [Miscellaneous](#miscellaneous) +* [Copyright & License](#copyright--license) + +# Description + +This is the official OpenResty branch of LuaJIT. It is not to be considered a +fork, since we still regularly synchronize changes from the upstream LuaJIT +project (https://github.com/LuaJIT/LuaJIT). + +# OpenResty extensions + +Additionally to synchronizing upstream changes, we introduce our own changes +which haven't been merged yet (or never will be). This document describes those +changes that are specific to this branch. + +## New Lua APIs + +### table.isempty + +**syntax:** *res = isempty(tab)* + +Returns `true` when the given Lua table contains neither non-nil array elements +nor non-nil key-value pairs, or `false` otherwise. + +This API can be JIT compiled. + +Usage: + +```lua +local isempty = require "table.isempty" + +print(isempty({})) -- true +print(isempty({nil, dog = nil})) -- true +print(isempty({"a", "b"})) -- false +print(isempty({nil, 3})) -- false +print(isempty({cat = 3})) -- false +``` + +[Back to TOC](#table-of-contents) + +### table.isarray + +**syntax:** *res = isarray(tab)* + +Returns `true` when the given Lua table is a pure array-like Lua table, or +`false` otherwise. + +Empty Lua tables are treated as arrays. + +This API can be JIT compiled. + +Usage: + +```lua +local isarray = require "table.isarray" + +print(isarray{"a", true, 3.14}) -- true +print(isarray{dog = 3}) -- false +print(isarray{}) -- true +``` + +[Back to TOC](#table-of-contents) + +### table.nkeys + +**syntax:** *n = nkeys(tab)* + +Returns the total number of elements in a given Lua table (i.e. from both the +array and hash parts combined). + +This API can be JIT compiled. + +Usage: + +```lua +local nkeys = require "table.nkeys" + +print(nkeys({})) -- 0 +print(nkeys({ "a", nil, "b" })) -- 2 +print(nkeys({ dog = 3, cat = 4, bird = nil })) -- 2 +print(nkeys({ "a", dog = 3, cat = 4 })) -- 3 +``` + +[Back to TOC](#table-of-contents) + +### table.clone + +**syntax:** *t = clone(tab)* + +Returns a shallow copy of the given Lua table. + +This API can be JIT compiled. + +Usage: + +```lua +local clone = require "table.clone" + +local x = {x=12, y={5, 6, 7}} +local y = clone(x) +... use y ... +``` + +**Note:** We observe 7% over-all speedup in the edgelang-fan compiler's +compiling speed whose Lua is generated by the fanlang compiler. + +**Note bis:** Deep cloning is planned to be supported by adding `true` as a +second argument. + +[Back to TOC](#table-of-contents) + +### jit.prngstate + +**syntax:** *state = jit.prngstate(state?)* + +Returns (and optionally sets) the current PRNG state (an array of 8 Lua +numbers with 32-bit integer values) currently used by the JIT compiler. + +When the `state` argument is non-nil, it is expected to be an array of up to 8 +unsigned Lua numbers, each with value less than 2\*\*32-1. This will set the +current PRNG state and return the state that was overridden. + +**Note:** For backward compatibility, `state` argument can also be an unsigned +Lua number less than 2\*\*32-1. + +**Note:** When the `state` argument is an array and less than 8 numbers, or the +`state` is a number, the remaining positions are filled with zeros. + +Usage: + +```lua +local state = jit.prngstate() +local oldstate = jit.prngstate{ a, b, c, ... } + +jit.prngstate(32) -- {32, 0, 0, 0, 0, 0, 0, 0} +jit.prngstate{432, 23, 50} -- {432, 23, 50, 0, 0, 0, 0, 0} +``` + +**Note:** This API has no effect if LuaJIT is compiled with +`-DLUAJIT_DISABLE_JIT`, and will return a table with all `0`. + +[Back to TOC](#table-of-contents) + +### thread.exdata + +**syntax:** *exdata = th_exdata(data?)* + +This API allows for embedding user data into a thread (`lua_State`). + +The retrieved `exdata` value on the Lua land is represented as a cdata object +of the ctype `void*`. + +As of this version, retrieving the `exdata` (i.e. `th_exdata()` without any +argument) can be JIT compiled. + +Usage: + +```lua +local th_exdata = require "thread.exdata" + +th_exdata(0xdeadbeefLL) -- set the exdata of the current Lua thread +local exdata = th_exdata() -- fetch the exdata of the current Lua thread +``` + +Also available are the following public C API functions for manipulating +`exdata` on the C land: + +```C +void lua_setexdata(lua_State *L, void *exdata); +void *lua_getexdata(lua_State *L); +``` + +The `exdata` pointer is initialized to `NULL` when the main thread is created. +Any child Lua thread will inherit its parent's `exdata`, but still can override +it. + +**Note:** This API will not be available if LuaJIT is compiled with +`-DLUAJIT_DISABLE_FFI`. + +**Note bis:** This API is used internally by the OpenResty core, and it is +strongly discouraged to use it yourself in the context of OpenResty. + +[Back to TOC](#table-of-contents) + +### thread.exdata2 + +**syntax:** *exdata = th_exdata2(data?)* + +Similar to `thread.exdata` but for a 2nd separate user data as a pointer value. + +[Back to TOC](#table-of-contents) + +## New C API + +### lua_setexdata + +```C +void lua_setexdata(lua_State *L, void *exdata); +``` + +Sets extra user data as a pointer value to the current Lua state or thread. + +[Back to TOC](#table-of-contents) + +### lua_getexdata + +```C +void *lua_getexdata(lua_State *L); +``` + +Gets extra user data as a pointer value to the current Lua state or thread. + +[Back to TOC](#table-of-contents) + +### lua_setexdata2 + +```C +void lua_setexdata2(lua_State *L, void *exdata2); +``` + +Similar to `lua_setexdata` but for a 2nd user data (pointer) value. + +[Back to TOC](#table-of-contents) + +### lua_getexdata2 + +```C +void *lua_getexdata2(lua_State *L); +``` + +Similar to `lua_getexdata` but for a 2nd user data (pointer) value. + +[Back to TOC](#table-of-contents) + +### lua_resetthread + +```C +void lua_resetthread(lua_State *L, lua_State *th); +``` + +Resets the state of `th` to the initial state of a newly created Lua thread +object as returned by `lua_newthread()`. This is mainly for Lua thread +recycling. Lua threads in arbitrary states (like yielded or errored) can be +reset properly. + +The current implementation does not shrink the already allocated Lua stack +though. It only clears it. + +[Back to TOC](#table-of-contents) + +## New macros + +The macros described in this section have been added to this branch. + +[Back to TOC](#table-of-contents) + +### `OPENRESTY_LUAJIT` + +In the `luajit.h` header file, a new macro `OPENRESTY_LUAJIT` was defined to +help distinguishing this OpenResty-specific branch of LuaJIT. + +### `HAVE_LUA_RESETTHREAD` + +This macro is set when the `lua_resetthread` C API is present. + +[Back to TOC](#table-of-contents) + +## Optimizations + +### Updated JIT default parameters + +We use more appressive default JIT compiler options to help large OpenResty +Lua applications. + +The following `jit.opt` options are used by default: + +```lua +maxtrace=8000 +maxrecord=16000 +minstitch=3 +maxmcode=40960 -- in KB +``` + +[Back to TOC](#table-of-contents) + +### String hashing + +This optimization only applies to Intel CPUs supporting the SSE 4.2 instruction +sets. For such CPUs, and when this branch is compiled with `-msse4.2`, the +string hashing function used for strings interning will be based on an +optimized crc32 implementation (see `lj_str_new()`). + +This optimization still provides constant-time hashing complexity (`O(n)`), but +makes hash collision attacks harder for strings up to 127 bytes of size. + +[Back to TOC](#table-of-contents) + +## Updated bytecode options + +### New `-bL` option + +The bytecode option `L` was added to display Lua sources line numbers. + +For example, `luajit -bL -e 'print(1)'` now produces bytecode dumps like below: + +``` +-- BYTECODE -- "print(1)":0-1 +0001 [1] GGET 0 0 ; "print" +0002 [1] KSHORT 1 1 +0003 [1] CALL 0 1 2 +0004 [1] RET0 0 1 +``` + +The `[N]` column corresponds to the Lua source line number. For example, `[1]` +means "the first source line". + +[Back to TOC](#table-of-contents) + +### Updated `-bl` option + +The bytecode option `l` was updated to display the constant tables of each Lua +prototype. + +For example, `luajit -bl a.lua'` now produces bytecode dumps like below: + +``` +-- BYTECODE -- a.lua:0-48 +KGC 0 "print" +KGC 1 "hi" +KGC 2 table +KGC 3 a.lua:17 +KN 1 1000000 +KN 2 1.390671161567e-309 +... +``` + +[Back to TOC](#table-of-contents) + +## Miscellaneous + +* Increased the maximum number of allowed upvalues from 60 to 120. +* Various important bugfixes in the JIT compiler and Lua VM which have + not been merged in upstream LuaJIT. +* Removed the GCC 4 requirement for x86 on older systems such as Solaris i386. +* In the `Makefile` file, make sure we always install the symlink for "luajit" + even for alpha or beta versions. +* Applied a patch to fix DragonFlyBSD compatibility. Note: this is not an + officially supported target. +* feature: jit.dump: output Lua source location after every BC. +* feature: added internal memory-buffer-based trace entry/exit/start-recording + event logging, mainly for debugging bugs in the JIT compiler. it requires + `-DLUA_USE_TRACE_LOGS` when building LuaJIT. +* feature: save `g->jit_base` to `g->saved_jit_base` before `lj_err_throw` + clears `g->jit_base` which makes it impossible to get Lua backtrace in such + states. + +[Back to TOC](#table-of-contents) + +# Copyright & License + +LuaJIT is a Just-In-Time (JIT) compiler for the Lua programming language. + +Project Homepage: http://luajit.org/ + +LuaJIT is Copyright (C) 2005-2019 Mike Pall. + +Additional patches for OpenResty are copyrighted by Yichun Zhang and OpenResty +Inc.: + +Copyright (C) 2017-2019 Yichun Zhang. All rights reserved. + +Copyright (C) 2017-2019 OpenResty Inc. All rights reserved. + +LuaJIT is free software, released under the MIT license. +See full Copyright Notice in the COPYRIGHT file or in luajit.h. + +Documentation for the official LuaJIT is available in HTML format. +Please point your favorite browser to: + + doc/luajit.html + +[Back to TOC](#table-of-contents) diff --git a/third_party/luajit/luajit/doc/bluequad-print.css b/third_party/luajit/luajit/doc/bluequad-print.css index a49d309ff..4a1392789 100644 --- a/third_party/luajit/luajit/doc/bluequad-print.css +++ b/third_party/luajit/luajit/doc/bluequad-print.css @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2022 Mike Pall. +/* Copyright (C) 2004-2023 Mike Pall. * * You are welcome to use the general ideas of this design for your own sites. * But please do not steal the stylesheet, the layout or the color scheme. diff --git a/third_party/luajit/luajit/doc/bluequad.css b/third_party/luajit/luajit/doc/bluequad.css index 4c1a9082e..7399f6251 100644 --- a/third_party/luajit/luajit/doc/bluequad.css +++ b/third_party/luajit/luajit/doc/bluequad.css @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2022 Mike Pall. +/* Copyright (C) 2004-2023 Mike Pall. * * You are welcome to use the general ideas of this design for your own sites. * But please do not steal the stylesheet, the layout or the color scheme. @@ -206,11 +206,9 @@ img.right { .ext { color: #ff8000; } -.new { - font-size: 6pt; - vertical-align: middle; - background: #ff8000; - color: #ffffff; +.note { + padding: 0.5em 1em; + border-left: 3px solid #bfcfff; } #site { clear: both; diff --git a/third_party/luajit/luajit/doc/contact.html b/third_party/luajit/luajit/doc/contact.html index 6d609286e..cc4d8c723 100644 --- a/third_party/luajit/luajit/doc/contact.html +++ b/third_party/luajit/luajit/doc/contact.html @@ -3,7 +3,7 @@ Contact - + @@ -46,9 +46,9 @@

Contact

Profiler
  • -Status +Status »
  • -FAQ +FAQ »
  • Mailing List »
  • @@ -94,7 +94,7 @@

    Contact

    Copyright

    All documentation is -Copyright © 2005-2022 Mike Pall. +Copyright © 2005-2023 Mike Pall.

    @@ -102,7 +102,7 @@

    Copyright