refactor(tvix/eval): enhance debug output for bytecode dumps
This adds addresses of thunk and closure chunks to the debug output displayed when dumping bytecode. This makes it possible to see in the dump which thunks are referenced by constants in other thunks. Change-Id: I2c98de5227e7cb415666cd3134c947a56979dc80 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8137 Autosubmit: tazjin <tazjin@tvl.su> Reviewed-by: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
This commit is contained in:
parent
dbca46d052
commit
fb4c197b39
2 changed files with 25 additions and 1 deletions
|
|
@ -143,7 +143,15 @@ impl Chunk {
|
|||
}
|
||||
|
||||
match self[idx] {
|
||||
OpCode::OpConstant(idx) => writeln!(writer, "OpConstant({}@{})", self[idx], idx.0),
|
||||
OpCode::OpConstant(idx) => {
|
||||
let val_str = match &self[idx] {
|
||||
Value::Thunk(t) => t.debug_repr(),
|
||||
Value::Closure(c) => format!("closure({:p})", c.lambda),
|
||||
val => format!("{}", val),
|
||||
};
|
||||
|
||||
writeln!(writer, "OpConstant({}@{})", val_str, idx.0)
|
||||
}
|
||||
op => writeln!(writer, "{:?}", op),
|
||||
}?;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue