diff options
author | Vincent Ambo <mail@tazj.in> | 2022-08-23T19·57+0300 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2022-09-01T21·56+0000 |
commit | 0b37b3f2a9b3cd59f609b41f7c72f1a4d7dce39c (patch) | |
tree | 99c3ae6d6b7977ce78b98589075084cad0a443f2 /tvix | |
parent | 6f31c895ffe2dc5dd8281d812252d5db0644ec77 (diff) |
feat(tvix/eval): add call frame struct to VM r/4577
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 <grfn@gws.fyi>
Diffstat (limited to 'tvix')
-rw-r--r-- | tvix/eval/src/vm.rs | 8 |
1 files changed, 8 insertions, 0 deletions
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<CallFrame>, ip: usize, chunk: Chunk, stack: Vec<Value>, @@ -367,6 +374,7 @@ impl VM { pub fn run_lambda(lambda: Lambda) -> EvalResult<Value> { let mut vm = VM { + frames: vec![], chunk: Rc::<Chunk>::try_unwrap(lambda.chunk).unwrap(), ip: 0, stack: vec![], |