diff --git a/crates/prometeu-bytecode/src/opcode_spec.rs b/crates/prometeu-bytecode/src/opcode_spec.rs index 5f302c7d..81f595ff 100644 --- a/crates/prometeu-bytecode/src/opcode_spec.rs +++ b/crates/prometeu-bytecode/src/opcode_spec.rs @@ -105,8 +105,6 @@ mod tests { spec.is_terminator, spec.may_trap, ); - // imm_bytes must be defined (0 is valid) - assert!(spec.imm_bytes >= 0, "imm_bytes must be defined for {op:?}"); count += 1; } } diff --git a/crates/prometeu-vm/src/virtual_machine.rs b/crates/prometeu-vm/src/virtual_machine.rs index 8958f05d..5b7138b1 100644 --- a/crates/prometeu-vm/src/virtual_machine.rs +++ b/crates/prometeu-vm/src/virtual_machine.rs @@ -950,28 +950,28 @@ impl VirtualMachine { Ok(entry) } - /// Resolves a `GateId` to a mutable reference to its `GateEntry` or returns a trap reason. - fn resolve_gate_mut(&mut self, gate_id: GateId, opcode: u16, pc: u32) -> Result<&mut GateEntry, LogicalFrameEndingReason> { - let idx = gate_id as usize; - if idx >= self.gate_pool.len() { - return Err(self.trap( - TRAP_INVALID_GATE, - opcode, - format!("Invalid gate id: {}", gate_id), - pc, - )); - } - if !self.gate_pool[idx].alive { - return Err(self.trap( - TRAP_DEAD_GATE, - opcode, - format!("Dead gate id: {}", gate_id), - pc, - )); - } - // This borrow is safe because we validated bounds and liveness without using closures. - Ok(&mut self.gate_pool[idx]) - } + // /// Resolves a `GateId` to a mutable reference to its `GateEntry` or returns a trap reason. + // fn resolve_gate_mut(&mut self, gate_id: GateId, opcode: u16, pc: u32) -> Result<&mut GateEntry, LogicalFrameEndingReason> { + // let idx = gate_id as usize; + // if idx >= self.gate_pool.len() { + // return Err(self.trap( + // TRAP_INVALID_GATE, + // opcode, + // format!("Invalid gate id: {}", gate_id), + // pc, + // )); + // } + // if !self.gate_pool[idx].alive { + // return Err(self.trap( + // TRAP_DEAD_GATE, + // opcode, + // format!("Dead gate id: {}", gate_id), + // pc, + // )); + // } + // // This borrow is safe because we validated bounds and liveness without using closures. + // Ok(&mut self.gate_pool[idx]) + // } pub fn trap(&self, code: u32, opcode: u16, message: String, pc: u32) -> LogicalFrameEndingReason { LogicalFrameEndingReason::Trap(self.program.create_trap(code, opcode, message, pc))