refactor(tvix/eval): avoid unnecessary pop/push in OpForce

Change-Id: Ic7559eaa43aa0dcc97babb7669770c0f7f959f1b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7754
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
Vincent Ambo 2023-01-04 18:41:44 +03:00 committed by clbot
parent 9b8ba915c8
commit 0c17718dd1

View file

@ -1003,14 +1003,9 @@ impl<'o> VM<'o> {
}
OpCode::OpForce => {
let value = self.pop();
if let Value::Thunk(thunk) = value {
self.push(Value::Thunk(thunk));
if let Some(Value::Thunk(_)) = self.stack.last() {
let trampoline = fallible!(self, Thunk::force_trampoline(self));
return Ok(trampoline);
} else {
self.push(value);
}
}