Type¶
Entities for represent values or objects used within WasmVM
Types out of WebAssembly specification (extended) are denoted as [ext]
Fundamental types¶
Represent basic values or date references
-
using WasmVM::i32_t = int32_t¶
32-bit signed integer
-
using WasmVM::i64_t = int64_t¶
64-bit signed integer
-
using WasmVM::f32_t = float¶
32-bit (single precision) floating-point number
-
using WasmVM::f64_t = double¶
64-bit (double precision) floating-point number
-
using WasmVM::externref_t = void*¶
Nullable reference of external objects
-
using WasmVM::i8_t = int8_t¶
[ext] 8-bit signed integer
-
using WasmVM::u8_t = uint8_t¶
[ext] 8-bit unsigned integer
-
using WasmVM::i16_t = int16_t¶
[ext] 16-bit signed integer
-
using WasmVM::u16_t = uint16_t¶
[ext] 16-bit unsigned integer
-
using WasmVM::u32_t = uint32_t¶
[ext] 32-bit unsigned integer
-
using WasmVM::u64_t = uint64_t¶
[ext] 64-bit unsigned integer
-
using WasmVM::byte_t = std::byte¶
[ext] Single byte
-
using WasmVM::align_t = uint8_t¶
[ext] Memory alignment
Constants¶
Enumerations¶
-
struct WasmVM::ValueType¶
A number type, or a reference type
(ref null? heaptype). The heap type is abstract or names a type index; the legacy spellings are the nullable abstract forms, sofuncrefis(ref null func).-
bool nullable¶
Meaningful for the reference kinds.
-
bool is_num() const¶
-
bool is_ref() const¶
-
bool is_concrete() const¶
-
bool is_bottom() const¶
-
bool nullable¶
-
enum WasmVM::ValueType::Kind¶
-
enumerator i32¶
Denote i32_t value
-
enumerator i64¶
Denote i64_t value
-
enumerator f32¶
Denote f32_t value
-
enumerator f64¶
Denote f64_t value
-
enumerator funcref¶
Denote funcref_t value
-
enumerator externref¶
Denote externref_t value
-
enumerator i31ref¶
Denote i31ref_t value (GC proposal)
-
enumerator exnref¶
Denote exnref_t value (exception-handling proposal)
-
enumerator structref¶
Any struct (GC proposal)
-
enumerator arrayref¶
Any array (GC proposal)
-
enumerator anyref¶
Anything in the internal hierarchy (GC proposal)
-
enumerator eqref¶
Anything comparable with
ref.eq(GC proposal)
-
enumerator nullref¶
The bottom of the internal hierarchy: only null
-
enumerator nullfuncref¶
The bottom of the function hierarchy: only null
-
enumerator nullexternref¶
The bottom of the external hierarchy: only null
-
enumerator ref¶
A concrete reference, whose
typeidxnames the type
-
enumerator i32¶
-
struct WasmVM::GcObject¶
Base of everything a guest allocates on the garbage-collected heap: a struct, an array, an exception payload. Reference counted, with a cycle collector on top so that a cycle through a mutable reference field is reclaimed as well.
-
template<typename T>
class WasmVM::GcPtr¶ A counted handle on a
WasmVM::GcObject, null when it holds nothing. Shaped like thestd::shared_ptrit replaces.
-
std::size_t WasmVM::gc_collect()¶
Collect now, and return how many objects were freed. Collection also happens on its own as candidates gather, so an embedder need not call this.
-
std::size_t WasmVM::gc_live_count()¶
How many objects the guest has allocated and not yet had reclaimed.
-
using WasmVM::structref_t = GcPtr<StructObj>¶
A reference to a struct on the heap; null when the handle is
-
using WasmVM::arrayref_t = GcPtr<ArrayObj>¶
A reference to an array on the heap; null when the handle is
-
struct WasmVM::StructObj¶
Object types¶
-
using WasmVM::Value = std::variant<i32_t, i64_t, f32_t, f64_t, funcref_t, externref_t, i31ref_t, exnref_t, structref_t, arrayref_t>¶
General type of value
-
using WasmVM::Ref = std::variant<funcref_t, externref_t>¶
Reference type
-
struct WasmVM::Limits¶
Limits of ranged objects or values
-
bool is64 = false¶
[ext] When
true, the memory or table uses a 64-bit address space (memory64proposal). Defaults tofalse(32-bit).
-
bool is64 = false¶
-
struct WasmVM::FuncType¶
Declarational type (signature) of function
-
enum class WasmVM::PackedType¶
Packed storage of a struct field or array element (GC proposal). Never a value type: a packed field is read and written through
i32.-
enumerator i8¶
-
enumerator i16¶
-
enumerator i8¶
-
using WasmVM::StorageType = std::variant<ValueType, PackedType>¶
Storage type of a struct field or array element
-
struct WasmVM::FieldType¶
Type of a struct field or of an array’s elements
-
StorageType storage¶
-
bool mut = false¶
Whether
struct.set/array.setmay write it
-
StorageType storage¶
-
using WasmVM::CompType = std::variant<FuncType, StructType, ArrayType>¶
Composite type: what a type section entry defines
-
struct WasmVM::SubType¶
One entry of the type section: a composite type that may name a supertype and may sit inside a recursion group. A plain function type is a
SubTypethat isfinalwith nosupers.-
bool final = true¶
-
std::vector<index_t> supers¶
Supertype indices, as written. The spec allows at most one; the validator rejects more.
-
bool is_func() const¶
-
bool is_struct() const¶
-
bool is_array() const¶
-
const FuncType &func() const¶
The function type, for the places a type index can only ever name a function’s. Throws
WasmVM::Exception::Exceptionwhen the entry is a struct or array type.
-
bool final = true¶
-
struct WasmVM::RecGroup¶
An explicit
(rec ...)group:countconsecutive entries ofWasmVM::WasmModule::typesstarting atfirst.
-
struct WasmVM::TableType¶
Declarational type (signature) of table
-
struct WasmVM::GlobalType¶
Declarational type (signature) of global
-
struct WasmVM::ExternVal¶
Declarational type (signature) of external values or objects
-
enum ExternType¶
-
enumerator Func¶
Indicate the external value is function
-
enumerator Mem¶
Indicate the external value is memory
-
enumerator Table¶
Indicate the external value is table
-
enumerator Global¶
Indicate the external value is global
-
ExternType type¶
-
enum ExternType¶