mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
Expose compressed snapshot map to reflection API.
Update jit.dump module and restore printing of frame separators.
This commit is contained in:
parent
3aeb892262
commit
09b8f67cd8
27
lib/dump.lua
27
lib/dump.lua
@ -266,24 +266,21 @@ local function formatk(tr, idx)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function printsnap(tr, snap)
|
local function printsnap(tr, snap)
|
||||||
for i=1,#snap do
|
local n = 2
|
||||||
local ref = snap[i]
|
for s=0,snap[1] do
|
||||||
if not ref then
|
local sn = snap[n]
|
||||||
out:write("---- ")
|
if shr(sn, 24) == s then
|
||||||
elseif ref < 0 then
|
n = n + 1
|
||||||
out:write(formatk(tr, ref), " ")
|
local ref = band(sn, 0xffff) - 0x8000 -- REF_BIAS
|
||||||
|
if ref < 0 then
|
||||||
|
out:write(formatk(tr, ref))
|
||||||
else
|
else
|
||||||
local m, ot, op1, op2 = traceir(tr, ref)
|
local m, ot, op1, op2 = traceir(tr, ref)
|
||||||
local t = band(ot, 15)
|
out:write(colorize(format("%04d", ref), band(ot, 15)))
|
||||||
local sep = " "
|
|
||||||
if t == 8 then
|
|
||||||
local oidx = 6*shr(ot, 8)
|
|
||||||
local op = sub(vmdef.irnames, oidx+1, oidx+6)
|
|
||||||
if op == "FRAME " then
|
|
||||||
sep = "|"
|
|
||||||
end
|
end
|
||||||
end
|
out:write(band(sn, 0x10000) == 0 and " " or "|") -- SNAP_FRAME
|
||||||
out:write(colorize(format("%04d", ref), t), sep)
|
else
|
||||||
|
out:write("---- ")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
out:write("]\n")
|
out:write("]\n")
|
||||||
|
@ -333,25 +333,14 @@ LJLIB_CF(jit_util_tracesnap)
|
|||||||
SnapShot *snap = &T->snap[sn];
|
SnapShot *snap = &T->snap[sn];
|
||||||
SnapEntry *map = &T->snapmap[snap->mapofs];
|
SnapEntry *map = &T->snapmap[snap->mapofs];
|
||||||
MSize n, nent = snap->nent;
|
MSize n, nent = snap->nent;
|
||||||
BCReg nslots = snap->nslots;
|
|
||||||
GCtab *t;
|
GCtab *t;
|
||||||
lua_createtable(L, nslots ? (int)nslots : 1, 0);
|
lua_createtable(L, nent+2, 0);
|
||||||
t = tabV(L->top-1);
|
t = tabV(L->top-1);
|
||||||
setintV(lj_tab_setint(L, t, 0), (int32_t)snap->ref - REF_BIAS);
|
setintV(lj_tab_setint(L, t, 0), (int32_t)snap->ref - REF_BIAS);
|
||||||
/* NYI: get rid of this and expose the compressed slot map. */
|
setintV(lj_tab_setint(L, t, 1), (int32_t)snap->nslots);
|
||||||
{
|
for (n = 0; n < nent; n++)
|
||||||
BCReg s;
|
setintV(lj_tab_setint(L, t, (int32_t)(n+2)), (int32_t)map[n]);
|
||||||
for (s = 0; s < nslots; s++) {
|
setintV(lj_tab_setint(L, t, (int32_t)(nent+2)), (int32_t)SNAP(255, 0, 0));
|
||||||
TValue *o = lj_tab_setint(L, t, (int32_t)(s+1));
|
|
||||||
setboolV(o, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (n = 0; n < nent; n++) {
|
|
||||||
BCReg s = snap_slot(map[n]);
|
|
||||||
IRRef ref = snap_ref(map[n]);
|
|
||||||
TValue *o = lj_tab_setint(L, t, (int32_t)(s+1));
|
|
||||||
setintV(o, (int32_t)ref - REF_BIAS);
|
|
||||||
}
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user