diff options
| author | Mike Pall <mike> | 2016-05-23 01:49:00 +0200 |
|---|---|---|
| committer | Mike Pall <mike> | 2016-05-23 01:49:00 +0200 |
| commit | 6c8258d74b7d4ae7f288897518f23c809b9395f2 (patch) | |
| tree | 7479dce31b17ed704f20ee3920b6de6696521f26 /src/jit | |
| parent | 8f868a9d02340bae8b3b4a703118b324213f5c6d (diff) | |
| download | luajit-6c8258d74b7d4ae7f288897518f23c809b9395f2.tar.gz luajit-6c8258d74b7d4ae7f288897518f23c809b9395f2.tar.bz2 luajit-6c8258d74b7d4ae7f288897518f23c809b9395f2.zip | |
LJ_FR2: Add support for trace recording and snapshots.
Contributed by Peter Cawley.
Diffstat (limited to 'src/jit')
| -rw-r--r-- | src/jit/dump.lua | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/jit/dump.lua b/src/jit/dump.lua index 9a722f73..a635af10 100644 --- a/src/jit/dump.lua +++ b/src/jit/dump.lua | |||
| @@ -310,15 +310,17 @@ local function fmtfunc(func, pc) | |||
| 310 | end | 310 | end |
| 311 | end | 311 | end |
| 312 | 312 | ||
| 313 | local function formatk(tr, idx) | 313 | local function formatk(tr, idx, sn) |
| 314 | local k, t, slot = tracek(tr, idx) | 314 | local k, t, slot = tracek(tr, idx) |
| 315 | local tn = type(k) | 315 | local tn = type(k) |
| 316 | local s | 316 | local s |
| 317 | if tn == "number" then | 317 | if tn == "number" then |
| 318 | if k == 2^52+2^51 then | 318 | if band(sn or 0, 0x30000) ~= 0 then |
| 319 | s = band(sn, 0x20000) ~= 0 and "contpc" or "ftsz" | ||
| 320 | elseif k == 2^52+2^51 then | ||
| 319 | s = "bias" | 321 | s = "bias" |
| 320 | else | 322 | else |
| 321 | s = format("%+.14g", k) | 323 | s = format(0 < k and k < 0x1p-1026 and "%+a" or "%+.14g", k) |
| 322 | end | 324 | end |
| 323 | elseif tn == "string" then | 325 | elseif tn == "string" then |
| 324 | s = format(#k > 20 and '"%.20s"~' or '"%s"', gsub(k, "%c", ctlsub)) | 326 | s = format(#k > 20 and '"%.20s"~' or '"%s"', gsub(k, "%c", ctlsub)) |
| @@ -354,7 +356,7 @@ local function printsnap(tr, snap) | |||
| 354 | n = n + 1 | 356 | n = n + 1 |
| 355 | local ref = band(sn, 0xffff) - 0x8000 -- REF_BIAS | 357 | local ref = band(sn, 0xffff) - 0x8000 -- REF_BIAS |
| 356 | if ref < 0 then | 358 | if ref < 0 then |
| 357 | out:write(formatk(tr, ref)) | 359 | out:write(formatk(tr, ref, sn)) |
| 358 | elseif band(sn, 0x80000) ~= 0 then -- SNAP_SOFTFPNUM | 360 | elseif band(sn, 0x80000) ~= 0 then -- SNAP_SOFTFPNUM |
| 359 | out:write(colorize(format("%04d/%04d", ref, ref+1), 14)) | 361 | out:write(colorize(format("%04d/%04d", ref, ref+1), 14)) |
| 360 | else | 362 | else |
