Wasmtime
store.h
Go to the documentation of this file.
1
7#ifndef WASMTIME_STORE_H
8#define WASMTIME_STORE_H
9
10#include <wasi.h>
11#include <wasm.h>
12#include <wasmtime/conf.h>
13#include <wasmtime/error.h>
14#include <wasmtime/wasip2.h>
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
39
60
74 void *data,
75 void (*finalizer)(void *));
76
80WASM_API_EXTERN wasmtime_context_t *
82
112WASM_API_EXTERN void wasmtime_store_limiter(wasmtime_store_t *store,
113 int64_t memory_size,
114 int64_t table_elements,
115 int64_t instances, int64_t tables,
116 int64_t memories);
117
121WASM_API_EXTERN void wasmtime_store_delete(wasmtime_store_t *store);
122
126WASM_API_EXTERN void *
128
136WASM_API_EXTERN void wasmtime_context_set_data(wasmtime_context_t *context,
137 void *data);
138
148WASM_API_EXTERN void wasmtime_context_gc(wasmtime_context_t *context);
149
164WASM_API_EXTERN wasmtime_error_t *
166
177WASM_API_EXTERN wasmtime_error_t *
178wasmtime_context_get_fuel(const wasmtime_context_t *context, uint64_t *fuel);
179
180#ifdef WASMTIME_FEATURE_WASI
181
193WASM_API_EXTERN wasmtime_error_t *
195
196#ifdef WASMTIME_FEATURE_COMPONENT_MODEL
197
206WASM_API_EXTERN void
209
210#endif // WASMTIME_FEATURE_COMPONENT_MODEL
211
212#endif // WASMTIME_FEATURE_WASI
213
224WASM_API_EXTERN void
226 uint64_t ticks_beyond_current);
227
231#define WASMTIME_UPDATE_DEADLINE_CONTINUE 0
233#define WASMTIME_UPDATE_DEADLINE_YIELD 1
234
256 wasmtime_store_t *store,
257 wasmtime_error_t *(*func)(wasmtime_context_t *context, void *data,
258 uint64_t *epoch_deadline_delta,
260 void *data, void (*finalizer)(void *));
261
262#ifdef __cplusplus
263} // extern "C"
264#endif
265
266#endif // WASMTIME_STORE_H
Build-time defines for how the C API was built.
Definition and accessors of wasmtime_error_t.
void wasmtime_store_limiter(wasmtime_store_t *store, 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....
void wasmtime_context_set_data(wasmtime_context_t *context, void *data)
Overwrites the user-specified data associated with this store.
uint8_t wasmtime_update_deadline_kind_t
An enum for the behavior before extending the epoch deadline.
Definition: store.h:229
void wasmtime_context_set_wasip2(wasmtime_context_t *context, wasmtime_wasip2_config_t *config)
Set the WASIP2 config for this store.
void wasmtime_store_epoch_deadline_callback(wasmtime_store_t *store, wasmtime_error_t *(*func)(wasmtime_context_t *context, void *data, uint64_t *epoch_deadline_delta, wasmtime_update_deadline_kind_t *update_kind), void *data, void(*finalizer)(void *))
Configures epoch deadline callback to C function.
void wasmtime_context_gc(wasmtime_context_t *context)
Perform garbage collection within the given context.
void wasmtime_store_delete(wasmtime_store_t *store)
Deletes a store.
void wasmtime_context_set_epoch_deadline(wasmtime_context_t *context, uint64_t ticks_beyond_current)
Configures the relative deadline at which point WebAssembly code will trap or invoke the callback fun...
wasmtime_context_t * wasmtime_store_context(wasmtime_store_t *store)
Returns the interior wasmtime_context_t pointer to this store.
void * wasmtime_context_get_data(const wasmtime_context_t *context)
Returns the user-specified data associated with the specified store.
wasmtime_store_t * wasmtime_store_new(wasm_engine_t *engine, void *data, void(*finalizer)(void *))
Creates a new store within the specified engine.
wasmtime_error_t * wasmtime_context_set_fuel(wasmtime_context_t *store, uint64_t fuel)
Set fuel to this context's store for wasm to consume while executing.
wasmtime_error_t * wasmtime_context_set_wasi(wasmtime_context_t *context, wasi_config_t *wasi)
Configures WASI state within the specified store.
wasmtime_error_t * wasmtime_context_get_fuel(const wasmtime_context_t *context, uint64_t *fuel)
Returns the amount of fuel remaining in this context's store.
Compilation environment and configuration.
An interior pointer into a wasmtime_store_t which is used as "context" for many functions.
Errors generated by Wasmtime.
Storage of WebAssembly objects.
struct wasmtime_wasip2_config_t wasmtime_wasip2_config_t
Config for the WASIP2 context.
Definition: wasip2.h:17