]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Show name of NYI bytecode in -jv and -jdump.
authorMike Pall <mike>
Thu, 18 Apr 2024 22:12:22 +0000 (00:12 +0200)
committerMike Pall <mike>
Thu, 18 Apr 2024 22:12:22 +0000 (00:12 +0200)
Suggested by Sergey Kaplun. #1176 #567

src/jit/dump.lua
src/jit/v.lua
src/lj_traceerr.h

index 746732f9f40e44ccaa2a778769f4d4321b54f5ea..f296a517c923f5a2ad042a09fa79a5c086a98792 100644 (file)
@@ -552,7 +552,12 @@ local recdepth = 0
 local function fmterr(err, info)
   if type(err) == "number" then
     if type(info) == "function" then info = fmtfunc(info) end
-    err = format(vmdef.traceerr[err], info)
+    local fmt = vmdef.traceerr[err]
+    if fmt == "NYI: bytecode %s" then
+      local oidx = 6 * info
+      info = sub(vmdef.bcnames, oidx+1, oidx+6)
+    end
+    err = format(fmt, info)
   end
   return err
 end
index 8e91f49420d5c9d9a3cb7bc037a9f22e38eba238..45a663d79a8b3c2f4011ebf3352488f48f907404 100644 (file)
@@ -62,7 +62,7 @@ local jit = require("jit")
 local jutil = require("jit.util")
 local vmdef = require("jit.vmdef")
 local funcinfo, traceinfo = jutil.funcinfo, jutil.traceinfo
-local type, format = type, string.format
+local type, sub, format = type, string.sub, string.format
 local stdout, stderr = io.stdout, io.stderr
 
 -- Active flag and output file handle.
@@ -89,7 +89,12 @@ end
 local function fmterr(err, info)
   if type(err) == "number" then
     if type(info) == "function" then info = fmtfunc(info) end
-    err = format(vmdef.traceerr[err], info)
+    local fmt = vmdef.traceerr[err]
+    if fmt == "NYI: bytecode %s" then
+      local oidx = 6 * info
+      info = sub(vmdef.bcnames, oidx+1, oidx+6)
+    end
+    err = format(fmt, info)
   end
   return err
 end
index 19ce30ad8444c40c02974770291fdcba5bb70529..08134dc54a237b770c4080d26266cef8db347125 100644 (file)
@@ -13,7 +13,7 @@ TREDEF(STACKOV,       "trace too deep")
 TREDEF(SNAPOV, "too many snapshots")
 TREDEF(BLACKL, "blacklisted")
 TREDEF(RETRY,  "retry recording")
-TREDEF(NYIBC,  "NYI: bytecode %d")
+TREDEF(NYIBC,  "NYI: bytecode %s")
 
 /* Recording loop ops. */
 TREDEF(LLEAVE, "leaving loop in root trace")