pub struct PvmProgram {
pub code: Vec<u8>,
pub bitmask: Vec<u8>,
pub jump_table: Vec<u32>,
pub mem_cycles: u8,
}Expand description
PVM program for execution.
codeis the raw byte-encoded PVM bytecode (JAM Gray Paper Appendix A.5).bitmaskis the unpacked form (one byte per code position);bitmask[i] == 1iff a PVM instruction starts atcode[i]. Packed bitmasks (1 bit per byte) live only in the serialized blob format upstream; by the time the program reaches this layer the upstream parser has unpacked them.jump_table[i]is the target byte offset withincodefor a branch / jump whose immediate decodes toi.mem_cyclesis the L/S latency tier (seecompute_mem_cycles).
Fields§
§code: Vec<u8>§bitmask: Vec<u8>§jump_table: Vec<u32>§mem_cycles: u8Implementations§
Source§impl PvmProgram
impl PvmProgram
Sourcepub fn new(
code: Vec<u8>,
bitmask: Vec<u8>,
jump_table: Vec<u32>,
mem_cycles: u8,
) -> Result<Self, ProgramError>
pub fn new( code: Vec<u8>, bitmask: Vec<u8>, jump_table: Vec<u32>, mem_cycles: u8, ) -> Result<Self, ProgramError>
Construct with validation: bitmask.len() must equal
code.len().
Sourcepub fn is_insn_start(&self, pc: u32) -> bool
pub fn is_insn_start(&self, pc: u32) -> bool
true iff a PVM instruction starts at byte offset pc in
code. False if pc is out of range.
Trait Implementations§
Source§impl Clone for PvmProgram
impl Clone for PvmProgram
Source§fn clone(&self) -> PvmProgram
fn clone(&self) -> PvmProgram
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PvmProgram
impl Debug for PvmProgram
Source§impl PartialEq for PvmProgram
impl PartialEq for PvmProgram
impl Eq for PvmProgram
impl StructuralPartialEq for PvmProgram
Auto Trait Implementations§
impl Freeze for PvmProgram
impl RefUnwindSafe for PvmProgram
impl Send for PvmProgram
impl Sync for PvmProgram
impl Unpin for PvmProgram
impl UnsafeUnpin for PvmProgram
impl UnwindSafe for PvmProgram
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more