Wasmtime
memory.h
Go to the documentation of this file.
1
7#ifndef WASMTIME_MEMORY_H
8#define WASMTIME_MEMORY_H
9
10#include <wasm.h>
11#include <wasmtime/error.h>
12#include <wasmtime/extern.h>
13#include <wasmtime/store.h>
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
25WASM_API_EXTERN wasmtime_error_t *
26wasmtime_memorytype_new(uint64_t min, bool max_present, uint64_t max,
27 bool is_64, bool shared, uint8_t page_size_log2,
28 wasm_memorytype_t **ret);
29
36WASM_API_EXTERN uint64_t
38
49WASM_API_EXTERN bool wasmtime_memorytype_maximum(const wasm_memorytype_t *ty,
50 uint64_t *max);
51
55WASM_API_EXTERN bool wasmtime_memorytype_is64(const wasm_memorytype_t *ty);
56
60WASM_API_EXTERN bool wasmtime_memorytype_isshared(const wasm_memorytype_t *ty);
61
65WASM_API_EXTERN uint64_t
67
71WASM_API_EXTERN uint8_t
73
84WASM_API_EXTERN wasmtime_error_t *
87
91WASM_API_EXTERN wasm_memorytype_t *
93 const wasmtime_memory_t *memory);
94
98WASM_API_EXTERN uint8_t *wasmtime_memory_data(const wasmtime_context_t *store,
99 const wasmtime_memory_t *memory);
100
104WASM_API_EXTERN size_t wasmtime_memory_data_size(
105 const wasmtime_context_t *store, const wasmtime_memory_t *memory);
106
110WASM_API_EXTERN uint64_t wasmtime_memory_size(const wasmtime_context_t *store,
111 const wasmtime_memory_t *memory);
112
125WASM_API_EXTERN wasmtime_error_t *
127 uint64_t delta, uint64_t *prev_size);
128
146WASM_API_EXTERN uint64_t wasmtime_memory_page_size(
147 wasmtime_context_t *store, const wasmtime_memory_t *memory);
148
167WASM_API_EXTERN uint8_t wasmtime_memory_page_size_log2(
168 wasmtime_context_t *store, const wasmtime_memory_t *memory);
169
170#ifdef __cplusplus
171} // extern "C"
172#endif
173
174#endif // WASMTIME_MEMORY_H
Definition and accessors of wasmtime_error_t.
Definition of wasmtime_extern_t and external items.
WASM_API_EXTERN bool wasmtime_memorytype_maximum(const wasm_memorytype_t *ty, uint64_t *max)
Returns the maximum size, in pages, of the specified memory type.
WASM_API_EXTERN uint64_t wasmtime_memorytype_minimum(const wasm_memorytype_t *ty)
Returns the minimum size, in pages, of the specified memory type.
WASM_API_EXTERN wasmtime_error_t * wasmtime_memorytype_new(uint64_t min, bool max_present, uint64_t max, bool is_64, bool shared, uint8_t page_size_log2, wasm_memorytype_t **ret)
Creates a new memory type from the specified parameters.
WASM_API_EXTERN uint8_t * wasmtime_memory_data(const wasmtime_context_t *store, const wasmtime_memory_t *memory)
Returns the base pointer in memory where the linear memory starts.
WASM_API_EXTERN uint64_t wasmtime_memory_page_size(wasmtime_context_t *store, const wasmtime_memory_t *memory)
Returns the size of a page, in bytes, for this memory.
WASM_API_EXTERN wasmtime_error_t * wasmtime_memory_grow(wasmtime_context_t *store, const wasmtime_memory_t *memory, uint64_t delta, uint64_t *prev_size)
Attempts to grow the specified memory by delta pages.
WASM_API_EXTERN bool wasmtime_memorytype_is64(const wasm_memorytype_t *ty)
Returns whether this type of memory represents a 64-bit memory.
WASM_API_EXTERN bool wasmtime_memorytype_isshared(const wasm_memorytype_t *ty)
Returns whether this type of memory represents a shared memory.
WASM_API_EXTERN uint8_t wasmtime_memory_page_size_log2(wasmtime_context_t *store, const wasmtime_memory_t *memory)
Returns the log2 of this memory's page size, in bytes.
WASM_API_EXTERN uint64_t wasmtime_memory_size(const wasmtime_context_t *store, const wasmtime_memory_t *memory)
Returns the length, in WebAssembly pages, of this linear memory.
WASM_API_EXTERN wasmtime_error_t * wasmtime_memory_new(wasmtime_context_t *store, const wasm_memorytype_t *ty, wasmtime_memory_t *ret)
Creates a new WebAssembly linear memory.
WASM_API_EXTERN uint64_t wasmtime_memorytype_page_size(const wasm_memorytype_t *ty)
Returns the page size, in bytes, of this memory type.
WASM_API_EXTERN wasm_memorytype_t * wasmtime_memory_type(const wasmtime_context_t *store, const wasmtime_memory_t *memory)
Returns the type of the memory specified.
WASM_API_EXTERN size_t wasmtime_memory_data_size(const wasmtime_context_t *store, const wasmtime_memory_t *memory)
Returns the byte length of this linear memory.
WASM_API_EXTERN uint8_t wasmtime_memorytype_page_size_log2(const wasm_memorytype_t *ty)
Returns the log2 of this memory type's page size, in bytes.
An opaque object representing the type of a memory.
An interior pointer into a wasmtime_store_t which is used as "context" for many functions.
Errors generated by Wasmtime.
Representation of a memory in Wasmtime.
Definition: extern.h:61