|
Wasmtime
|
#include <wasm.h>#include <wasmtime/error.h>#include <wasmtime/extern.h>#include <wasmtime/store.h>#include <wasmtime/val.h>Go to the source code of this file.
Functions | |
| WASM_API_EXTERN wasmtime_error_t * | wasmtime_table_new (wasmtime_context_t *store, const wasm_tabletype_t *ty, const wasmtime_val_t *init, wasmtime_table_t *table) |
| Creates a new host-defined wasm table. More... | |
| WASM_API_EXTERN wasm_tabletype_t * | wasmtime_table_type (const wasmtime_context_t *store, const wasmtime_table_t *table) |
| Returns the type of this table. More... | |
| WASM_API_EXTERN bool | wasmtime_table_get (wasmtime_context_t *store, const wasmtime_table_t *table, uint64_t index, wasmtime_val_t *val) |
| Gets a value in a table. More... | |
| WASM_API_EXTERN wasmtime_error_t * | wasmtime_table_set (wasmtime_context_t *store, const wasmtime_table_t *table, uint64_t index, const wasmtime_val_t *value) |
| Sets a value in a table. More... | |
| WASM_API_EXTERN uint64_t | wasmtime_table_size (const wasmtime_context_t *store, const wasmtime_table_t *table) |
| Returns the size, in elements, of the specified table. | |
| WASM_API_EXTERN wasmtime_error_t * | wasmtime_table_grow (wasmtime_context_t *store, const wasmtime_table_t *table, uint64_t delta, const wasmtime_val_t *init, uint64_t *prev_size) |
| Grows a table. More... | |
Wasmtime APIs for interacting with WebAssembly tables.
| WASM_API_EXTERN bool wasmtime_table_get | ( | wasmtime_context_t * | store, |
| const wasmtime_table_t * | table, | ||
| uint64_t | index, | ||
| wasmtime_val_t * | val | ||
| ) |
Gets a value in a table.
| store | the store that owns table |
| table | the table to access |
| index | the table index to access |
| val | where to store the table's value |
This function will attempt to access a table element. If a nonzero value is returned then val is filled in and is owned by the caller. Otherwise zero is returned because the index is out-of-bounds.
| WASM_API_EXTERN wasmtime_error_t * wasmtime_table_grow | ( | wasmtime_context_t * | store, |
| const wasmtime_table_t * | table, | ||
| uint64_t | delta, | ||
| const wasmtime_val_t * | init, | ||
| uint64_t * | prev_size | ||
| ) |
Grows a table.
| store | the store that owns table |
| table | the table to grow |
| delta | the number of elements to grow the table by |
| init | the initial value for new table element slots |
| prev_size | where to store the previous size of the table before growth |
This function will attempt to grow the table by delta table elements. This can fail if delta would exceed the maximum size of the table or if init is the wrong type for this table. If growth is successful then NULL is returned and prev_size is filled in with the previous size of the table, in elements, before the growth happened.
This function does not take ownership of any of its arguments.
| WASM_API_EXTERN wasmtime_error_t * wasmtime_table_new | ( | wasmtime_context_t * | store, |
| const wasm_tabletype_t * | ty, | ||
| const wasmtime_val_t * | init, | ||
| wasmtime_table_t * | table | ||
| ) |
Creates a new host-defined wasm table.
| store | the store to create the table within |
| ty | the type of the table to create |
| init | the initial value for this table's elements |
| table | where to store the returned table |
This function does not take ownership of any of its parameters, but yields ownership of returned error. This function may return an error if the init value does not match ty, for example.
| WASM_API_EXTERN wasmtime_error_t * wasmtime_table_set | ( | wasmtime_context_t * | store, |
| const wasmtime_table_t * | table, | ||
| uint64_t | index, | ||
| const wasmtime_val_t * | value | ||
| ) |
Sets a value in a table.
| store | the store that owns table |
| table | the table to write to |
| index | the table index to write |
| value | the value to store. |
This function will store value into the specified index in the table. This does not take ownership of any argument but yields ownership of the error. This function can fail if value has the wrong type for the table, or if index is out of bounds.
| WASM_API_EXTERN wasm_tabletype_t * wasmtime_table_type | ( | const wasmtime_context_t * | store, |
| const wasmtime_table_t * | table | ||
| ) |
Returns the type of this table.
The caller has ownership of the returned wasm_tabletype_t