Wasmtime
eqref.h
Go to the documentation of this file.
1
7#ifndef WASMTIME_EQREF_H
8#define WASMTIME_EQREF_H
9
10#include <wasmtime/conf.h>
11
12#ifdef WASMTIME_FEATURE_GC
13
14#include <wasmtime/val.h>
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
21static inline void wasmtime_eqref_set_null(wasmtime_eqref_t *ref) {
22 ref->store_id = 0;
23}
24
26static inline bool wasmtime_eqref_is_null(const wasmtime_eqref_t *ref) {
27 return ref->store_id == 0;
28}
29
35WASM_API_EXTERN void wasmtime_eqref_clone(const wasmtime_eqref_t *eqref,
36 wasmtime_eqref_t *out);
37
44WASM_API_EXTERN void wasmtime_eqref_unroot(wasmtime_eqref_t *ref);
45
52WASM_API_EXTERN void wasmtime_eqref_to_anyref(const wasmtime_eqref_t *eqref,
54
63WASM_API_EXTERN void wasmtime_eqref_from_i31(wasmtime_context_t *context,
64 uint32_t i31val,
65 wasmtime_eqref_t *out);
66
73WASM_API_EXTERN bool wasmtime_eqref_is_i31(wasmtime_context_t *context,
74 const wasmtime_eqref_t *eqref);
75
85WASM_API_EXTERN bool wasmtime_eqref_i31_get_u(wasmtime_context_t *context,
86 const wasmtime_eqref_t *eqref,
87 uint32_t *dst);
88
98WASM_API_EXTERN bool wasmtime_eqref_i31_get_s(wasmtime_context_t *context,
99 const wasmtime_eqref_t *eqref,
100 int32_t *dst);
101
107WASM_API_EXTERN bool wasmtime_eqref_is_array(wasmtime_context_t *context,
108 const wasmtime_eqref_t *eqref);
109
117WASM_API_EXTERN bool wasmtime_eqref_as_array(wasmtime_context_t *context,
118 const wasmtime_eqref_t *eqref,
120
126WASM_API_EXTERN bool wasmtime_eqref_is_struct(wasmtime_context_t *context,
127 const wasmtime_eqref_t *eqref);
128
136WASM_API_EXTERN bool wasmtime_eqref_as_struct(wasmtime_context_t *context,
137 const wasmtime_eqref_t *eqref,
139
140#ifdef __cplusplus
141} // extern "C"
142#endif
143
144#endif // WASMTIME_FEATURE_GC
145
146#endif // WASMTIME_EQREF_H
Build-time defines for how the C API was built.
WASM_API_EXTERN bool wasmtime_eqref_is_struct(wasmtime_context_t *context, const wasmtime_eqref_t *eqref)
Test whether an eqref is a structref.
WASM_API_EXTERN bool wasmtime_eqref_is_array(wasmtime_context_t *context, const wasmtime_eqref_t *eqref)
Test whether an eqref is an arrayref.
WASM_API_EXTERN void wasmtime_eqref_to_anyref(const wasmtime_eqref_t *eqref, wasmtime_anyref_t *out)
Upcast an eqref to an anyref.
WASM_API_EXTERN void wasmtime_eqref_unroot(wasmtime_eqref_t *ref)
Unroot an eqref to allow garbage collection.
WASM_API_EXTERN bool wasmtime_eqref_as_struct(wasmtime_context_t *context, const wasmtime_eqref_t *eqref, wasmtime_structref_t *out)
Downcast an eqref to a structref.
WASM_API_EXTERN bool wasmtime_eqref_i31_get_u(wasmtime_context_t *context, const wasmtime_eqref_t *eqref, uint32_t *dst)
Get the eqref's underlying i31ref value, zero extended.
WASM_API_EXTERN void wasmtime_eqref_clone(const wasmtime_eqref_t *eqref, wasmtime_eqref_t *out)
Clone an eqref, creating a new root.
WASM_API_EXTERN bool wasmtime_eqref_as_array(wasmtime_context_t *context, const wasmtime_eqref_t *eqref, wasmtime_arrayref_t *out)
Downcast an eqref to an arrayref.
WASM_API_EXTERN bool wasmtime_eqref_i31_get_s(wasmtime_context_t *context, const wasmtime_eqref_t *eqref, int32_t *dst)
Get the eqref's underlying i31ref value, sign extended.
WASM_API_EXTERN bool wasmtime_eqref_is_i31(wasmtime_context_t *context, const wasmtime_eqref_t *eqref)
Test whether this eqref is an i31ref.
WASM_API_EXTERN void wasmtime_eqref_from_i31(wasmtime_context_t *context, uint32_t i31val, wasmtime_eqref_t *out)
Create a new i31ref value.
A WebAssembly value in the any hierarchy of GC types.
Definition: val.h:77
A WebAssembly arrayref value.
Definition: val.h:210
An interior pointer into a wasmtime_store_t which is used as "context" for many functions.
A WebAssembly eqref value.
Definition: val.h:163
uint64_t store_id
Definition: val.h:166
A WebAssembly structref value.
Definition: val.h:187