Skip to main content

WasmABI

Struct WasmABI 

Source
pub struct WasmABI { /* private fields */ }
Expand description

Platform-specific ABI utilities for WASM code generation.

Implementations§

Source§

impl WasmABI

Source

pub fn new(target_os: TargetOperatingSystem) -> Self

Creates a new ABI instance for the specified target OS.

Source

pub fn mangle_function_name(&self, name: &str) -> String

Get the WASM function name (currently just the original name). WASM doesn’t require name mangling, but this method exists for consistency with other backends and future extensibility.

Source

pub fn get_runtime_imports(&self) -> &'static [(&'static str, &'static str)]

Helpers the backend calls but emits no body for, each paired with the symbol a call site names. A module that calls none of them imports none, so it needs no host beyond what its own code asks for.

Source

pub fn get_wasm_type(&self, ty: &MirType) -> &'static str

Get the WASM type for MIR types (currently only i64).

Source

pub fn generate_local_decl(&self, index: usize) -> String

Generate WASM local variable declaration.

Trait Implementations§

Source§

impl Abi for WasmABI

Source§

fn target_os(&self) -> TargetOperatingSystem

Returns the target operating system for this ABI instance.
Source§

fn mangle_function_name(&self, name: &str) -> String

Returns the mangled function name with platform-specific prefix. Read more
Source§

fn builtin_library(&self) -> BuiltinLibrary

Source§

fn call_stub(&self, name: &str) -> Option<String>

Maps well-known intrinsic/runtime names to platform symbol stubs. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.