Enum ketos::bytecode::Instruction [] [src]

pub enum Instruction {
    Load(u32),
    LoadC(u32),
    UnboundToUnit(u32),
    GetDef(u32),
    Push,
    Unit,
    True,
    False,
    Const(u32),
    Store(u32),
    LoadPush(u32),
    LoadCPush(u32),
    GetDefPush(u32),
    UnitPush,
    TruePush,
    FalsePush,
    ConstPush(u32),
    SetDef(u32),
    List(u32),
    Quote(u32),
    Quasiquote(u32),
    Comma(u32),
    CommaAt(u32),
    BuildClosure(u32u32),
    Jump(u32),
    JumpIf(u32),
    JumpIfBound(u32u32),
    JumpIfNot(u32),
    JumpIfNull(u32),
    JumpIfNotNull(u32),
    JumpIfEq(u32),
    JumpIfNotEq(u32),
    JumpIfEqConst(u32u32),
    JumpIfNotEqConst(u32u32),
    Null,
    NotNull,
    Eq,
    NotEq,
    EqConst(u32),
    NotEqConst(u32),
    Not,
    Inc,
    Dec,
    Append,
    First,
    Tail,
    Init,
    Last,
    FirstPush,
    TailPush,
    InitPush,
    LastPush,
    CallSys(u32),
    CallSysArgs(u32u32),
    CallConst(u32u32),
    Call(u32),
    Apply(u32),
    ApplyConst(u32u32),
    ApplySelf(u32),
    TailApplySelf(u32),
    CallSelf(u32),
    TailCallSelf(u32),
    Skip(u32),
    Return,
}

Represents an instruction and any immediate parameters.

Any addition, deletion, or modification to this enum constitutes a breaking change to the bytecode format.

Variants

Load a value from the stack

Load a value from enclosed values

If value n on the stack is Unbound, replace it with ().

Load a named value from global scope

Push a value onto the stack; value is invalidated.

Load () into value

Load true into value

Load false into value

Load a const into value

Store a value in the stack; value is invalidated.

Load, then push

Load enclosed value, then push

Load a name from global scope, then push

Load (), then push

Load true, then push

Load false, then push

Load a const, then push

Assign a value to a name into global scope

Build a list of n values from the stack

Transform value into an n-quoted value

Transform value into an n-quasiquoted value

Transform value into an n-comma'd value

Transform value into an n-comma-at'd value

Create a closure from code object in n_const and a list of n_values values on the stack; parameters are (n_const, n_values).

Jump to a label

Jump if value is true

Jump if value n from the stack is bound; parameters are (label, n)

Jump if value is false

Jump if value is ()

Jump if value is not ()

Jump if value is equal to top of stack

Jump if value is not equal to top of stack

Jump if value is equal to const; parameters are (label, n)

Jump if value is not equal to const; parameters are (label, n)

Test whether value is ()

Test whether value is not ()

Pops from the top of the stack and tests for equality with value.

Pops from the top of the stack and tesst for inequality with value.

Tests value for equality with const n

Tests value for inequality with const n

Negate boolean value

Increment integer value

Decrement integer value

Append value to list on top of stack; result will be in value

Take first element of list or string and assign to value

Take tail of list or string and assign to value

Take head of list or string and assign to value

Take last element of list or string and assign to value

Push first value from list or string

Push tail from list or string

Push head from list or string

Push last value from list or string

Call system function n with known number of arguments on stack. Only functions with Exact arity may be called in this manner.

Call system function with n arguments on the stack; parameters are (sys_fn, n_args).

Call const function with arguments on the stack; parameters are (const, n_args).

Call function on the stack with n arguments from the top of the stack

Call function on the stack with n stack arguments, plus additional arguments from list value

Call const function with n stack arguments, plus additional arguments from list value; parameters are (const, n_args).

Call current code object with n stack arguments, plus additional arguments from list value; does not perform a tail call

Call current code object with n stack arguments, plus additional arguments from list value

Call current code object with n arguments from the top of the stack; this does not perform a tail call

Perform tail-recursive call with n arguments from the top of the stack

Remove n values from the top of the stack

Return value from function

Methods

impl Instruction
[src]

Decodes a single Instruction from a CodeReader.

Encodes a single Instruction into a CodeBlock.

Returns whether the Instruction is trivial; that is, in valid top-level code, it does not produce any side effects.

If the instruction is a jump instruction, returns the jump offset. Otherwise, returns None.

Returns the maximum length, in bytes, of an encoded instruction.

Trait Implementations

impl Copy for Instruction
[src]

impl Clone for Instruction
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for Instruction
[src]

Formats the value using the given formatter.

impl Eq for Instruction
[src]

impl PartialEq for Instruction
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.