pub struct FuncTranslator { /* private fields */ }Expand description
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.
Implementations§
Source§impl FuncTranslator
impl FuncTranslator
Sourcepub fn context(&mut self) -> &mut FunctionBuilderContext
pub fn context(&mut self) -> &mut FunctionBuilderContext
Returns the underlying FunctionBuilderContext that this translator
uses.
Sourcepub fn translate_body<FE: FuncEnvironment + ?Sized>(
&mut self,
validator: &mut FuncValidator<impl WasmModuleResources>,
body: FunctionBody<'_>,
func: &mut Function,
environ: &mut FE,
) -> WasmResult<()>
pub fn translate_body<FE: FuncEnvironment + ?Sized>( &mut self, validator: &mut FuncValidator<impl WasmModuleResources>, body: FunctionBody<'_>, func: &mut Function, environ: &mut FE, ) -> WasmResult<()>
Translate a binary WebAssembly function from a FunctionBody.
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.
Auto Trait Implementations§
impl Freeze for FuncTranslator
impl RefUnwindSafe for FuncTranslator
impl Send for FuncTranslator
impl Sync for FuncTranslator
impl Unpin for FuncTranslator
impl UnwindSafe for FuncTranslator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more