aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMike Pall <mike>2011-10-24 16:13:12 +0200
committerMike Pall <mike>2011-10-24 16:13:12 +0200
commitcb1dd159e3b25e23cb8aa2ba9b6da76bb17398ec (patch)
tree9605b1c4e9800cfe7d33f6e7cec989365d98e58c /lib
parenta0d782755482483c09e919a51c396322dd228bf2 (diff)
downloadluajit-cb1dd159e3b25e23cb8aa2ba9b6da76bb17398ec.tar.gz
luajit-cb1dd159e3b25e23cb8aa2ba9b6da76bb17398ec.tar.bz2
luajit-cb1dd159e3b25e23cb8aa2ba9b6da76bb17398ec.zip
PPC: Add support for per-trace exit stubs.
Diffstat (limited to 'lib')
-rw-r--r--lib/dump.lua30
1 files changed, 25 insertions, 5 deletions
diff --git a/lib/dump.lua b/lib/dump.lua
index bb8aa1ce..3a88ef45 100644
--- a/lib/dump.lua
+++ b/lib/dump.lua
@@ -76,11 +76,24 @@ local active, out, dumpmode
76 76
77------------------------------------------------------------------------------ 77------------------------------------------------------------------------------
78 78
79local symtabmt = { __index = false }
79local symtab = {} 80local symtab = {}
80local nexitsym = 0 81local nexitsym = 0
81 82
82-- Fill symbol table with trace exit addresses. 83-- Fill nested symbol table with per-trace exit stub addresses.
83local function fillsymtab(nexit) 84local function fillsymtab_tr(tr, nexit)
85 local t = {}
86 symtabmt.__index = t
87 for i=0,nexit-1 do
88 local addr = traceexitstub(tr, i)
89 t[addr] = tostring(i)
90 end
91 local addr = traceexitstub(tr, nexit)
92 if addr then t[addr] = "stack_check" end
93end
94
95-- Fill symbol table with trace exit stub addresses.
96local function fillsymtab(tr, nexit)
84 local t = symtab 97 local t = symtab
85 if nexitsym == 0 then 98 if nexitsym == 0 then
86 local ircall = vmdef.ircall 99 local ircall = vmdef.ircall
@@ -89,10 +102,17 @@ local function fillsymtab(nexit)
89 if addr ~= 0 then t[addr] = ircall[i] end 102 if addr ~= 0 then t[addr] = ircall[i] end
90 end 103 end
91 end 104 end
92 if nexit > nexitsym then 105 if nexitsym == 1000000 then -- Per-trace exit stubs.
106 fillsymtab_tr(tr, nexit)
107 elseif nexit > nexitsym then -- Shared exit stubs.
93 for i=nexitsym,nexit-1 do 108 for i=nexitsym,nexit-1 do
94 local addr = traceexitstub(i) 109 local addr = traceexitstub(i)
95 if addr == nil then nexit = 1000000; break end 110 if addr == nil then -- Fall back to per-trace exit stubs.
111 fillsymtab_tr(tr, nexit)
112 setmetatable(symtab, symtabmt)
113 nexit = 1000000
114 break
115 end
96 t[addr] = tostring(i) 116 t[addr] = tostring(i)
97 end 117 end
98 nexitsym = nexit 118 nexitsym = nexit
@@ -114,7 +134,7 @@ local function dump_mcode(tr)
114 out:write("---- TRACE ", tr, " mcode ", #mcode, "\n") 134 out:write("---- TRACE ", tr, " mcode ", #mcode, "\n")
115 local ctx = disass.create(mcode, addr, dumpwrite) 135 local ctx = disass.create(mcode, addr, dumpwrite)
116 ctx.hexdump = 0 136 ctx.hexdump = 0
117 ctx.symtab = fillsymtab(info.nexit) 137 ctx.symtab = fillsymtab(tr, info.nexit)
118 if loop ~= 0 then 138 if loop ~= 0 then
119 symtab[addr+loop] = "LOOP" 139 symtab[addr+loop] = "LOOP"
120 ctx:disass(0, loop) 140 ctx:disass(0, loop)