Wasmtime
val.h File Reference
#include <stdalign.h>
#include <wasm.h>
#include <wasmtime/conf.h>
#include <wasmtime/extern.h>

Go to the source code of this file.

Data Structures

struct  wasmtime_anyref
 A WebAssembly value in the any hierarchy of GC types. More...
 
struct  wasmtime_exnref
 A WebAssembly exception reference value. More...
 
struct  wasmtime_externref
 A host-defined un-forgeable reference to pass into WebAssembly. More...
 
struct  wasmtime_eqref
 A WebAssembly eqref value. More...
 
struct  wasmtime_structref
 A WebAssembly structref value. More...
 
struct  wasmtime_arrayref
 A WebAssembly arrayref value. More...
 
union  wasmtime_valunion
 Container for different kinds of wasm values. More...
 
union  wasmtime_val_raw
 Container for possible wasm values. More...
 
union  wasmtime_val
 Container for different kinds of wasm values. More...
 

Macros

#define WASMTIME_I32   0
 Value of wasmtime_valkind_t meaning that wasmtime_val_t is an i32.
 
#define WASMTIME_I64   1
 Value of wasmtime_valkind_t meaning that wasmtime_val_t is an i64.
 
#define WASMTIME_F32   2
 Value of wasmtime_valkind_t meaning that wasmtime_val_t is a f32.
 
#define WASMTIME_F64   3
 Value of wasmtime_valkind_t meaning that wasmtime_val_t is a f64.
 
#define WASMTIME_V128   4
 Value of wasmtime_valkind_t meaning that wasmtime_val_t is a v128.
 
#define WASMTIME_FUNCREF   5
 Value of wasmtime_valkind_t meaning that wasmtime_val_t is a funcref.
 
#define WASMTIME_EXTERNREF   6
 Value of wasmtime_valkind_t meaning that wasmtime_val_t is an externref.
 
#define WASMTIME_ANYREF   7
 Value of wasmtime_valkind_t meaning that wasmtime_val_t is an anyref.
 
#define WASMTIME_EXNREF   8
 Value of wasmtime_valkind_t meaning that wasmtime_val_t is an exnref.
 

Typedefs

typedef uint8_t wasmtime_valkind_t
 Discriminant stored in wasmtime_val::kind.
 
typedef uint8_t wasmtime_v128[16]
 A 128-bit value representing the WebAssembly v128 type. Bytes are stored in little-endian order.
 
typedef struct wasmtime_anyref wasmtime_anyref_t
 Convenience alias for wasmtime_anyref.
 
typedef struct wasmtime_exnref wasmtime_exnref_t
 Convenience alias for wasmtime_exnref.
 
typedef struct wasmtime_externref wasmtime_externref_t
 Convenience alias for wasmtime_externref.
 
typedef struct wasmtime_eqref wasmtime_eqref_t
 Convenience alias for wasmtime_eqref.
 
typedef struct wasmtime_structref wasmtime_structref_t
 Convenience alias for wasmtime_structref.
 
typedef struct wasmtime_arrayref wasmtime_arrayref_t
 Convenience alias for wasmtime_arrayref.
 
typedef union wasmtime_valunion wasmtime_valunion_t
 Convenience alias for wasmtime_valunion.
 
typedef union wasmtime_val_raw wasmtime_val_raw_t
 Convenience alias for wasmtime_val_raw.
 
typedef struct wasmtime_val wasmtime_val_t
 Convenience alias for wasmtime_val_t.
 

Functions

WASM_API_EXTERN void wasmtime_val_unroot (wasmtime_val_t *val)
 Unroot the value contained by val. More...
 
WASM_API_EXTERN void wasmtime_val_clone (const wasmtime_val_t *src, wasmtime_val_t *dst)
 Clones the value pointed to by src into the dst provided. More...
 

Detailed Description

APIs for interacting with WebAssembly values in Wasmtime.

Function Documentation

◆ wasmtime_val_clone()

WASM_API_EXTERN void wasmtime_val_clone ( const wasmtime_val_t src,
wasmtime_val_t dst 
)

Clones the value pointed to by src into the dst provided.

This function will clone any rooted GC values in src and have them newly rooted inside of dst. When using this API the dst should be later unrooted with wasmtime_val_unroot if it contains GC values.

◆ wasmtime_val_unroot()

WASM_API_EXTERN void wasmtime_val_unroot ( wasmtime_val_t val)

Unroot the value contained by val.

This function will unroot any GC references that val points to, for example if it has the WASMTIME_EXTERNREF, WASMTIME_ANYREF, or WASMTIME_EXNREF kinds. This function leaves val in an undefined state and it should not be used again without re-initializing.

This method does not need to be called for integers, floats, v128, or funcref values.