[][src]Struct wasmer_clif_fork_wasm::TranslationState

pub struct TranslationState {
    pub stack: Vec<Value>,
    pub control_stack: Vec<ControlStackFrame>,
    pub reachable: bool,
    // some fields omitted
}

Contains information passed along during the translation and that records:

  • The current value and control stacks.
  • The depth of the two unreachable control blocks stacks, that are manipulated when translating unreachable code;

Fields

stack: Vec<Value>

Stack

control_stack: Vec<ControlStackFrame>

Control stack

reachable: bool

Reachability

Methods

impl TranslationState[src]

pub fn new() -> Self[src]

New TranslationState

pub fn initialize(&mut self, sig: &Signature, exit_block: Ebb)[src]

Initialize the state for compiling a function with the given signature.

This resets the state to containing only a single block representing the whole function. The exit block is the last block in the function which will contain the return instruction.

pub fn push1(&mut self, val: Value)[src]

Push a value.

pub fn pushn(&mut self, vals: &[Value])[src]

Push multiple values.

pub fn pop1(&mut self) -> Value[src]

Pop one value.

pub fn peek1(&self) -> Value[src]

Peek at the top of the stack without popping it.

pub fn pop2(&mut self) -> (Value, Value)[src]

Pop two values. Return them in the order they were pushed.

pub fn pop3(&mut self) -> (Value, Value, Value)[src]

Pop three values. Return them in the order they were pushed.

pub fn popn(&mut self, n: usize)[src]

Pop the top n values on the stack.

The popped values are not returned. Use peekn to look at them before popping.

pub fn peekn(&self, n: usize) -> &[Value][src]

Peek at the top n values on the stack in the order they were pushed.

pub fn push_block(&mut self, following_code: Ebb, num_result_types: usize)[src]

Push a block on the control stack.

pub fn push_loop(
    &mut self,
    header: Ebb,
    following_code: Ebb,
    num_result_types: usize
)
[src]

Push a loop on the control stack.

pub fn push_if(
    &mut self,
    branch_inst: Inst,
    following_code: Ebb,
    num_result_types: usize
)
[src]

Push an if on the control stack.

impl TranslationState[src]

Methods for handling entity references.

pub fn get_global<FE: FuncEnvironment + ?Sized>(
    &mut self,
    func: &mut Function,
    index: u32,
    environ: &mut FE
) -> WasmResult<GlobalVariable>
[src]

Get the GlobalVariable reference that should be used to access the global variable index. Create the reference if necessary. Also return the WebAssembly type of the global.

pub fn get_heap<FE: FuncEnvironment + ?Sized>(
    &mut self,
    func: &mut Function,
    index: u32,
    environ: &mut FE
) -> WasmResult<Heap>
[src]

Get the Heap reference that should be used to access linear memory index. Create the reference if necessary.

pub fn get_table<FE: FuncEnvironment + ?Sized>(
    &mut self,
    func: &mut Function,
    index: u32,
    environ: &mut FE
) -> WasmResult<Table>
[src]

Get the Table reference that should be used to access table index. Create the reference if necessary.

pub fn get_indirect_sig<FE: FuncEnvironment + ?Sized>(
    &mut self,
    func: &mut Function,
    index: u32,
    environ: &mut FE
) -> WasmResult<(SigRef, usize)>
[src]

Get the SigRef reference that should be used to make an indirect call with signature index. Also return the number of WebAssembly arguments in the signature.

Create the signature if necessary.

pub fn get_direct_func<FE: FuncEnvironment + ?Sized>(
    &mut self,
    func: &mut Function,
    index: u32,
    environ: &mut FE
) -> WasmResult<(FuncRef, usize)>
[src]

Get the FuncRef reference that should be used to make a direct call to function index. Also return the number of WebAssembly arguments in the signature.

Create the function reference if necessary.

Auto Trait Implementations

Blanket Implementations

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]