diff options
author | Mike Pall <mike> | 2013-05-13 19:39:34 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2013-05-13 19:39:34 +0200 |
commit | 2ef2c34d84d3e027e828e4726cc90fd55935bd18 (patch) | |
tree | e04e29b08fd721a704a80b84a4cb56621c1682e4 /src/jit | |
parent | 2369f5d00ab0a391dd23091af42d893ddceafa76 (diff) | |
download | luajit-2ef2c34d84d3e027e828e4726cc90fd55935bd18.tar.gz luajit-2ef2c34d84d3e027e828e4726cc90fd55935bd18.tar.bz2 luajit-2ef2c34d84d3e027e828e4726cc90fd55935bd18.zip |
Adapt -jdump to unified string.format("%x", -1) behavior.
Diffstat (limited to 'src/jit')
-rw-r--r-- | src/jit/dis_x86.lua | 4 | ||||
-rw-r--r-- | src/jit/dump.lua | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/jit/dis_x86.lua b/src/jit/dis_x86.lua index c442a176..49101efe 100644 --- a/src/jit/dis_x86.lua +++ b/src/jit/dis_x86.lua | |||
@@ -28,6 +28,8 @@ local type = type | |||
28 | local sub, byte, format = string.sub, string.byte, string.format | 28 | local sub, byte, format = string.sub, string.byte, string.format |
29 | local match, gmatch, gsub = string.match, string.gmatch, string.gsub | 29 | local match, gmatch, gsub = string.match, string.gmatch, string.gsub |
30 | local lower, rep = string.lower, string.rep | 30 | local lower, rep = string.lower, string.rep |
31 | local bit = require("bit") | ||
32 | local tohex = bit.tohex | ||
31 | 33 | ||
32 | -- Map for 1st opcode byte in 32 bit mode. Ugly? Well ... read on. | 34 | -- Map for 1st opcode byte in 32 bit mode. Ugly? Well ... read on. |
33 | local map_opc1_32 = { | 35 | local map_opc1_32 = { |
@@ -532,7 +534,7 @@ local function putpat(ctx, name, pat) | |||
532 | local lo = imm % 0x1000000 | 534 | local lo = imm % 0x1000000 |
533 | x = format("0x%02x%06x", (imm-lo) / 0x1000000, lo) | 535 | x = format("0x%02x%06x", (imm-lo) / 0x1000000, lo) |
534 | else | 536 | else |
535 | x = format("0x%08x", imm) | 537 | x = "0x"..tohex(imm) |
536 | end | 538 | end |
537 | elseif p == "R" then | 539 | elseif p == "R" then |
538 | local r = byte(code, pos-1, pos-1)%8 | 540 | local r = byte(code, pos-1, pos-1)%8 |
diff --git a/src/jit/dump.lua b/src/jit/dump.lua index 2a7d64e4..e6c9d5b6 100644 --- a/src/jit/dump.lua +++ b/src/jit/dump.lua | |||
@@ -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 |
@@ -609,7 +610,7 @@ local function dump_texit(tr, ex, ngpr, nfpr, ...) | |||
609 | end | 610 | end |
610 | else | 611 | else |
611 | for i=1,ngpr do | 612 | for i=1,ngpr do |
612 | out:write(format(" %08x", regs[i])) | 613 | out:write(" ", tohex(regs[i])) |
613 | if i % 8 == 0 then out:write("\n") end | 614 | if i % 8 == 0 then out:write("\n") end |
614 | end | 615 | end |
615 | end | 616 | end |