diff options
Diffstat (limited to 'src/jit/dump.lua')
-rw-r--r-- | src/jit/dump.lua | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/jit/dump.lua b/src/jit/dump.lua index 70a59280..18a4d260 100644 --- a/src/jit/dump.lua +++ b/src/jit/dump.lua | |||
@@ -54,7 +54,7 @@ | |||
54 | 54 | ||
55 | -- Cache some library functions and objects. | 55 | -- Cache some library functions and objects. |
56 | local jit = require("jit") | 56 | local jit = require("jit") |
57 | assert(jit.version_num == 20001, "LuaJIT core/library version mismatch") | 57 | assert(jit.version_num == 20100, "LuaJIT core/library version mismatch") |
58 | local jutil = require("jit.util") | 58 | local jutil = require("jit.util") |
59 | local vmdef = require("jit.vmdef") | 59 | local vmdef = require("jit.vmdef") |
60 | local funcinfo, funcbc = jutil.funcinfo, jutil.funcbc | 60 | local funcinfo, funcbc = jutil.funcinfo, jutil.funcbc |
@@ -62,7 +62,7 @@ local traceinfo, traceir, tracek = jutil.traceinfo, jutil.traceir, jutil.tracek | |||
62 | local tracemc, tracesnap = jutil.tracemc, jutil.tracesnap | 62 | local tracemc, tracesnap = jutil.tracemc, jutil.tracesnap |
63 | local traceexitstub, ircalladdr = jutil.traceexitstub, jutil.ircalladdr | 63 | local traceexitstub, ircalladdr = jutil.traceexitstub, jutil.ircalladdr |
64 | local bit = require("bit") | 64 | local bit = require("bit") |
65 | local band, shl, shr = bit.band, bit.lshift, bit.rshift | 65 | local band, shl, shr, tohex = bit.band, bit.lshift, bit.rshift, bit.tohex |
66 | local sub, gsub, format = string.sub, string.gsub, string.format | 66 | local sub, gsub, format = string.sub, string.gsub, string.format |
67 | local byte, char, rep = string.byte, string.char, string.rep | 67 | local byte, char, rep = string.byte, string.char, string.rep |
68 | local type, tostring = type, tostring | 68 | local type, tostring = type, tostring |
@@ -135,6 +135,7 @@ local function dump_mcode(tr) | |||
135 | local mcode, addr, loop = tracemc(tr) | 135 | local mcode, addr, loop = tracemc(tr) |
136 | if not mcode then return end | 136 | if not mcode then return end |
137 | if not disass then disass = require("jit.dis_"..jit.arch) end | 137 | if not disass then disass = require("jit.dis_"..jit.arch) end |
138 | if addr < 0 then addr = addr + 2^32 end | ||
138 | out:write("---- TRACE ", tr, " mcode ", #mcode, "\n") | 139 | out:write("---- TRACE ", tr, " mcode ", #mcode, "\n") |
139 | local ctx = disass.create(mcode, addr, dumpwrite) | 140 | local ctx = disass.create(mcode, addr, dumpwrite) |
140 | ctx.hexdump = 0 | 141 | ctx.hexdump = 0 |
@@ -269,8 +270,7 @@ local litname = { | |||
269 | ["CONV "] = setmetatable({}, { __index = function(t, mode) | 270 | ["CONV "] = setmetatable({}, { __index = function(t, mode) |
270 | local s = irtype[band(mode, 31)] | 271 | local s = irtype[band(mode, 31)] |
271 | s = irtype[band(shr(mode, 5), 31)].."."..s | 272 | s = irtype[band(shr(mode, 5), 31)].."."..s |
272 | if band(mode, 0x400) ~= 0 then s = s.." trunc" | 273 | if band(mode, 0x800) ~= 0 then s = s.." sext" end |
273 | elseif band(mode, 0x800) ~= 0 then s = s.." sext" end | ||
274 | local c = shr(mode, 14) | 274 | local c = shr(mode, 14) |
275 | if c == 2 then s = s.." index" elseif c == 3 then s = s.." check" end | 275 | if c == 2 then s = s.." index" elseif c == 3 then s = s.." check" end |
276 | t[mode] = s | 276 | t[mode] = s |
@@ -279,6 +279,8 @@ local litname = { | |||
279 | ["FLOAD "] = vmdef.irfield, | 279 | ["FLOAD "] = vmdef.irfield, |
280 | ["FREF "] = vmdef.irfield, | 280 | ["FREF "] = vmdef.irfield, |
281 | ["FPMATH"] = vmdef.irfpm, | 281 | ["FPMATH"] = vmdef.irfpm, |
282 | ["BUFHDR"] = { [0] = "RESET", "APPEND" }, | ||
283 | ["TOSTR "] = { [0] = "INT", "NUM", "CHAR" }, | ||
282 | } | 284 | } |
283 | 285 | ||
284 | local function ctlsub(c) | 286 | local function ctlsub(c) |
@@ -608,7 +610,7 @@ local function dump_texit(tr, ex, ngpr, nfpr, ...) | |||
608 | end | 610 | end |
609 | else | 611 | else |
610 | for i=1,ngpr do | 612 | for i=1,ngpr do |
611 | out:write(format(" %08x", regs[i])) | 613 | out:write(" ", tohex(regs[i])) |
612 | if i % 8 == 0 then out:write("\n") end | 614 | if i % 8 == 0 then out:write("\n") end |
613 | end | 615 | end |
614 | end | 616 | end |
@@ -692,9 +694,9 @@ local function dumpon(opt, outfile) | |||
692 | end | 694 | end |
693 | 695 | ||
694 | -- Public module functions. | 696 | -- Public module functions. |
695 | module(...) | 697 | return { |
696 | 698 | on = dumpon, | |
697 | on = dumpon | 699 | off = dumpoff, |
698 | off = dumpoff | 700 | start = dumpon -- For -j command line option. |
699 | start = dumpon -- For -j command line option. | 701 | } |
700 | 702 | ||