From 0b37b3f2a9b3cd59f609b41f7c72f1a4d7dce39c Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 23 Aug 2022 22:57:11 +0300 Subject: feat(tvix/eval): add call frame struct to VM This is going to carry the data for a function invocation inside of the VM. Change-Id: I86664563a7e35697a64294acd37ffde037fbd32d Reviewed-on: https://cl.tvl.fyi/c/depot/+/6241 Tested-by: BuildkiteCI Reviewed-by: grfn --- tvix/eval/src/vm.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tvix/eval/src') diff --git a/tvix/eval/src/vm.rs b/tvix/eval/src/vm.rs index c9b09be82b1c..99e2ba91327c 100644 --- a/tvix/eval/src/vm.rs +++ b/tvix/eval/src/vm.rs @@ -13,7 +13,14 @@ use crate::{ #[cfg(feature = "disassembler")] use crate::disassembler::Tracer; +struct CallFrame { + lambda: Lambda, + ip: usize, + stack_offset: usize, +} + pub struct VM { + frames: Vec, ip: usize, chunk: Chunk, stack: Vec, @@ -367,6 +374,7 @@ impl VM { pub fn run_lambda(lambda: Lambda) -> EvalResult { let mut vm = VM { + frames: vec![], chunk: Rc::::try_unwrap(lambda.chunk).unwrap(), ip: 0, stack: vec![], -- cgit 1.4.1