GC Struct
struct.new
Section titled “struct.new”Create a new structure on the heap.
Signature: (param field_types...) (result structref)
Example:
(struct.new $my_struct (i32.const 1) (f32.const 2.0))struct.new_default
Section titled “struct.new_default”Create a new structure with default values.
Signature: (result structref)
Example:
(struct.new_default $my_struct)struct.get
Section titled “struct.get”Get a field from a structure.
Signature: (param structref) (result field_type)
Example:
(struct.get $my_struct $field_name (local.get $s))struct.get_s
Section titled “struct.get_s”Get a signed field from a structure (sign-extending).
Signature: (param structref) (result field_type)
Example:
(struct.get_s $my_struct $field_index (local.get $s))struct.get_u
Section titled “struct.get_u”Get an unsigned field from a structure (zero-extending).
Signature: (param structref) (result field_type)
Example:
(struct.get_u $my_struct $field_index (local.get $s))struct.set
Section titled “struct.set”Set a field in a structure.
Signature: (param structref field_type)
Example:
(struct.set $my_struct $field_index (local.get $s) (i32.const 42))