diff --git a/love/src/jni/LuaJIT-2.1/COPYRIGHT b/love/src/jni/LuaJIT-2.1/COPYRIGHT index 9c2bca55..c74216c3 100644 --- a/love/src/jni/LuaJIT-2.1/COPYRIGHT +++ b/love/src/jni/LuaJIT-2.1/COPYRIGHT @@ -1,7 +1,7 @@ =============================================================================== LuaJIT -- a Just-In-Time Compiler for Lua. https://luajit.org/ -Copyright (C) 2005-2021 Mike Pall. All rights reserved. +Copyright (C) 2005-2022 Mike Pall. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/love/src/jni/LuaJIT-2.1/Makefile b/love/src/jni/LuaJIT-2.1/Makefile index aa1b84bd..b0288b4d 100644 --- a/love/src/jni/LuaJIT-2.1/Makefile +++ b/love/src/jni/LuaJIT-2.1/Makefile @@ -10,7 +10,7 @@ # 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-2021 Mike Pall. See Copyright Notice in luajit.h +# Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h ############################################################################## MAJVER= 2 @@ -33,7 +33,8 @@ DPREFIX= $(DESTDIR)$(PREFIX) INSTALL_BIN= $(DPREFIX)/bin INSTALL_LIB= $(DPREFIX)/$(MULTILIB) INSTALL_SHARE= $(DPREFIX)/share -INSTALL_INC= $(DPREFIX)/include/luajit-$(MAJVER).$(MINVER) +INSTALL_DEFINC= $(DPREFIX)/include/luajit-$(MAJVER).$(MINVER) +INSTALL_INC= $(INSTALL_DEFINC) INSTALL_LJLIBD= $(INSTALL_SHARE)/luajit-$(VERSION) INSTALL_JITLIB= $(INSTALL_LJLIBD)/jit @@ -78,6 +79,9 @@ UNINSTALL= $(RM) LDCONFIG= ldconfig -n 2>/dev/null SED_PC= sed -e "s|^prefix=.*|prefix=$(PREFIX)|" \ -e "s|^multilib=.*|multilib=$(MULTILIB)|" +ifneq ($(INSTALL_DEFINC),$(INSTALL_INC)) + SED_PC+= -e "s|^includedir=.*|includedir=$(INSTALL_INC)|" +endif FILE_T= luajit FILE_A= libluajit.a diff --git a/love/src/jni/LuaJIT-2.1/README b/love/src/jni/LuaJIT-2.1/README index c9f7d9ad..1faef255 100644 --- a/love/src/jni/LuaJIT-2.1/README +++ b/love/src/jni/LuaJIT-2.1/README @@ -5,7 +5,7 @@ LuaJIT is a Just-In-Time (JIT) compiler for the Lua programming language. Project Homepage: https://luajit.org/ -LuaJIT is Copyright (C) 2005-2021 Mike Pall. +LuaJIT is Copyright (C) 2005-2022 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/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/bc.lua b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/bc.lua index e58a3fef..8d0844c0 100644 --- a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/bc.lua +++ b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/bc.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT bytecode listing module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- diff --git a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/bcsave.lua b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/bcsave.lua index bc959327..90fe9daf 100644 --- a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/bcsave.lua +++ b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/bcsave.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT module to save/list bytecode. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- @@ -33,6 +33,7 @@ Save LuaJIT bytecode: luajit -b[options] input output -t type Set output file type (default: auto-detect from output name). -a arch Override architecture for object files (default: native). -o os Override OS for object files (default: native). + -F name Override filename (default: input filename). -e chunk Use chunk string as input. -- Stop handling options. - Use stdin as input and/or stdout as output. @@ -49,10 +50,22 @@ local function check(ok, ...) os.exit(1) end -local function readfile(input) +local function readfile(ctx, input) if type(input) == "function" then return input end - if input == "-" then input = nil end - return check(loadfile(input)) + if ctx.filename then + local data + if input == "-" then + data = io.stdin:read("*a") + else + local fp = assert(io.open(input, "rb")) + data = assert(fp:read("*a")) + assert(fp:close()) + end + return check(load(data, ctx.filename)) + else + if input == "-" then input = nil end + return check(loadfile(input)) + end end local function savefile(name, mode) @@ -456,18 +469,18 @@ typedef struct { uint32_t value; } mach_nlist; typedef struct { - uint32_t strx; + int32_t strx; uint8_t type, sect; uint16_t desc; uint64_t value; } mach_nlist_64; typedef struct { - uint32_t magic, nfat_arch; + int32_t magic, nfat_arch; } mach_fat_header; typedef struct { - uint32_t cputype, cpusubtype, offset, size, align; + int32_t cputype, cpusubtype, offset, size, align; } mach_fat_arch; typedef struct { struct { @@ -501,6 +514,18 @@ typedef struct { mach_nlist sym_entry; uint8_t space[4096]; } mach_fat_obj; +typedef struct { + mach_fat_header fat; + mach_fat_arch fat_arch[2]; + struct { + mach_header_64 hdr; + mach_segment_command_64 seg; + mach_section_64 sec; + mach_symtab_command sym; + } arch[2]; + mach_nlist_64 sym_entry; + uint8_t space[4096]; +} mach_fat_obj_64; ]] local symname = '_'..LJBC_PREFIX..ctx.modname local isfat, is64, align, mobj = false, false, 4, "mach_obj" @@ -509,7 +534,7 @@ typedef struct { elseif ctx.arch == "arm" then isfat, mobj = true, "mach_fat_obj" elseif ctx.arch == "arm64" then - is64, align, isfat, mobj = true, 8, true, "mach_fat_obj" + is64, align, isfat, mobj = true, 8, true, "mach_fat_obj_64" else check(ctx.arch == "x86", "unsupported architecture for OSX") end @@ -592,13 +617,13 @@ end ------------------------------------------------------------------------------ -local function bclist(input, output) - local f = readfile(input) +local function bclist(ctx, input, output) + local f = readfile(ctx, input) require("jit.bc").dump(f, savefile(output, "w"), true) end local function bcsave(ctx, input, output) - local f = readfile(input) + local f = readfile(ctx, input) local s = string.dump(f, ctx.strip) local t = ctx.type if not t then @@ -651,6 +676,8 @@ local function docmd(...) ctx.arch = checkarg(tremove(arg, n), map_arch, "architecture") elseif opt == "o" then ctx.os = checkarg(tremove(arg, n), map_os, "OS name") + elseif opt == "F" then + ctx.filename = "@"..tremove(arg, n) else usage() end @@ -662,7 +689,7 @@ local function docmd(...) end if list then if #arg == 0 or #arg > 2 then usage() end - bclist(arg[1], arg[2] or "-") + bclist(ctx, arg[1], arg[2] or "-") else if #arg ~= 2 then usage() end bcsave(ctx, arg[1], arg[2]) diff --git a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_arm.lua b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_arm.lua index ba79c47e..18ab68df 100644 --- a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_arm.lua +++ b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_arm.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT ARM disassembler module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This is a helper module used by the LuaJIT machine code dumper module. diff --git a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_arm64.lua b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_arm64.lua index ad909fbd..531584a1 100644 --- a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_arm64.lua +++ b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_arm64.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT ARM64 disassembler module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h -- -- Contributed by Djordje Kovacevic and Stefan Pejic from RT-RK.com. diff --git a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_arm64be.lua b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_arm64be.lua index edcbffa8..7337f5b7 100644 --- a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_arm64be.lua +++ b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_arm64be.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT ARM64BE disassembler wrapper module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- ARM64 instructions are always little-endian. So just forward to the diff --git a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_mips.lua b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_mips.lua index 6ad17f54..05dc30fd 100644 --- a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_mips.lua +++ b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_mips.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT MIPS disassembler module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT/X license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This is a helper module used by the LuaJIT machine code dumper module. diff --git a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_mips64.lua b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_mips64.lua index 5ad48f8f..1236e524 100644 --- a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_mips64.lua +++ b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_mips64.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT MIPS64 disassembler wrapper module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This module just exports the big-endian functions from the diff --git a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_mips64el.lua b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_mips64el.lua index d50e3a18..7c478d2d 100644 --- a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_mips64el.lua +++ b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_mips64el.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT MIPS64EL disassembler wrapper module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This module just exports the little-endian functions from the diff --git a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_mips64r6.lua b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_mips64r6.lua index 921b3cbe..c5789ce4 100644 --- a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_mips64r6.lua +++ b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_mips64r6.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT MIPS64R6 disassembler wrapper module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This module just exports the r6 big-endian functions from the diff --git a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_mips64r6el.lua b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_mips64r6el.lua index aadef9f3..f67f6240 100644 --- a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_mips64r6el.lua +++ b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_mips64r6el.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT MIPS64R6EL disassembler wrapper module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This module just exports the r6 little-endian functions from the diff --git a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_mipsel.lua b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_mipsel.lua index 52cebefb..a4fa6c60 100644 --- a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_mipsel.lua +++ b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_mipsel.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT MIPSEL disassembler wrapper module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This module just exports the little-endian functions from the diff --git a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_ppc.lua b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_ppc.lua index 08d742f1..8f65f25a 100644 --- a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_ppc.lua +++ b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_ppc.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT PPC disassembler module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT/X license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This is a helper module used by the LuaJIT machine code dumper module. diff --git a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_x64.lua b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_x64.lua index 2d37423e..d076c6ae 100644 --- a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_x64.lua +++ b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_x64.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT x64 disassembler wrapper module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This module just exports the 64 bit functions from the combined diff --git a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_x86.lua b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_x86.lua index 5480854c..84492fff 100644 --- a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_x86.lua +++ b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dis_x86.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT x86/x64 disassembler module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This is a helper module used by the LuaJIT machine code dumper module. diff --git a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dump.lua b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dump.lua index 9eda08c4..18e7a4b7 100644 --- a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dump.lua +++ b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/dump.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT compiler dump module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- diff --git a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/p.lua b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/p.lua index c9ec1d8b..f225c312 100644 --- a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/p.lua +++ b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/p.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT profiler. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- diff --git a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/v.lua b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/v.lua index 83589143..ac8b19db 100644 --- a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/v.lua +++ b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/v.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- Verbose mode of the LuaJIT compiler. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- diff --git a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/vmdef.lua b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/vmdef.lua index 68ff7ba2..9ed150be 100644 --- a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/vmdef.lua +++ b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/vmdef.lua @@ -76,7 +76,6 @@ ircall = { "sqrt", "log", "lj_vm_log2", -"lj_vm_powi", "pow", "atan2", "ldexp", diff --git a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/zone.lua b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/zone.lua index 94357854..1308cb74 100644 --- a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/zone.lua +++ b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/jit/zone.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT profiler zones. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- diff --git a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/libluajit.a b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/libluajit.a index 11850655..f877e899 100644 Binary files a/love/src/jni/LuaJIT-2.1/android/arm64-v8a/libluajit.a and b/love/src/jni/LuaJIT-2.1/android/arm64-v8a/libluajit.a differ diff --git a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/bc.lua b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/bc.lua index e58a3fef..8d0844c0 100644 --- a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/bc.lua +++ b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/bc.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT bytecode listing module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- diff --git a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/bcsave.lua b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/bcsave.lua index bc959327..90fe9daf 100644 --- a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/bcsave.lua +++ b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/bcsave.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT module to save/list bytecode. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- @@ -33,6 +33,7 @@ Save LuaJIT bytecode: luajit -b[options] input output -t type Set output file type (default: auto-detect from output name). -a arch Override architecture for object files (default: native). -o os Override OS for object files (default: native). + -F name Override filename (default: input filename). -e chunk Use chunk string as input. -- Stop handling options. - Use stdin as input and/or stdout as output. @@ -49,10 +50,22 @@ local function check(ok, ...) os.exit(1) end -local function readfile(input) +local function readfile(ctx, input) if type(input) == "function" then return input end - if input == "-" then input = nil end - return check(loadfile(input)) + if ctx.filename then + local data + if input == "-" then + data = io.stdin:read("*a") + else + local fp = assert(io.open(input, "rb")) + data = assert(fp:read("*a")) + assert(fp:close()) + end + return check(load(data, ctx.filename)) + else + if input == "-" then input = nil end + return check(loadfile(input)) + end end local function savefile(name, mode) @@ -456,18 +469,18 @@ typedef struct { uint32_t value; } mach_nlist; typedef struct { - uint32_t strx; + int32_t strx; uint8_t type, sect; uint16_t desc; uint64_t value; } mach_nlist_64; typedef struct { - uint32_t magic, nfat_arch; + int32_t magic, nfat_arch; } mach_fat_header; typedef struct { - uint32_t cputype, cpusubtype, offset, size, align; + int32_t cputype, cpusubtype, offset, size, align; } mach_fat_arch; typedef struct { struct { @@ -501,6 +514,18 @@ typedef struct { mach_nlist sym_entry; uint8_t space[4096]; } mach_fat_obj; +typedef struct { + mach_fat_header fat; + mach_fat_arch fat_arch[2]; + struct { + mach_header_64 hdr; + mach_segment_command_64 seg; + mach_section_64 sec; + mach_symtab_command sym; + } arch[2]; + mach_nlist_64 sym_entry; + uint8_t space[4096]; +} mach_fat_obj_64; ]] local symname = '_'..LJBC_PREFIX..ctx.modname local isfat, is64, align, mobj = false, false, 4, "mach_obj" @@ -509,7 +534,7 @@ typedef struct { elseif ctx.arch == "arm" then isfat, mobj = true, "mach_fat_obj" elseif ctx.arch == "arm64" then - is64, align, isfat, mobj = true, 8, true, "mach_fat_obj" + is64, align, isfat, mobj = true, 8, true, "mach_fat_obj_64" else check(ctx.arch == "x86", "unsupported architecture for OSX") end @@ -592,13 +617,13 @@ end ------------------------------------------------------------------------------ -local function bclist(input, output) - local f = readfile(input) +local function bclist(ctx, input, output) + local f = readfile(ctx, input) require("jit.bc").dump(f, savefile(output, "w"), true) end local function bcsave(ctx, input, output) - local f = readfile(input) + local f = readfile(ctx, input) local s = string.dump(f, ctx.strip) local t = ctx.type if not t then @@ -651,6 +676,8 @@ local function docmd(...) ctx.arch = checkarg(tremove(arg, n), map_arch, "architecture") elseif opt == "o" then ctx.os = checkarg(tremove(arg, n), map_os, "OS name") + elseif opt == "F" then + ctx.filename = "@"..tremove(arg, n) else usage() end @@ -662,7 +689,7 @@ local function docmd(...) end if list then if #arg == 0 or #arg > 2 then usage() end - bclist(arg[1], arg[2] or "-") + bclist(ctx, arg[1], arg[2] or "-") else if #arg ~= 2 then usage() end bcsave(ctx, arg[1], arg[2]) diff --git a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_arm.lua b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_arm.lua index ba79c47e..18ab68df 100644 --- a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_arm.lua +++ b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_arm.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT ARM disassembler module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This is a helper module used by the LuaJIT machine code dumper module. diff --git a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_arm64.lua b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_arm64.lua index ad909fbd..531584a1 100644 --- a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_arm64.lua +++ b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_arm64.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT ARM64 disassembler module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h -- -- Contributed by Djordje Kovacevic and Stefan Pejic from RT-RK.com. diff --git a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_arm64be.lua b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_arm64be.lua index edcbffa8..7337f5b7 100644 --- a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_arm64be.lua +++ b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_arm64be.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT ARM64BE disassembler wrapper module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- ARM64 instructions are always little-endian. So just forward to the diff --git a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_mips.lua b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_mips.lua index 6ad17f54..05dc30fd 100644 --- a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_mips.lua +++ b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_mips.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT MIPS disassembler module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT/X license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This is a helper module used by the LuaJIT machine code dumper module. diff --git a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_mips64.lua b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_mips64.lua index 5ad48f8f..1236e524 100644 --- a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_mips64.lua +++ b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_mips64.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT MIPS64 disassembler wrapper module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This module just exports the big-endian functions from the diff --git a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_mips64el.lua b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_mips64el.lua index d50e3a18..7c478d2d 100644 --- a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_mips64el.lua +++ b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_mips64el.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT MIPS64EL disassembler wrapper module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This module just exports the little-endian functions from the diff --git a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_mips64r6.lua b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_mips64r6.lua index 921b3cbe..c5789ce4 100644 --- a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_mips64r6.lua +++ b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_mips64r6.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT MIPS64R6 disassembler wrapper module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This module just exports the r6 big-endian functions from the diff --git a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_mips64r6el.lua b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_mips64r6el.lua index aadef9f3..f67f6240 100644 --- a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_mips64r6el.lua +++ b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_mips64r6el.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT MIPS64R6EL disassembler wrapper module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This module just exports the r6 little-endian functions from the diff --git a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_mipsel.lua b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_mipsel.lua index 52cebefb..a4fa6c60 100644 --- a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_mipsel.lua +++ b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_mipsel.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT MIPSEL disassembler wrapper module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This module just exports the little-endian functions from the diff --git a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_ppc.lua b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_ppc.lua index 08d742f1..8f65f25a 100644 --- a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_ppc.lua +++ b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_ppc.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT PPC disassembler module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT/X license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This is a helper module used by the LuaJIT machine code dumper module. diff --git a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_x64.lua b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_x64.lua index 2d37423e..d076c6ae 100644 --- a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_x64.lua +++ b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_x64.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT x64 disassembler wrapper module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This module just exports the 64 bit functions from the combined diff --git a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_x86.lua b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_x86.lua index 5480854c..84492fff 100644 --- a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_x86.lua +++ b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dis_x86.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT x86/x64 disassembler module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This is a helper module used by the LuaJIT machine code dumper module. diff --git a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dump.lua b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dump.lua index 9eda08c4..18e7a4b7 100644 --- a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dump.lua +++ b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/dump.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT compiler dump module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- diff --git a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/p.lua b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/p.lua index c9ec1d8b..f225c312 100644 --- a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/p.lua +++ b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/p.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT profiler. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- diff --git a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/v.lua b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/v.lua index 83589143..ac8b19db 100644 --- a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/v.lua +++ b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/v.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- Verbose mode of the LuaJIT compiler. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- diff --git a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/vmdef.lua b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/vmdef.lua index 68ff7ba2..9ed150be 100644 --- a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/vmdef.lua +++ b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/vmdef.lua @@ -76,7 +76,6 @@ ircall = { "sqrt", "log", "lj_vm_log2", -"lj_vm_powi", "pow", "atan2", "ldexp", diff --git a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/zone.lua b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/zone.lua index 94357854..1308cb74 100644 --- a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/zone.lua +++ b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/jit/zone.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT profiler zones. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- diff --git a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/libluajit.a b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/libluajit.a index 9bd4a7b3..c4c7bb89 100644 Binary files a/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/libluajit.a and b/love/src/jni/LuaJIT-2.1/android/armeabi-v7a/libluajit.a differ diff --git a/love/src/jni/LuaJIT-2.1/android/x86/jit/bc.lua b/love/src/jni/LuaJIT-2.1/android/x86/jit/bc.lua index e58a3fef..8d0844c0 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86/jit/bc.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86/jit/bc.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT bytecode listing module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- diff --git a/love/src/jni/LuaJIT-2.1/android/x86/jit/bcsave.lua b/love/src/jni/LuaJIT-2.1/android/x86/jit/bcsave.lua index bc959327..90fe9daf 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86/jit/bcsave.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86/jit/bcsave.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT module to save/list bytecode. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- @@ -33,6 +33,7 @@ Save LuaJIT bytecode: luajit -b[options] input output -t type Set output file type (default: auto-detect from output name). -a arch Override architecture for object files (default: native). -o os Override OS for object files (default: native). + -F name Override filename (default: input filename). -e chunk Use chunk string as input. -- Stop handling options. - Use stdin as input and/or stdout as output. @@ -49,10 +50,22 @@ local function check(ok, ...) os.exit(1) end -local function readfile(input) +local function readfile(ctx, input) if type(input) == "function" then return input end - if input == "-" then input = nil end - return check(loadfile(input)) + if ctx.filename then + local data + if input == "-" then + data = io.stdin:read("*a") + else + local fp = assert(io.open(input, "rb")) + data = assert(fp:read("*a")) + assert(fp:close()) + end + return check(load(data, ctx.filename)) + else + if input == "-" then input = nil end + return check(loadfile(input)) + end end local function savefile(name, mode) @@ -456,18 +469,18 @@ typedef struct { uint32_t value; } mach_nlist; typedef struct { - uint32_t strx; + int32_t strx; uint8_t type, sect; uint16_t desc; uint64_t value; } mach_nlist_64; typedef struct { - uint32_t magic, nfat_arch; + int32_t magic, nfat_arch; } mach_fat_header; typedef struct { - uint32_t cputype, cpusubtype, offset, size, align; + int32_t cputype, cpusubtype, offset, size, align; } mach_fat_arch; typedef struct { struct { @@ -501,6 +514,18 @@ typedef struct { mach_nlist sym_entry; uint8_t space[4096]; } mach_fat_obj; +typedef struct { + mach_fat_header fat; + mach_fat_arch fat_arch[2]; + struct { + mach_header_64 hdr; + mach_segment_command_64 seg; + mach_section_64 sec; + mach_symtab_command sym; + } arch[2]; + mach_nlist_64 sym_entry; + uint8_t space[4096]; +} mach_fat_obj_64; ]] local symname = '_'..LJBC_PREFIX..ctx.modname local isfat, is64, align, mobj = false, false, 4, "mach_obj" @@ -509,7 +534,7 @@ typedef struct { elseif ctx.arch == "arm" then isfat, mobj = true, "mach_fat_obj" elseif ctx.arch == "arm64" then - is64, align, isfat, mobj = true, 8, true, "mach_fat_obj" + is64, align, isfat, mobj = true, 8, true, "mach_fat_obj_64" else check(ctx.arch == "x86", "unsupported architecture for OSX") end @@ -592,13 +617,13 @@ end ------------------------------------------------------------------------------ -local function bclist(input, output) - local f = readfile(input) +local function bclist(ctx, input, output) + local f = readfile(ctx, input) require("jit.bc").dump(f, savefile(output, "w"), true) end local function bcsave(ctx, input, output) - local f = readfile(input) + local f = readfile(ctx, input) local s = string.dump(f, ctx.strip) local t = ctx.type if not t then @@ -651,6 +676,8 @@ local function docmd(...) ctx.arch = checkarg(tremove(arg, n), map_arch, "architecture") elseif opt == "o" then ctx.os = checkarg(tremove(arg, n), map_os, "OS name") + elseif opt == "F" then + ctx.filename = "@"..tremove(arg, n) else usage() end @@ -662,7 +689,7 @@ local function docmd(...) end if list then if #arg == 0 or #arg > 2 then usage() end - bclist(arg[1], arg[2] or "-") + bclist(ctx, arg[1], arg[2] or "-") else if #arg ~= 2 then usage() end bcsave(ctx, arg[1], arg[2]) diff --git a/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_arm.lua b/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_arm.lua index ba79c47e..18ab68df 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_arm.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_arm.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT ARM disassembler module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This is a helper module used by the LuaJIT machine code dumper module. diff --git a/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_arm64.lua b/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_arm64.lua index ad909fbd..531584a1 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_arm64.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_arm64.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT ARM64 disassembler module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h -- -- Contributed by Djordje Kovacevic and Stefan Pejic from RT-RK.com. diff --git a/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_arm64be.lua b/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_arm64be.lua index edcbffa8..7337f5b7 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_arm64be.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_arm64be.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT ARM64BE disassembler wrapper module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- ARM64 instructions are always little-endian. So just forward to the diff --git a/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_mips.lua b/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_mips.lua index 6ad17f54..05dc30fd 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_mips.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_mips.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT MIPS disassembler module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT/X license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This is a helper module used by the LuaJIT machine code dumper module. diff --git a/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_mips64.lua b/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_mips64.lua index 5ad48f8f..1236e524 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_mips64.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_mips64.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT MIPS64 disassembler wrapper module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This module just exports the big-endian functions from the diff --git a/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_mips64el.lua b/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_mips64el.lua index d50e3a18..7c478d2d 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_mips64el.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_mips64el.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT MIPS64EL disassembler wrapper module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This module just exports the little-endian functions from the diff --git a/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_mips64r6.lua b/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_mips64r6.lua index 921b3cbe..c5789ce4 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_mips64r6.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_mips64r6.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT MIPS64R6 disassembler wrapper module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This module just exports the r6 big-endian functions from the diff --git a/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_mips64r6el.lua b/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_mips64r6el.lua index aadef9f3..f67f6240 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_mips64r6el.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_mips64r6el.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT MIPS64R6EL disassembler wrapper module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This module just exports the r6 little-endian functions from the diff --git a/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_mipsel.lua b/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_mipsel.lua index 52cebefb..a4fa6c60 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_mipsel.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_mipsel.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT MIPSEL disassembler wrapper module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This module just exports the little-endian functions from the diff --git a/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_ppc.lua b/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_ppc.lua index 08d742f1..8f65f25a 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_ppc.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_ppc.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT PPC disassembler module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT/X license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This is a helper module used by the LuaJIT machine code dumper module. diff --git a/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_x64.lua b/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_x64.lua index 2d37423e..d076c6ae 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_x64.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_x64.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT x64 disassembler wrapper module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This module just exports the 64 bit functions from the combined diff --git a/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_x86.lua b/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_x86.lua index 5480854c..84492fff 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_x86.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86/jit/dis_x86.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT x86/x64 disassembler module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This is a helper module used by the LuaJIT machine code dumper module. diff --git a/love/src/jni/LuaJIT-2.1/android/x86/jit/dump.lua b/love/src/jni/LuaJIT-2.1/android/x86/jit/dump.lua index 9eda08c4..18e7a4b7 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86/jit/dump.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86/jit/dump.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT compiler dump module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- diff --git a/love/src/jni/LuaJIT-2.1/android/x86/jit/p.lua b/love/src/jni/LuaJIT-2.1/android/x86/jit/p.lua index c9ec1d8b..f225c312 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86/jit/p.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86/jit/p.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT profiler. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- diff --git a/love/src/jni/LuaJIT-2.1/android/x86/jit/v.lua b/love/src/jni/LuaJIT-2.1/android/x86/jit/v.lua index 83589143..ac8b19db 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86/jit/v.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86/jit/v.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- Verbose mode of the LuaJIT compiler. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- diff --git a/love/src/jni/LuaJIT-2.1/android/x86/jit/vmdef.lua b/love/src/jni/LuaJIT-2.1/android/x86/jit/vmdef.lua index 68ff7ba2..9ed150be 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86/jit/vmdef.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86/jit/vmdef.lua @@ -76,7 +76,6 @@ ircall = { "sqrt", "log", "lj_vm_log2", -"lj_vm_powi", "pow", "atan2", "ldexp", diff --git a/love/src/jni/LuaJIT-2.1/android/x86/jit/zone.lua b/love/src/jni/LuaJIT-2.1/android/x86/jit/zone.lua index 94357854..1308cb74 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86/jit/zone.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86/jit/zone.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT profiler zones. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- diff --git a/love/src/jni/LuaJIT-2.1/android/x86/libluajit.a b/love/src/jni/LuaJIT-2.1/android/x86/libluajit.a index 905fe541..66ec590f 100644 Binary files a/love/src/jni/LuaJIT-2.1/android/x86/libluajit.a and b/love/src/jni/LuaJIT-2.1/android/x86/libluajit.a differ diff --git a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/bc.lua b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/bc.lua index e58a3fef..8d0844c0 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/bc.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/bc.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT bytecode listing module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- diff --git a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/bcsave.lua b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/bcsave.lua index bc959327..90fe9daf 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/bcsave.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/bcsave.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT module to save/list bytecode. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- @@ -33,6 +33,7 @@ Save LuaJIT bytecode: luajit -b[options] input output -t type Set output file type (default: auto-detect from output name). -a arch Override architecture for object files (default: native). -o os Override OS for object files (default: native). + -F name Override filename (default: input filename). -e chunk Use chunk string as input. -- Stop handling options. - Use stdin as input and/or stdout as output. @@ -49,10 +50,22 @@ local function check(ok, ...) os.exit(1) end -local function readfile(input) +local function readfile(ctx, input) if type(input) == "function" then return input end - if input == "-" then input = nil end - return check(loadfile(input)) + if ctx.filename then + local data + if input == "-" then + data = io.stdin:read("*a") + else + local fp = assert(io.open(input, "rb")) + data = assert(fp:read("*a")) + assert(fp:close()) + end + return check(load(data, ctx.filename)) + else + if input == "-" then input = nil end + return check(loadfile(input)) + end end local function savefile(name, mode) @@ -456,18 +469,18 @@ typedef struct { uint32_t value; } mach_nlist; typedef struct { - uint32_t strx; + int32_t strx; uint8_t type, sect; uint16_t desc; uint64_t value; } mach_nlist_64; typedef struct { - uint32_t magic, nfat_arch; + int32_t magic, nfat_arch; } mach_fat_header; typedef struct { - uint32_t cputype, cpusubtype, offset, size, align; + int32_t cputype, cpusubtype, offset, size, align; } mach_fat_arch; typedef struct { struct { @@ -501,6 +514,18 @@ typedef struct { mach_nlist sym_entry; uint8_t space[4096]; } mach_fat_obj; +typedef struct { + mach_fat_header fat; + mach_fat_arch fat_arch[2]; + struct { + mach_header_64 hdr; + mach_segment_command_64 seg; + mach_section_64 sec; + mach_symtab_command sym; + } arch[2]; + mach_nlist_64 sym_entry; + uint8_t space[4096]; +} mach_fat_obj_64; ]] local symname = '_'..LJBC_PREFIX..ctx.modname local isfat, is64, align, mobj = false, false, 4, "mach_obj" @@ -509,7 +534,7 @@ typedef struct { elseif ctx.arch == "arm" then isfat, mobj = true, "mach_fat_obj" elseif ctx.arch == "arm64" then - is64, align, isfat, mobj = true, 8, true, "mach_fat_obj" + is64, align, isfat, mobj = true, 8, true, "mach_fat_obj_64" else check(ctx.arch == "x86", "unsupported architecture for OSX") end @@ -592,13 +617,13 @@ end ------------------------------------------------------------------------------ -local function bclist(input, output) - local f = readfile(input) +local function bclist(ctx, input, output) + local f = readfile(ctx, input) require("jit.bc").dump(f, savefile(output, "w"), true) end local function bcsave(ctx, input, output) - local f = readfile(input) + local f = readfile(ctx, input) local s = string.dump(f, ctx.strip) local t = ctx.type if not t then @@ -651,6 +676,8 @@ local function docmd(...) ctx.arch = checkarg(tremove(arg, n), map_arch, "architecture") elseif opt == "o" then ctx.os = checkarg(tremove(arg, n), map_os, "OS name") + elseif opt == "F" then + ctx.filename = "@"..tremove(arg, n) else usage() end @@ -662,7 +689,7 @@ local function docmd(...) end if list then if #arg == 0 or #arg > 2 then usage() end - bclist(arg[1], arg[2] or "-") + bclist(ctx, arg[1], arg[2] or "-") else if #arg ~= 2 then usage() end bcsave(ctx, arg[1], arg[2]) diff --git a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_arm.lua b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_arm.lua index ba79c47e..18ab68df 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_arm.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_arm.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT ARM disassembler module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This is a helper module used by the LuaJIT machine code dumper module. diff --git a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_arm64.lua b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_arm64.lua index ad909fbd..531584a1 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_arm64.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_arm64.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT ARM64 disassembler module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h -- -- Contributed by Djordje Kovacevic and Stefan Pejic from RT-RK.com. diff --git a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_arm64be.lua b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_arm64be.lua index edcbffa8..7337f5b7 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_arm64be.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_arm64be.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT ARM64BE disassembler wrapper module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- ARM64 instructions are always little-endian. So just forward to the diff --git a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_mips.lua b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_mips.lua index 6ad17f54..05dc30fd 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_mips.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_mips.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT MIPS disassembler module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT/X license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This is a helper module used by the LuaJIT machine code dumper module. diff --git a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_mips64.lua b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_mips64.lua index 5ad48f8f..1236e524 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_mips64.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_mips64.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT MIPS64 disassembler wrapper module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This module just exports the big-endian functions from the diff --git a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_mips64el.lua b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_mips64el.lua index d50e3a18..7c478d2d 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_mips64el.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_mips64el.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT MIPS64EL disassembler wrapper module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This module just exports the little-endian functions from the diff --git a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_mips64r6.lua b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_mips64r6.lua index 921b3cbe..c5789ce4 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_mips64r6.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_mips64r6.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT MIPS64R6 disassembler wrapper module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This module just exports the r6 big-endian functions from the diff --git a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_mips64r6el.lua b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_mips64r6el.lua index aadef9f3..f67f6240 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_mips64r6el.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_mips64r6el.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT MIPS64R6EL disassembler wrapper module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This module just exports the r6 little-endian functions from the diff --git a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_mipsel.lua b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_mipsel.lua index 52cebefb..a4fa6c60 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_mipsel.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_mipsel.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT MIPSEL disassembler wrapper module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This module just exports the little-endian functions from the diff --git a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_ppc.lua b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_ppc.lua index 08d742f1..8f65f25a 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_ppc.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_ppc.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT PPC disassembler module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT/X license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This is a helper module used by the LuaJIT machine code dumper module. diff --git a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_x64.lua b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_x64.lua index 2d37423e..d076c6ae 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_x64.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_x64.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT x64 disassembler wrapper module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This module just exports the 64 bit functions from the combined diff --git a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_x86.lua b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_x86.lua index 5480854c..84492fff 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_x86.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dis_x86.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT x86/x64 disassembler module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This is a helper module used by the LuaJIT machine code dumper module. diff --git a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dump.lua b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dump.lua index 9eda08c4..18e7a4b7 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dump.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/dump.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT compiler dump module. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- diff --git a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/p.lua b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/p.lua index c9ec1d8b..f225c312 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/p.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/p.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT profiler. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- diff --git a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/v.lua b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/v.lua index 83589143..ac8b19db 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/v.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/v.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- Verbose mode of the LuaJIT compiler. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- diff --git a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/vmdef.lua b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/vmdef.lua index 68ff7ba2..9ed150be 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/vmdef.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/vmdef.lua @@ -76,7 +76,6 @@ ircall = { "sqrt", "log", "lj_vm_log2", -"lj_vm_powi", "pow", "atan2", "ldexp", diff --git a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/zone.lua b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/zone.lua index 94357854..1308cb74 100644 --- a/love/src/jni/LuaJIT-2.1/android/x86_64/jit/zone.lua +++ b/love/src/jni/LuaJIT-2.1/android/x86_64/jit/zone.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT profiler zones. -- --- Copyright (C) 2005-2021 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2022 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- diff --git a/love/src/jni/LuaJIT-2.1/android/x86_64/libluajit.a b/love/src/jni/LuaJIT-2.1/android/x86_64/libluajit.a index 1ad8eac3..6f8a93bf 100644 Binary files a/love/src/jni/LuaJIT-2.1/android/x86_64/libluajit.a and b/love/src/jni/LuaJIT-2.1/android/x86_64/libluajit.a differ diff --git a/love/src/jni/LuaJIT-2.1/build_instructions.bat b/love/src/jni/LuaJIT-2.1/build_instructions.bat index 8e42dba3..eacaf6a9 100644 --- a/love/src/jni/LuaJIT-2.1/build_instructions.bat +++ b/love/src/jni/LuaJIT-2.1/build_instructions.bat @@ -1,5 +1,5 @@ rem Build instruction assume using WSL + Clang for Windows (with MSVC x86+x64 toolset for -m32 switch) -rem This assume NDK r19 or later. See https://github.com/LuaJIT/LuaJIT/issues/477 for more information. +rem This assume NDK r23c or later. See https://github.com/LuaJIT/LuaJIT/issues/477 for more information. rem Make sure LuaJIT (yes, you need LuaJIT interpreter) and the NDK toolchain binaries is already in rem your PATH environment variable. If you're confused which part of the NDK should be added your path: @@ -18,18 +18,9 @@ call :compile arm64-v8a aarch64-linux-android 21 if "%ERRORLEVEL%" == "1" goto :error rem ARMv7 -rem ARMv7 is complicated. -if exist android\armeabi-v7a\libluajit.a goto :x86 -wsl make clean +call :compile armeabi-v7a armv7a-linux-androideabi 16 -m32 if not "%ERRORLEVEL%" == "0" goto :error -wsl make HOST_LUA=luajit.exe "HOST_CC=clang.exe -m32" HOST_CFLAGS=-D_CRT_SECURE_NO_WARNINGS CC=clang CROSS=arm-linux-androideabi- STATIC_CC=armv7a-linux-androideabi16-clang "DYNAMIC_CC=armv7a-linux-androideabi16-clang -fPIC" "TARGET_AR=arm-linux-androideabi-ar.exe rcus" TARGET_LD=armv7a-linux-androideabi16-clang TARGET_LDFLAGS=-fuse-ld=lld TARGET_STRIP=arm-linux-androideabi-strip.exe amalg -j4 -if not "%ERRORLEVEL%" == "0" goto :error -copy src\libluajit.a android\armeabi-v7a\libluajit.a -if not "%ERRORLEVEL%" == "0" goto :error -xcopy src\jit android\armeabi-v7a\jit /I -del android\armeabi-v7a\jit\.gitignore -:x86 rem x86 call :compile x86 i686-linux-android 16 -m32 if not "%ERRORLEVEL%" == "0" goto :error @@ -44,7 +35,7 @@ goto :done if exist android\%1\libluajit.a exit /b 0 wsl make clean if not "%ERRORLEVEL%" == "0" goto :error -wsl make HOST_LUA=luajit.exe "HOST_CC=clang.exe %4" HOST_CFLAGS=-D_CRT_SECURE_NO_WARNINGS CC=clang CROSS=%2- "STATIC_CC=%2%3-clang -fPIC" "DYNAMIC_CC=%2%3-clang -fPIC" "TARGET_AR=%2-ar.exe rcus" TARGET_LD=%2%3-clang TARGET_LDFLAGS=-fuse-ld=lld TARGET_STRIP=%2-strip.exe amalg -j%NUMBER_OF_PROCESSORS% +wsl make HOST_LUA=luajit.exe "HOST_CC=clang.exe %4" HOST_CFLAGS=-D_CRT_SECURE_NO_WARNINGS CC=clang CROSS=%2- "STATIC_CC=%2%3-clang -fPIC" "DYNAMIC_CC=%2%3-clang -fPIC" "TARGET_AR=llvm-ar.exe rcus" TARGET_LD=%2%3-clang TARGET_LDFLAGS=-fuse-ld=lld TARGET_STRIP=llvm-strip.exe amalg -j%NUMBER_OF_PROCESSORS% if not "%ERRORLEVEL%" == "0" goto :error copy src\libluajit.a android\%1\libluajit.a if not "%ERRORLEVEL%" == "0" goto :error diff --git a/love/src/jni/LuaJIT-2.1/doc/bluequad-print.css b/love/src/jni/LuaJIT-2.1/doc/bluequad-print.css index 0b385cee..a49d309f 100644 --- a/love/src/jni/LuaJIT-2.1/doc/bluequad-print.css +++ b/love/src/jni/LuaJIT-2.1/doc/bluequad-print.css @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2021 Mike Pall. +/* Copyright (C) 2004-2022 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/love/src/jni/LuaJIT-2.1/doc/bluequad.css b/love/src/jni/LuaJIT-2.1/doc/bluequad.css index 86cd9ac0..4c1a9082 100644 --- a/love/src/jni/LuaJIT-2.1/doc/bluequad.css +++ b/love/src/jni/LuaJIT-2.1/doc/bluequad.css @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2021 Mike Pall. +/* Copyright (C) 2004-2022 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/love/src/jni/LuaJIT-2.1/doc/contact.html b/love/src/jni/LuaJIT-2.1/doc/contact.html index c253a08b..6d609286 100644 --- a/love/src/jni/LuaJIT-2.1/doc/contact.html +++ b/love/src/jni/LuaJIT-2.1/doc/contact.html @@ -3,7 +3,7 @@
+Note: I cannot reply to GMail, Google Workplace, Outlook or Office365 +mail addresses, since they prefer to mindlessly filter out mails sent +from small domains using independent mail servers, such as mine. If you +don't like that, please complain to Google or Microsoft, not me. +
+All documentation is -Copyright © 2005-2021 Mike Pall. +Copyright © 2005-2022 Mike Pall.
@@ -97,7 +102,7 @@ Copyright © 2005-2021 Mike Pall.-The string buffer libary also includes a high-performance +The string buffer library also includes a high-performance serializer for Lua objects.
@@ -434,8 +432,8 @@ unsupported object types, circular references or deeply nested tables.-The stand-alone function de-serializes (decodes) the string -str, the buffer method de-serializes one object from the +The stand-alone function deserializes (decodes) the string +str, the buffer method deserializes one object from the buffer. Both return a Lua object obj.
@@ -448,6 +446,10 @@ encoded data. The stand-alone function throws when there's left-over data after decoding a single top-level object. The buffer method leaves any left-over data in the buffer.
++Attempting to deserialize an FFI type will throw an error, if the FFI +library is not built-in or has not been loaded, yet. +
@@ -458,7 +460,7 @@ the following members (all optional):
dict needs to be an array of strings and metatable needs to be an array of tables. Both starting at index 1 and without holes (no -nil inbetween). The tables are anchored in the buffer object and +nil in between). The tables are anchored in the buffer object and internally modified into a two-way index (don't do this yourself, just pass a plain array). The tables must not be modified after they have been passed to buffer.new(). @@ -620,7 +622,7 @@ errors are best caught with an outer wrapper for larger parts of code. There's not much one can do after that, anyway.
-OTOH you may want to catch some errors individually. Buffer methods need +OTOH, you may want to catch some errors individually. Buffer methods need to receive the buffer object as the first argument. The Lua colon-syntax obj:method() does that implicitly. But to wrap a method with pcall(), the arguments need to be passed like this: @@ -683,7 +685,7 @@ mappings of files are OK, but only if the file does not change.
The FFI library allows you to create and access C data -structures. Of course the main use for this is for interfacing with +structures. Of course, the main use for this is for interfacing with C functions. But they can be used stand-alone, too.
@@ -169,7 +167,7 @@ implemented with a big table holding lots of tiny tables. This imposes both a substantial memory overhead as well as a performance overhead.
-Here's a sketch of a library that operates on color images plus a +Here's a sketch of a library that operates on color images, plus a simple benchmark. First, the plain Lua version:
@@ -184,7 +182,7 @@ local function image_ramp_green(n)
return img
end
-local function image_to_grey(img, n)
+local function image_to_gray(img, n)
for i=1,n do
local y = floor(0.3*img[i].red + 0.59*img[i].green + 0.11*img[i].blue)
img[i].red = y; img[i].green = y; img[i].blue = y
@@ -194,14 +192,14 @@ end
local N = 400*400
local img = image_ramp_green(N)
for i=1,1000 do
- image_to_grey(img, N)
+ image_to_gray(img, N)
end
This creates a table with 160.000 pixels, each of which is a table -holding four number values in the range of 0-255. First an image with +holding four number values in the range of 0-255. First, an image with a green ramp is created (1D for simplicity), then the image is -converted to greyscale 1000 times. Yes, that's silly, but I was in +converted to grayscale 1000 times. Yes, that's silly, but I was in need of a simple example ...
@@ -308,7 +306,7 @@ be more compact and faster. This is certainly true (by a factor of ~1.7x). Switching to a struct-of-arrays would help, too.
-However the resulting code would be less idiomatic and rather +However, the resulting code would be less idiomatic and rather error-prone. And it still doesn't get even close to the performance of the FFI version of the code. Also, high-level data structures cannot be easily passed to other C functions, especially I/O functions, @@ -318,7 +316,7 @@ without undue conversion penalties.
-Please note that external symbols are only declared, but they +Please note, that external symbols are only declared, but they are not bound to any specific address, yet. Binding is achieved with C library namespaces (see below).
@@ -209,7 +207,7 @@ parse the cdecl only once and get its ctype with ffi.typeof(). Then use the ctype as a constructor repeatedly.-Please note that an anonymous struct declaration implicitly +Please note, that an anonymous struct declaration implicitly creates a new and distinguished ctype every time you use it for ffi.new(). This is probably not what you want, especially if you create more than one cdata object. Different anonymous @@ -256,12 +254,12 @@ afterwards. Neither the contents of the metatable nor the contents of an __index table (if any) may be modified afterwards. The associated metatable automatically applies to all uses of this type, no matter how the objects are created or where they -originate from. Note that pre-defined operations on types have +originate from. Note that predefined operations on types have precedence (e.g. declared field names cannot be overridden).
All standard Lua metamethods are implemented. These are called directly, -without shortcuts and on any mix of types. For binary operations, the +without shortcuts, and on any mix of types. For binary operations, the left operand is checked first for a valid ctype metamethod. The __gc metamethod only applies to struct/union types and performs an implicit ffi.gc() @@ -492,7 +490,7 @@ have some extra methods:
Free the resources associated with a callback. The associated Lua function is unanchored and may be garbage collected. The callback -function pointer is no longer valid and must not be called anymore +function pointer is no longer valid and must not be called again (it may be reused by a subsequently created callback).
@@ -558,7 +556,7 @@ named i.-It's only purpose is to parse C declarations, as found e.g. in +Its only purpose is to parse C declarations, as found e.g. in C header files. Although it does evaluate constant expressions, it's not a C compiler. The body of inline C function definitions is simply ignored. @@ -165,7 +163,7 @@ function declarations.
-The following C types are pre-defined by the C parser (like +The following C types are predefined by the C parser (like a typedef, except re-declarations will be ignored):
-All of the standard Lua operators can be applied to cdata objects or a +All standard Lua operators can be applied to cdata objects or a mix of a cdata object and another Lua object. The following list shows -the pre-defined operations. +the predefined operations.
Reference types are dereferenced before performing each of @@ -593,7 +591,7 @@ the operations below — the operation is applied to the C type pointed to by the reference.
-The pre-defined operations are always tried first before deferring to a +The predefined operations are always tried first before deferring to a metamethod or index table (if any) for the corresponding ctype (except for __new). An error is raised if the metamethod lookup or index table lookup fails. @@ -643,7 +641,7 @@ assigning to an index of a vector raises an error.
A ctype object can be indexed with a string key, too. The only -pre-defined operation is reading scoped constants of +predefined operation is reading scoped constants of struct/union types. All other accesses defer to the corresponding metamethods or index tables (if any).
@@ -656,7 +654,7 @@ certain optimizations.As a consequence, the elements of complex numbers and vectors are immutable. But the elements of an aggregate holding these -types may be modified of course. I.e. you cannot assign to +types may be modified, of course. I.e. you cannot assign to foo.c.im, but you can assign a (newly created) complex number to foo.c.
@@ -675,8 +673,8 @@ through unions is explicitly detected and allowed. to ffi.new(ct, ...), unless a __new metamethod is defined. The __new metamethod is called with the ctype object plus any other arguments passed to the constructor. Note that you have to -use ffi.new inside of it, since calling ct(...) would -cause infinite recursion. +use ffi.new inside the metamethod, since calling ct(...) +would cause infinite recursion.
@@ -808,7 +806,7 @@ the resulting Lua number as a key when indexing tables.
One obvious benefit: t[tonumber(2LL)] does point to
the same slot as t[2].
-Please note that pointers themselves are cdata objects, however they +Please note, that pointers themselves are cdata objects, however they are not followed by the garbage collector. So e.g. if you assign a cdata array to a pointer, you must keep the cdata object holding the array alive as long as the pointer is still in use: @@ -931,18 +929,18 @@ of the function pointer and the Lua function object (closure).
This can happen implicitly due to the usual conversions, e.g. when -passing a Lua function to a function pointer argument. Or you can use +passing a Lua function to a function pointer argument. Or, you can use ffi.cast() to explicitly cast a Lua function to a C function pointer.
-Currently only certain C function types can be used as callback +Currently, only certain C function types can be used as callback functions. Neither C vararg functions nor functions with pass-by-value aggregate argument or result types are supported. There -are no restrictions for the kind of Lua functions that can be called +are no restrictions on the kind of Lua functions that can be called from the callback — no checks for the proper number of arguments are made. The return value of the Lua function will be converted to the -result type and an error will be thrown for invalid conversions. +result type, and an error will be thrown for invalid conversions.
It's allowed to throw errors across a callback invocation, but it's not @@ -1003,7 +1001,7 @@ convention cannot be automatically detected, unlike for __stdcall calls to Windows functions.
-For some use cases it's necessary to free up the resources or to +For some use cases, it's necessary to free up the resources or to dynamically redirect callbacks. Use an explicit cast to a C function pointer and keep the resulting cdata object. Then use the cb:free() @@ -1056,7 +1054,7 @@ GUI application, which waits for user input most of the time, anyway.
For new designs avoid push-style APIs: a C function repeatedly -calling a callback for each result. Instead use pull-style APIs: +calling a callback for each result. Instead, use pull-style APIs: call a C function repeatedly to get a new result. Calls from Lua to C via the FFI are much faster than the other way round. Most well-designed libraries already use pull-style APIs (read/write, get/put). @@ -1075,7 +1073,7 @@ function.
Indexing a C library namespace object with a symbol name (a Lua -string) automatically binds it to the library. First the symbol type +string) automatically binds it to the library. First, the symbol type is resolved — it must have been declared with ffi.cdef. Then the symbol address is resolved by searching for the symbol name in the @@ -1130,7 +1128,7 @@ Performance notice: the JIT compiler specializes to the identity of namespace objects and to the strings used to index it. This effectively turns function cdata objects into constants. It's not useful and actually counter-productive to explicitly cache these -function objects, e.g. local strlen = ffi.C.strlen. OTOH it +function objects, e.g. local strlen = ffi.C.strlen. OTOH, it is useful to cache the namespace itself, e.g. local C = ffi.C.
@@ -1155,14 +1153,14 @@ This behavior is inevitable, since the goal is to provide full interoperability with C code. Adding extra safety measures, like bounds checks, would be futile. There's no way to detect misdeclarations of C functions, since shared libraries only -provide symbol names, but no type information. Likewise there's no way +provide symbol names, but no type information. Likewise, there's no way to infer the valid range of indexes for a returned pointer.Again: the FFI library is a low-level library. This implies it needs to be used with care, but it's flexibility and performance often outweigh this concern. If you're a C or C++ developer, it'll be easy -to apply your existing knowledge. OTOH writing code for the FFI +to apply your existing knowledge. OTOH, writing code for the FFI library is not for the faint of heart and probably shouldn't be the first exercise for someone with little experience in Lua, C or C++.
@@ -1190,7 +1188,7 @@ currently incomplete:-Please note this doesn't define an ffi variable in the table +Please note, this doesn't define an ffi variable in the table of globals — you really need to use the local variable. The require function ensures the library is only loaded once.
@@ -194,7 +192,7 @@ don't need to declare them as such. ⑤ The poll() function takes a couple more arguments we're not going to use. You can simply use nil to pass a NULL pointer and 0 -for the nfds parameter. Please note that the +for the nfds parameter. Please note, that the number 0 does not convert to a pointer value, unlike in C++. You really have to pass pointers to pointer arguments and numbers to number arguments. @@ -291,12 +289,12 @@ Here's the step-by-step explanation:① This defines some of the C functions provided by zlib. For the sake of this example, some -type indirections have been reduced and it uses the pre-defined +type indirections have been reduced and it uses the predefined fixed-size integer types, while still adhering to the zlib API/ABI.
② This loads the zlib shared -library. On POSIX systems it's named libz.so and usually +library. On POSIX systems, it's named libz.so and usually comes pre-installed. Since ffi.load() automatically adds any missing standard prefixes/suffixes, we can simply load the "z" library. On Windows it's named zlib1.dll and @@ -324,7 +322,7 @@ actual length that was used.
In C you'd pass in the address of a local variable (&buflen). But since there's no address-of operator in -Lua, we'll just pass in a one-element array. Conveniently it can be +Lua, we'll just pass in a one-element array. Conveniently, it can be initialized with the maximum buffer size in one step. Calling the actual zlib.compress2 function is then straightforward.
@@ -348,7 +346,7 @@ for garbage collection and string interning. ⑥ The uncompress functions does the exact opposite of the compress function. The compressed data doesn't include the size of the original string, -so this needs to be passed in. Otherwise no surprises here. +so this needs to be passed in. Otherwise, no surprises here.⑦ The code, that makes use @@ -382,7 +380,7 @@ Ok, so the ffi.* functions generally accept cdata objects wherever you'd want to use a number. That's why we get a away with passing n to ffi.string() above. But other Lua library functions or modules don't know how to deal with this. So for -maximum portability one needs to use tonumber() on returned +maximum portability, one needs to use tonumber() on returned long results before passing them on. Otherwise the application might work on some systems, but would fail in a POSIX/x64 environment. @@ -454,7 +452,7 @@ the origin.
④ If we run out of operators, we can -define named methods, too. Here the __index table defines an +define named methods, too. Here, the __index table defines an area function. For custom indexing needs, one might want to define __index and __newindex functions instead.
@@ -468,13 +466,13 @@ be used e.g. to create an array of points. The metamethods automatically apply to any and all uses of this type.-Please note that the association with a metatable is permanent and +Please note, that the association with a metatable is permanent and the metatable must not be modified afterwards! Ditto for the __index table.
⑥ Here are some simple usage examples -for the point type and their expected results. The pre-defined +for the point type and their expected results. The predefined operations (such as a.x) can be freely mixed with the newly defined metamethods. Note that area is a method and must be called with the Lua syntax for methods: a:area(), not @@ -483,7 +481,7 @@ called with the Lua syntax for methods: a:area(), not
The C type metamethod mechanism is most useful when used in conjunction with C libraries that are written in an object-oriented -style. Creators return a pointer to a new instance and methods take an +style. Creators return a pointer to a new instance, and methods take an instance pointer as the first argument. Sometimes you can just point __index to the library namespace and __gc to the destructor and you're done. But often enough you'll want to add @@ -569,7 +567,7 @@ end
This turns them into indirect calls and generates bigger and slower -machine code. Instead you'll want to cache the namespace itself and +machine code. Instead, you'll want to cache the namespace itself and rely on the JIT compiler to eliminate the lookups:
@@ -589,7 +587,7 @@ it to a local variable in the function scope is unnecessary.@@ -154,7 +152,7 @@ Contains the target architecture name:
-Copyright © 2005-2021 +Copyright © 2005-2022jit.opt.* — JIT compiler optimization control
-This sub-module provides the backend for the -O command line +This submodule provides the backend for the -O command line option.
@@ -174,7 +172,7 @@ which was one of the ways to enable optimization.
jit.util.* — JIT compiler introspection
-This sub-module holds functions to introspect the bytecode, generated +This submodule holds functions to introspect the bytecode, generated traces, the IR and the generated machine code. The functionality provided by this module is still in flux and therefore undocumented.
@@ -187,7 +185,7 @@ if you want to know more.@@ -158,7 +156,7 @@ To see how much time is spent in different VM states or Combinations of v/z with f/F/l produce two-level views, e.g. -jp=vf or -jp=fv. This shows the time spent in a VM state or zone vs. hotspots. This can be used to answer -questions like "Which time consuming functions are only interpreted?" or +questions like "Which time-consuming functions are only interpreted?" or "What's the garbage collector overhead for a specific function?".
-Copyright © 2005-2021 +Copyright © 2005-2022@@ -217,7 +215,7 @@ local profile = require("jit.profile") This module can be used to implement your own higher-level profiler. A typical profiling run starts the profiler, captures stack dumps in the profiler callback, adds them to a hash table to aggregate the number -of samples, stops the profiler and then analyzes all of the captured +of samples, stops the profiler and then analyzes all captured stack dumps. Other parameters can be sampled in the profiler callback, too. But it's important not to spend too much time in the callback, since this may skew the statistics. @@ -271,9 +269,9 @@ returns a string with a stack dump for the thread (coroutine), formatted according to the fmt argument:
LuaJIT extends the standard Lua VM with new functionality and adds -several extension modules. Please note this page is only about +several extension modules. Please note, this page is only about functional enhancements and not about performance enhancements, such as the optimized VM, the faster interpreter or the JIT compiler.
@@ -197,7 +195,7 @@ usage. See also theThe generated bytecode is portable and can be loaded on any architecture -that LuaJIT supports, independent of word size or endianess. However the +that LuaJIT supports, independent of word size or endianess. However, the bytecode compatibility versions must match. Bytecode stays compatible for dot releases (x.y.0 → x.y.1), but may change with major or minor releases (2.0 → 2.1) or between any beta release. Foreign @@ -229,7 +227,7 @@ avoids managing backlinks, saves an allocation and the overhead of incremental array/hash part growth.
-Please note this function is meant for very specific situations. In most +Please note, this function is meant for very specific situations. In most cases it's better to replace the (usually single) link with a new table and let the GC do its work.
@@ -239,7 +237,7 @@ and let the GC do its work. LuaJIT uses a Tausworthe PRNG with period 2^223 to implement math.random() and math.randomseed(). The quality of the PRNG results is much superior compared to the standard Lua -implementation which uses the platform-specific ANSI rand(). +implementation, which uses the platform-specific ANSI rand().The PRNG generates the same sequences from the same seeds on all @@ -257,7 +255,7 @@ Important: Neither this nor any other PRNG based on the simplistic
The file I/O functions in the standard io.* library handle -64 bit file offsets. In particular this means it's possible +64 bit file offsets. In particular, this means it's possible to open files larger than 2 Gigabytes and to reposition or obtain the current file position for offsets beyond 2 GB (fp:seek() method). @@ -464,7 +462,7 @@ C++ destructors.
make && sudo make install+ +
-LuaJIT currently builds out-of-the box on most systems. -Here's the compatibility matrix for the supported combinations of -operating systems, CPUs and compilers: +LuaJIT currently builds out-of-the box on most systems:
| CPU / OS | -Linux or Android |
-*BSD, Other | -macOS 10.4+ or iOS 3.0+ |
-Windows 7 or later |
+OS | +Min. Version | +Requirements | +LuaJIT Versions |
| x86 (32 bit) | -GCC 4.2+ | -GCC 4.2+ | -XCode 5.0+ Clang |
-MSVC MinGW, Cygwin |
+Windows | +7 | +x86 or x64, ARM64: TBA | +v2.0 – |
| x64 (64 bit) | -GCC 4.2+ | -GCC 4.2+ ORBIS (PS4) |
-XCode 5.0+ Clang |
-MSVC Durango (Xbox One) |
+Linux | ++ | + | v2.0 – |
| ARMv5+ ARM9E+ |
-GCC 4.2+ | -GCC 4.2+ PSP2 (PS VITA) |
-XCode 5.0+ Clang |
-+ | *BSD | ++ | + | v2.0 – |
| ARM64 ARM64be |
-GCC 4.8+ | -- | XCode 6.0+ Clang 3.5+ |
-+ | macOS (OSX) | +10.4 | ++ | v2.1 – |
| PPC | -GCC 4.3+ | -GCC 4.3+ GCC 4.1 (PS3) |
-- | XEDK (Xbox 360) | +POSIX | ++ | mmap, dlopen | +v2.0 – | +
| Android | +4.0 | +Recent Android NDK | +v2.0 – | +|||||
| iOS | +3.0 | +Xcode iOS SDK | +v2.1 – | +|||||
| PS3 | ++ | PS3 SDK | +v2.0 – v2.1 EOL | +|||||
| PS4 | ++ | PS4 SDK (ORBIS) | +v2.0 – | |||||
| MIPS32 MIPS64 MIPS64r6 |
-GCC 4.3+ | -GCC 4.3+ | -- | + | PS5 | ++ | PS5 SDK (PROSPERO) | +v2.1 – | +
| PS Vita | ++ | PS Vita SDK (PSP2) | +v2.0 – v2.1 EOL | +|||||
| Xbox 360 | ++ | Xbox 360 SDK (XEDK) | +v2.0 – v2.1 EOL | +|||||
| Xbox One | ++ | Xbox One SDK (DURANGO) | +v2.1 – | +|||||
| Nintendo Switch | ++ | NintendoSDK + NX Addon | +v2.1 – |
+The codebase has compatibility defines for some more systems, but +without official support. +
++Building LuaJIT requires a recent toolchain based on GCC, Clang/LLVM or +MSVC++. +
++The Makefile-based build system requires GNU Make and supports +cross-builds. Batch files are provided for MSVC++ builds and console +cross-builds. +
+| CPU | +Bits | +Requirements | +Variants | +LuaJIT Versions | +
| x86 | +32 | +v2.1+: SSE2 | ++ | v2.0 – | +
| x64 | +64 | ++ | + | v2.0 – | +
| ARM | +32 | +ARMv5+, ARM9E+ | +hard-fp + soft-fp | +v2.0 – | +
| ARM64 | +64 | ++ | ARM64le + ARM64be | +v2.1 – | +
| PPC32 | +32 | ++ | hard-fp + soft-fp | +v2.0 – v2.1 EOL | +
| PPC/e500 | +32 | +e500v2 | ++ | v2.0 EOL | +
| MIPS32 | +32 | +MIPS32r1 – r5 | +hard-fp + soft-fp | +v2.0 – | +
| MIPS64 | +64 | +MIPS64r1 – r5 | +hard-fp + soft-fp | +v2.1 – | +
| MIPS64 | +64 | +MIPS64r6 | +hard-fp + soft-fp | +v2.1 EOL | +
| RISC-V | +64 | +RVA22+ | ++ | TBA | +
+There are no plans to add historic architectures or to continue support +for end-of-life (EOL) architectures, for which no new CPUs are commonly +available anymore. Likewise, there are no plans to support marginal +and/or de-facto-dead architectures. +
@@ -191,7 +326,7 @@ The recommended way to fetch the latest version is to do a pull from the git repository.
-Alternatively download the latest source package of LuaJIT (pick the .tar.gz). +Alternatively, download the latest source package of LuaJIT (pick the .tar.gz). Move it to a directory of your choice, open a terminal window and change to this directory. Now unpack the archive and change to the newly created directory (replace XX.YY.ZZ with the version you downloaded): @@ -411,7 +546,7 @@ NDKCROSS=$NDKBIN/aarch64-linux-android- NDKCC=$NDKBIN/aarch64-linux-android21-clang make CROSS=$NDKCROSS \ STATIC_CC=$NDKCC DYNAMIC_CC="$NDKCC -fPIC" \ - TARGET_LD=$NDKCC TARGET_AR=$NDKBIN/llvm-ar + TARGET_LD=$NDKCC TARGET_AR="$NDKBIN/llvm-ar rcus" \ TARGET_STRIP=$NDKBIN/llvm-strip # Android/ARM, armeabi-v7a (ARMv7 VFP), Android 4.1+ (JB) @@ -421,7 +556,7 @@ NDKCROSS=$NDKBIN/arm-linux-androideabi- NDKCC=$NDKBIN/armv7a-linux-androideabi16-clang make HOST_CC="gcc -m32" CROSS=$NDKCROSS \ STATIC_CC=$NDKCC DYNAMIC_CC="$NDKCC -fPIC" \ - TARGET_LD=$NDKCC TARGET_AR=$NDKBIN/llvm-ar + TARGET_LD=$NDKCC TARGET_AR="$NDKBIN/llvm-ar rcus" \ TARGET_STRIP=$NDKBIN/llvm-strip
@@ -446,8 +581,7 @@ make DEFAULT_CC=clang CROSS="$(dirname $ICC)/" \
Building LuaJIT for consoles requires both a supported host compiler -(x86 or x64) and a cross-compiler (to PPC or ARM) from the official -console SDK. +(x86 or x64) and a cross-compiler from the official console SDK.
Due to restrictions on consoles, the JIT compiler is disabled and only @@ -468,45 +602,58 @@ To cross-compile for PS3 from a Linux host (requires make HOST_CC="gcc -m32" CROSS=ppu-lv2-
-To cross-compile for PS4 from a Windows host, -open a "Visual Studio .NET Command Prompt" (64 bit host compiler), -cd to the directory where you've unpacked the sources and -run the following commands: +To cross-compile for the other consoles from a Windows host, open a +"Native Tools Command Prompt for VS". You need to choose either the 32 +or the 64 bit version of the host compiler to match the target. +Then cd to the src directory below where you've +unpacked the sources and run the build command given in the table:
--cd src -ps4build -+
| Console | +Bits | +Build Command | +
| PS4 | +64 | +ps4build | +
| PS5 | +64 | +ps5build | +
| PS Vita | +32 | +psvitabuild | +
| Xbox 360 | +32 | +xedkbuild | +
| Xbox One | +64 | +xb1build | +
| Nintendo Switch NX32 | +32 | +nxbuild | +
| Nintendo Switch NX64 | +64 | +nxbuild | +
-To cross-compile for PS Vita from a Windows host, -open a "Visual Studio .NET Command Prompt" (32 bit host compiler), -cd to the directory where you've unpacked the sources and -run the following commands: +Please check out the comments in the corresponding *.bat +file for more options.
--cd src -psvitabuild --
-To cross-compile for Xbox 360 from a Windows host, -open a "Visual Studio .NET Command Prompt" (32 bit host compiler), -cd to the directory where you've unpacked the sources and run -the following commands: -
--cd src -xedkbuild --
-To cross-compile for Xbox One from a Windows host, -open a "Visual Studio .NET Command Prompt" (64 bit host compiler), -cd to the directory where you've unpacked the sources and run -the following commands: -
--cd src -xb1build -
@@ -548,7 +695,7 @@ allocator from your system (no support for this on 64 bit architectures). of calling luaopen_base etc. directly.
The build system uses GNU make and auto-detects most settings based on @@ -619,7 +766,7 @@ to me (the upstream) and not you (the package maintainer), anyway.
-LuaJIT is Copyright © 2005-2021 Mike Pall, released under the +LuaJIT is Copyright © 2005-2022 Mike Pall, released under the » MIT open source license.
@@ -162,7 +160,7 @@ LuaJIT is Copyright © 2005-2021 Mike Pall, released under the
| PS3 | PS4 | PS Vita | Xbox 360 | Xbox One | |
| PS3 | PS4 PS5 | PS Vita | Xbox 360 | Xbox One | Nintendo Switch |
| GCC | Clang LLVM | MSVC | sink | • | Allocation/Store Sinking |
| fuse | • | Fusion of operands into instructions | ||
| fma | Fused multiply-add |
Here are the parameters and their default settings: @@ -295,7 +302,7 @@ Here are the parameters and their default settings: