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>
12
13namespace wasmtime {
14
16enum class Strategy {
21};
22
24enum class OptLevel {
31};
32
43};
44
45#ifdef WASMTIME_FEATURE_POOLING_ALLOCATOR
53 friend class Config;
54
55 struct deleter {
56 void operator()(wasmtime_pooling_allocation_config_t *p) const {
58 }
59 };
60
61 std::unique_ptr<wasmtime_pooling_allocation_config_t, deleter> ptr;
62
63public:
65
70 void max_unused_warm_slots(uint32_t max) {
72 max);
73 }
74
78 void decommit_batch_size(size_t batch_size) {
80 batch_size);
81 }
82
83#ifdef WASMTIME_FEATURE_ASYNC
88 void async_stack_keep_resident(size_t size) {
90 size);
91 }
92#endif // WASMTIME_FEATURE_ASYNC
93
98 void linear_memory_keep_resident(size_t size) {
100 ptr.get(), size);
101 }
102
107 void table_keep_resident(size_t size) {
109 }
110
115 void total_component_instances(uint32_t count) {
117 count);
118 }
119
124 void max_component_instance_size(size_t size) {
126 ptr.get(), size);
127 }
128
133 void max_core_instances_per_component(uint32_t count) {
135 ptr.get(), count);
136 }
137
142 void max_memories_per_component(uint32_t count) {
144 count);
145 }
146
151 void max_tables_per_component(uint32_t count) {
153 count);
154 }
155
160 void total_memories(uint32_t count) {
162 }
163
168 void total_tables(uint32_t count) {
170 }
171
172#ifdef WASMTIME_FEATURE_ASYNC
177 void total_stacks(uint32_t count) {
179 }
180#endif // WASMTIME_FEATURE_ASYNC
181
186 void total_core_instances(uint32_t count) {
188 count);
189 }
190
195 void max_core_instance_size(size_t size) {
197 size);
198 }
199
204 void max_tables_per_module(uint32_t tables) {
206 tables);
207 }
208
213 void table_elements(size_t elements) {
215 }
216
221 void max_memories_per_module(uint32_t memories) {
223 memories);
224 }
225
230 void max_memory_size(size_t bytes) {
232 }
233
238 void total_gc_heaps(uint32_t count) {
240 }
241};
242#endif // WASMTIME_FEATURE_POOLING_ALLOCATOR
243
253class Config {
254 friend class Engine;
255
256 struct deleter {
257 void operator()(wasm_config_t *p) const { wasm_config_delete(p); }
258 };
259
260 std::unique_ptr<wasm_config_t, deleter> ptr;
261
262public:
265
270 void debug_info(bool enable) {
271 wasmtime_config_debug_info_set(ptr.get(), enable);
272 }
273
278 void epoch_interruption(bool enable) {
280 }
281
286 void consume_fuel(bool enable) {
287 wasmtime_config_consume_fuel_set(ptr.get(), enable);
288 }
289
293 void max_wasm_stack(size_t stack) {
294 wasmtime_config_max_wasm_stack_set(ptr.get(), stack);
295 }
296
297#ifdef WASMTIME_FEATURE_THREADS
301 void wasm_threads(bool enable) {
302 wasmtime_config_wasm_threads_set(ptr.get(), enable);
303 }
304#endif // WASMTIME_FEATURE_THREADS
305
309 void wasm_tail_call(bool enable) {
310 wasmtime_config_wasm_tail_call_set(ptr.get(), enable);
311 }
312
317 void wasm_reference_types(bool enable) {
319 }
320
324 void wasm_simd(bool enable) {
325 wasmtime_config_wasm_simd_set(ptr.get(), enable);
326 }
327
331 void wasm_relaxed_simd(bool enable) {
332 wasmtime_config_wasm_relaxed_simd_set(ptr.get(), enable);
333 }
334
341 }
342
346 void wasm_bulk_memory(bool enable) {
347 wasmtime_config_wasm_bulk_memory_set(ptr.get(), enable);
348 }
349
353 void wasm_multi_value(bool enable) {
354 wasmtime_config_wasm_multi_value_set(ptr.get(), enable);
355 }
356
360 void wasm_multi_memory(bool enable) {
361 wasmtime_config_wasm_multi_memory_set(ptr.get(), enable);
362 }
363
367 void wasm_memory64(bool enable) {
368 wasmtime_config_wasm_memory64_set(ptr.get(), enable);
369 }
370
374 void wasm_gc(bool enable) {
375 wasmtime_config_wasm_gc_set(ptr.get(), enable);
376 }
377
381 void wasm_function_references(bool enable) {
383 }
384
388 void wasm_wide_arithmetic(bool enable) {
390 }
391
392#ifdef WASMTIME_FEATURE_COMPONENT_MODEL
396 void wasm_component_model(bool enable) {
398 }
399#endif // WASMTIME_FEATURE_COMPONENT_MODEL
400
401#ifdef WASMTIME_FEATURE_PARALLEL_COMPILATION
405 void parallel_compilation(bool enable) {
407 }
408#endif // WASMTIME_FEATURE_PARALLEL_COMPILATION
409
410#ifdef WASMTIME_FEATURE_COMPILER
416 static_cast<wasmtime_strategy_t>(strategy));
417 }
418
422 void cranelift_debug_verifier(bool enable) {
424 }
425
431 }
432
438 ptr.get(), static_cast<wasmtime_opt_level_t>(level));
439 }
440
444 void cranelift_flag_enable(const std::string &flag) {
445 wasmtime_config_cranelift_flag_enable(ptr.get(), flag.c_str());
446 }
447
451 void cranelift_flag_set(const std::string &flag, const std::string &value) {
452 wasmtime_config_cranelift_flag_set(ptr.get(), flag.c_str(), value.c_str());
453 }
454#endif // WASMTIME_FEATURE_COMPILER
455
461 ptr.get(), static_cast<wasmtime_profiling_strategy_t>(profiler));
462 }
463
467 void memory_reservation(size_t size) {
469 }
470
476 }
477
481 void memory_guard_size(size_t size) {
483 }
484
488 void memory_may_move(bool enable) {
489 wasmtime_config_memory_may_move_set(ptr.get(), enable);
490 }
491
495 void memory_init_cow(bool enable) {
496 wasmtime_config_memory_init_cow_set(ptr.get(), enable);
497 }
498
502 void native_unwind_info(bool enable) {
504 }
505
509 void macos_use_mach_ports(bool enable) {
511 }
512
513#ifdef WASMTIME_FEATURE_CACHE
518 auto *error = wasmtime_config_cache_config_load(ptr.get(), nullptr);
519 if (error != nullptr) {
520 return Error(error);
521 }
522 return std::monostate();
523 }
524
528 Result<std::monostate> cache_load(const std::string &path) {
529 auto *error = wasmtime_config_cache_config_load(ptr.get(), path.c_str());
530 if (error != nullptr) {
531 return Error(error);
532 }
533 return std::monostate();
534 }
535#endif // WASMTIME_FEATURE_CACHE
536
537private:
538 template <typename T>
539 static void raw_finalize(void *env) {
540 std::unique_ptr<T> ptr(reinterpret_cast<T *>(env));
541 }
542
543 template <typename M>
544 static uint8_t *raw_get_memory(void *env, size_t *byte_size, size_t *byte_capacity) {
545 M *memory = reinterpret_cast<M *>(env);
546 return memory->get_memory(byte_size, byte_capacity);
547 }
548
549 template <typename M>
550 static wasmtime_error_t *raw_grow_memory(void *env, size_t new_size) {
551 M *memory = reinterpret_cast<M *>(env);
552 Result<std::monostate> result = memory->grow_memory(new_size);
553 if (!result)
554 return result.err().release();
555 return nullptr;
556 }
557
558 template <typename T>
559 static wasmtime_error_t *raw_new_memory(
560 void *env, const wasm_memorytype_t *ty, size_t minimum, size_t maximum,
561 size_t reserved_size_in_bytes, size_t guard_size_in_bytes,
562 wasmtime_linear_memory_t *memory_ret)
563 {
564 using Memory = typename T::Memory;
565 T *creator = reinterpret_cast<T *>(env);
566 Result<Memory> result = creator->new_memory(
567 MemoryType::Ref(ty),
568 minimum,
569 maximum,
570 reserved_size_in_bytes,
571 guard_size_in_bytes);
572 if (!result) {
573 return result.err().release();
574 }
575 Memory memory = result.unwrap();
576 memory_ret->env = std::make_unique<Memory>(memory).release();
577 memory_ret->finalizer = raw_finalize<Memory>;
578 memory_ret->get_memory = raw_get_memory<Memory>;
579 memory_ret->grow_memory = raw_grow_memory<Memory>;
580 return nullptr;
581 }
582
583public:
584
590 template<typename T>
591 void host_memory_creator(T creator) {
592 wasmtime_memory_creator_t config = {0};
593 config.env = std::make_unique<T>(creator).release();
594 config.finalizer = raw_finalize<T>;
595 config.new_memory = raw_new_memory<T>;
596 wasmtime_config_host_memory_creator_set(ptr.get(), &config);
597 }
598
599
600#ifdef WASMTIME_FEATURE_POOLING_ALLOCATOR
605 wasmtime_pooling_allocation_strategy_set(ptr.get(), config.ptr.get());
606 }
607#endif // WASMTIME_FEATURE_POOLING_ALLOCATOR
608};
609
610} // namespace wasmtime
611
612#endif // WASMTIME_CONFIG_HH
Configuration for Wasmtime.
Definition: config.hh:253
void wasm_memory64(bool enable)
Configures whether the WebAssembly memory64 proposal is enabled.
Definition: config.hh:367
void memory_guard_size(size_t size)
Configures the size of memory's guard region.
Definition: config.hh:481
Result< std::monostate > cache_load(const std::string &path)
Loads cache configuration from the specified filename.
Definition: config.hh:528
void wasm_bulk_memory(bool enable)
Configures whether the WebAssembly bulk memory proposal is enabled.
Definition: config.hh:346
void host_memory_creator(T creator)
Configures a custom memory creator for this configuration and eventual Engine.
Definition: config.hh:591
void cranelift_debug_verifier(bool enable)
Configures whether cranelift's debug verifier is enabled.
Definition: config.hh:422
Config()
Creates configuration with all the default settings.
Definition: config.hh:264
void debug_info(bool enable)
Configures whether dwarf debuginfo is emitted for assisting in-process debugging.
Definition: config.hh:270
void cranelift_nan_canonicalization(bool enable)
Configures whether cranelift's nan canonicalization.
Definition: config.hh:429
void wasm_simd(bool enable)
Configures whether the WebAssembly simd proposal is enabled.
Definition: config.hh:324
void wasm_function_references(bool enable)
Configures whether the WebAssembly function references proposal will be enabled.
Definition: config.hh:381
void wasm_threads(bool enable)
Configures whether the WebAssembly threads proposal is enabled.
Definition: config.hh:301
void native_unwind_info(bool enable)
Configures whether native unwind information is emitted.
Definition: config.hh:502
void memory_may_move(bool enable)
Configures whether the base pointer of linear memory is allowed to move.
Definition: config.hh:488
void strategy(Strategy strategy)
Configures compilation strategy for wasm code.
Definition: config.hh:414
void memory_reservation_for_growth(size_t size)
Configures the size of the bytes to reserve beyond the end of linear memory to grow into.
Definition: config.hh:474
void wasm_relaxed_simd_deterministic(bool enable)
Configures whether the WebAssembly relaxed simd proposal supports its deterministic behavior.
Definition: config.hh:339
void wasm_multi_memory(bool enable)
Configures whether the WebAssembly multi memory proposal is enabled.
Definition: config.hh:360
void memory_reservation(size_t size)
Configures the size of the initial linear memory allocation.
Definition: config.hh:467
void cranelift_flag_set(const std::string &flag, const std::string &value)
Configure the specified Cranelift flag.
Definition: config.hh:451
void wasm_reference_types(bool enable)
Configures whether the WebAssembly reference types proposal is enabled.
Definition: config.hh:317
void wasm_component_model(bool enable)
Configures whether the WebAssembly component model proposal will be enabled.
Definition: config.hh:396
void cranelift_opt_level(OptLevel level)
Configures cranelift's optimization level.
Definition: config.hh:436
void consume_fuel(bool enable)
Configures whether WebAssembly code will consume fuel and trap when it runs out.
Definition: config.hh:286
void pooling_allocation_strategy(const PoolAllocationConfig &config)
Enables and configures the pooling allocation strategy.
Definition: config.hh:604
void wasm_multi_value(bool enable)
Configures whether the WebAssembly multi value proposal is enabled.
Definition: config.hh:353
void wasm_relaxed_simd(bool enable)
Configures whether the WebAssembly relaxed simd proposal is enabled.
Definition: config.hh:331
void max_wasm_stack(size_t stack)
Configures the maximum amount of native stack wasm can consume.
Definition: config.hh:293
void cranelift_flag_enable(const std::string &flag)
Enable the specified Cranelift flag.
Definition: config.hh:444
void macos_use_mach_ports(bool enable)
Configures whether mach ports are used on macOS.
Definition: config.hh:509
Result< std::monostate > cache_load_default()
Loads the default cache configuration present on the system.
Definition: config.hh:517
void parallel_compilation(bool enable)
Configure whether wasmtime should compile a module using multiple threads.
Definition: config.hh:405
void epoch_interruption(bool enable)
Configures whether epochs are enabled which can be used to interrupt currently executing WebAssembly.
Definition: config.hh:278
void wasm_tail_call(bool enable)
Configures whether the WebAssembly tail call proposal is enabled.
Definition: config.hh:309
void wasm_gc(bool enable)
Configures whether the WebAssembly Garbage Collection proposal will be enabled.
Definition: config.hh:374
void memory_init_cow(bool enable)
Configures whether CoW is enabled.
Definition: config.hh:495
void profiler(ProfilingStrategy profiler)
Configures an active wasm profiler.
Definition: config.hh:459
void wasm_wide_arithmetic(bool enable)
Configures whether the WebAssembly wide arithmetic proposal will be enabled.
Definition: config.hh:388
Global compilation state in Wasmtime.
Definition: engine.hh:21
Errors coming from Wasmtime.
Definition: error.hh:24
Pool allocation configuration for Wasmtime.
Definition: config.hh:52
void max_tables_per_module(uint32_t tables)
The maximum number of defined tables for a core module (default is 1).
Definition: config.hh:204
void total_tables(uint32_t count)
The maximum number of concurrent tables supported (default is 1000).
Definition: config.hh:168
void max_component_instance_size(size_t size)
The maximum size, in bytes, allocated for a component instance’s VMComponentContext metadata.
Definition: config.hh:124
void max_memories_per_component(uint32_t count)
The maximum number of Wasm linear memories that a single component may transitively contain (default ...
Definition: config.hh:142
void decommit_batch_size(size_t batch_size)
The target number of decommits to do per batch.
Definition: config.hh:78
void total_gc_heaps(uint32_t count)
The maximum number of concurrent GC heaps supported (default is 1000).
Definition: config.hh:238
void max_core_instances_per_component(uint32_t count)
The maximum number of core instances a single component may contain (default is unlimited).
Definition: config.hh:133
void async_stack_keep_resident(size_t size)
How much memory, in bytes, to keep resident for async stacks allocated with the pooling allocator.
Definition: config.hh:88
void max_core_instance_size(size_t size)
The maximum size, in bytes, allocated for a core instance’s VMContext metadata.
Definition: config.hh:195
void total_core_instances(uint32_t count)
The maximum number of concurrent core instances supported (default is 1000).
Definition: config.hh:186
void table_elements(size_t elements)
The maximum table elements for any table defined in a module (default is 20000).
Definition: config.hh:213
void max_unused_warm_slots(uint32_t max)
Configures the maximum number of “unused warm slots” to retain in the pooling allocator.
Definition: config.hh:70
void max_memory_size(size_t bytes)
The maximum byte size that any WebAssembly linear memory may grow to.
Definition: config.hh:230
void total_memories(uint32_t count)
The maximum number of concurrent Wasm linear memories supported (default is 1000).
Definition: config.hh:160
void linear_memory_keep_resident(size_t size)
How much memory, in bytes, to keep resident for each linear memory after deallocation.
Definition: config.hh:98
void total_component_instances(uint32_t count)
The maximum number of concurrent component instances supported (default is 1000).
Definition: config.hh:115
void max_memories_per_module(uint32_t memories)
The maximum number of defined linear memories for a module (default is 1).
Definition: config.hh:221
void table_keep_resident(size_t size)
How much memory, in bytes, to keep resident for each table after deallocation.
Definition: config.hh:107
void total_stacks(uint32_t count)
The maximum number of execution stacks allowed for asynchronous execution, when enabled (default is 1...
Definition: config.hh:177
void max_tables_per_component(uint32_t count)
The maximum number of tables that a single component may transitively contain (default is unlimited).
Definition: config.hh:151
Fallible result type used for Wasmtime.
Definition: error.hh:83
Build-time defines for how the C API was built.
Wasmtime-specific extensions to wasm_config_t.
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.
void wasmtime_config_wasm_relaxed_simd_deterministic_set(wasm_config_t *, bool)
Configures whether the WebAssembly relaxed SIMD proposal is in deterministic mode.
void wasmtime_config_cranelift_nan_canonicalization_set(wasm_config_t *, bool)
Configures whether Cranelift should perform a NaN-canonicalization pass.
void wasmtime_config_wasm_function_references_set(wasm_config_t *, bool)
Configures whether the WebAssembly typed function reference types proposal is enabled.
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).
wasmtime_error_t * wasmtime_config_cache_config_load(wasm_config_t *, const char *)
Enables Wasmtime's cache and loads configuration from the specified path.
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...
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).
void wasmtime_config_wasm_multi_memory_set(wasm_config_t *, bool)
Configures whether the WebAssembly multi-memory proposal is enabled.
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.
uint8_t wasmtime_strategy_t
Specifier for how Wasmtime will compile code, values are in wasmtime_strategy_enum.
Definition: config.h:22
void wasmtime_config_native_unwind_info_set(wasm_config_t *, bool)
Configures whether to generate native unwind information (e.g. .eh_frame on Linux).
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.
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...
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 ...
void wasmtime_config_cranelift_flag_enable(wasm_config_t *, const char *)
Enables a target-specific flag in Cranelift.
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).
void wasmtime_config_wasm_simd_set(wasm_config_t *, bool)
Configures whether the WebAssembly SIMD proposal is enabled.
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.
void wasmtime_config_wasm_tail_call_set(wasm_config_t *, bool)
Configures whether the WebAssembly tail call proposal is enabled.
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.
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...
void wasmtime_config_wasm_gc_set(wasm_config_t *, bool)
Configures whether the WebAssembly GC proposal is enabled.
uint8_t wasmtime_profiling_strategy_t
Different ways wasmtime can enable profiling JIT code.
Definition: config.h:66
void wasmtime_config_cranelift_debug_verifier_set(wasm_config_t *, bool)
Configures whether Cranelift's debug verifier is enabled.
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.
void wasmtime_config_profiler_set(wasm_config_t *, wasmtime_profiling_strategy_t)
Configures the profiling strategy used for JIT code.
void wasmtime_config_cranelift_opt_level_set(wasm_config_t *, wasmtime_opt_level_t)
Configures Cranelift's optimization level for JIT code.
void wasmtime_config_memory_reservation_set(wasm_config_t *, uint64_t)
Configures the size, in bytes, of initial memory reservation size for linear memories.
@ 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
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.
void wasmtime_config_wasm_bulk_memory_set(wasm_config_t *, bool)
Configures whether the WebAssembly bulk memory proposal is enabled.
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).
@ WASMTIME_STRATEGY_CRANELIFT
Definition: config.h:36
@ WASMTIME_STRATEGY_AUTO
Definition: config.h:32
void wasmtime_config_parallel_compilation_set(wasm_config_t *, bool)
Configure whether wasmtime should compile a module using multiple threads.
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.
void wasmtime_config_consume_fuel_set(wasm_config_t *, bool)
Whether or not fuel is enabled for generated code.
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 ...
void wasmtime_config_wasm_reference_types_set(wasm_config_t *, bool)
Configures whether the WebAssembly reference types proposal is enabled.
void wasmtime_config_wasm_relaxed_simd_set(wasm_config_t *, bool)
Configures whether the WebAssembly relaxed SIMD proposal is enabled.
void wasmtime_config_wasm_component_model_set(wasm_config_t *, bool)
Configures whether the WebAssembly component-model proposal will be enabled for compilation.
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).
@ 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
void wasmtime_config_host_memory_creator_set(wasm_config_t *, wasmtime_memory_creator_t *)
uint8_t wasmtime_opt_level_t
Specifier of what optimization level to use for generated JIT code.
Definition: config.h:44
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.
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).
void wasmtime_config_wasm_multi_value_set(wasm_config_t *, bool)
Configures whether the WebAssembly multi value proposal is enabled.
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...
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.
void wasmtime_config_memory_guard_size_set(wasm_config_t *, uint64_t)
Configures the guard region size for linear memory.
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).
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...
void wasmtime_config_epoch_interruption_set(wasm_config_t *, bool)
Whether or not epoch-based interruption is enabled for generated code.
void wasmtime_config_memory_may_move_set(wasm_config_t *, bool)
Configures whether memory_reservation is the maximal size of linear memory.
void wasmtime_config_strategy_set(wasm_config_t *, wasmtime_strategy_t)
Configures how JIT code will be compiled.
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).
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).
void wasmtime_config_wasm_threads_set(wasm_config_t *, bool)
Configures whether the WebAssembly threading proposal is enabled.
void wasmtime_config_wasm_wide_arithmetic_set(wasm_config_t *, bool)
Configures whether the WebAssembly wide-arithmetic proposal is enabled.
void wasmtime_config_debug_info_set(wasm_config_t *, bool)
Configures whether DWARF debug information is constructed at runtime to describe JIT code.
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).
void wasmtime_config_wasm_memory64_set(wasm_config_t *, bool)
Configures whether the WebAssembly memory64 proposal is enabled.
void wasmtime_config_max_wasm_stack_set(wasm_config_t *, size_t)
Configures the maximum stack size, in bytes, that JIT code can use.
struct wasmtime_pooling_allocation_config_t wasmtime_pooling_allocation_config_t
A type containing configuration options for the pooling allocator.
Definition: config.h:553
Strategy
Strategies passed to Config::strategy
Definition: config.hh:16
@ Auto
Automatically selects the compilation strategy.
@ Cranelift
Requires Cranelift to be used for compilation.
OptLevel
Values passed to Config::cranelift_opt_level
Definition: config.hh:24
@ 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:34
@ Perfmap
Profiling hooks via perfmap.
@ Vtune
Profiling hooks via VTune.
@ Jitdump
Profiling hooks via perf's jitdump.
Global engine configuration.
An opaque object representing the type of a memory.
Errors generated by Wasmtime.
Definition: config.h:466
wasmtime_memory_get_callback_t get_memory
Callback to get the memory and size of this LinearMemory.
Definition: config.h:470
void * env
User provided value to be passed to get_memory and grow_memory.
Definition: config.h:468
void(* finalizer)(void *)
An optional finalizer for env.
Definition: config.h:474
wasmtime_memory_grow_callback_t grow_memory
Callback to request growing the memory.
Definition: config.h:472
Definition: config.h:500
void(* finalizer)(void *)
An optional finalizer for env.
Definition: config.h:506
wasmtime_new_memory_callback_t new_memory
The callback to create new memory, must be thread safe.
Definition: config.h:504
void * env
User provided value to be passed to new_memory.
Definition: config.h:502
wasm_config_t * wasm_config_new(void)
Creates a new empty configuration object.
void wasm_config_delete(wasm_config_t *)
Deletes a configuration object.