Re: luajit-dump.el -- Emacs mode for reading jit.dump files

  • From: "Yichun Zhang (agentzh)" <agentzh@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Fri, 12 Dec 2014 12:50:17 -0800

Hello!

On Fri, Dec 12, 2014 at 9:19 AM, Luke Gorrie wrote:
> I also have a jit.dump feature idea and I wonder if it would be feasible: to
> have a table that spells the (partial) mapping between line numbers of
> source code, byte code, IR, and machine code.

+1

Yes, I've also been thinking about this for long.

This is essentially the debug information for the machine code
generated by the JIT compiler, which can be used by Lua-land debuggers
(and dynamic tracing tools based on dtrace or systemtap), which can be
way more useful than cross-referenced documents (though the latter is
very useful too for LuaJIT developers and advanced users). This is
essentially similar to modern C compilers generate debuginfo for its
binary output though we don't have to use complicated debuginfo format
like DWARF in LuaJIT's JIT compiler :)

This feature, however, inevitably adds complexity and runtime overhead
to the JIT compiler itself, especially for all those optimizations in
the JIT compiler. So even if we have it in LuaJIT, we may not want to
enable it (or compile it in) by default.

I'd really appreciate Mike's inputs on this :)

BTW, we already have mappings between LuaJIT bytecode and the original
Lua source code if the bytecode is not stripped.

Regards,
-agentzh

Other related posts: