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

Commit

Permalink
fix to stop VM on Trap opcode (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
vezenovm authored Mar 28, 2023
1 parent cb70b7d commit 59eb20a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion brillig_bytecode/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,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

0 comments on commit 59eb20a

Please sign in to comment.