feat(tvix/eval): implement opcode for function calls in VM

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
This commit is contained in:
Vincent Ambo 2022-08-24 02:26:58 +03:00 committed by tazjin
parent fc892b7a9d
commit 1239a85e23
3 changed files with 30 additions and 8 deletions

View file

@ -75,4 +75,7 @@ pub enum OpCode {
// Asserts stack top is a boolean, and true.
OpAssert,
// Lambdas
OpCall,
}