Module wasmer_vm::libcalls [−][src]
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 leakingInstanceHandle
s 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); } }
Enums
LibCall | The name of a runtime library routine. |
Statics
wasmer_vm_probestack | Probestack check |
Functions
wasmer_vm_data_drop⚠ | Implementation of |
wasmer_vm_elem_drop⚠ | Implementation of |
wasmer_vm_externref_dec⚠ | Implementation of externref decrement |
wasmer_vm_externref_inc⚠ | Implementation of externref increment |
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 |
wasmer_vm_imported_memory32_copy⚠ | Implementation of |
wasmer_vm_imported_memory32_fill⚠ | Implementation of |
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 |
wasmer_vm_imported_table_grow⚠ | Implementation of |
wasmer_vm_imported_table_set⚠ | Implementation of |
wasmer_vm_imported_table_size⚠ | Implementation of |
wasmer_vm_memory32_copy⚠ | Implementation of |
wasmer_vm_memory32_fill⚠ | Implementation of |
wasmer_vm_memory32_grow⚠ | Implementation of memory.grow for locally-defined 32-bit memories. |
wasmer_vm_memory32_init⚠ | Implementation of |
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_table_copy⚠ | Implementation of |
wasmer_vm_table_fill⚠ | Implementation of |
wasmer_vm_table_get⚠ | Implementation of |
wasmer_vm_table_grow⚠ | Implementation of |
wasmer_vm_table_init⚠ | Implementation of |
wasmer_vm_table_set⚠ | Implementation of |
wasmer_vm_table_size⚠ | Implementation of |