[−][src]Struct wasmer_clif_fork_wasm::FuncTranslator
WebAssembly to Cranelift IR function translator.
A FuncTranslator
is used to translate a binary WebAssembly function into Cranelift IR guided
by a FuncEnvironment
object. A single translator instance can be reused to translate multiple
functions which will reduce heap allocation traffic.
Fields
func_ctx: FunctionBuilderContext
Func ctx
state: TranslationState
Translation state
Methods
impl FuncTranslator
[src]
pub fn new() -> Self
[src]
Create a new translator.
pub fn translate<FE: FuncEnvironment + ?Sized>(
&mut self,
code: &[u8],
code_offset: usize,
func: &mut Function,
environ: &mut FE
) -> WasmResult<()>
[src]
&mut self,
code: &[u8],
code_offset: usize,
func: &mut Function,
environ: &mut FE
) -> WasmResult<()>
Translate a binary WebAssembly function.
The code
slice contains the binary WebAssembly function code as it appears in the code
section of a WebAssembly module, not including the initial size of the function code. The
slice is expected to contain two parts:
- The declaration of locals, and
- The function body as an expression.
See the WebAssembly specification.
The Cranelift IR function func
should be completely empty except for the func.signature
and func.name
fields. The signature may contain special-purpose arguments which are not
regarded as WebAssembly local variables. Any signature arguments marked as
ArgumentPurpose::Normal
are made accessible as WebAssembly local variables.
pub fn translate_from_reader<FE: FuncEnvironment + ?Sized>(
&mut self,
reader: BinaryReader,
func: &mut Function,
environ: &mut FE
) -> WasmResult<()>
[src]
&mut self,
reader: BinaryReader,
func: &mut Function,
environ: &mut FE
) -> WasmResult<()>
Translate a binary WebAssembly function from a BinaryReader
.
Auto Trait Implementations
impl Send for FuncTranslator
impl Sync for FuncTranslator
impl Unpin for FuncTranslator
impl RefUnwindSafe for FuncTranslator
impl UnwindSafe for FuncTranslator
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,