Open chc4 opened 2 years ago
Intel CPUs have a feature which allow recording the traces of taken branches in the form of a record with a from & to pointer. Look for "branch trace" in the intel documentation.
I never used it, but this could potentially be used to record traces of execution of any code, even the one generated by the Rust compiler. Thus removing the need for instrumenting the code to recompile it later.
The tracing in this issue is actually about switching to use the tracing
crate for diagnostics, not collecting JIT traces :)
Intel BTS and PT are both very cool technologies, and would be a good fit if we needed to. Currently Lineiform is designed as a method based JIT, not a tracing JIT, so we never record execution traces, only inline and constant fold closed environment members in the closure inputs. There are some tradeoffs between method and tracing JIT, where tracing is really good at optimizing hot loops and deep call stacks, but I don't think there is a consensus on which is definitively better, so I'm just going to stick to method-based for now.
There is another meta-JIT project I know of (https://github.com/ykjit/yk) that is planning on using Intel PT to collect JIT traces, and I'm curious to see how it turns out.
Right now we just println a bunch, which sucks.
tracing
so we have introspection into how long specific parts of the program are takingcranelift_codegen::cfg_printer::CFGPrinter
to disk so we can visualize the JIT'd program CFG better (and maybe build our own graphviz printout for JitValues?)