feat(tvix/eval): print lambda memory adresses in disassembler
This makes it easier to track exactly which lambda is which when inspecting e.g. the concrete representation of a thunk. At runtime all lambdas live in an Rc. To make this print the right address, the construction of these Rcs had to be moved up right to the point where the lambda is first emitted (and disassembled). Change-Id: I6070e6c8ac55f0bd697966c4e7c5565c20d19106 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6435 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
This commit is contained in:
parent
d3421c1cb9
commit
48d5f4fd57
4 changed files with 30 additions and 32 deletions
|
|
@ -1,4 +1,4 @@
|
|||
use std::path::PathBuf;
|
||||
use std::{path::PathBuf, rc::Rc};
|
||||
|
||||
use crate::{
|
||||
builtins::global_builtins,
|
||||
|
|
@ -45,11 +45,12 @@ pub fn interpret(code: &str, location: Option<PathBuf>) -> EvalResult<Value> {
|
|||
&file,
|
||||
global_builtins(),
|
||||
#[cfg(feature = "disassembler")]
|
||||
std::rc::Rc::new(codemap),
|
||||
Rc::new(codemap),
|
||||
)?;
|
||||
let lambda = Rc::new(result.lambda);
|
||||
|
||||
#[cfg(feature = "disassembler")]
|
||||
crate::disassembler::disassemble_chunk(&result.lambda.chunk);
|
||||
crate::disassembler::disassemble_lambda(lambda.clone());
|
||||
|
||||
for warning in result.warnings {
|
||||
eprintln!(
|
||||
|
|
@ -73,5 +74,5 @@ pub fn interpret(code: &str, location: Option<PathBuf>) -> EvalResult<Value> {
|
|||
return Err(err.clone());
|
||||
}
|
||||
|
||||
crate::vm::run_lambda(result.lambda)
|
||||
crate::vm::run_lambda(lambda)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue