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
40 //
44};
45
51typedef uint8_t wasmtime_opt_level_t;
52
58enum wasmtime_opt_level_enum { // OptLevel
66};
67
74
80enum wasmtime_profiling_strategy_enum { // ProfilingStrategy
95};
96
103
109enum wasmtime_regalloc_algorithm_enum { // RegallocAlgorithm
128};
129
130#define WASMTIME_CONFIG_PROP(ret, name, ty) \
131 WASM_API_EXTERN ret wasmtime_config_##name##_set(wasm_config_t *, ty);
132
142WASMTIME_CONFIG_PROP(void, debug_info, bool)
143
144
151WASMTIME_CONFIG_PROP(void, consume_fuel, bool)
152
167WASMTIME_CONFIG_PROP(void, epoch_interruption, bool)
168
182WASMTIME_CONFIG_PROP(void, max_wasm_stack, size_t)
183
184#ifdef WASMTIME_FEATURE_THREADS
185
191WASMTIME_CONFIG_PROP(void, wasm_threads, bool)
192
193#endif // WASMTIME_FEATURE_THREADS
194
200WASMTIME_CONFIG_PROP(void, shared_memory, bool)
201
202
207WASMTIME_CONFIG_PROP(void, wasm_tail_call, bool)
208
209#ifdef WASMTIME_FEATURE_GC
210
217WASMTIME_CONFIG_PROP(void, wasm_reference_types, bool)
218
219
225WASMTIME_CONFIG_PROP(void, wasm_function_references, bool)
226
232WASMTIME_CONFIG_PROP(void, wasm_gc, bool)
233
234#endif // WASMTIME_FEATURE_GC
235
242WASMTIME_CONFIG_PROP(void, gc_support, bool)
243
244
250WASMTIME_CONFIG_PROP(void, wasm_simd, bool)
251
258WASMTIME_CONFIG_PROP(void, wasm_relaxed_simd, bool)
259
266WASMTIME_CONFIG_PROP(void, wasm_relaxed_simd_deterministic, bool)
267
274WASMTIME_CONFIG_PROP(void, wasm_bulk_memory, bool)
275
282WASMTIME_CONFIG_PROP(void, wasm_multi_value, bool)
283
290WASMTIME_CONFIG_PROP(void, wasm_multi_memory, bool)
291
298WASMTIME_CONFIG_PROP(void, wasm_memory64, bool)
299
306WASMTIME_CONFIG_PROP(void, wasm_wide_arithmetic, bool)
307
308#ifdef WASMTIME_FEATURE_GC
309
315WASMTIME_CONFIG_PROP(void, wasm_exceptions, bool)
316
317#endif // WASMTIME_FEATURE_GC
318
325WASMTIME_CONFIG_PROP(void, wasm_custom_page_sizes, bool)
326
327#ifdef WASMTIME_FEATURE_COMPILER
328
335WASMTIME_CONFIG_PROP(void, wasm_stack_switching, bool)
336
337
342WASMTIME_CONFIG_PROP(void, strategy, wasmtime_strategy_t)
343
344#endif // WASMTIME_FEATURE_COMPILER
345
346#ifdef WASMTIME_FEATURE_PARALLEL_COMPILATION
347
355WASMTIME_CONFIG_PROP(void, parallel_compilation, bool)
356
357#endif // WASMTIME_FEATURE_PARALLEL_COMPILATION
358
359#ifdef WASMTIME_FEATURE_COMPILER
360
369WASMTIME_CONFIG_PROP(void, cranelift_debug_verifier, bool)
370
371
384WASMTIME_CONFIG_PROP(void, cranelift_nan_canonicalization, bool)
385
391WASMTIME_CONFIG_PROP(void, cranelift_opt_level, wasmtime_opt_level_t)
392
399WASMTIME_CONFIG_PROP(void, cranelift_regalloc_algorithm,
401
402#endif // WASMTIME_FEATURE_COMPILER
403
409WASMTIME_CONFIG_PROP(void, profiler, wasmtime_profiling_strategy_t)
410
411
420WASMTIME_CONFIG_PROP(void, memory_may_move, bool)
421
429WASMTIME_CONFIG_PROP(void, memory_reservation, uint64_t)
430
437WASMTIME_CONFIG_PROP(void, memory_guard_size, uint64_t)
438
446WASMTIME_CONFIG_PROP(void, memory_reservation_for_growth, uint64_t)
447
457WASMTIME_CONFIG_PROP(void, native_unwind_info, bool)
458
459#ifdef WASMTIME_FEATURE_CACHE
460
473WASM_API_EXTERN wasmtime_error_t *
475
476#endif // WASMTIME_FEATURE_CACHE
477
490WASMTIME_CONFIG_PROP(wasmtime_error_t *, target, const char *)
491
492#ifdef WASMTIME_FEATURE_COMPILER
493
504 const char *);
505
516 const char *key,
517 const char *value);
518
519#endif // WASMTIME_FEATURE_COMPILER
520
530WASMTIME_CONFIG_PROP(void, macos_use_mach_ports, bool)
531
532
543WASMTIME_CONFIG_PROP(void, signals_based_traps, bool)
544
554typedef uint8_t *(*wasmtime_memory_get_callback_t)(void *env, size_t *byte_size,
555 size_t *byte_capacity);
556
564 size_t new_size);
565
574 void *env;
580 void (*finalizer)(void *);
582
594typedef wasmtime_error_t *(*wasmtime_new_memory_callback_t)(
595 void *env, const wasm_memorytype_t *ty, size_t minimum, size_t maximum,
596 size_t reserved_size_in_bytes, size_t guard_size_in_bytes,
597 wasmtime_linear_memory_t *memory_ret);
598
608 void *env;
612 void (*finalizer)(void *);
614
628WASM_API_EXTERN void
631
649WASMTIME_CONFIG_PROP(void, memory_init_cow, bool)
650
651#ifdef WASMTIME_FEATURE_POOLING_ALLOCATOR
652
661
668
675
676#define WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(name, ty) \
677 WASM_API_EXTERN void wasmtime_pooling_allocation_config_##name##_set( \
678 wasmtime_pooling_allocation_config_t *, ty);
679
687WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(max_unused_warm_slots, uint32_t)
688
689
695WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(decommit_batch_size, size_t)
696
697#ifdef WASMTIME_FEATURE_ASYNC
705WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(async_stack_keep_resident, size_t)
706#endif
707
715WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(linear_memory_keep_resident, size_t)
716
717
724WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(table_keep_resident, size_t)
725
733WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(total_component_instances, uint32_t)
734
742WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(max_component_instance_size, size_t)
743
751WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(max_core_instances_per_component,
752 uint32_t)
753
761WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(max_memories_per_component, uint32_t)
762
770WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(max_tables_per_component, uint32_t)
771
779WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(total_memories, uint32_t)
780
787WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(total_tables, uint32_t)
788
789#ifdef WASMTIME_FEATURE_ASYNC
797WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(total_stacks, uint32_t)
798#endif
799
807WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(total_core_instances, uint32_t)
808
809
816WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(max_core_instance_size, size_t)
817
824WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(max_tables_per_module, uint32_t)
825
833WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(table_elements, size_t)
834
842WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(max_memories_per_module, uint32_t)
843
850WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(max_memory_size, size_t)
851
858WASMTIME_POOLING_ALLOCATION_CONFIG_PROP(total_gc_heaps, uint32_t)
859
870
871#endif // WASMTIME_FEATURE_POOLING_ALLOCATOR
872
873#ifdef WASMTIME_FEATURE_COMPONENT_MODEL
874
882WASMTIME_CONFIG_PROP(void, wasm_component_model, bool)
883
884
891WASMTIME_CONFIG_PROP(void, concurrency_support, bool)
892
900WASMTIME_CONFIG_PROP(void, wasm_component_model_map, bool)
901
902#endif // WASMTIME_FEATURE_COMPONENT_MODEL
903
904#ifdef WASMTIME_FEATURE_COMPONENT_MODEL_ASYNC
905
913WASMTIME_CONFIG_PROP(void, wasm_component_model_async, bool)
914
915
922WASMTIME_CONFIG_PROP(void, wasm_component_model_more_async_builtins, bool)
923
931WASMTIME_CONFIG_PROP(void, wasm_component_model_async_stackful, bool)
932
933#endif // WASMTIME_FEATURE_COMPONENT_MODEL_ASYNC
934
935#ifdef __cplusplus
936} // extern "C"
937#endif
938
939#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:73
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_regalloc_algorithm_enum
Different ways to allocate registers.
Definition: config.h:109
@ WASMTIME_REGALLOC_BACKTRACKING
Definition: config.h:116
@ WASMTIME_REGALLOC_SINGLE_PASS
Definition: config.h:127
wasmtime_profiling_strategy_enum
Different ways to profile JIT code.
Definition: config.h:80
@ WASMTIME_PROFILING_STRATEGY_VTUNE
Definition: config.h:90
@ WASMTIME_PROFILING_STRATEGY_PERFMAP
Definition: config.h:94
@ WASMTIME_PROFILING_STRATEGY_NONE
No profiling is enabled at runtime.
Definition: config.h:82
@ WASMTIME_PROFILING_STRATEGY_JITDUMP
Definition: config.h:85
wasmtime_strategy_enum
Different ways that Wasmtime can compile WebAssembly.
Definition: config.h:29
@ WASMTIME_STRATEGY_CRANELIFT
Definition: config.h:36
@ WASMTIME_STRATEGY_WINCH
Definition: config.h:43
@ 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:554
wasmtime_opt_level_enum
Different ways Wasmtime can optimize generated code.
Definition: config.h:58
@ WASMTIME_OPT_LEVEL_SPEED_AND_SIZE
Definition: config.h:65
@ WASMTIME_OPT_LEVEL_NONE
Generated code will not be optimized at all.
Definition: config.h:60
@ WASMTIME_OPT_LEVEL_SPEED
Generated code will be optimized purely for speed.
Definition: config.h:62
uint8_t wasmtime_opt_level_t
Specifier of what optimization level to use for generated JIT code.
Definition: config.h:51
uint8_t wasmtime_regalloc_algorithm_t
Different ways Cranelift can allocate registers.
Definition: config.h:102
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:594
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:563
struct wasmtime_pooling_allocation_config_t wasmtime_pooling_allocation_config_t
A type containing configuration options for the pooling allocator.
Definition: config.h:659
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:572
wasmtime_memory_get_callback_t get_memory
Callback to get the memory and size of this LinearMemory.
Definition: config.h:576
void * env
User provided value to be passed to get_memory and grow_memory.
Definition: config.h:574
wasmtime_memory_grow_callback_t grow_memory
Callback to request growing the memory.
Definition: config.h:578
Definition: config.h:606
void(* finalizer)(void *)
An optional finalizer for env.
Definition: config.h:612
wasmtime_new_memory_callback_t new_memory
The callback to create new memory, must be thread safe.
Definition: config.h:610
void * env
User provided value to be passed to new_memory.
Definition: config.h:608