aboutsummaryrefslogtreecommitdiff
path: root/src/jit
diff options
context:
space:
mode:
authorMike Pall <mike>2021-09-19 17:49:25 +0200
committerMike Pall <mike>2021-09-19 17:49:25 +0200
commitbb0f24101565d34ea8b70fdec4dd3f3b35a70e7b (patch)
tree01ea9267c638c96967036e03ff296d8dac82d610 /src/jit
parent986bb406ad6af93eebd781860c384cc853103827 (diff)
downloadluajit-bb0f24101565d34ea8b70fdec4dd3f3b35a70e7b.tar.gz
luajit-bb0f24101565d34ea8b70fdec4dd3f3b35a70e7b.tar.bz2
luajit-bb0f24101565d34ea8b70fdec4dd3f3b35a70e7b.zip
Compile table traversals: next(), pairs(), BC_ISNEXT/BC_ITERN.
Sponsored by OpenResty Inc.
Diffstat (limited to 'src/jit')
-rw-r--r--src/jit/dump.lua17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/jit/dump.lua b/src/jit/dump.lua
index 5fb1e144..9eda08c4 100644
--- a/src/jit/dump.lua
+++ b/src/jit/dump.lua
@@ -219,8 +219,10 @@ local function colorize_text(s)
219 return s 219 return s
220end 220end
221 221
222local function colorize_ansi(s, t) 222local function colorize_ansi(s, t, extra)
223 return format(colortype_ansi[t], s) 223 local out = format(colortype_ansi[t], s)
224 if extra then out = "\027[3m"..out end
225 return out
224end 226end
225 227
226local irtype_ansi = setmetatable({}, 228local irtype_ansi = setmetatable({},
@@ -229,9 +231,10 @@ local irtype_ansi = setmetatable({},
229 231
230local html_escape = { ["<"] = "&lt;", [">"] = "&gt;", ["&"] = "&amp;", } 232local html_escape = { ["<"] = "&lt;", [">"] = "&gt;", ["&"] = "&amp;", }
231 233
232local function colorize_html(s, t) 234local function colorize_html(s, t, extra)
233 s = gsub(s, "[<>&]", html_escape) 235 s = gsub(s, "[<>&]", html_escape)
234 return format('<span class="irt_%s">%s</span>', irtype_text[t], s) 236 return format('<span class="irt_%s%s">%s</span>',
237 irtype_text[t], extra and " irt_extra" or "", s)
235end 238end
236 239
237local irtype_html = setmetatable({}, 240local irtype_html = setmetatable({},
@@ -256,6 +259,7 @@ span.irt_tab { color: #c00000; }
256span.irt_udt, span.irt_lud { color: #00c0c0; } 259span.irt_udt, span.irt_lud { color: #00c0c0; }
257span.irt_num { color: #4040c0; } 260span.irt_num { color: #4040c0; }
258span.irt_int, span.irt_i8, span.irt_u8, span.irt_i16, span.irt_u16 { color: #b040b0; } 261span.irt_int, span.irt_i8, span.irt_u8, span.irt_i16, span.irt_u16 { color: #b040b0; }
262span.irt_extra { font-style: italic; }
259</style> 263</style>
260]] 264]]
261 265
@@ -271,6 +275,7 @@ local litname = {
271 if band(mode, 8) ~= 0 then s = s.."C" end 275 if band(mode, 8) ~= 0 then s = s.."C" end
272 if band(mode, 16) ~= 0 then s = s.."R" end 276 if band(mode, 16) ~= 0 then s = s.."R" end
273 if band(mode, 32) ~= 0 then s = s.."I" end 277 if band(mode, 32) ~= 0 then s = s.."I" end
278 if band(mode, 64) ~= 0 then s = s.."K" end
274 t[mode] = s 279 t[mode] = s
275 return s 280 return s
276 end}), 281 end}),
@@ -350,7 +355,7 @@ local function formatk(tr, idx, sn)
350 else 355 else
351 s = tostring(k) -- For primitives. 356 s = tostring(k) -- For primitives.
352 end 357 end
353 s = colorize(format("%-4s", s), t) 358 s = colorize(format("%-4s", s), t, band(sn or 0, 0x100000) ~= 0)
354 if slot then 359 if slot then
355 s = format("%s @%d", s, slot) 360 s = format("%s @%d", s, slot)
356 end 361 end
@@ -370,7 +375,7 @@ local function printsnap(tr, snap)
370 out:write(colorize(format("%04d/%04d", ref, ref+1), 14)) 375 out:write(colorize(format("%04d/%04d", ref, ref+1), 14))
371 else 376 else
372 local m, ot, op1, op2 = traceir(tr, ref) 377 local m, ot, op1, op2 = traceir(tr, ref)
373 out:write(colorize(format("%04d", ref), band(ot, 31))) 378 out:write(colorize(format("%04d", ref), band(ot, 31), band(sn, 0x100000) ~= 0))
374 end 379 end
375 out:write(band(sn, 0x10000) == 0 and " " or "|") -- SNAP_FRAME 380 out:write(band(sn, 0x10000) == 0 and " " or "|") -- SNAP_FRAME
376 else 381 else