summaryrefslogtreecommitdiff
path: root/src/jit
diff options
context:
space:
mode:
authorMike Pall <mike>2013-05-13 19:39:34 +0200
committerMike Pall <mike>2013-05-13 19:39:34 +0200
commit2ef2c34d84d3e027e828e4726cc90fd55935bd18 (patch)
treee04e29b08fd721a704a80b84a4cb56621c1682e4 /src/jit
parent2369f5d00ab0a391dd23091af42d893ddceafa76 (diff)
downloadluajit-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.lua4
-rw-r--r--src/jit/dump.lua5
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
28local sub, byte, format = string.sub, string.byte, string.format 28local sub, byte, format = string.sub, string.byte, string.format
29local match, gmatch, gsub = string.match, string.gmatch, string.gsub 29local match, gmatch, gsub = string.match, string.gmatch, string.gsub
30local lower, rep = string.lower, string.rep 30local lower, rep = string.lower, string.rep
31local bit = require("bit")
32local 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.
33local map_opc1_32 = { 35local 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
62local tracemc, tracesnap = jutil.tracemc, jutil.tracesnap 62local tracemc, tracesnap = jutil.tracemc, jutil.tracesnap
63local traceexitstub, ircalladdr = jutil.traceexitstub, jutil.ircalladdr 63local traceexitstub, ircalladdr = jutil.traceexitstub, jutil.ircalladdr
64local bit = require("bit") 64local bit = require("bit")
65local band, shl, shr = bit.band, bit.lshift, bit.rshift 65local band, shl, shr, tohex = bit.band, bit.lshift, bit.rshift, bit.tohex
66local sub, gsub, format = string.sub, string.gsub, string.format 66local sub, gsub, format = string.sub, string.gsub, string.format
67local byte, char, rep = string.byte, string.char, string.rep 67local byte, char, rep = string.byte, string.char, string.rep
68local type, tostring = type, tostring 68local 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