Trait cton_wasm::ModuleEnvironment [] [src]

pub trait ModuleEnvironment<'data> {
    fn get_func_name(&self, func_index: FunctionIndex) -> ExternalName;
fn declare_signature(&mut self, sig: &Signature);
fn get_signature(&self, sig_index: SignatureIndex) -> &Signature;
fn declare_func_import(
        &mut self,
        sig_index: SignatureIndex,
        module: &'data str,
        field: &'data str
    );
fn get_num_func_imports(&self) -> usize;
fn declare_func_type(&mut self, sig_index: SignatureIndex);
fn get_func_type(&self, func_index: FunctionIndex) -> SignatureIndex;
fn declare_global(&mut self, global: Global);
fn get_global(&self, global_index: GlobalIndex) -> &Global;
fn declare_table(&mut self, table: Table);
fn declare_table_elements(
        &mut self,
        table_index: TableIndex,
        base: Option<GlobalIndex>,
        offset: usize,
        elements: Vec<FunctionIndex>
    );
fn declare_memory(&mut self, memory: Memory);
fn declare_data_initialization(
        &mut self,
        memory_index: MemoryIndex,
        base: Option<GlobalIndex>,
        offset: usize,
        data: &'data [u8]
    );
fn declare_func_export(
        &mut self,
        func_index: FunctionIndex,
        name: &'data str
    );
fn declare_table_export(
        &mut self,
        table_index: TableIndex,
        name: &'data str
    );
fn declare_memory_export(
        &mut self,
        memory_index: MemoryIndex,
        name: &'data str
    );
fn declare_global_export(
        &mut self,
        global_index: GlobalIndex,
        name: &'data str
    );
fn declare_start_func(&mut self, index: FunctionIndex);
fn define_function_body(
        &mut self,
        body_bytes: &'data [u8]
    ) -> Result<(), String>; }

An object satisfying the ModuleEnvironment trait can be passed as argument to the translate_module function. These methods should not be called by the user, they are only for cretonne-wasm internal use.

Required Methods

Return the name for the given function index.

Declares a function signature to the environment.

Return the signature with the given index.

Declares a function import to the environment.

Return the number of imported funcs.

Declares the type (signature) of a local function in the module.

Return the signature index for the given function index.

Declares a global to the environment.

Return the global for the given global index.

Declares a table to the environment.

Fills a declared table with references to functions in the module.

Declares a memory to the environment

Fills a declared memory with bytes at module instantiation.

Declares a function export to the environment.

Declares a table export to the environment.

Declares a memory export to the environment.

Declares a global export to the environment.

Declares a start function.

Provides the contents of a function body.

Implementors