about summary refs log tree commit diff
path: root/tvix/eval/src/chunk.rs
diff options
context:
space:
mode:
authorGriffin Smith <root@gws.fyi>2022-10-10T23·37-0400
committergrfn <grfn@gws.fyi>2022-10-11T00·08+0000
commit4a058a9c00d772c22a4ddbe256e8a95c19bfaacb (patch)
tree3f492be8c7c989d1b074c443658762324841255f /tvix/eval/src/chunk.rs
parent76e0c37b9eb9e2ddf6cedbbf0b5a1d2a603de0c4 (diff)
fix(tvix/eval): Pop frames even if running op fails r/5100
Previously, the VM assumed that if an error was returned from `run()`,
the evaluation was "finished" and the state of the VM didn't matter.
This used to be a reasonable assumption, but now that we've got
`tryEval` around we need to actually make sure that we clean up after
ourselves if we're about to return an error. Specifically, if the *last*
instruction in an evaluation frame returns an error, we previously
wouldn't pop that evaluation frame, which could cause all sorts of
bizarre errors based on what happened to be in the stack at the time.

This commit splits out a `run_op` method from `VM::run`, and uses that
to check the evaluation frame return condition even if the op we're
running is about to return an error, and pop the evaluation frame if
we're at the last instruction.

Change-Id: Ib40649d8915ee1571153cb71e3d76492542fc3d7
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6940
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Diffstat (limited to 'tvix/eval/src/chunk.rs')
0 files changed, 0 insertions, 0 deletions