feat(tvix/eval): nonrecursive deep_force()

This commit implements deep_force() nonrecursively, by maintaining
an explicit stack rather than using the call stack for recursion.

As an added bonus, we don't need to pass around the SharedThunkSet
anymore, and can in fact completely eliminate SharedThunkSet.

Change-Id: I7c4f59f37834d451a28bf6be317eb0a90eac4ee6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10252
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: Adam Joseph <adam@westernsemico.com>
This commit is contained in:
Adam Joseph 2023-12-11 01:04:04 -08:00 committed by clbot
parent c956138ee6
commit 3701379745
5 changed files with 83 additions and 81 deletions

View file

@ -432,14 +432,3 @@ impl ThunkSet {
self.0.insert(ptr)
}
}
#[derive(Default, Clone)]
pub struct SharedThunkSet(Rc<RefCell<ThunkSet>>);
impl SharedThunkSet {
/// Check whether the given thunk has already been seen. Will mark the thunk
/// as seen otherwise.
pub fn insert(&self, thunk: &Thunk) -> bool {
self.0.borrow_mut().insert(thunk)
}
}