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/types/val.h>
15#include <wasmtime/val.h>
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
22static inline void wasmtime_eqref_set_null(wasmtime_eqref_t *ref) {
23 ref->store_id = 0;
24}
25
27static inline bool wasmtime_eqref_is_null(const wasmtime_eqref_t *ref) {
28 return ref->store_id == 0;
29}
30
36WASM_API_EXTERN void wasmtime_eqref_clone(const wasmtime_eqref_t *eqref,
37 wasmtime_eqref_t *out);
38
45WASM_API_EXTERN void wasmtime_eqref_unroot(wasmtime_eqref_t *ref);
46
53WASM_API_EXTERN void wasmtime_eqref_to_anyref(const wasmtime_eqref_t *eqref,
55
64WASM_API_EXTERN void wasmtime_eqref_from_i31(wasmtime_context_t *context,
65 uint32_t i31val,
66 wasmtime_eqref_t *out);
67
74WASM_API_EXTERN bool wasmtime_eqref_is_i31(wasmtime_context_t *context,
75 const wasmtime_eqref_t *eqref);
76
86WASM_API_EXTERN bool wasmtime_eqref_i31_get_u(wasmtime_context_t *context,
87 const wasmtime_eqref_t *eqref,
88 uint32_t *dst);
89
99WASM_API_EXTERN bool wasmtime_eqref_i31_get_s(wasmtime_context_t *context,
100 const wasmtime_eqref_t *eqref,
101 int32_t *dst);
102
108WASM_API_EXTERN bool wasmtime_eqref_is_array(wasmtime_context_t *context,
109 const wasmtime_eqref_t *eqref);
110
118WASM_API_EXTERN bool wasmtime_eqref_as_array(wasmtime_context_t *context,
119 const wasmtime_eqref_t *eqref,
121
127WASM_API_EXTERN bool wasmtime_eqref_is_struct(wasmtime_context_t *context,
128 const wasmtime_eqref_t *eqref);
129
137WASM_API_EXTERN bool wasmtime_eqref_as_struct(wasmtime_context_t *context,
138 const wasmtime_eqref_t *eqref,
140
148WASM_API_EXTERN bool wasmtime_eqref_type(wasmtime_context_t *context,
149 const wasmtime_eqref_t *eqref,
151
152#ifdef __cplusplus
153} // extern "C"
154#endif
155
156#endif // WASMTIME_FEATURE_GC
157
158#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_type(wasmtime_context_t *context, const wasmtime_eqref_t *eqref, wasmtime_heaptype_t *out)
Returns the type of the specified eqref.
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 heap type.
Definition: types/val.h:76
A WebAssembly structref value.
Definition: val.h:187