aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2010-01-27 20:06:03 +0100
committerMike Pall <mike>2010-01-27 20:06:03 +0100
commit09b8f67cd8d181fdb0f4af3b72b6030f5496cb8b (patch)
tree418e199ae542e9cc7a0f222a91bb071c98acdfc2
parent3aeb89226202439c0be07830ae6e71007a7b5dd3 (diff)
downloadluajit-09b8f67cd8d181fdb0f4af3b72b6030f5496cb8b.tar.gz
luajit-09b8f67cd8d181fdb0f4af3b72b6030f5496cb8b.tar.bz2
luajit-09b8f67cd8d181fdb0f4af3b72b6030f5496cb8b.zip
Expose compressed snapshot map to reflection API.
Update jit.dump module and restore printing of frame separators.
-rw-r--r--lib/dump.lua31
-rw-r--r--src/lib_jit.c21
2 files changed, 19 insertions, 33 deletions
diff --git a/lib/dump.lua b/lib/dump.lua
index fb40a8f8..b13e1a5a 100644
--- a/lib/dump.lua
+++ b/lib/dump.lua
@@ -266,24 +266,21 @@ local function formatk(tr, idx)
266end 266end
267 267
268local function printsnap(tr, snap) 268local function printsnap(tr, snap)
269 for i=1,#snap do 269 local n = 2
270 local ref = snap[i] 270 for s=0,snap[1] do
271 if not ref then 271 local sn = snap[n]
272 out:write("---- ") 272 if shr(sn, 24) == s then
273 elseif ref < 0 then 273 n = n + 1
274 out:write(formatk(tr, ref), " ") 274 local ref = band(sn, 0xffff) - 0x8000 -- REF_BIAS
275 else 275 if ref < 0 then
276 local m, ot, op1, op2 = traceir(tr, ref) 276 out:write(formatk(tr, ref))
277 local t = band(ot, 15) 277 else
278 local sep = " " 278 local m, ot, op1, op2 = traceir(tr, ref)
279 if t == 8 then 279 out:write(colorize(format("%04d", ref), band(ot, 15)))
280 local oidx = 6*shr(ot, 8)
281 local op = sub(vmdef.irnames, oidx+1, oidx+6)
282 if op == "FRAME " then
283 sep = "|"
284 end
285 end 280 end
286 out:write(colorize(format("%04d", ref), t), sep) 281 out:write(band(sn, 0x10000) == 0 and " " or "|") -- SNAP_FRAME
282 else
283 out:write("---- ")
287 end 284 end
288 end 285 end
289 out:write("]\n") 286 out:write("]\n")
diff --git a/src/lib_jit.c b/src/lib_jit.c
index f3425d98..4da079c8 100644
--- a/src/lib_jit.c
+++ b/src/lib_jit.c
@@ -333,25 +333,14 @@ LJLIB_CF(jit_util_tracesnap)
333 SnapShot *snap = &T->snap[sn]; 333 SnapShot *snap = &T->snap[sn];
334 SnapEntry *map = &T->snapmap[snap->mapofs]; 334 SnapEntry *map = &T->snapmap[snap->mapofs];
335 MSize n, nent = snap->nent; 335 MSize n, nent = snap->nent;
336 BCReg nslots = snap->nslots;
337 GCtab *t; 336 GCtab *t;
338 lua_createtable(L, nslots ? (int)nslots : 1, 0); 337 lua_createtable(L, nent+2, 0);
339 t = tabV(L->top-1); 338 t = tabV(L->top-1);
340 setintV(lj_tab_setint(L, t, 0), (int32_t)snap->ref - REF_BIAS); 339 setintV(lj_tab_setint(L, t, 0), (int32_t)snap->ref - REF_BIAS);
341 /* NYI: get rid of this and expose the compressed slot map. */ 340 setintV(lj_tab_setint(L, t, 1), (int32_t)snap->nslots);
342 { 341 for (n = 0; n < nent; n++)
343 BCReg s; 342 setintV(lj_tab_setint(L, t, (int32_t)(n+2)), (int32_t)map[n]);
344 for (s = 0; s < nslots; s++) { 343 setintV(lj_tab_setint(L, t, (int32_t)(nent+2)), (int32_t)SNAP(255, 0, 0));
345 TValue *o = lj_tab_setint(L, t, (int32_t)(s+1));
346 setboolV(o, 0);
347 }
348 }
349 for (n = 0; n < nent; n++) {
350 BCReg s = snap_slot(map[n]);
351 IRRef ref = snap_ref(map[n]);
352 TValue *o = lj_tab_setint(L, t, (int32_t)(s+1));
353 setintV(o, (int32_t)ref - REF_BIAS);
354 }
355 return 1; 344 return 1;
356 } 345 }
357 return 0; 346 return 0;