Wasmtime
config.h
Go to the documentation of this file.
1
7#ifndef WASMTIME_CONFIG_H
8#define WASMTIME_CONFIG_H
9
10#include <wasm.h>
11#include <wasmtime/conf.h>
12#include <wasmtime/error.h>
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
22typedef uint8_t wasmtime_strategy_t;
23
29enum wasmtime_strategy_enum { // Strategy
33
37};
38
44typedef uint8_t wasmtime_opt_level_t;
45
51enum wasmtime_opt_level_enum { // OptLevel
59};
60
67
73enum wasmtime_profiling_strategy_enum { // ProfilingStrategy
88};
89
90#define WASMTIME_CONFIG_PROP(ret, name, ty) \
91 WASM_API_EXTERN ret wasmtime_config_##name##_set(wasm_config_t *, ty);
92
102WASMTIME_CONFIG_PROP(void, debug_info, bool)
103
104
111WASMTIME_CONFIG_PROP(void, consume_fuel, bool)
112
127WASMTIME_CONFIG_PROP(void, epoch_interruption, bool)
128
142WASMTIME_CONFIG_PROP(void, max_wasm_stack, size_t)
143
144#ifdef WASMTIME_FEATURE_THREADS
145
151WASMTIME_CONFIG_PROP(void, wasm_threads, bool)
152
153#endif // WASMTIME_FEATURE_THREADS
154
160WASMTIME_CONFIG_PROP(void, shared_memory, bool)
161
162
167WASMTIME_CONFIG_PROP(void, wasm_tail_call, bool)
168
175WASMTIME_CONFIG_PROP(void, wasm_reference_types, bool)
176
183WASMTIME_CONFIG_PROP(void, wasm_function_references, bool)
184
190WASMTIME_CONFIG_PROP(void, wasm_gc, bool)
191
198WASMTIME_CONFIG_PROP(void, wasm_simd, bool)
199
206WASMTIME_CONFIG_PROP(void, wasm_relaxed_simd, bool)
207
214WASMTIME_CONFIG_PROP(void, wasm_relaxed_simd_deterministic, bool)
215
222WASMTIME_CONFIG_PROP(void, wasm_bulk_memory, bool)
223
230WASMTIME_CONFIG_PROP(void, wasm_multi_value, bool)
231
238WASMTIME_CONFIG_PROP(void, wasm_multi_memory, bool)
239
246WASMTIME_CONFIG_PROP(void, wasm_memory64, bool)
247
254WASMTIME_CONFIG_PROP(void, wasm_wide_arithmetic, bool)
255
261WASMTIME_CONFIG_PROP(void, wasm_exceptions, bool)
262
269WASMTIME_CONFIG_PROP(void, wasm_custom_page_sizes, bool)
270
271#ifdef WASMTIME_FEATURE_COMPILER
272
279WASMTIME_CONFIG_PROP(void, wasm_stack_switching, bool)
280
281
286WASMTIME_CONFIG_PROP(void, strategy, wasmtime_strategy_t)
287
288#endif // WASMTIME_FEATURE_COMPILER
289
290#ifdef WASMTIME_FEATURE_PARALLEL_COMPILATION
291
299WASMTIME_CONFIG_PROP(void, parallel_compilation, bool)
300
301#endif // WASMTIME_FEATURE_PARALLEL_COMPILATION
302
303#ifdef WASMTIME_FEATURE_COMPILER
304
313WASMTIME_CONFIG_PROP(void, cranelift_debug_verifier, bool)
314
315
328WASMTIME_CONFIG_PROP(void, cranelift_nan_canonicalization, bool)
329
335WASMTIME_CONFIG_PROP(void, cranelift_opt_level, wasmtime_opt_level_t)
336
337#endif // WASMTIME_FEATURE_COMPILER
338
344WASMTIME_CONFIG_PROP(void, profiler, wasmtime_profiling_strategy_t)
345
346
355WASMTIME_CONFIG_PROP(void, memory_may_move, bool)
356
364WASMTIME_CONFIG_PROP(void, memory_reservation, uint64_t)
365
372WASMTIME_CONFIG_PROP(void, memory_guard_size, uint64_t)
373
381WASMTIME_CONFIG_PROP(void, memory_reservation_for_growth, uint64_t)
382
392WASMTIME_CONFIG_PROP(void, native_unwind_info, bool)
393
394#ifdef WASMTIME_FEATURE_CACHE
395
408WASM_API_EXTERN wasmtime_error_t *
410
411#endif // WASMTIME_FEATURE_CACHE
412
425WASMTIME_CONFIG_PROP(wasmtime_error_t *, target, const char *)
426
427#ifdef WASMTIME_FEATURE_COMPILER
428
439 const char *);
440
451 const char *key,
452 const char *value);
453
454#endif // WASMTIME_FEATURE_COMPILER
455
465WASMTIME_CONFIG_PROP(void, macos_use_mach_ports, bool)
466
467
478WASMTIME_CONFIG_PROP(void, signals_based_traps, bool)
479
489typedef uint8_t *(*wasmtime_memory_get_callback_t)(void *env, size_t *byte_size,
490 size_t *byte_capacity);
491
499 size_t new_size);
500
509 void *env;
515 void (*finalizer)(void *);
517
529typedef wasmtime_error_t *(*wasmtime_new_memory_callback_t)(
530 void *env, const wasm_memorytype_t *ty, size_t minimum, size_t maximum,
531 size_t reserved_size_in_bytes, size_t guard_size_in_bytes,
532 wasmtime_linear_memory_t *memory_ret);
533
543 void *env;
547 void (*finalizer)(void *);
549
563WASM_API_EXTERN void
566
584WASMTIME_CONFIG_PROP(void, memory_init_cow, bool)
585
586#ifdef WASMTIME_FEATURE_POOLING_ALLOCATOR
587
596
603
610
611#define WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(name, ty) \
612 WASM_API_EXTERN void wasmtime_pooling_allocation_config_##name##_set( \
613 wasmtime_pooling_allocation_config_t *, ty);
614
622WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(max_unused_warm_slots, uint32_t)
623
624
630WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(decommit_batch_size, size_t)
631
632#ifdef WASMTIME_FEATURE_ASYNC
640WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(async_stack_keep_resident, size_t)
641#endif
642
650WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(linear_memory_keep_resident, size_t)
651
652
659WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(table_keep_resident, size_t)
660
668WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(total_component_instances, uint32_t)
669
677WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(max_component_instance_size, size_t)
678
686WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(max_core_instances_per_component,
687 uint32_t)
688
696WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(max_memories_per_component, uint32_t)
697
705WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(max_tables_per_component, uint32_t)
706
714WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(total_memories, uint32_t)
715
722WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(total_tables, uint32_t)
723
724#ifdef WASMTIME_FEATURE_ASYNC
732WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(total_stacks, uint32_t)
733#endif
734
742WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(total_core_instances, uint32_t)
743
744
751WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(max_core_instance_size, size_t)
752
759WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(max_tables_per_module, uint32_t)
760
768WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(table_elements, size_t)
769
777WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(max_memories_per_module, uint32_t)
778
785WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(max_memory_size, size_t)
786
793WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(total_gc_heaps, uint32_t)
794
805
806#endif // WASMTIME_FEATURE_POOLING_ALLOCATOR
807
808#ifdef WASMTIME_FEATURE_COMPONENT_MODEL
809
817WASMTIME_CONFIG_PROP(void, wasm_component_model, bool)
818
819#endif // WASMTIME_FEATURE_COMPONENT_MODEL
820
821#ifdef __cplusplus
822} // extern "C"
823#endif
824
825#endif // WASMTIME_CONFIG_H
Build-time defines for how the C API was built.
struct wasmtime_memory_creator wasmtime_memory_creator_t
WASM_API_EXTERN wasmtime_error_t * wasmtime_config_cache_config_load(wasm_config_t *, const char *)
Enables Wasmtime's cache and loads configuration from the specified path.
struct wasmtime_linear_memory wasmtime_linear_memory_t
WASM_API_EXTERN void wasmtime_pooling_allocation_strategy_set(wasm_config_t *, const wasmtime_pooling_allocation_config_t *)
Sets the Wasmtime allocation strategy to use the pooling allocator. It does not take ownership of the...
uint8_t wasmtime_strategy_t
Specifier for how Wasmtime will compile code, values are in wasmtime_strategy_enum.
Definition: config.h:22
WASM_API_EXTERN wasmtime_pooling_allocation_config_t * wasmtime_pooling_allocation_config_new()
Creates a new pooling allocation configuration object. Must be deallocated with a call to wasmtime_po...
WASM_API_EXTERN void wasmtime_pooling_allocation_config_delete(wasmtime_pooling_allocation_config_t *)
Deallocates a pooling allocation configuration object created with a call to wasmtime_pooling_allocat...
WASM_API_EXTERN void wasmtime_config_cranelift_flag_enable(wasm_config_t *, const char *)
Enables a target-specific flag in Cranelift.
uint8_t wasmtime_profiling_strategy_t
Different ways wasmtime can enable profiling JIT code.
Definition: config.h:66
WASM_API_EXTERN void wasmtime_config_cranelift_flag_set(wasm_config_t *, const char *key, const char *value)
Sets a target-specific flag in Cranelift to the specified value.
wasmtime_profiling_strategy_enum
Different ways to profile JIT code.
Definition: config.h:73
@ WASMTIME_PROFILING_STRATEGY_VTUNE
Definition: config.h:83
@ WASMTIME_PROFILING_STRATEGY_PERFMAP
Definition: config.h:87
@ WASMTIME_PROFILING_STRATEGY_NONE
No profiling is enabled at runtime.
Definition: config.h:75
@ WASMTIME_PROFILING_STRATEGY_JITDUMP
Definition: config.h:78
wasmtime_strategy_enum
Different ways that Wasmtime can compile WebAssembly.
Definition: config.h:29
@ WASMTIME_STRATEGY_CRANELIFT
Definition: config.h:36
@ WASMTIME_STRATEGY_AUTO
Definition: config.h:32
uint8_t *(* wasmtime_memory_get_callback_t)(void *env, size_t *byte_size, size_t *byte_capacity)
Definition: config.h:489
wasmtime_opt_level_enum
Different ways Wasmtime can optimize generated code.
Definition: config.h:51
@ WASMTIME_OPT_LEVEL_SPEED_AND_SIZE
Definition: config.h:58
@ WASMTIME_OPT_LEVEL_NONE
Generated code will not be optimized at all.
Definition: config.h:53
@ WASMTIME_OPT_LEVEL_SPEED
Generated code will be optimized purely for speed.
Definition: config.h:55
uint8_t wasmtime_opt_level_t
Specifier of what optimization level to use for generated JIT code.
Definition: config.h:44
wasmtime_error_t *(* wasmtime_new_memory_callback_t)(void *env, const wasm_memorytype_t *ty, size_t minimum, size_t maximum, size_t reserved_size_in_bytes, size_t guard_size_in_bytes, wasmtime_linear_memory_t *memory_ret)
Definition: config.h:529
WASM_API_EXTERN void wasmtime_config_host_memory_creator_set(wasm_config_t *, wasmtime_memory_creator_t *)
wasmtime_error_t *(* wasmtime_memory_grow_callback_t)(void *env, size_t new_size)
Definition: config.h:498
struct wasmtime_pooling_allocation_config_t wasmtime_pooling_allocation_config_t
A type containing configuration options for the pooling allocator.
Definition: config.h:594
Definition and accessors of wasmtime_error_t.
Global engine configuration.
An opaque object representing the type of a memory.
Errors generated by Wasmtime.
Definition: config.h:507
wasmtime_memory_get_callback_t get_memory
Callback to get the memory and size of this LinearMemory.
Definition: config.h:511
void * env
User provided value to be passed to get_memory and grow_memory.
Definition: config.h:509
wasmtime_memory_grow_callback_t grow_memory
Callback to request growing the memory.
Definition: config.h:513
Definition: config.h:541
void(* finalizer)(void *)
An optional finalizer for env.
Definition: config.h:547
wasmtime_new_memory_callback_t new_memory
The callback to create new memory, must be thread safe.
Definition: config.h:545
void * env
User provided value to be passed to new_memory.
Definition: config.h:543