Enum aluvm::isa::ControlFlowOp
source · pub enum ControlFlowOp {
Fail,
Succ,
Jmp(u16),
Jif(u16),
Routine(u16),
Call(LibSite),
Exec(LibSite),
Ret,
}
Expand description
Control-flow instructions
Variants§
Fail
Completes program execution writing false
to st0
(indicating program failure). Does not
modify value of call stack registers.
Succ
Completes program execution writing true
to st0
(indicating program success). Does not
modify value of call stack registers.
Jmp(u16)
Unconditionally jumps to an offset. Increments cy0
.
Jif(u16)
Jumps to an offset if st0
== true, otherwise does nothing. Increments cy0
.
Routine(u16)
Jumps to other location in the current code with ability to return back (calls a
subroutine). Increments cy0
and pushes offset of the instruction which follows current
one to cs0
.
Call(LibSite)
Calls code from an external library identified by the hash of its code. Increments cy0
and cp0
and pushes offset of the instruction which follows current one to cs0
.
Exec(LibSite)
Passes execution to other library without an option to return. Does not increment cy0
and
cp0
counters and does not add anything to the call stack cs0
.
Ret
Returns execution flow to the previous location from the top of cs0
. Does not change the
value in cy0
. Decrements cp0
.
Trait Implementations§
source§impl Bytecode for ControlFlowOp
impl Bytecode for ControlFlowOp
source§fn call_site(&self) -> Option<LibSite>
fn call_site(&self) -> Option<LibSite>
source§fn byte_count(&self) -> u16
fn byte_count(&self) -> u16
source§fn instr_range() -> RangeInclusive<u8>
fn instr_range() -> RangeInclusive<u8>
source§fn instr_byte(&self) -> u8
fn instr_byte(&self) -> u8
source§fn encode_args<W>(&self, writer: &mut W) -> Result<(), BytecodeError>where
W: Write,
fn encode_args<W>(&self, writer: &mut W) -> Result<(), BytecodeError>where
W: Write,
source§impl Clone for ControlFlowOp
impl Clone for ControlFlowOp
source§fn clone(&self) -> ControlFlowOp
fn clone(&self) -> ControlFlowOp
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ControlFlowOp
impl Debug for ControlFlowOp
source§impl Display for ControlFlowOp
impl Display for ControlFlowOp
source§impl Hash for ControlFlowOp
impl Hash for ControlFlowOp
source§impl InstructionSet for ControlFlowOp
impl InstructionSet for ControlFlowOp
source§fn isa_ids() -> BTreeSet<&'static str>
fn isa_ids() -> BTreeSet<&'static str>
source§fn complexity(&self) -> u64
fn complexity(&self) -> u64
source§fn exec(&self, regs: &mut CoreRegs, site: LibSite) -> ExecStep
fn exec(&self, regs: &mut CoreRegs, site: LibSite) -> ExecStep
source§fn isa_string() -> String
fn isa_string() -> String
source§fn isa_id() -> Box<[u8]>
fn isa_id() -> Box<[u8]>
source§fn is_supported(id: &str) -> bool
fn is_supported(id: &str) -> bool
source§impl Ord for ControlFlowOp
impl Ord for ControlFlowOp
source§fn cmp(&self, other: &ControlFlowOp) -> Ordering
fn cmp(&self, other: &ControlFlowOp) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<ControlFlowOp> for ControlFlowOp
impl PartialEq<ControlFlowOp> for ControlFlowOp
source§fn eq(&self, other: &ControlFlowOp) -> bool
fn eq(&self, other: &ControlFlowOp) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<ControlFlowOp> for ControlFlowOp
impl PartialOrd<ControlFlowOp> for ControlFlowOp
source§fn partial_cmp(&self, other: &ControlFlowOp) -> Option<Ordering>
fn partial_cmp(&self, other: &ControlFlowOp) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more