pr 04
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
// Re-export canonical decoder from prometeu-bytecode to eliminate bespoke implementation in VM.
|
||||
pub use prometeu_bytecode::decoder::{decode_next, DecodeError, DecodedInstr};
|
||||
|
||||
/// Backwards-compatible shim for legacy call sites; delegates to canonical decoder.
|
||||
#[inline]
|
||||
pub fn decode_at(rom: &[u8], pc: usize) -> Result<DecodedInstr<'_>, DecodeError> {
|
||||
decode_next(pc, rom)
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
pub mod decoder;
|
||||
@@ -2,8 +2,6 @@ mod virtual_machine;
|
||||
mod call_frame;
|
||||
mod scope_frame;
|
||||
pub mod local_addressing;
|
||||
pub mod opcode_spec;
|
||||
pub mod bytecode;
|
||||
pub mod verifier;
|
||||
|
||||
pub use prometeu_abi::virtual_machine::program::ProgramImage;
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
// Canonical `OpcodeSpec` now lives in `prometeu-bytecode`.
|
||||
// Keep this module as a thin re-export for compatibility.
|
||||
pub use prometeu_bytecode::opcode_spec::*;
|
||||
@@ -1,5 +1,5 @@
|
||||
use prometeu_abi::syscalls::Syscall;
|
||||
use crate::bytecode::decoder::{decode_at, DecodeError};
|
||||
use prometeu_bytecode::decoder::{decode_next, DecodeError};
|
||||
use prometeu_bytecode::opcode::OpCode;
|
||||
use prometeu_bytecode::opcode_spec::OpCodeSpecExt;
|
||||
use prometeu_bytecode::FunctionMeta;
|
||||
@@ -62,7 +62,7 @@ impl Verifier {
|
||||
let mut pc = 0;
|
||||
while pc < func_code.len() {
|
||||
valid_pc.insert(pc);
|
||||
let instr = decode_at(func_code, pc).map_err(|e| match e {
|
||||
let instr = decode_next(pc, func_code).map_err(|e| match e {
|
||||
DecodeError::UnknownOpcode { pc: _, opcode } =>
|
||||
VerifierError::UnknownOpcode { pc: func_start + pc, opcode },
|
||||
DecodeError::TruncatedOpcode { pc: _ } =>
|
||||
@@ -89,7 +89,7 @@ impl Verifier {
|
||||
|
||||
while let Some(pc) = worklist.pop_front() {
|
||||
let in_height = *stack_height_in.get(&pc).unwrap();
|
||||
let instr = decode_at(func_code, pc).unwrap(); // Guaranteed to succeed due to first pass
|
||||
let instr = decode_next(pc, func_code).unwrap(); // Guaranteed to succeed due to first pass
|
||||
let spec = instr.opcode.spec();
|
||||
|
||||
// Resolve dynamic pops/pushes
|
||||
|
||||
@@ -366,7 +366,7 @@ impl VirtualMachine {
|
||||
let start_pc = self.pc;
|
||||
|
||||
// Fetch & Decode
|
||||
let instr = crate::bytecode::decoder::decode_at(&self.program.rom, self.pc)
|
||||
let instr = prometeu_bytecode::decoder::decode_next(self.pc, &self.program.rom)
|
||||
.map_err(|e| LogicalFrameEndingReason::Panic(format!("{:?}", e)))?;
|
||||
|
||||
let opcode = instr.opcode;
|
||||
|
||||
Reference in New Issue
Block a user