]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Expose compressed snapshot map to reflection API.
authorMike Pall <mike>
Wed, 27 Jan 2010 19:06:03 +0000 (20:06 +0100)
committerMike Pall <mike>
Wed, 27 Jan 2010 19:06:03 +0000 (20:06 +0100)
Update jit.dump module and restore printing of frame separators.

lib/dump.lua
src/lib_jit.c

index fb40a8f85772ac9669d92b7c08b24a02a8edb9fe..b13e1a5a189264ae170856740188ad0a2393cb30 100644 (file)
@@ -266,24 +266,21 @@ local function formatk(tr, idx)
 end
 
 local function printsnap(tr, snap)
-  for i=1,#snap do
-    local ref = snap[i]
-    if not ref then
-      out:write("---- ")
-    elseif ref < 0 then
-      out:write(formatk(tr, ref), " ")
-    else
-      local m, ot, op1, op2 = traceir(tr, ref)
-      local t = 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
+  local n = 2
+  for s=0,snap[1] do
+    local sn = snap[n]
+    if shr(sn, 24) == s then
+      n = n + 1
+      local ref = band(sn, 0xffff) - 0x8000 -- REF_BIAS
+      if ref < 0 then
+       out:write(formatk(tr, ref))
+      else
+       local m, ot, op1, op2 = traceir(tr, ref)
+       out:write(colorize(format("%04d", ref), band(ot, 15)))
       end
-      out:write(colorize(format("%04d", ref), t), sep)
+      out:write(band(sn, 0x10000) == 0 and " " or "|") -- SNAP_FRAME
+    else
+      out:write("---- ")
     end
   end
   out:write("]\n")
index f3425d98d12b70e286afbd7f3719d9f3a10e8406..4da079c8fe38e5fd907a93ce69d5aa16de32b854 100644 (file)
@@ -333,25 +333,14 @@ LJLIB_CF(jit_util_tracesnap)
     SnapShot *snap = &T->snap[sn];
     SnapEntry *map = &T->snapmap[snap->mapofs];
     MSize n, nent = snap->nent;
-    BCReg nslots = snap->nslots;
     GCtab *t;
-    lua_createtable(L, nslots ? (int)nslots : 1, 0);
+    lua_createtable(L, nent+2, 0);
     t = tabV(L->top-1);
     setintV(lj_tab_setint(L, t, 0), (int32_t)snap->ref - REF_BIAS);
-    /* NYI: get rid of this and expose the compressed slot map. */
-    {
-      BCReg s;
-      for (s = 0; s < nslots; s++) {
-       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);
-    }
+    setintV(lj_tab_setint(L, t, 1), (int32_t)snap->nslots);
+    for (n = 0; n < nent; n++)
+      setintV(lj_tab_setint(L, t, (int32_t)(n+2)), (int32_t)map[n]);
+    setintV(lj_tab_setint(L, t, (int32_t)(nent+2)), (int32_t)SNAP(255, 0, 0));
     return 1;
   }
   return 0;