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§
- Archived
LibCall - An archived
LibCall
- LibCall
- The name of a runtime library routine.
- LibCall
Resolver - The resolver for an archived
LibCall
Statics§
- wasmer_
vm_ probestack - Probestack check
Functions§
- wasmer_
vm_ ⚠data_ drop - Implementation of
data.drop
. - wasmer_
vm_ ⚠elem_ drop - Implementation of
elem.drop
. - 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
func.ref
. - 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_ 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_ ⚠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
.