fix(wasmtime):Config methods should be idempotent (#4252)
This commit refactored `Config` to use a seperate `CompilerConfig` field instead of operating on `CompilerBuilder` directly to make all its methods idempotent. Fixes #4189
This commit is contained in:
@@ -103,13 +103,12 @@ pub extern "C" fn wasmtime_config_wasm_memory64_set(c: &mut wasm_config_t, enabl
|
||||
pub extern "C" fn wasmtime_config_strategy_set(
|
||||
c: &mut wasm_config_t,
|
||||
strategy: wasmtime_strategy_t,
|
||||
) -> Option<Box<wasmtime_error_t>> {
|
||||
) {
|
||||
use wasmtime_strategy_t::*;
|
||||
let result = c.config.strategy(match strategy {
|
||||
c.config.strategy(match strategy {
|
||||
WASMTIME_STRATEGY_AUTO => Strategy::Auto,
|
||||
WASMTIME_STRATEGY_CRANELIFT => Strategy::Cranelift,
|
||||
});
|
||||
handle_result(result, |_cfg| {})
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
@@ -145,13 +144,12 @@ pub extern "C" fn wasmtime_config_cranelift_opt_level_set(
|
||||
pub extern "C" fn wasmtime_config_profiler_set(
|
||||
c: &mut wasm_config_t,
|
||||
strategy: wasmtime_profiling_strategy_t,
|
||||
) -> Option<Box<wasmtime_error_t>> {
|
||||
) {
|
||||
use wasmtime_profiling_strategy_t::*;
|
||||
let result = c.config.profiler(match strategy {
|
||||
c.config.profiler(match strategy {
|
||||
WASMTIME_PROFILING_STRATEGY_NONE => ProfilingStrategy::None,
|
||||
WASMTIME_PROFILING_STRATEGY_JITDUMP => ProfilingStrategy::JitDump,
|
||||
});
|
||||
handle_result(result, |_cfg| {})
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
||||
Reference in New Issue
Block a user