diff options
author | Vincent Ambo <mail@tazj.in> | 2022-09-02T20·55+0300 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2022-09-08T13·36+0000 |
commit | a303ea3ff50c68d77679e72f7b67256b992cbd94 (patch) | |
tree | 2e7d32d112bcb99dfd6b629c138136b2dbf31fc8 /tvix/eval/src/disassembler.rs | |
parent | 60ff8d046c01c7a820e56d584bf9fcabacc417b7 (diff) |
refactor(tvix/eval): implement much clearer disassembler output r/4752
With this change the runtime trace contains much more exact information about the context of the computation (entering/exiting calls etc.) This is in large part due to moving the tracer to be a field on the VM itself, which enables consistent ordering of traces across the execution, and tracing an execution with its *input* instead of *output* stack. Change-Id: Ibe525e6e7d869756501e52bef1a441619ce7332c Reviewed-on: https://cl.tvl.fyi/c/depot/+/6419 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/disassembler.rs')
-rw-r--r-- | tvix/eval/src/disassembler.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tvix/eval/src/disassembler.rs b/tvix/eval/src/disassembler.rs index e3cc1f16e706..a555f9179102 100644 --- a/tvix/eval/src/disassembler.rs +++ b/tvix/eval/src/disassembler.rs @@ -15,9 +15,7 @@ pub struct Tracer(TabWriter<Stderr>); impl Tracer { pub fn new() -> Self { - let mut tw = TabWriter::new(std::io::stderr()); - write!(&mut tw, "=== runtime trace ===\n").ok(); - Tracer(tw) + Tracer(TabWriter::new(std::io::stderr())) } pub fn trace(&mut self, op: &OpCode, ip: usize, stack: &[Value]) { @@ -29,6 +27,10 @@ impl Tracer { write!(&mut self.0, "]\n").ok(); } + + pub fn literal(&mut self, line: &str) { + let _ = write!(&mut self.0, "{}\n", line); + } } impl Drop for Tracer { |