Wasmtime
val.h
Go to the documentation of this file.
1
7#ifndef WASMTIME_VAL_H
8#define WASMTIME_VAL_H
9
10#include <wasm.h>
11#include <wasmtime/extern.h>
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
29
44WASM_API_EXTERN wasmtime_externref_t *wasmtime_externref_new(void *data, void (*finalizer)(void*));
45
52WASM_API_EXTERN void *wasmtime_externref_data(wasmtime_externref_t *data);
53
59
65
74
85WASM_API_EXTERN size_t wasmtime_externref_to_raw(
86 wasmtime_context_t *context,
87 const wasmtime_externref_t *ref);
88
90typedef uint8_t wasmtime_valkind_t;
92#define WASMTIME_I32 0
94#define WASMTIME_I64 1
96#define WASMTIME_F32 2
98#define WASMTIME_F64 3
100#define WASMTIME_V128 4
102#define WASMTIME_FUNCREF 5
104#define WASMTIME_EXTERNREF 6
105
108typedef uint8_t wasmtime_v128[16];
109
120typedef union wasmtime_valunion {
124 int32_t i32;
128 int64_t i64;
156
170typedef union wasmtime_val_raw {
172 int32_t i32;
174 int64_t i64;
185 size_t funcref;
191 size_t externref;
193
207typedef struct wasmtime_val {
213
220WASM_API_EXTERN void wasmtime_val_delete(wasmtime_val_t *val);
221
225WASM_API_EXTERN void wasmtime_val_copy(wasmtime_val_t *dst, const wasmtime_val_t *src);
226
227#ifdef __cplusplus
228} // extern "C"
229#endif
230
231#endif // WASMTIME_VAL_H
232
Definition of wasmtime_extern_t and external items.
An interior pointer into a wasmtime_store_t which is used as "context" for many functions.
A host-defined un-forgeable reference to pass into WebAssembly.
Representation of a function in Wasmtime.
Definition: extern.h:24
Container for different kinds of wasm values.
Definition: val.h:207
wasmtime_valkind_t kind
Discriminant of which field of of is valid.
Definition: val.h:209
wasmtime_valunion_t of
Container for the extern item's value.
Definition: val.h:211
Container for possible wasm values.
Definition: val.h:170
size_t externref
Definition: val.h:191
float32_t f32
Field for when this val is a WebAssembly f32 value.
Definition: val.h:176
float64_t f64
Field for when this val is a WebAssembly f64 value.
Definition: val.h:178
int32_t i32
Field for when this val is a WebAssembly i32 value.
Definition: val.h:172
wasmtime_v128 v128
Field for when this val is a WebAssembly v128 value.
Definition: val.h:180
int64_t i64
Field for when this val is a WebAssembly i64 value.
Definition: val.h:174
size_t funcref
Definition: val.h:185
Container for different kinds of wasm values.
Definition: val.h:120
wasmtime_func_t funcref
Definition: val.h:143
wasmtime_externref_t * externref
Definition: val.h:150
int32_t i32
Definition: val.h:124
wasmtime_v128 v128
Definition: val.h:154
float32_t f32
Definition: val.h:132
int64_t i64
Definition: val.h:128
float64_t f64
Definition: val.h:136
uint8_t wasmtime_valkind_t
Discriminant stored in wasmtime_val::kind.
Definition: val.h:90
void wasmtime_val_copy(wasmtime_val_t *dst, const wasmtime_val_t *src)
Copies src into dst.
union wasmtime_valunion wasmtime_valunion_t
Convenience alias for wasmtime_valunion.
wasmtime_externref_t * wasmtime_externref_clone(wasmtime_externref_t *ref)
Creates a shallow copy of the externref argument, returning a separately owned pointer (increases the...
union wasmtime_val_raw wasmtime_val_raw_t
Convenience alias for wasmtime_val_raw.
uint8_t wasmtime_v128[16]
A 128-bit value representing the WebAssembly v128 type. Bytes are stored in little-endian order.
Definition: val.h:108
void wasmtime_val_delete(wasmtime_val_t *val)
Delets an owned wasmtime_val_t.
size_t wasmtime_externref_to_raw(wasmtime_context_t *context, const wasmtime_externref_t *ref)
Converts a wasmtime_externref_t to a raw value suitable for storing into a wasmtime_val_raw_t.
wasmtime_externref_t * wasmtime_externref_new(void *data, void(*finalizer)(void *))
Create a new externref value.
struct wasmtime_val wasmtime_val_t
Convenience alias for wasmtime_val_t.
wasmtime_externref_t * wasmtime_externref_from_raw(wasmtime_context_t *context, size_t raw)
Converts a raw externref value coming from wasmtime_val_raw_t into a wasmtime_externref_t.
void wasmtime_externref_delete(wasmtime_externref_t *ref)
Decrements the reference count of the ref, deleting it if it's the last reference.
void * wasmtime_externref_data(wasmtime_externref_t *data)
Get an externref's wrapped data.
float float32_t
A type definition for a 32-bit float.
Definition: wasm.h:38
double float64_t
A type definition for a 64-bit float.
Definition: wasm.h:39