diff options
Diffstat (limited to 'src/jit/v.lua')
-rw-r--r-- | src/jit/v.lua | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/jit/v.lua b/src/jit/v.lua index 2e5d1be3..0d4ec277 100644 --- a/src/jit/v.lua +++ b/src/jit/v.lua | |||
@@ -62,7 +62,7 @@ local jit = require("jit") | |||
62 | local jutil = require("jit.util") | 62 | local jutil = require("jit.util") |
63 | local vmdef = require("jit.vmdef") | 63 | local vmdef = require("jit.vmdef") |
64 | local funcinfo, traceinfo = jutil.funcinfo, jutil.traceinfo | 64 | local funcinfo, traceinfo = jutil.funcinfo, jutil.traceinfo |
65 | local type, format = type, string.format | 65 | local type, sub, format = type, string.sub, string.format |
66 | local stdout, stderr = io.stdout, io.stderr | 66 | local stdout, stderr = io.stdout, io.stderr |
67 | 67 | ||
68 | -- Active flag and output file handle. | 68 | -- Active flag and output file handle. |
@@ -89,7 +89,12 @@ end | |||
89 | local function fmterr(err, info) | 89 | local function fmterr(err, info) |
90 | if type(err) == "number" then | 90 | if type(err) == "number" then |
91 | if type(info) == "function" then info = fmtfunc(info) end | 91 | if type(info) == "function" then info = fmtfunc(info) end |
92 | err = format(vmdef.traceerr[err], info) | 92 | local fmt = vmdef.traceerr[err] |
93 | if fmt == "NYI: bytecode %s" then | ||
94 | local oidx = 6 * info | ||
95 | info = sub(vmdef.bcnames, oidx+1, oidx+6) | ||
96 | end | ||
97 | err = format(fmt, info) | ||
93 | end | 98 | end |
94 | return err | 99 | return err |
95 | end | 100 | end |
@@ -98,7 +103,7 @@ end | |||
98 | local function dump_trace(what, tr, func, pc, otr, oex) | 103 | local function dump_trace(what, tr, func, pc, otr, oex) |
99 | if what == "start" then | 104 | if what == "start" then |
100 | startloc = fmtfunc(func, pc) | 105 | startloc = fmtfunc(func, pc) |
101 | startex = otr and "("..otr.."/"..oex..") " or "" | 106 | startex = otr and "("..otr.."/"..(oex == -1 and "stitch" or oex)..") " or "" |
102 | else | 107 | else |
103 | if what == "abort" then | 108 | if what == "abort" then |
104 | local loc = fmtfunc(func, pc) | 109 | local loc = fmtfunc(func, pc) |
@@ -115,6 +120,9 @@ local function dump_trace(what, tr, func, pc, otr, oex) | |||
115 | if ltype == "interpreter" then | 120 | if ltype == "interpreter" then |
116 | out:write(format("[TRACE %3s %s%s -- fallback to interpreter]\n", | 121 | out:write(format("[TRACE %3s %s%s -- fallback to interpreter]\n", |
117 | tr, startex, startloc)) | 122 | tr, startex, startloc)) |
123 | elseif ltype == "stitch" then | ||
124 | out:write(format("[TRACE %3s %s%s %s %s]\n", | ||
125 | tr, startex, startloc, ltype, fmtfunc(func, pc))) | ||
118 | elseif link == tr or link == 0 then | 126 | elseif link == tr or link == 0 then |
119 | out:write(format("[TRACE %3s %s%s %s]\n", | 127 | out:write(format("[TRACE %3s %s%s %s]\n", |
120 | tr, startex, startloc, ltype)) | 128 | tr, startex, startloc, ltype)) |
@@ -158,9 +166,9 @@ local function dumpon(outfile) | |||
158 | end | 166 | end |
159 | 167 | ||
160 | -- Public module functions. | 168 | -- Public module functions. |
161 | module(...) | 169 | return { |
162 | 170 | on = dumpon, | |
163 | on = dumpon | 171 | off = dumpoff, |
164 | off = dumpoff | 172 | start = dumpon -- For -j command line option. |
165 | start = dumpon -- For -j command line option. | 173 | } |
166 | 174 | ||