mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
e598aeb7 bugfix: Update s390x support. 8009e8cb Merge upstream to v2.1-agentzh 4c2a5331 tests: only run with 1 core. 52e83c8b tests: fix one test cases. 58b44276 Merge branch 'v2.1' into v2.1-agentzh 41fb94de Add randomized register allocation for fuzz testing. 2f6c451c ARM64: Improve register allocation for integer IR_MUL/IR_MULOV. 7ff8f26e ARM64: Fix register allocation for IR_*LOAD. 356231ed Merge branch 'master' into v2.1 c6ee7e19 Update external MSDN URL in code. 83954100 FFI/ARM64/OSX: Handle non-standard OSX C calling conventions. cf903edb FFI: Unify stack setup for C calls in interpreter. 7cc53f0b ARM64: Prevent STP fusion for conditional code emitted by TBAR. 0fa2f1cb ARM64: Fix LDP/STP fusing for unaligned accesses. c0d5240a Merge branch 'master' into v2.1 0ef51b49 Handle table unsinking in the presence of IRFL_TAB_NOMM. 238a2a80 Merge branch 'master' into v2.1 6a3111a5 Use fallback name for install files without valid .git or .relver. a0b52aae Handle non-.git checkout with .relver in .bat-file builds. 631a45f7 Merge branch 'master' into v2.1 14e2917e Fix external C call stack check when using LUAJIT_MODE_WRAPCFUNC. 309fb42b Fix predict_next() in parser (again). 03c31124 Fix typo. ff192d13 Merge branch 'master' into v2.1 d0ce82ec Handle the case when .git is not a directory. 0b5bf71e Merge branch 'master' into v2.1 6a2163a6 Add .gitattributes to dynamically resolve .relver. 33e2a49d Add .gitattributes to dynamically resolve .relver. 093759d5 Fix for last commit: also remove symlink on uninstall. 748ab9d9 Switch to rolling releases: mark v2.1 as production. 54ef81f8 Merge branch 'master' into v2.1 ed21acd8 Fix Windows build scripts for rolling releases. 3c290f81 Merge branch 'master' into v2.1 6351abc7 Switch MSVC and console build scripts to rolling releases. 20908424 Merge branch 'master' into v2.1 50e0fa03 Switch build system to rolling releases. f0ff869b Merge branch 'master' into v2.1 c3459468 Update documentation for switch to rolling releases. ef587afb Merge branch 'master' into v2.1 158a284c Bump copyright date. cbb187ae Remove work-in-progress notice in string buffer docs. 72efc42e MIPS: Fix "bad FP FLOAD" assertion. 119fd1fa Ensure forward progress on trace exit to BC_ITERN. 27af72e6 ARM64: Add support for ARM64e pointer authentication codes (PAC). 117ddf35 DynASM/ARM64: Add instructions for ARM64e PAC. dbed79ea Merge branch 'master' into v2.1 abb27c77 Fix maxslots when recording BC_VARG, part 3. caf7cbc5 Fix predict_next() in parser. 9b544c25 MIPS32: Declare that the assembler part uses the FR=0 model. 93ce12ee ARM64: Fix assembly of HREFK (again). d5bbf9cd Fix frame for more types of on-trace error messages. 165ea18b Add workaround for bytecode dump of builtins. 91914b23 DynASM: Fix regression due to warning fix. 107baafb Merge branch 'v2.1' into v2.1-agentzh 8635cbab Merge branch 'master' into v2.1 aa2db7eb Fix base register coalescing in side trace. 8fbd576f ARM64: Fix assembly of HREFK. bd55d302 Merge branch 'master' into v2.1 a01cba9d Fix maxslots when recording BC_VARG, part 2. 0cc5fdfb Fix maxslots when recording BC_TSETM. 69dadad6 Merge branch 'master' into v2.1 94ada596 Fix maxslots when recording BC_VARG. b7a8c7c1 Fix register mask for stack check in head of side trace. 4c35a42d FFI: Fix ffi.metatype() for non-raw types. 9493acc1 ARM64: Fix LDP code generation. f9c31e34 PPC/e500 with SPE enabled: use soft float instead of failing. ff6c496b MIPSr6: Add missing files to Makefile install target. 51fb2f2c DynASM: Fix warnings. 2d8300c1 Fix frame for on-trace out-of-memory error. 8e53ccc6 Merge branch 'master' into v2.1 9f452bbe Fix handling of instable types in TNEW/TDUP load forwarding. 8c20c3b1 Fix compiler warning. 224129a8 Fix last commit. 1c279127 Print errors from __gc finalizers instead of rethrowing them. 8bbd58e5 Merge branch 'master' into v2.1 c7db8255 Fix TDUP load forwarding after table rehash. 96fc114a Fix canonicalization of +-0.0 keys for IR_NEWREF. 505e2c03 Merge branch 'master' into v2.1 8135de2a Improve error reporting on stack overflow. eccdf6d6 Merge branch 'master' into v2.1 126526ab Allow building sources with mixed LF/CRLF line-endings. d0e88930 Fix compiler warning. a4f4f5b8 Don't fail for Clang builds, which pretend to be an ancient GCC. git-subtree-dir: src/deps/src/luajit git-subtree-split: e598aeb7426dbc069f90ba70db9bce43cd573b0e
169 lines
5.6 KiB
Lua
169 lines
5.6 KiB
Lua
----------------------------------------------------------------------------
|
|
-- Verbose mode of the LuaJIT compiler.
|
|
--
|
|
-- Copyright (C) 2005-2023 Mike Pall. All rights reserved.
|
|
-- Released under the MIT license. See Copyright Notice in luajit.h
|
|
----------------------------------------------------------------------------
|
|
--
|
|
-- This module shows verbose information about the progress of the
|
|
-- JIT compiler. It prints one line for each generated trace. This module
|
|
-- is useful to see which code has been compiled or where the compiler
|
|
-- punts and falls back to the interpreter.
|
|
--
|
|
-- Example usage:
|
|
--
|
|
-- luajit -jv -e "for i=1,1000 do for j=1,1000 do end end"
|
|
-- luajit -jv=myapp.out myapp.lua
|
|
--
|
|
-- Default output is to stderr. To redirect the output to a file, pass a
|
|
-- filename as an argument (use '-' for stdout) or set the environment
|
|
-- variable LUAJIT_VERBOSEFILE. The file is overwritten every time the
|
|
-- module is started.
|
|
--
|
|
-- The output from the first example should look like this:
|
|
--
|
|
-- [TRACE 1 (command line):1 loop]
|
|
-- [TRACE 2 (1/3) (command line):1 -> 1]
|
|
--
|
|
-- The first number in each line is the internal trace number. Next are
|
|
-- the file name ('(command line)') and the line number (':1') where the
|
|
-- trace has started. Side traces also show the parent trace number and
|
|
-- the exit number where they are attached to in parentheses ('(1/3)').
|
|
-- An arrow at the end shows where the trace links to ('-> 1'), unless
|
|
-- it loops to itself.
|
|
--
|
|
-- In this case the inner loop gets hot and is traced first, generating
|
|
-- a root trace. Then the last exit from the 1st trace gets hot, too,
|
|
-- and triggers generation of the 2nd trace. The side trace follows the
|
|
-- path along the outer loop and *around* the inner loop, back to its
|
|
-- start, and then links to the 1st trace. Yes, this may seem unusual,
|
|
-- if you know how traditional compilers work. Trace compilers are full
|
|
-- of surprises like this -- have fun! :-)
|
|
--
|
|
-- Aborted traces are shown like this:
|
|
--
|
|
-- [TRACE --- foo.lua:44 -- leaving loop in root trace at foo:lua:50]
|
|
--
|
|
-- Don't worry -- trace aborts are quite common, even in programs which
|
|
-- can be fully compiled. The compiler may retry several times until it
|
|
-- finds a suitable trace.
|
|
--
|
|
-- Of course this doesn't work with features that are not-yet-implemented
|
|
-- (NYI error messages). The VM simply falls back to the interpreter. This
|
|
-- may not matter at all if the particular trace is not very high up in
|
|
-- the CPU usage profile. Oh, and the interpreter is quite fast, too.
|
|
--
|
|
-- Also check out the -jdump module, which prints all the gory details.
|
|
--
|
|
------------------------------------------------------------------------------
|
|
|
|
-- Cache some library functions and objects.
|
|
local jit = require("jit")
|
|
local jutil = require("jit.util")
|
|
local vmdef = require("jit.vmdef")
|
|
local funcinfo, traceinfo = jutil.funcinfo, jutil.traceinfo
|
|
local type, format = type, string.format
|
|
local stdout, stderr = io.stdout, io.stderr
|
|
|
|
-- Active flag and output file handle.
|
|
local active, out
|
|
|
|
------------------------------------------------------------------------------
|
|
|
|
local startloc, startex
|
|
|
|
local function fmtfunc(func, pc)
|
|
local fi = funcinfo(func, pc)
|
|
if fi.loc then
|
|
return fi.loc
|
|
elseif fi.ffid then
|
|
return vmdef.ffnames[fi.ffid]
|
|
elseif fi.addr then
|
|
return format("C:%x", fi.addr)
|
|
else
|
|
return "(?)"
|
|
end
|
|
end
|
|
|
|
-- Format trace error message.
|
|
local function fmterr(err, info)
|
|
if type(err) == "number" then
|
|
if type(info) == "function" then info = fmtfunc(info) end
|
|
err = format(vmdef.traceerr[err], info)
|
|
end
|
|
return err
|
|
end
|
|
|
|
-- Dump trace states.
|
|
local function dump_trace(what, tr, func, pc, otr, oex)
|
|
if what == "start" then
|
|
startloc = fmtfunc(func, pc)
|
|
startex = otr and "("..otr.."/"..(oex == -1 and "stitch" or oex)..") " or ""
|
|
else
|
|
if what == "abort" then
|
|
local loc = fmtfunc(func, pc)
|
|
if loc ~= startloc then
|
|
out:write(format("[TRACE --- %s%s -- %s at %s]\n",
|
|
startex, startloc, fmterr(otr, oex), loc))
|
|
else
|
|
out:write(format("[TRACE --- %s%s -- %s]\n",
|
|
startex, startloc, fmterr(otr, oex)))
|
|
end
|
|
elseif what == "stop" then
|
|
local info = traceinfo(tr)
|
|
local link, ltype = info.link, info.linktype
|
|
if ltype == "interpreter" then
|
|
out:write(format("[TRACE %3s %s%s -- fallback to interpreter]\n",
|
|
tr, startex, startloc))
|
|
elseif ltype == "stitch" then
|
|
out:write(format("[TRACE %3s %s%s %s %s]\n",
|
|
tr, startex, startloc, ltype, fmtfunc(func, pc)))
|
|
elseif link == tr or link == 0 then
|
|
out:write(format("[TRACE %3s %s%s %s]\n",
|
|
tr, startex, startloc, ltype))
|
|
elseif ltype == "root" then
|
|
out:write(format("[TRACE %3s %s%s -> %d]\n",
|
|
tr, startex, startloc, link))
|
|
else
|
|
out:write(format("[TRACE %3s %s%s -> %d %s]\n",
|
|
tr, startex, startloc, link, ltype))
|
|
end
|
|
else
|
|
out:write(format("[TRACE %s]\n", what))
|
|
end
|
|
out:flush()
|
|
end
|
|
end
|
|
|
|
------------------------------------------------------------------------------
|
|
|
|
-- Detach dump handlers.
|
|
local function dumpoff()
|
|
if active then
|
|
active = false
|
|
jit.attach(dump_trace)
|
|
if out and out ~= stdout and out ~= stderr then out:close() end
|
|
out = nil
|
|
end
|
|
end
|
|
|
|
-- Open the output file and attach dump handlers.
|
|
local function dumpon(outfile)
|
|
if active then dumpoff() end
|
|
if not outfile then outfile = os.getenv("LUAJIT_VERBOSEFILE") end
|
|
if outfile then
|
|
out = outfile == "-" and stdout or assert(io.open(outfile, "w"))
|
|
else
|
|
out = stderr
|
|
end
|
|
jit.attach(dump_trace, "trace")
|
|
active = true
|
|
end
|
|
|
|
-- Public module functions.
|
|
return {
|
|
on = dumpon,
|
|
off = dumpoff,
|
|
start = dumpon -- For -j command line option.
|
|
}
|
|
|