diff options
author | Vincent Ambo <mail@tazj.in> | 2022-09-04T17·10+0300 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2022-09-09T21·14+0000 |
commit | e2a942e4b2ccdf2caa2970201f90edf5be926c2b (patch) | |
tree | 6d096fc2eaff558e6ba03cbbdff0d797942ca346 /tvix/eval/src/disassembler.rs | |
parent | e03a729fa36287e236b5ac66f17d67d63a219d00 (diff) |
chore(tvix/eval): clean up remains of previous disassembler impl r/4780
Change-Id: Ib402ea23a58dc52ed0c5a97178cb5d0e53d69300 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6454 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 | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/tvix/eval/src/disassembler.rs b/tvix/eval/src/disassembler.rs deleted file mode 100644 index 51d39c3910a1..000000000000 --- a/tvix/eval/src/disassembler.rs +++ /dev/null @@ -1,41 +0,0 @@ -//! Implements methods for disassembling and printing a representation -//! of compiled code, as well as tracing the runtime stack during -//! execution. -use std::io::{Stderr, Write}; -use tabwriter::TabWriter; - -use crate::opcode::OpCode; -use crate::value::Value; - -/// Helper struct to trace runtime values and automatically flush the -/// output after the value is dropped (i.e. in both success and -/// failure exits from the VM). -pub struct Tracer(TabWriter<Stderr>); - -impl Default for Tracer { - fn default() -> Self { - Tracer(TabWriter::new(std::io::stderr())) - } -} - -impl Tracer { - pub fn trace(&mut self, op: &OpCode, ip: usize, stack: &[Value]) { - let _ = write!(&mut self.0, "{:04} {:?}\t[ ", ip, op); - - for val in stack { - let _ = write!(&mut self.0, "{} ", val); - } - - let _ = writeln!(&mut self.0, "]"); - } - - pub fn literal(&mut self, line: &str) { - let _ = writeln!(&mut self.0, "{}", line); - } -} - -impl Drop for Tracer { - fn drop(&mut self) { - let _ = self.0.flush(); - } -} |