5#ifndef WASMTIME_TYPES_VAL_HH
6#define WASMTIME_TYPES_VAL_HH
37#define WASMTIME_FOR_EACH_VAL_KIND(X) \
38 X(I32, "i32", WASM_I32) \
39 X(I64, "i64", WASM_I64) \
40 X(F32, "f32", WASM_F32) \
41 X(F64, "f64", WASM_F64) \
42 X(ExternRef, "externref", WASM_EXTERNREF) \
43 X(FuncRef, "funcref", WASM_FUNCREF) \
44 X(AnyRef, "anyref", WASMTIME_ANYREF) \
45 X(V128, "v128", WASMTIME_V128)
50#define CASE_KIND_PRINT_NAME(kind, name, ignore) \
55#undef CASE_KIND_PRINT_NAME
68 friend class TableType;
69 friend class GlobalType;
70 friend class FuncType;
76 std::unique_ptr<wasm_valtype_t, deleter> ptr;
80#define CASE_KIND_TO_C(kind, ignore, ckind) \
107#define CASE_C_TO_KIND(kind, ignore, ckind) \
109 return ValKind::kind;
131 return reinterpret_cast<Ref *
>(&list->
data[0]);
136 return reinterpret_cast<Ref *
>(&list->
data[list->
size]);
140 size_t size()
const {
return list->
size; }
155 ValType &
operator=(
const ValType &other) {
174#undef WASMTIME_FOR_EACH_VAL_KIND
Representation of a WebAssembly anyref value.
Definition: val.hh:82
Representation of a WebAssembly externref value.
Definition: val.hh:28
Non-owning reference to a list of ValType instances. Must not be used after the original owner is del...
Definition: types/val.hh:116
ListRef(const wasm_valtype_vec_t *list)
Creates a list from the raw underlying C API.
Definition: types/val.hh:121
size_t size() const
Returns how many types are in this list.
Definition: types/val.hh:137
iterator begin() const
Pointer to the beginning of iteration.
Definition: types/val.hh:127
iterator end() const
Pointer to the end of iteration.
Definition: types/val.hh:132
const Ref * iterator
This list iterates over a list of ValType::Ref instances.
Definition: types/val.hh:124
Non-owning reference to a ValType, must not be used after the original ValType is deleted.
Definition: types/val.hh:91
Ref(const ValType &ty)
Copy constructor.
Definition: types/val.hh:100
Ref(const wasm_valtype_t *ptr)
Instantiates from the raw C API representation.
Definition: types/val.hh:98
ValKind kind() const
Returns the corresponding "kind" for this type.
Definition: types/val.hh:103
Type information about a WebAssembly value.
Definition: types/val.hh:66
ValType & operator=(const ValType &other)
Copies the contents of another type into this one.
Definition: types/val.hh:152
Ref * operator->()
Returns the underlying Ref, a non-owning reference pointing to this instance.
Definition: types/val.hh:165
Ref * operator*()
Returns the underlying Ref, a non-owning reference pointing to this instance.
Definition: types/val.hh:168
std::ostream & operator<<(std::ostream &os, const Error &e)
Used to print an error.
Definition: error.hh:71
An object representing the type of a value.
A list of wasm_valtype_t values.
Definition: wasm.h:183
wasm_valtype_t ** data
Pointer to the base of this vector.
Definition: wasm.h:183
size_t size
Length of this vector.
Definition: wasm.h:183
Container for the v128 WebAssembly type.
Definition: val.hh:135
ValKind
Different kinds of types accepted by Wasmtime.
Definition: types/val.hh:16
@ F64
WebAssembly's f64 type.
@ F32
WebAssembly's f32 type.
@ FuncRef
WebAssembly's funcref type from the reference types.
@ I32
WebAssembly's i32 type.
@ I64
WebAssembly's i64 type.
#define WASMTIME_FOR_EACH_VAL_KIND(X)
Definition: types/val.hh:37
void wasm_valtype_delete(wasm_valtype_t *)
Deletes a type.
uint8_t wasm_valkind_t
Different kinds of types supported in wasm.
Definition: wasm.h:185
wasm_valtype_t * wasm_valtype_copy(const wasm_valtype_t *)
Creates a new value which matches the provided one.
wasm_valkind_t wasm_valtype_kind(const wasm_valtype_t *)
Returns the associated kind for this value type.
wasm_valtype_t * wasm_valtype_new(wasm_valkind_t)
Creates a new value type from the specified kind.