Module libcalls

Module libcalls 

Source
Expand description

Runtime library calls.

Note that Wasm compilers may sometimes perform these inline rather than calling them, particularly when CPUs have special instructions which compute them directly.

These functions are called by compiled Wasm code, and therefore must take certain care about some things:

  • They must always be pub extern "C" and should only contain basic, raw i32/i64/f32/f64/pointer parameters that are safe to pass across the system ABI!

  • If any nested function propagates an Err(trap) out to the library function frame, we need to raise it. This involves some nasty and quite unsafe code under the covers! Notable, after raising the trap, drops will not be run for local variables! This can lead to things like leaking VMInstances which leads to never deallocating JIT code, instances, and modules! Therefore, always use nested blocks to ensure drops run before raising a trap:

    β“˜
    pub extern "C" fn my_lib_function(...) {
        let result = {
            // Do everything in here so drops run at the end of the block.
            ...
        };
        if let Err(trap) = result {
            // Now we can safely raise the trap without leaking!
            raise_lib_trap(trap);
        }
    }

ModulesΒ§

eh πŸ”’

EnumsΒ§

LibCall
The name of a runtime library routine.

StaticsΒ§

WASMER_VM_PROBESTACK
Probestack check

FunctionsΒ§

__adddf3 πŸ”’ ⚠
__addsf3 πŸ”’ ⚠
__divdf3 πŸ”’ ⚠
__divsf3 πŸ”’ ⚠
__eqdf2 πŸ”’ ⚠
__eqsf2 πŸ”’ ⚠
__extendsfdf2 πŸ”’ ⚠
__fixdfdi πŸ”’ ⚠
__fixdfsi πŸ”’ ⚠
__fixsfdi πŸ”’ ⚠
__fixsfsi πŸ”’ ⚠
__fixunsdfdi πŸ”’ ⚠
__fixunsdfsi πŸ”’ ⚠
__fixunssfdi πŸ”’ ⚠
__fixunssfsi πŸ”’ ⚠
__floatdidf πŸ”’ ⚠
__floatdisf πŸ”’ ⚠
__floatsidf πŸ”’ ⚠
__floatsisf πŸ”’ ⚠
__floatundidf πŸ”’ ⚠
__floatundisf πŸ”’ ⚠
__floatunsidf πŸ”’ ⚠
__floatunsisf πŸ”’ ⚠
__gedf2 πŸ”’ ⚠
__gesf2 πŸ”’ ⚠
__gtdf2 πŸ”’ ⚠
__gtsf2 πŸ”’ ⚠
__ledf2 πŸ”’ ⚠
__lesf2 πŸ”’ ⚠
__ltdf2 πŸ”’ ⚠
__ltsf2 πŸ”’ ⚠
__muldf3 πŸ”’ ⚠
__mulsf3 πŸ”’ ⚠
__nedf2 πŸ”’ ⚠
__negdf2 πŸ”’ ⚠
__negsf2 πŸ”’ ⚠
__nesf2 πŸ”’ ⚠
__subdf3 πŸ”’ ⚠
__subsf3 πŸ”’ ⚠
__truncdfsf2 πŸ”’ ⚠
__unorddf2 πŸ”’ ⚠
__unordsf2 πŸ”’ ⚠
function_pointer
The function pointer to a libcall
throw⚠
Safety
wasmer_eh_personality⚠
The implementation of Wasmer’s personality function.
wasmer_eh_personality2⚠
The second stage of the personality function. See module level documentation for an explanation of the exact procedure used during unwinding.
wasmer_vm_alloc_exception⚠
Implementation for allocating an exception. Returns the exnref, i.e. a handle to the exception within the store.
wasmer_vm_data_drop⚠
Implementation of data.drop.
wasmer_vm_dbg_str
(debug) Print a string.
wasmer_vm_dbg_usize
(debug) Print an usize.
wasmer_vm_elem_drop⚠
Implementation of elem.drop.
wasmer_vm_exception_into_exnref⚠
Given a pointer to a caught exception, return the exnref contained within.
wasmer_vm_f32_ceil
Implementation of f32.ceil
wasmer_vm_f32_floor
Implementation of f32.floor
wasmer_vm_f32_nearest
Implementation of f32.nearest
wasmer_vm_f32_trunc
Implementation of f32.trunc
wasmer_vm_f64_ceil
Implementation of f64.ceil
wasmer_vm_f64_floor
Implementation of f64.floor
wasmer_vm_f64_nearest
Implementation of f64.nearest
wasmer_vm_f64_trunc
Implementation of f64.trunc
wasmer_vm_func_ref⚠
Implementation of func.ref.
wasmer_vm_imported_memory32_atomic_notify⚠
Implementation of memory.notify for imported 32-bit memories.
wasmer_vm_imported_memory32_atomic_wait32⚠
Implementation of memory.wait32 for imported 32-bit memories.
wasmer_vm_imported_memory32_atomic_wait64⚠
Implementation of memory.wait64 for imported 32-bit memories.
wasmer_vm_imported_memory32_copy⚠
Implementation of memory.copy for imported memories.
wasmer_vm_imported_memory32_fill⚠
Implementation of memory.fill for imported memories.
wasmer_vm_imported_memory32_grow⚠
Implementation of memory.grow for imported 32-bit memories.
wasmer_vm_imported_memory32_size⚠
Implementation of memory.size for imported 32-bit memories.
wasmer_vm_imported_table_get⚠
Implementation of table.get for imported tables.
wasmer_vm_imported_table_grow⚠
Implementation of table.grow for imported tables.
wasmer_vm_imported_table_set⚠
Implementation of table.set for imported tables.
wasmer_vm_imported_table_size⚠
Implementation of table.size for imported tables.
wasmer_vm_memory32_atomic_notify⚠
Implementation of memory.notify for locally-defined 32-bit memories.
wasmer_vm_memory32_atomic_wait32⚠
Implementation of memory.wait32 for locally-defined 32-bit memories.
wasmer_vm_memory32_atomic_wait64⚠
Implementation of memory.wait64 for locally-defined 32-bit memories.
wasmer_vm_memory32_copy⚠
Implementation of memory.copy for locally defined memories.
wasmer_vm_memory32_fill⚠
Implementation of memory.fill for locally defined memories.
wasmer_vm_memory32_grow⚠
Implementation of memory.grow for locally-defined 32-bit memories.
wasmer_vm_memory32_init⚠
Implementation of memory.init.
wasmer_vm_memory32_size⚠
Implementation of memory.size for locally-defined 32-bit memories.
wasmer_vm_raise_trap⚠
Implementation for raising a trap
wasmer_vm_read_exnref
Given a VMContext and an exnref (handle to an exception within the store), returns a pointer to the payload buffer of the underlying VMExceptionObj.
wasmer_vm_table_copy⚠
Implementation of table.copy.
wasmer_vm_table_fill⚠
Implementation of table.fill.
wasmer_vm_table_get⚠
Implementation of table.get.
wasmer_vm_table_grow⚠
Implementation of table.grow for locally-defined tables.
wasmer_vm_table_init⚠
Implementation of table.init.
wasmer_vm_table_set⚠
Implementation of table.set.
wasmer_vm_table_size⚠
Implementation of table.size.
wasmer_vm_throw⚠
Implementation for throwing an exception.