1515extern "C" {
1616#endif
1717
18+
1819/**
1920 * \typedef wasmtime_anyref_t
2021 * \brief Convenience alias for #wasmtime_anyref
@@ -52,6 +53,7 @@ typedef struct wasmtime_anyref {
5253 void * __private3 ;
5354} wasmtime_anyref_t ;
5455
56+ #ifdef WASMTIME_FEATURE_GC
5557/// \brief Helper function to initialize the `ref` provided to a null anyref
5658/// value.
5759static inline void wasmtime_anyref_set_null (wasmtime_anyref_t * ref ) {
@@ -67,6 +69,7 @@ static inline bool wasmtime_anyref_is_null(const wasmtime_anyref_t *ref) {
6769 return ref -> store_id == 0 ;
6870}
6971
72+
7073/**
7174 * \brief Creates a new reference pointing to the same data that `anyref`
7275 * points to (depending on the configured collector this might increase a
@@ -92,7 +95,6 @@ WASM_API_EXTERN void wasmtime_anyref_clone(const wasmtime_anyref_t *anyref,
9295 */
9396WASM_API_EXTERN void wasmtime_anyref_unroot (wasmtime_anyref_t * ref );
9497
95- #ifdef WASMTIME_FEATURE_GC
9698/**
9799 * \brief Converts a raw `anyref` value coming from #wasmtime_val_raw_t into
98100 * a #wasmtime_anyref_t.
@@ -103,9 +105,7 @@ WASM_API_EXTERN void wasmtime_anyref_unroot(wasmtime_anyref_t *ref);
103105WASM_API_EXTERN void wasmtime_anyref_from_raw (wasmtime_context_t * context ,
104106 uint32_t raw ,
105107 wasmtime_anyref_t * out );
106- #endif // WASMTIME_FEATURE_GC
107108
108- #ifdef WASMTIME_FEATURE_GC
109109/**
110110 * \brief Converts a #wasmtime_anyref_t to a raw value suitable for storing
111111 * into a #wasmtime_val_raw_t.
@@ -118,9 +118,7 @@ WASM_API_EXTERN void wasmtime_anyref_from_raw(wasmtime_context_t *context,
118118 */
119119WASM_API_EXTERN uint32_t wasmtime_anyref_to_raw (wasmtime_context_t * context ,
120120 const wasmtime_anyref_t * ref );
121- #endif // WASMTIME_FEATURE_GC
122121
123- #ifdef WASMTIME_FEATURE_GC
124122/**
125123 * \brief Create a new `i31ref` value.
126124 *
@@ -132,10 +130,7 @@ WASM_API_EXTERN uint32_t wasmtime_anyref_to_raw(wasmtime_context_t *context,
132130WASM_API_EXTERN void wasmtime_anyref_from_i31 (wasmtime_context_t * context ,
133131 uint32_t i31val ,
134132 wasmtime_anyref_t * out );
135- #endif // WASMTIME_FEATURE_GC
136-
137133
138- #ifdef WASMTIME_FEATURE_GC
139134/**
140135 * \brief Get the `anyref`'s underlying `i31ref` value, zero extended, if any.
141136 *
@@ -148,9 +143,7 @@ WASM_API_EXTERN void wasmtime_anyref_from_i31(wasmtime_context_t *context,
148143WASM_API_EXTERN bool wasmtime_anyref_i31_get_u (wasmtime_context_t * context ,
149144 const wasmtime_anyref_t * anyref ,
150145 uint32_t * dst );
151- #endif // WASMTIME_FEATURE_GC
152146
153- #ifdef WASMTIME_FEATURE_GC
154147/**
155148 * \brief Get the `anyref`'s underlying `i31ref` value, sign extended, if any.
156149 *
@@ -163,7 +156,6 @@ WASM_API_EXTERN bool wasmtime_anyref_i31_get_u(wasmtime_context_t *context,
163156WASM_API_EXTERN bool wasmtime_anyref_i31_get_s (wasmtime_context_t * context ,
164157 const wasmtime_anyref_t * anyref ,
165158 int32_t * dst );
166- #endif // WASMTIME_FEATURE_GC
167159
168160/**
169161 * \typedef wasmtime_externref_t
@@ -186,6 +178,8 @@ WASM_API_EXTERN bool wasmtime_anyref_i31_get_s(wasmtime_context_t *context,
186178 * `wasmtime_externref_set_null`. Null can be tested for with the
187179 * `wasmtime_externref_is_null` function.
188180 */
181+ #endif // WASMTIME_FEATURE_GC
182+
189183typedef struct wasmtime_externref {
190184 /// Internal metadata tracking within the store, embedders should not
191185 /// configure or modify these fields.
@@ -198,6 +192,7 @@ typedef struct wasmtime_externref {
198192 void * __private3 ;
199193} wasmtime_externref_t ;
200194
195+ #ifdef WASMTIME_FEATURE_GC
201196/// \brief Helper function to initialize the `ref` provided to a null externref
202197/// value.
203198static inline void wasmtime_externref_set_null (wasmtime_externref_t * ref ) {
@@ -213,7 +208,6 @@ static inline bool wasmtime_externref_is_null(const wasmtime_externref_t *ref) {
213208 return ref -> store_id == 0 ;
214209}
215210
216- #ifdef WASMTIME_FEATURE_GC
217211/**
218212 * \brief Create a new `externref` value.
219213 *
@@ -241,10 +235,7 @@ WASM_API_EXTERN bool wasmtime_externref_new(wasmtime_context_t *context,
241235 void * data ,
242236 void (* finalizer )(void * ),
243237 wasmtime_externref_t * out );
244- #endif // WASMTIME_FEATURE_GC
245-
246238
247- #ifdef WASMTIME_FEATURE_GC
248239/**
249240 * \brief Get an `externref`'s wrapped data
250241 *
@@ -253,7 +244,6 @@ WASM_API_EXTERN bool wasmtime_externref_new(wasmtime_context_t *context,
253244 */
254245WASM_API_EXTERN void * wasmtime_externref_data (wasmtime_context_t * context ,
255246 const wasmtime_externref_t * data );
256- #endif // WASMTIME_FEATURE_GC
257247
258248/**
259249 * \brief Creates a new reference pointing to the same data that `ref` points
@@ -280,7 +270,6 @@ WASM_API_EXTERN void wasmtime_externref_clone(const wasmtime_externref_t *ref,
280270 */
281271WASM_API_EXTERN void wasmtime_externref_unroot (wasmtime_externref_t * ref );
282272
283- #ifdef WASMTIME_FEATURE_GC
284273/**
285274 * \brief Converts a raw `externref` value coming from #wasmtime_val_raw_t into
286275 * a #wasmtime_externref_t.
@@ -291,9 +280,7 @@ WASM_API_EXTERN void wasmtime_externref_unroot(wasmtime_externref_t *ref);
291280WASM_API_EXTERN void wasmtime_externref_from_raw (wasmtime_context_t * context ,
292281 uint32_t raw ,
293282 wasmtime_externref_t * out );
294- #endif // WASMTIME_FEATURE_GC
295283
296- #ifdef WASMTIME_FEATURE_GC
297284/**
298285 * \brief Converts a #wasmtime_externref_t to a raw value suitable for storing
299286 * into a #wasmtime_val_raw_t.
@@ -334,6 +321,7 @@ typedef uint8_t wasmtime_valkind_t;
334321/// stored in little-endian order.
335322typedef uint8_t wasmtime_v128 [16 ];
336323
324+
337325/**
338326 * \typedef wasmtime_valunion_t
339327 * \brief Convenience alias for #wasmtime_valunion
0 commit comments