feat(tvix/eval): implement OpTailCall

If the last operation within a chunk is a function call, the call can
be executed in the same call frame without increasing the depth of the
call stack.

To enable this, a new OpTailCall instruction (similar to OpCall) is
introduced, but not yet emitted by the compiler.

Change-Id: I9ffbd7da6d2d6a8ec7a724646435dc6ee89712f2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6457
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
Vincent Ambo 2022-09-04 23:16:59 +03:00 committed by tazjin
parent 6deaa0d6ce
commit 2e018a50a7
3 changed files with 52 additions and 11 deletions

View file

@ -104,6 +104,7 @@ pub enum OpCode {
// Lambdas & closures
OpCall,
OpTailCall,
OpGetUpvalue(UpvalueIdx),
OpClosure(ConstantIdx),