[−][src]Module wascap_guest::guestmem
Guest module memory management
Guest modules need a way to hold onto memory locations long enough for them to make calls into the host module and vise versa. This is accomplished by sticking pointers onto a stack and then passing numeric references to that stack out of the guest module.
This pattern is borrowed from and inspired by the work done by wasm-bindgen. That library uses code generation to make strongly-typed, Rust-idiomatic calls invoke corresponding generated JavaScript code. Since we don't need to be able to generate an infinite combination of method signatures, we only need to be able to facilitate a single type of host call, we've just borrowed the stack manipulation code from wasm-bindgen and not the code generator (which is somewhat coupled to a JavaScript host at any rate).
Structs
GlobalStack | A struct implementing the simple stack trait |
Constants
GLOBAL_STACK_CAP |
Traits
Stack | Simple stack trait |
Functions
__wascap_free⚠ | Frees guest module memory |
__wascap_global_argument_ptr⚠ | A reference to the current global argument pointer |
__wascap_malloc | Allocates memory |
__wascap_realloc | Re-allocates memory |