From 8033a7abaea3c44a16eb6d3db477a89c2fa88a82 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 29 Aug 2022 18:03:24 +0300 Subject: refactor(tvix/eval): simplify thunk representations For now, do not distinguish between closing and non-closing thunks, it will make the initial implementation easier. See Knuth etc. Change-Id: I0bd51e0f89f2c77e90bac63b507e5027b649e3d8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6346 Tested-by: BuildkiteCI Reviewed-by: sterni --- tvix/eval/src/value/thunk.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'tvix/eval/src/value') diff --git a/tvix/eval/src/value/thunk.rs b/tvix/eval/src/value/thunk.rs index 15179388dc86..57c38e089460 100644 --- a/tvix/eval/src/value/thunk.rs +++ b/tvix/eval/src/value/thunk.rs @@ -27,13 +27,10 @@ use super::Lambda; /// Internal representation of the different states of a thunk. #[derive(Debug)] enum ThunkRepr { - /// Thunk is suspended and awaiting execution. - Suspended { lambda: Lambda }, - /// Thunk is closed over some values, suspended and awaiting /// execution. - ClosedSuspended { - lambda: Lambda, + Suspended { + lambda: Rc, upvalues: Vec, }, @@ -49,7 +46,10 @@ enum ThunkRepr { pub struct Thunk(Rc>); impl Thunk { - pub fn new(lambda: Lambda) -> Self { - Thunk(Rc::new(RefCell::new(ThunkRepr::Suspended { lambda }))) + pub fn new(lambda: Rc) -> Self { + Thunk(Rc::new(RefCell::new(ThunkRepr::Suspended { + lambda, + upvalues: vec![], + }))) } } -- cgit 1.4.1