Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

fix(brillig): Stop on VM failure #163

Merged
merged 1 commit into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion brillig_bytecode/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl VM {

/// Loop over the bytecode and update the program counter
pub fn process_opcodes(mut self) -> Registers {
while self.process_opcode() != VMStatus::Halted {}
while !matches!(self.process_opcode(), VMStatus::Halted | VMStatus::Failure) {}
self.finish()
}
// Process a single opcode and modify the program counter
Expand Down
2 changes: 1 addition & 1 deletion brillig_bytecode/src/opcodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub enum Opcode {
source: RegisterMemIndex,
},
/// Used if execution fails during evaluation
Trap
Trap,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
Expand Down