pub struct Interpreter<'a> { /* private fields */ }Expand description
The Cranelift interpreter; this contains some high-level functions to control the interpreter’s flow. The interpreter state is defined separately (see InterpreterState) as the execution semantics for each Cranelift instruction (see step).
Implementations§
Source§impl<'a> Interpreter<'a>
impl<'a> Interpreter<'a>
pub fn new(state: InterpreterState<'a>) -> Self
Sourcepub fn with_fuel(self, fuel: Option<u64>) -> Self
pub fn with_fuel(self, fuel: Option<u64>) -> Self
The fuel mechanism sets a number of instructions that
the interpreter can execute before stopping. If this
value is None (the default), no limit is imposed.
Sourcepub fn call_by_name(
&mut self,
func_name: &str,
arguments: &[DataValue],
) -> Result<ControlFlow<'a>, InterpreterError>
pub fn call_by_name( &mut self, func_name: &str, arguments: &[DataValue], ) -> Result<ControlFlow<'a>, InterpreterError>
Call a function by name; this is a helpful proxy for Interpreter::call_by_index.
Sourcepub fn call_by_index(
&mut self,
index: FuncIndex,
arguments: &[DataValue],
) -> Result<ControlFlow<'a>, InterpreterError>
pub fn call_by_index( &mut self, index: FuncIndex, arguments: &[DataValue], ) -> Result<ControlFlow<'a>, InterpreterError>
Call a function by its index in the FunctionStore; this is a proxy for
Interpreter::call.