c-api: add wasm_config_parallel_compilation_set (#5298)

This commit is contained in:
Thibault Charbonnier
2022-11-29 15:03:05 -08:00
committed by GitHub
parent 86acb9a438
commit e7cb82af89
3 changed files with 18 additions and 2 deletions

View File

@@ -200,6 +200,14 @@ WASMTIME_CONFIG_PROP(void, wasm_memory64, bool)
*/ */
WASMTIME_CONFIG_PROP(void, strategy, wasmtime_strategy_t) WASMTIME_CONFIG_PROP(void, strategy, wasmtime_strategy_t)
/**
* \brief Configure wether wasmtime should compile a module using multiple threads.
*
* For more information see the Rust documentation at
* https://docs.wasmtime.dev/api/wasmtime/struct.Config.html#method.parallel_compilation.
*/
WASMTIME_CONFIG_PROP(void, parallel_compilation, bool)
/** /**
* \brief Configures whether Cranelift's debug verifier is enabled. * \brief Configures whether Cranelift's debug verifier is enabled.
* *

View File

@@ -112,6 +112,12 @@ pub extern "C" fn wasmtime_config_strategy_set(
}); });
} }
#[no_mangle]
#[cfg(feature = "parallel-compilation")]
pub extern "C" fn wasmtime_config_parallel_compilation_set(c: &mut wasm_config_t, enable: bool) {
c.config.parallel_compilation(enable);
}
#[no_mangle] #[no_mangle]
pub extern "C" fn wasmtime_config_cranelift_debug_verifier_set( pub extern "C" fn wasmtime_config_cranelift_debug_verifier_set(
c: &mut wasm_config_t, c: &mut wasm_config_t,

View File

@@ -1275,9 +1275,11 @@ impl Config {
Ok(self) Ok(self)
} }
/// Configure wether wasmtime should compile a module using multiple threads. /// Configure wether wasmtime should compile a module using multiple
/// threads.
/// ///
/// Disabling this will result in a single thread being used to compile the wasm bytecode. /// Disabling this will result in a single thread being used to compile
/// the wasm bytecode.
/// ///
/// By default parallel compilation is enabled. /// By default parallel compilation is enabled.
#[cfg(feature = "parallel-compilation")] #[cfg(feature = "parallel-compilation")]