feat(tvix/eval): implement runtime tracing methods for Observer

These methods make it possible to trace the runtime execution of the
VM through an observer.

Change-Id: I90e26853ba2fe44748613e7f761ed5c1c5fc9ff7
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6452
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
This commit is contained in:
Vincent Ambo 2022-09-04 19:38:26 +03:00 committed by tazjin
parent cbf2d2d292
commit 14ff889d60
3 changed files with 44 additions and 30 deletions

View file

@ -3,7 +3,7 @@ use std::{path::PathBuf, rc::Rc};
use crate::{
builtins::global_builtins,
errors::{Error, ErrorKind, EvalResult},
observer::DisassemblingObserver,
observer::{DisassemblingObserver, NoOpObserver},
value::Value,
};
@ -68,5 +68,6 @@ pub fn interpret(code: &str, location: Option<PathBuf>) -> EvalResult<Value> {
return Err(err.clone());
}
crate::vm::run_lambda(result.lambda)
let mut tracer = NoOpObserver::default();
crate::vm::run_lambda(&mut tracer, result.lambda)
}