5#ifndef WASMTIME_TYPES_VAL_HH
6#define WASMTIME_TYPES_VAL_HH
11#include <wasmtime/types/_structref_class.hh>
12#include <wasmtime/types/_val_class.hh>
91 this->ty.of.concrete_array =
ArrayType(ty).capi_release();
100 this->ty.of.concrete_struct =
StructType(ty).capi_release();
109 this->ty.of.concrete_exn =
ExnType(ty).capi_release();
Owned handle to a WebAssembly array type definition.
Definition: types/arrayref.hh:18
Global compilation state in Wasmtime.
Definition: engine.hh:22
Owned handle to a WebAssembly exception type definition.
Definition: types/exnref.hh:22
Definition: types/func.hh:29
Type information for a WebAssembly function.
Definition: types/func.hh:15
wasm_functype_t * capi_release()
Releases the underlying C API pointer.
Definition: types/func.hh:104
Representation of a heap type in WebAssembly.
Definition: types/val.hh:22
const ArrayType * as_concrete_array() const
If this is a concrete array type, returns the underlying array type.
Definition: types/val.hh:168
static HeapType eq()
Constructor for the eq heap type.
Definition: types/val.hh:80
bool is_i31() const
Is this the abstract i31 heap type?
Definition: types/val.hh:161
HeapType(const StructType &ty)
Constructor for a concrete struct heap type.
Definition: types/val.hh:98
bool is_nofunc() const
Is this the abstract nofunc heap type?
Definition: types/val.hh:149
bool is_none() const
Is this the abstract none heap type?
Definition: types/val.hh:155
HeapType(const HeapType &other)
Copy constructor.
Definition: types/val.hh:29
HeapType(const FuncType &ty)
Constructor for a concrete function heap type.
Definition: types/val.hh:65
HeapType & operator=(const HeapType &other)
Copy assignment operator.
Definition: types/val.hh:31
bool is_func() const
Is this the abstract func heap type?
Definition: types/val.hh:137
bool is_noextern() const
Is this the abstract noextern heap type?
Definition: types/val.hh:132
static HeapType nofunc()
Constructor for the nofunc heap type.
Definition: types/val.hh:71
bool is_exn() const
Is this the abstract exn heap type?
Definition: types/val.hh:190
static HeapType any()
Constructor for the any heap type.
Definition: types/val.hh:74
HeapType(HeapType &&other)
Move constructor.
Definition: types/val.hh:41
bool is_struct() const
Is this the abstract struct heap type?
Definition: types/val.hh:177
const wasmtime_heaptype_t * capi() const
Returns the underlying C API heap type.
Definition: types/val.hh:206
bool is_any() const
Is this the abstract any heap type?
Definition: types/val.hh:152
static HeapType exn()
Constructor for the exn heap type.
Definition: types/val.hh:104
const ExnType * as_concrete_exn() const
If this is a concrete exception type, returns the underlying exception type.
Definition: types/val.hh:194
static HeapType struct_()
Constructor for the struct heap type.
Definition: types/val.hh:95
HeapType & operator=(HeapType &&other)
Move assignment operator.
Definition: types/val.hh:46
bool is_concrete() const
Is this a concrete heap type?
Definition: types/val.hh:116
static HeapType noexn()
Constructor for the noexn heap type.
Definition: types/val.hh:113
static HeapType i31()
Constructor for the i31 heap type.
Definition: types/val.hh:83
bool is_extern() const
Is this the abstract extern heap type?
Definition: types/val.hh:129
std::optional< FuncType::Ref > as_concrete_func() const
If this is a concrete function type, returns the underlying function type.
Definition: types/val.hh:141
static HeapType none()
Constructor for the none heap type.
Definition: types/val.hh:77
HeapType(const ArrayType &ty)
Constructor for a concrete array heap type.
Definition: types/val.hh:89
bool is_eq() const
Is this the abstract eq heap type?
Definition: types/val.hh:158
static HeapType extern_()
Constructor for the extern heap type.
Definition: types/val.hh:54
static HeapType noextern()
Constructor for the noextern heap type.
Definition: types/val.hh:57
const StructType * as_concrete_struct() const
If this is a concrete struct type, returns the underlying struct type.
Definition: types/val.hh:181
bool is_array() const
Is this the abstract array heap type?
Definition: types/val.hh:164
static HeapType array()
Constructor for the array heap type.
Definition: types/val.hh:86
bool is_noexn() const
Is this the abstract noexn heap type?
Definition: types/val.hh:203
HeapType(const ExnType &ty)
Constructor for a concrete exception heap type.
Definition: types/val.hh:107
static HeapType func()
Constructor for the func heap type.
Definition: types/val.hh:62
Representation of a reference type in WebAssembly.
Definition: types/val.hh:210
static RefType structref()
Convenience constructor for the wasm structref type.
Definition: types/val.hh:277
static RefType eqref()
Convenience constructor for the wasm eqref type.
Definition: types/val.hh:268
const HeapType & heaptype() const
Returns the heap type of this reference type.
Definition: types/val.hh:247
static RefType nullexnref()
Convenience constructor for the wasm nullexnref type.
Definition: types/val.hh:286
RefType(RefType &&other)
Move constructor.
Definition: types/val.hh:224
static RefType externref()
Convenience constructor for the wasm externref type.
Definition: types/val.hh:253
static RefType funcref()
Convenience constructor for the wasm funcref type.
Definition: types/val.hh:259
static RefType nullfuncref()
Convenience constructor for the wasm nullfuncref type.
Definition: types/val.hh:262
static RefType nullexternref()
Convenience constructor for the wasm nullexternref type.
Definition: types/val.hh:256
bool nullable() const
Returns whether this reference type is nullable.
Definition: types/val.hh:244
static RefType arrayref()
Convenience constructor for the wasm arrayref type.
Definition: types/val.hh:274
RefType(bool nullable, const HeapType &heaptype)
Constructs a reference type with the given nullability and heap type.
Definition: types/val.hh:238
RefType & operator=(const RefType &other)
Copy assignment operator.
Definition: types/val.hh:217
const wasmtime_reftype_t * capi() const
Returns the underlying C API reference type.
Definition: types/val.hh:289
RefType & operator=(RefType &&other)
Move assignment operator.
Definition: types/val.hh:229
static RefType nullref()
Convenience constructor for the wasm nullref type.
Definition: types/val.hh:280
static RefType i31ref()
Convenience constructor for the wasm i31ref type.
Definition: types/val.hh:271
RefType(const RefType &other)
Copy constructor.
Definition: types/val.hh:215
static RefType exnref()
Convenience constructor for the wasm exnref type.
Definition: types/val.hh:283
static RefType anyref()
Convenience constructor for the wasm anyref type.
Definition: types/val.hh:265
Owned handle to a WebAssembly struct type definition.
Definition: types/_structref_class.hh:144
Type information about a WebAssembly value.
Definition: types/_val_class.hh:19
static ValType exnref()
Convenience constructor for the exnref value type.
Definition: types/val.hh:316
const RefType * as_ref() const
Returns if this is a reference type.
Definition: types/val.hh:292
static ValType anyref()
Convenience constructor for the anyref value type.
Definition: types/val.hh:308
const wasmtime_valtype_t * wasmtime_capi() const
Returns the underlying C API representation of this type.
Definition: types/_val_class.hh:171
std::ostream & operator<<(std::ostream &os, const Error &e)
Used to print an error.
Definition: error.hh:58
A WebAssembly heap type.
Definition: types/val.h:76
wasmtime_heaptype_union_t of
Payload of this heap type, with fields indicated by kind.
Definition: types/val.h:81
wasmtime_heaptype_kind_t kind
Discriminant of which heap type this is, and may indicate fields of of to use.
Definition: types/val.h:79
A WebAssembly reference type.
Definition: types/val.h:94
wasmtime_heaptype_t heaptype
The heap type of this reference type.
Definition: types/val.h:98
bool nullable
Whether this reference type is nullable.
Definition: types/val.h:96
A WebAssembly value type.
Definition: types/val.h:131
wasmtime_reftype_t reftype
Payload of this value type, only used with WASMTIME_VALTYPE_KIND_REF.
Definition: types/val.h:136
wasmtime_valtype_kind_t kind
Discriminant of which value type this is.
Definition: types/val.h:133
struct wasmtime_array_type wasmtime_array_type_t
An opaque handle to a WebAssembly array type definition.
Definition: types/arrayref.h:25
struct wasmtime_exn_type wasmtime_exn_type_t
A type of a WebAssembly exception.
Definition: types/exnref.h:16
struct wasmtime_struct_type wasmtime_struct_type_t
An opaque handle to a WebAssembly struct type definition.
Definition: types/structref.h:80
WASM_API_EXTERN void wasmtime_heaptype_clone(const wasmtime_heaptype_t *ty, wasmtime_heaptype_t *out)
Clones ty into out.
#define WASMTIME_HEAPTYPE_KIND_NONE
Heap type for the abstract none type.
Definition: types/val.h:43
#define WASMTIME_VALTYPE_KIND_I64
The WebAssembly i64 type.
Definition: types/val.h:116
#define WASMTIME_HEAPTYPE_KIND_STRUCT
Heap type for the abstract struct type.
Definition: types/val.h:53
#define WASMTIME_HEAPTYPE_KIND_EXN
Heap type for the abstract exn type.
Definition: types/val.h:57
#define WASMTIME_VALTYPE_KIND_REF
A WebAssembly reference type.
Definition: types/val.h:124
#define WASMTIME_HEAPTYPE_KIND_CONCRETE_STRUCT
Heap type for a concrete struct type.
Definition: types/val.h:55
#define WASMTIME_HEAPTYPE_KIND_ARRAY
Heap type for the abstract array type.
Definition: types/val.h:49
#define WASMTIME_HEAPTYPE_KIND_CONCRETE_ARRAY
Heap type for a concrete array type.
Definition: types/val.h:51
#define WASMTIME_HEAPTYPE_KIND_EQ
Heap type for the abstract eq type.
Definition: types/val.h:45
#define WASMTIME_HEAPTYPE_KIND_EXTERN
Heap type for the abstract extern type.
Definition: types/val.h:31
#define WASMTIME_HEAPTYPE_KIND_I31
Heap type for the abstract i31 type.
Definition: types/val.h:47
WASM_API_EXTERN void wasmtime_heaptype_delete(wasmtime_heaptype_t *ty)
Deletes any payload of ty, if applicable.
#define WASMTIME_HEAPTYPE_KIND_CONCRETE_FUNC
Heap type for a concrete function type.
Definition: types/val.h:37
WASM_API_EXTERN wasm_valtype_t * wasmtime_valtype_to_wasm(const wasm_engine_t *engine, const wasmtime_valtype_t *ty)
Converts ty into a wasm_valtype_t and returns a pointer to it.
#define WASMTIME_VALTYPE_KIND_I32
The WebAssembly i32 type.
Definition: types/val.h:114
WASM_API_EXTERN void wasmtime_reftype_delete(wasmtime_reftype_t *ty)
Deletes any payload of ty, if applicable.
#define WASMTIME_HEAPTYPE_KIND_FUNC
Heap type for the abstract func type.
Definition: types/val.h:35
#define WASMTIME_VALTYPE_KIND_F32
The WebAssembly f32 type.
Definition: types/val.h:118
#define WASMTIME_HEAPTYPE_KIND_NOEXN
Heap type for the abstract noexn type.
Definition: types/val.h:61
WASM_API_EXTERN void wasmtime_reftype_clone(const wasmtime_reftype_t *ty, wasmtime_reftype_t *out)
Clones ty into out.
#define WASMTIME_HEAPTYPE_KIND_CONCRETE_EXN
Heap type for a concrete exception type.
Definition: types/val.h:59
uint8_t wasmtime_heaptype_kind_t
Discriminant located in wasmtime_heaptype_t.kind
Definition: types/val.h:28
#define WASMTIME_HEAPTYPE_KIND_ANY
Heap type for the abstract any type.
Definition: types/val.h:41
#define WASMTIME_VALTYPE_KIND_V128
The WebAssembly v128 type.
Definition: types/val.h:122
#define WASMTIME_HEAPTYPE_KIND_NOEXTERN
Heap type for the abstract noextern type.
Definition: types/val.h:33
#define WASMTIME_VALTYPE_KIND_F64
The WebAssembly f64 type.
Definition: types/val.h:120
#define WASMTIME_HEAPTYPE_KIND_NOFUNC
Heap type for the abstract nofunc type.
Definition: types/val.h:39
wasmtime_exn_type_t * concrete_exn
Used with WASMTIME_HEAPTYPE_KIND_CONCRETE_EXN.
Definition: types/val.h:72
wasmtime_array_type_t * concrete_array
Used with WASMTIME_HEAPTYPE_KIND_CONCRETE_ARRAY.
Definition: types/val.h:68
wasm_functype_t * concrete_func
Used with WASMTIME_HEAPTYPE_KIND_CONCRETE_FUNC.
Definition: types/val.h:66
wasmtime_struct_type_t * concrete_struct
Used with WASMTIME_HEAPTYPE_KIND_CONCRETE_STRUCT.
Definition: types/val.h:70