|
Wasmtime
|
Owner of all WebAssembly objects. More...
#include <store.hh>
Data Structures | |
| class | Context |
An interior pointer into a Store. More... | |
Public Member Functions | |
| Store (Engine &engine) | |
Creates a new Store within the provided Engine. | |
| void | limiter (int64_t memory_size, int64_t table_elements, int64_t instances, int64_t tables, int64_t memories) |
| Provides limits for a store. Used by hosts to limit resource consumption of instances. Use negative value to keep the default value for the limit. More... | |
| template<typename F , std::enable_if_t< std::is_invocable_r_v< Result< DeadlineKind >, F, Context, uint64_t & >, bool > = true> | |
| void | epoch_deadline_callback (F &&f) |
| Configures epoch deadline callback to C function. More... | |
| Context | context () |
Explicit function to acquire a Context from this store. | |
| void | gc () |
| const wasmtime_store_t * | capi () const |
| Returns the underlying C API pointer. | |
| wasmtime_store_t * | capi () |
| Returns the underlying C API pointer. | |
Owner of all WebAssembly objects.
A Store owns all WebAssembly objects such as instances, globals, functions, memories, etc. A Store is one of the main central points about working with WebAssembly since it's an argument to almost all APIs. The Store serves as a form of "context" to give meaning to the pointers of Func and friends.
A Store can be sent between threads but it cannot generally be shared concurrently between threads. Memory associated with WebAssembly instances will be deallocated when the Store is deallocated.
|
inline |
Configures epoch deadline callback to C function.
This function configures a store-local callback function that will be called when the running WebAssembly function has exceeded its epoch deadline. That function can:
|
inline |
Runs a garbage collection pass in the referenced store to collect loose GC-managed objects, if any are available.
|
inline |
Provides limits for a store. Used by hosts to limit resource consumption of instances. Use negative value to keep the default value for the limit.
| memory_size | the maximum number of bytes a linear memory can grow to. Growing a linear memory beyond this limit will fail. By default, linear memory will not be limited. |
| table_elements | the maximum number of elements in a table. Growing a table beyond this limit will fail. By default, table elements will not be limited. |
| instances | the maximum number of instances that can be created for a Store. Module instantiation will fail if this limit is exceeded. This value defaults to 10,000. |
| tables | the maximum number of tables that can be created for a Store. Module instantiation will fail if this limit is exceeded. This value defaults to 10,000. |
| memories | the maximum number of linear memories that can be created for a Store. Instantiation will fail with an error if this limit is exceeded. This value defaults to 10,000. |
Use any negative value for the parameters that should be kept on the default values.
Note that the limits are only used to limit the creation/growth of resources in the future, this does not retroactively attempt to apply limits to the store.