Wasmtime
config.hh
Go to the documentation of this file.
1
5#ifndef WASMTIME_CONFIG_HH
6#define WASMTIME_CONFIG_HH
7
8#include <wasmtime/conf.h>
9#include <wasmtime/config.h>
10#include <wasmtime/error.hh>
11#include <wasmtime/helpers.hh>
13
14namespace wasmtime {
15
17enum class Strategy {
24};
25
27enum class OptLevel {
34};
35
46};
47
70};
71
75enum class MemoryKind {
90};
91
98
99public:
101 explicit MemoryRequest(const wasmtime_memory_request_t *req) : req(req) {}
103 MemoryType::Ref ty() const { return MemoryType::Ref(req->ty); }
105 size_t minimum() const { return req->minimum; }
107 size_t maximum() const { return req->maximum; }
109 size_t reserved_size_in_bytes() const { return req->reserved_size_in_bytes; }
111 size_t guard_size_in_bytes() const { return req->guard_size_in_bytes; }
113 MemoryKind kind() const { return static_cast<MemoryKind>(req->kind); }
114};
115
116#ifdef WASMTIME_FEATURE_POOLING_ALLOCATOR
124 WASMTIME_OWN_WRAPPER(PoolAllocationConfig,
125 wasmtime_pooling_allocation_config);
126
128
133 void max_unused_warm_slots(uint32_t max) {
135 max);
136 }
137
141 void decommit_batch_size(size_t batch_size) {
143 batch_size);
144 }
145
146#ifdef WASMTIME_FEATURE_ASYNC
151 void async_stack_keep_resident(size_t size) {
153 size);
154 }
155#endif // WASMTIME_FEATURE_ASYNC
156
161 void linear_memory_keep_resident(size_t size) {
163 ptr.get(), size);
164 }
165
170 void table_keep_resident(size_t size) {
172 }
173
178 void total_component_instances(uint32_t count) {
180 count);
181 }
182
187 void max_component_instance_size(size_t size) {
189 ptr.get(), size);
190 }
191
196 void max_core_instances_per_component(uint32_t count) {
198 ptr.get(), count);
199 }
200
205 void max_memories_per_component(uint32_t count) {
207 count);
208 }
209
214 void max_tables_per_component(uint32_t count) {
216 count);
217 }
218
223 void total_memories(uint32_t count) {
225 }
226
231 void total_tables(uint32_t count) {
233 }
234
235#ifdef WASMTIME_FEATURE_ASYNC
240 void total_stacks(uint32_t count) {
242 }
243#endif // WASMTIME_FEATURE_ASYNC
244
249 void total_core_instances(uint32_t count) {
251 count);
252 }
253
258 void max_core_instance_size(size_t size) {
260 size);
261 }
262
267 void max_tables_per_module(uint32_t tables) {
269 tables);
270 }
271
276 void table_elements(size_t elements) {
278 }
279
284 void max_memories_per_module(uint32_t memories) {
286 memories);
287 }
288
293 void max_memory_size(size_t bytes) {
295 }
296
301 void total_gc_heaps(uint32_t count) {
303 }
304};
305#endif // WASMTIME_FEATURE_POOLING_ALLOCATOR
306
316class Config {
317 WASMTIME_OWN_WRAPPER(Config, wasm_config);
318
320 Config() : ptr(wasm_config_new()) {}
321
326 void debug_info(bool enable) {
327 wasmtime_config_debug_info_set(ptr.get(), enable);
328 }
329
334 void epoch_interruption(bool enable) {
336 }
337
342 void consume_fuel(bool enable) {
343 wasmtime_config_consume_fuel_set(ptr.get(), enable);
344 }
345
349 void max_wasm_stack(size_t stack) {
350 wasmtime_config_max_wasm_stack_set(ptr.get(), stack);
351 }
352
353#ifdef WASMTIME_FEATURE_THREADS
357 void wasm_threads(bool enable) {
358 wasmtime_config_wasm_threads_set(ptr.get(), enable);
359 }
360#endif // WASMTIME_FEATURE_THREADS
361
365 void shared_memory(bool enable) {
366 wasmtime_config_shared_memory_set(ptr.get(), enable);
367 }
368
372 void wasm_tail_call(bool enable) {
373 wasmtime_config_wasm_tail_call_set(ptr.get(), enable);
374 }
375
376#ifdef WASMTIME_FEATURE_GC
381 void wasm_reference_types(bool enable) {
383 }
384#endif // WASMTIME_FEATURE_GC
385
389 void wasm_simd(bool enable) {
390 wasmtime_config_wasm_simd_set(ptr.get(), enable);
391 }
392
396 void wasm_relaxed_simd(bool enable) {
397 wasmtime_config_wasm_relaxed_simd_set(ptr.get(), enable);
398 }
399
404 void wasm_relaxed_simd_deterministic(bool enable) {
406 }
407
411 void wasm_bulk_memory(bool enable) {
412 wasmtime_config_wasm_bulk_memory_set(ptr.get(), enable);
413 }
414
418 void wasm_multi_value(bool enable) {
419 wasmtime_config_wasm_multi_value_set(ptr.get(), enable);
420 }
421
425 void wasm_multi_memory(bool enable) {
426 wasmtime_config_wasm_multi_memory_set(ptr.get(), enable);
427 }
428
432 void wasm_memory64(bool enable) {
433 wasmtime_config_wasm_memory64_set(ptr.get(), enable);
434 }
435
440 void wasm_stack_switching(bool enable) {
442 }
443
444#ifdef WASMTIME_FEATURE_GC
449 void wasm_gc(bool enable) { wasmtime_config_wasm_gc_set(ptr.get(), enable); }
450#endif // WASMTIME_FEATURE_GC
451
452#ifdef WASMTIME_FEATURE_GC
457 void wasm_function_references(bool enable) {
459 }
460#endif // WASMTIME_FEATURE_GC
461
466 void wasm_wide_arithmetic(bool enable) {
468 }
469
470#ifdef WASMTIME_FEATURE_GC
475 void wasm_exceptions(bool enable) {
476 wasmtime_config_wasm_exceptions_set(ptr.get(), enable);
477 }
478#endif // WASMTIME_FEATURE_GC
479
484 void wasm_custom_page_sizes(bool enable) {
486 }
487
492 void wasm_compact_imports(bool enable) {
494 }
495
496#ifdef WASMTIME_FEATURE_COMPONENT_MODEL
501 void wasm_component_model(bool enable) {
503 }
504
509 void wasm_component_model_map(bool enable) {
511 }
512
517 void wasm_component_model_implements(bool enable) {
519 }
520#endif // WASMTIME_FEATURE_COMPONENT_MODEL
521
522#ifdef WASMTIME_FEATURE_PARALLEL_COMPILATION
527 void parallel_compilation(bool enable) {
529 }
530#endif // WASMTIME_FEATURE_PARALLEL_COMPILATION
531
532#ifdef WASMTIME_FEATURE_COMPILER
536 void strategy(Strategy strategy) {
538 static_cast<wasmtime_strategy_t>(strategy));
539 }
540
544 void cranelift_debug_verifier(bool enable) {
546 }
547
551 void cranelift_nan_canonicalization(bool enable) {
553 }
554
558 void cranelift_opt_level(OptLevel level) {
560 ptr.get(), static_cast<wasmtime_opt_level_t>(level));
561 }
562
566 void cranelift_flag_enable(const std::string &flag) {
567 wasmtime_config_cranelift_flag_enable(ptr.get(), flag.c_str());
568 }
569
573 void cranelift_flag_set(const std::string &flag, const std::string &value) {
574 wasmtime_config_cranelift_flag_set(ptr.get(), flag.c_str(), value.c_str());
575 }
576
580 void cranelift_regalloc_algorithm(RegallocAlgorithm algo) {
582 ptr.get(), static_cast<wasmtime_regalloc_algorithm_t>(algo));
583 }
584#endif // WASMTIME_FEATURE_COMPILER
585
589 void profiler(ProfilingStrategy profiler) {
591 ptr.get(), static_cast<wasmtime_profiling_strategy_t>(profiler));
592 }
593
597 void memory_reservation(uint64_t size) {
599 }
600
605 void memory_reservation_for_growth(uint64_t size) {
607 }
608
612 void memory_guard_size(uint64_t size) {
614 }
615
620 void memory_may_move(bool enable) {
621 wasmtime_config_memory_may_move_set(ptr.get(), enable);
622 }
623
627 void memory_init_cow(bool enable) {
628 wasmtime_config_memory_init_cow_set(ptr.get(), enable);
629 }
630
634 void native_unwind_info(bool enable) {
636 }
637
641 void macos_use_mach_ports(bool enable) {
643 }
644
647 void signals_based_traps(bool enable) {
649 }
650
651#ifdef WASMTIME_FEATURE_CACHE
655 Result<std::monostate> cache_load_default() {
656 auto *error = wasmtime_config_cache_config_load(ptr.get(), nullptr);
657 if (error != nullptr) {
658 return Error(error);
659 }
660 return std::monostate();
661 }
662
666 Result<std::monostate> cache_load(const std::string &path) {
667 auto *error = wasmtime_config_cache_config_load(ptr.get(), path.c_str());
668 if (error != nullptr) {
669 return Error(error);
670 }
671 return std::monostate();
672 }
673#endif // WASMTIME_FEATURE_CACHE
674
675private:
676 template <typename T> static void raw_finalize(void *env) {
677 std::unique_ptr<T> ptr(reinterpret_cast<T *>(env));
678 }
679
680 template <typename M>
681 static uint8_t *raw_get_memory(void *env, size_t *byte_size,
682 size_t *byte_capacity) {
683 M *memory = reinterpret_cast<M *>(env);
684 return memory->get_memory(byte_size, byte_capacity);
685 }
686
687 template <typename M>
688 static wasmtime_error_t *raw_grow_memory(void *env, size_t new_size) {
689 M *memory = reinterpret_cast<M *>(env);
690 Result<std::monostate> result = memory->grow_memory(new_size);
691 if (!result)
692 return result.err().capi_release();
693 return nullptr;
694 }
695
696 template <typename T>
697 static wasmtime_error_t *
698 raw_new_memory(void *env, const wasmtime_memory_request_t *request,
699 wasmtime_linear_memory_t *memory_ret) {
700 using Memory = typename T::Memory;
701 T *creator = reinterpret_cast<T *>(env);
702 Result<Memory> result = creator->new_memory(MemoryRequest(request));
703 if (!result) {
704 return result.err().capi_release();
705 }
706 Memory memory = result.unwrap();
707 memory_ret->env = std::make_unique<Memory>(memory).release();
708 memory_ret->finalizer = raw_finalize<Memory>;
709 memory_ret->get_memory = raw_get_memory<Memory>;
710 memory_ret->grow_memory = raw_grow_memory<Memory>;
711 return nullptr;
712 }
713
714public:
720 template <typename T> void host_memory_creator(T creator) {
721 wasmtime_memory_creator_t config = {0};
722 config.env = std::make_unique<T>(creator).release();
723 config.finalizer = raw_finalize<T>;
724 config.new_memory = raw_new_memory<T>;
725 wasmtime_config_host_memory_creator_set(ptr.get(), &config);
726 }
727
728#ifdef WASMTIME_FEATURE_POOLING_ALLOCATOR
733 wasmtime_pooling_allocation_strategy_set(ptr.get(), config.capi());
734 }
735#endif // WASMTIME_FEATURE_POOLING_ALLOCATOR
736
737#ifdef WASMTIME_FEATURE_COMPONENT_MODEL
745 void concurrency_support(bool enable) {
747 }
748#endif // WASMTIME_FEATURE_COMPONENT_MODEL
749
750#ifdef WASMTIME_FEATURE_COMPONENT_MODEL_ASYNC
756 void wasm_component_model_async(bool enable) {
758 }
759
768 enable);
769 }
770
779 }
780#endif // WASMTIME_FEATURE_COMPONENT_MODEL_ASYNC
781};
782
783} // namespace wasmtime
784
785#endif // WASMTIME_CONFIG_HH
Configuration for Wasmtime.
Definition: config.hh:316
void host_memory_creator(T creator)
Configures a custom memory creator for this configuration and eventual Engine.
Definition: config.hh:720
void wasm_component_model_async_stackful(bool enable)
Configures whether stackful coroutine support is enabled for async components.
Definition: config.hh:777
void concurrency_support(bool enable)
Specifies whether support for concurrent execution of WebAssembly is supported within this store.
Definition: config.hh:745
void wasm_component_model_more_async_builtins(bool enable)
Configures whether async built-in intrinsics are enabled for the component model.
Definition: config.hh:766
void pooling_allocation_strategy(const PoolAllocationConfig &config)
Enables and configures the pooling allocation strategy.
Definition: config.hh:732
void wasm_component_model_async(bool enable)
Configures whether component-model async support is enabled.
Definition: config.hh:756
Errors coming from Wasmtime.
Definition: error.hh:26
Parameters of a request to create a new linear memory, passed to a custom memory creator....
Definition: config.hh:96
size_t reserved_size_in_bytes() const
Required virtual memory reservation in bytes.
Definition: config.hh:109
size_t maximum() const
Maximum size in bytes, SIZE_MAX if unbounded.
Definition: config.hh:107
MemoryRequest(const wasmtime_memory_request_t *req)
Wraps a raw C request.
Definition: config.hh:101
MemoryKind kind() const
The kind of memory being created.
Definition: config.hh:113
MemoryType::Ref ty() const
The type of memory being created.
Definition: config.hh:103
size_t guard_size_in_bytes() const
Required unmapped guard region after the allocation, in bytes.
Definition: config.hh:111
size_t minimum() const
Minimum size in bytes.
Definition: config.hh:105
Non-owning reference to a MemoryType, must not be used after the original owner has been deleted.
Definition: types/memory.hh:34
A WebAssembly linear memory.
Definition: memory.hh:27
Pool allocation configuration for Wasmtime.
Definition: config.hh:123
Fallible result type used for Wasmtime.
Definition: error.hh:70
E && err()
Returns the error, if present, aborts if this is not an error.
Definition: error.hh:84
T unwrap()
Returns the success, if present, aborts if this is an error.
Definition: error.hh:104
Build-time defines for how the C API was built.
Wasmtime-specific extensions to wasm_config_t.
WASM_API_EXTERN void wasmtime_pooling_allocation_config_total_gc_heaps_set(wasmtime_pooling_allocation_config_t *, uint32_t)
The maximum number of concurrent GC heaps supported (default is 1000).
@ WASMTIME_MEMORY_KIND_GC_HEAP
Definition: config.h:628
@ WASMTIME_MEMORY_KIND_LINEAR_MEMORY
A standard WebAssembly linear memory (module or host).
Definition: config.h:613
WASM_API_EXTERN void wasmtime_pooling_allocation_config_total_component_instances_set(wasmtime_pooling_allocation_config_t *, uint32_t)
The maximum number of concurrent component instances supported (default is 1000).
WASM_API_EXTERN void wasmtime_pooling_allocation_config_table_keep_resident_set(wasmtime_pooling_allocation_config_t *, size_t)
How much memory, in bytes, to keep resident for each table after deallocation.
WASM_API_EXTERN void wasmtime_config_wasm_compact_imports_set(wasm_config_t *, bool)
Configures whether the WebAssembly compact imports proposal is enabled.
WASM_API_EXTERN void wasmtime_config_shared_memory_set(wasm_config_t *, bool)
Configures whether shared memories can be created.
WASM_API_EXTERN void wasmtime_config_wasm_tail_call_set(wasm_config_t *, bool)
Configures whether the WebAssembly tail call proposal is enabled.
WASM_API_EXTERN void wasmtime_config_max_wasm_stack_set(wasm_config_t *, size_t)
Configures the maximum stack size, in bytes, that JIT code can use.
WASM_API_EXTERN void wasmtime_config_wasm_multi_memory_set(wasm_config_t *, bool)
Configures whether the WebAssembly multi-memory proposal is enabled.
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.
WASM_API_EXTERN void wasmtime_pooling_allocation_config_max_core_instances_per_component_set(wasmtime_pooling_allocation_config_t *, uint32_t)
The maximum number of core instances a single component may contain (default is unlimited).
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...
WASM_API_EXTERN void wasmtime_config_wasm_component_model_set(wasm_config_t *, bool)
Configures whether the WebAssembly component-model proposal will be enabled for compilation.
WASM_API_EXTERN void wasmtime_config_wasm_custom_page_sizes_set(wasm_config_t *, bool)
Configures whether the WebAssembly custom-page-sizes proposal is enabled.
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 void wasmtime_pooling_allocation_config_linear_memory_keep_resident_set(wasmtime_pooling_allocation_config_t *, size_t)
How much memory, in bytes, to keep resident for each linear memory after deallocation.
WASM_API_EXTERN void wasmtime_config_memory_reservation_set(wasm_config_t *, uint64_t)
Configures the size, in bytes, of initial memory reservation size for linear memories.
WASM_API_EXTERN void wasmtime_config_wasm_wide_arithmetic_set(wasm_config_t *, bool)
Configures whether the WebAssembly wide-arithmetic proposal is enabled.
WASM_API_EXTERN void wasmtime_pooling_allocation_config_max_tables_per_module_set(wasmtime_pooling_allocation_config_t *, uint32_t)
The maximum number of defined tables for a core module (default is 1).
WASM_API_EXTERN void wasmtime_pooling_allocation_config_max_tables_per_component_set(wasmtime_pooling_allocation_config_t *, uint32_t)
The maximum number of tables that a single component may transitively contain (default is unlimited).
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_config_cranelift_flag_enable(wasm_config_t *, const char *)
Enables a target-specific flag in Cranelift.
WASM_API_EXTERN void wasmtime_config_parallel_compilation_set(wasm_config_t *, bool)
Configure whether wasmtime should compile a module using multiple threads.
WASM_API_EXTERN void wasmtime_pooling_allocation_config_max_unused_warm_slots_set(wasmtime_pooling_allocation_config_t *, uint32_t)
Configures the maximum number of “unused warm slots” to retain in the pooling allocator.
WASM_API_EXTERN void wasmtime_config_wasm_gc_set(wasm_config_t *, bool)
Configures whether the WebAssembly GC proposal is enabled.
WASM_API_EXTERN void wasmtime_config_macos_use_mach_ports_set(wasm_config_t *, bool)
Configures whether, when on macOS, Mach ports are used for exception handling instead of traditional ...
WASM_API_EXTERN void wasmtime_config_wasm_memory64_set(wasm_config_t *, bool)
Configures whether the WebAssembly memory64 proposal is enabled.
WASM_API_EXTERN void wasmtime_pooling_allocation_config_max_memories_per_module_set(wasmtime_pooling_allocation_config_t *, uint32_t)
The maximum number of defined linear memories for a module (default is 1).
WASM_API_EXTERN void wasmtime_config_wasm_relaxed_simd_set(wasm_config_t *, bool)
Configures whether the WebAssembly relaxed SIMD proposal is enabled.
WASM_API_EXTERN void wasmtime_pooling_allocation_config_total_memories_set(wasmtime_pooling_allocation_config_t *, uint32_t)
The maximum number of concurrent Wasm linear memories supported (default is 1000).
WASM_API_EXTERN void wasmtime_config_wasm_bulk_memory_set(wasm_config_t *, bool)
Configures whether the WebAssembly bulk memory proposal is enabled.
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.
WASM_API_EXTERN void wasmtime_config_wasm_threads_set(wasm_config_t *, bool)
Configures whether the WebAssembly threading proposal is enabled.
@ WASMTIME_REGALLOC_BACKTRACKING
Definition: config.h:116
@ WASMTIME_REGALLOC_SINGLE_PASS
Definition: config.h:127
WASM_API_EXTERN void wasmtime_pooling_allocation_config_table_elements_set(wasmtime_pooling_allocation_config_t *, size_t)
The maximum table elements for any table defined in a module (default is 20000).
WASM_API_EXTERN void wasmtime_pooling_allocation_config_max_core_instance_size_set(wasmtime_pooling_allocation_config_t *, size_t)
The maximum size, in bytes, allocated for a core instance’s VMContext metadata.
WASM_API_EXTERN void wasmtime_config_strategy_set(wasm_config_t *, wasmtime_strategy_t)
Configures how JIT code will be compiled.
WASM_API_EXTERN void wasmtime_config_signals_based_traps_set(wasm_config_t *, bool)
Configures Wasmtime to not use signals-based trap handlers, for example disables SIGILL and SIGSEGV h...
@ 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
WASM_API_EXTERN void wasmtime_config_memory_guard_size_set(wasm_config_t *, uint64_t)
Configures the guard region size for linear memory.
WASM_API_EXTERN void wasmtime_config_cranelift_debug_verifier_set(wasm_config_t *, bool)
Configures whether Cranelift's debug verifier is enabled.
WASM_API_EXTERN void wasmtime_pooling_allocation_config_total_stacks_set(wasmtime_pooling_allocation_config_t *, uint32_t)
The maximum number of execution stacks allowed for asynchronous execution, when enabled (default is 1...
@ WASMTIME_STRATEGY_CRANELIFT
Definition: config.h:36
@ WASMTIME_STRATEGY_WINCH
Definition: config.h:43
@ WASMTIME_STRATEGY_AUTO
Definition: config.h:32
WASM_API_EXTERN void wasmtime_config_wasm_component_model_async_stackful_set(wasm_config_t *, bool)
Configures whether stackful coroutine support is enabled for async components.
WASM_API_EXTERN void wasmtime_pooling_allocation_config_max_memories_per_component_set(wasmtime_pooling_allocation_config_t *, uint32_t)
The maximum number of Wasm linear memories that a single component may transitively contain (default ...
WASM_API_EXTERN void wasmtime_config_cranelift_opt_level_set(wasm_config_t *, wasmtime_opt_level_t)
Configures Cranelift's optimization level for JIT code.
WASM_API_EXTERN void wasmtime_config_consume_fuel_set(wasm_config_t *, bool)
Whether or not fuel is enabled for generated code.
WASM_API_EXTERN void wasmtime_config_debug_info_set(wasm_config_t *, bool)
Configures whether DWARF debug information is constructed at runtime to describe JIT code.
WASM_API_EXTERN void wasmtime_config_wasm_relaxed_simd_deterministic_set(wasm_config_t *, bool)
Configures whether the WebAssembly relaxed SIMD proposal is in deterministic mode.
WASM_API_EXTERN void wasmtime_config_wasm_component_model_more_async_builtins_set(wasm_config_t *, bool)
Configures whether async built-in intrinsics are enabled for the component model.
WASM_API_EXTERN void wasmtime_config_wasm_exceptions_set(wasm_config_t *, bool)
Configures whether the WebAssembly exceptions proposal is enabled.
WASM_API_EXTERN void wasmtime_config_native_unwind_info_set(wasm_config_t *, bool)
Configures whether to generate native unwind information (e.g. .eh_frame on Linux).
@ 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
WASM_API_EXTERN void wasmtime_config_profiler_set(wasm_config_t *, wasmtime_profiling_strategy_t)
Configures the profiling strategy used for JIT code.
WASM_API_EXTERN void wasmtime_config_wasm_simd_set(wasm_config_t *, bool)
Configures whether the WebAssembly SIMD proposal is enabled.
WASM_API_EXTERN void wasmtime_config_epoch_interruption_set(wasm_config_t *, bool)
Whether or not epoch-based interruption is enabled for generated code.
WASM_API_EXTERN void wasmtime_config_cranelift_regalloc_algorithm_set(wasm_config_t *, wasmtime_regalloc_algorithm_t)
Configures the regalloc algorithm used by the Cranelift code generator.
WASM_API_EXTERN void wasmtime_config_cranelift_nan_canonicalization_set(wasm_config_t *, bool)
Configures whether Cranelift should perform a NaN-canonicalization pass.
WASM_API_EXTERN void wasmtime_config_wasm_stack_switching_set(wasm_config_t *, bool)
Configures whether the WebAssembly stack switching proposal is enabled.
WASM_API_EXTERN void wasmtime_config_memory_reservation_for_growth_set(wasm_config_t *, uint64_t)
Configures the size, in bytes, of the extra virtual memory space reserved for memories to grow into a...
WASM_API_EXTERN void wasmtime_config_wasm_component_model_implements_set(wasm_config_t *, bool)
Configures whether the WebAssembly component-model (implements "...") and (external-id "....
uint8_t wasmtime_regalloc_algorithm_t
Different ways Cranelift can allocate registers.
Definition: config.h:102
WASM_API_EXTERN void wasmtime_pooling_allocation_config_total_core_instances_set(wasmtime_pooling_allocation_config_t *, uint32_t)
The maximum number of concurrent core instances supported (default is 1000).
WASM_API_EXTERN void wasmtime_config_host_memory_creator_set(wasm_config_t *, wasmtime_memory_creator_t *)
WASM_API_EXTERN void wasmtime_config_wasm_component_model_async_set(wasm_config_t *, bool)
Configures whether the WebAssembly component-model async support will be enabled.
WASM_API_EXTERN void wasmtime_pooling_allocation_config_total_tables_set(wasmtime_pooling_allocation_config_t *, uint32_t)
The maximum number of concurrent tables supported (default is 1000).
WASM_API_EXTERN void wasmtime_config_wasm_function_references_set(wasm_config_t *, bool)
Configures whether the WebAssembly typed function reference types proposal is enabled.
WASM_API_EXTERN void wasmtime_pooling_allocation_config_decommit_batch_size_set(wasmtime_pooling_allocation_config_t *, size_t)
The target number of decommits to do per batch.
WASM_API_EXTERN void wasmtime_config_wasm_reference_types_set(wasm_config_t *, bool)
Configures whether the WebAssembly reference types proposal is enabled.
WASM_API_EXTERN void wasmtime_config_memory_init_cow_set(wasm_config_t *, bool)
Configures whether copy-on-write memory-mapped data is used to initialize a linear memory.
WASM_API_EXTERN void wasmtime_config_concurrency_support_set(wasm_config_t *, bool)
Specifies whether support for concurrent execution of WebAssembly is supported within this store.
WASM_API_EXTERN void wasmtime_config_wasm_component_model_map_set(wasm_config_t *, bool)
Configures whether the WebAssembly component-model map type will be enabled for compilation.
WASM_API_EXTERN void wasmtime_config_wasm_multi_value_set(wasm_config_t *, bool)
Configures whether the WebAssembly multi value proposal is enabled.
WASM_API_EXTERN void wasmtime_pooling_allocation_config_max_memory_size_set(wasmtime_pooling_allocation_config_t *, size_t)
The maximum byte size that any WebAssembly linear memory may grow to.
WASM_API_EXTERN void wasmtime_config_memory_may_move_set(wasm_config_t *, bool)
Configures whether memory_reservation is the maximal size of linear memory.
WASM_API_EXTERN void wasmtime_pooling_allocation_config_max_component_instance_size_set(wasmtime_pooling_allocation_config_t *, size_t)
The maximum size, in bytes, allocated for a component instance’s VMComponentContext metadata.
WASM_API_EXTERN void wasmtime_pooling_allocation_config_async_stack_keep_resident_set(wasmtime_pooling_allocation_config_t *, size_t)
How much memory, in bytes, to keep resident for async stacks allocated with the pooling allocator.
MemoryKind
The kind of memory a custom memory creator is asked to create.
Definition: config.hh:75
@ LinearMemory
A standard WebAssembly linear memory (module or host).
RegallocAlgorithm
Values passed to Config::cranelift_regalloc_algorithm
Definition: config.hh:49
@ Backtracking
Definition: config.hh:58
@ SinglePass
Definition: config.hh:69
Strategy
Strategies passed to Config::strategy
Definition: config.hh:17
@ Auto
Automatically selects the compilation strategy.
@ Cranelift
Requires Cranelift to be used for compilation.
@ Winch
Use winch for compilation.
OptLevel
Values passed to Config::cranelift_opt_level
Definition: config.hh:27
@ Speed
Optimize for speed.
@ None
No extra optimizations performed.
@ SpeedAndSize
Optimize for speed and generated code size.
ProfilingStrategy
Values passed to Config::profiler
Definition: config.hh:37
@ Perfmap
Profiling hooks via perfmap.
@ Vtune
Profiling hooks via VTune.
@ Jitdump
Profiling hooks via perf's jitdump.
Errors generated by Wasmtime.
Definition: config.h:588
wasmtime_memory_get_callback_t get_memory
Callback to get the memory and size of this LinearMemory.
Definition: config.h:592
void * env
User provided value to be passed to get_memory and grow_memory.
Definition: config.h:590
void(* finalizer)(void *)
An optional finalizer for env.
Definition: config.h:596
wasmtime_memory_grow_callback_t grow_memory
Callback to request growing the memory.
Definition: config.h:594
Definition: config.h:683
void(* finalizer)(void *)
An optional finalizer for env.
Definition: config.h:689
wasmtime_new_memory_callback_t new_memory
The callback to create new memory, must be thread safe.
Definition: config.h:687
void * env
User provided value to be passed to new_memory.
Definition: config.h:685
Parameters of a request to create a new linear memory.
Definition: config.h:641
size_t minimum
Minimum size of the memory, in bytes.
Definition: config.h:645
size_t maximum
Maximum size of the memory, in bytes, or SIZE_MAX if unbounded.
Definition: config.h:647
size_t reserved_size_in_bytes
Definition: config.h:650
const wasm_memorytype_t * ty
The type of memory being created.
Definition: config.h:643
wasmtime_memory_kind_t kind
The kind of memory being created, see wasmtime_memory_kind_enum.
Definition: config.h:655
size_t guard_size_in_bytes
Definition: config.h:653
wasm_config_t * wasm_config_new(void)
Creates a new empty configuration object.