about summary refs log tree commit diff
path: root/tvix/eval/src/opcode.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-08-23T23·26+0300
committertazjin <tazjin@tvl.su>2022-09-02T12·31+0000
commit1239a85e237f0ce24cd53effbdbc23c455e02364 (patch)
tree82051ce1b61e7bd897aaf83c2e6438af33e4a95e /tvix/eval/src/opcode.rs
parentfc892b7a9dd635467f362767ad58fefc26ffc122 (diff)
feat(tvix/eval): implement opcode for function calls in VM r/4583
Nix functions always have a single argument and we do not yet make
efforts to optimise this in Tvix for known multi-argument functions
being directly applied.

For this reason, the call instruction is fairly simple and just calls
out to construct a new call frame.

Note that the logic for terminating the run loop has moved to the top
of the dispatch; this is because the loop run needs to be skipped if
the call frame for the current lambda has just been dropped.

Change-Id: I259bc07e19c1e55cd0a65207fa8105b23052b967
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6249
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/opcode.rs')
-rw-r--r--tvix/eval/src/opcode.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/tvix/eval/src/opcode.rs b/tvix/eval/src/opcode.rs
index cda3fdf26be5..39a32d3bad2b 100644
--- a/tvix/eval/src/opcode.rs
+++ b/tvix/eval/src/opcode.rs
@@ -75,4 +75,7 @@ pub enum OpCode {
 
     // Asserts stack top is a boolean, and true.
     OpAssert,
+
+    // Lambdas
+    OpCall,
 }