about summary refs log tree commit diff
path: root/tvix/eval/src/value/mod.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-10-10T23·14+0300
committertazjin <tazjin@tvl.su>2022-10-10T23·36+0000
commit1f84d9081130eb55b911a2542ac4781ee1438fc4 (patch)
tree2eaf1ef4f44f85f1726db59a3e5681d04c0a770d /tvix/eval/src/value/mod.rs
parent0b04dfe03ca380bd234d90efa4f98d76732305f2 (diff)
refactor(tvix/eval): after calling, the caller has to pop r/5094
Previously the various call functions either returned `EvalResult<()>`
or `EvalResult<Value>`, which was confusing.

Now only vm::call_with returns a Value directly, and other parts of
the API just leave the stack top in the post-call state.

This makes it easier to reason about what's going on in non-tail-call
cases (which are making a comeback).

Change-Id: I264ffc683a11aca72dd06e2220a5ff6e7c5fc2b0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6936
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
Diffstat (limited to 'tvix/eval/src/value/mod.rs')
-rw-r--r--tvix/eval/src/value/mod.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/tvix/eval/src/value/mod.rs b/tvix/eval/src/value/mod.rs
index fd5b5255c5d8..3791aaf56b9b 100644
--- a/tvix/eval/src/value/mod.rs
+++ b/tvix/eval/src/value/mod.rs
@@ -163,7 +163,8 @@ impl Value {
                         let call_to_string = |value: &Value, vm: &mut VM| {
                             // Leave self on the stack as an argument to the function call.
                             vm.push(self.clone());
-                            let result = vm.call_value(value)?;
+                            vm.call_value(value)?;
+                            let result = vm.pop();
 
                             match result {
                                 Value::String(s) => Ok(s),