From 9ac400cac613e98c92c6d039f72ed376ff1a5cb6 Mon Sep 17 00:00:00 2001 From: Andrew Gutekanst Date: Thu, 18 May 2023 14:57:52 -0400 Subject: [PATCH 1/2] Expose static_memory_forced to C --- crates/c-api/src/config.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/c-api/src/config.rs b/crates/c-api/src/config.rs index 7625083a5ca0..42032d0f6891 100644 --- a/crates/c-api/src/config.rs +++ b/crates/c-api/src/config.rs @@ -194,6 +194,11 @@ pub unsafe extern "C" fn wasmtime_config_cache_config_load( ) } +#[no_mangle] +pub extern "C" fn wasmtime_config_static_memory_forced_set(c: &mut wasm_config_t, enable: bool) { + c.config.static_memory_forced(enable); +} + #[no_mangle] pub extern "C" fn wasmtime_config_static_memory_maximum_size_set(c: &mut wasm_config_t, size: u64) { c.config.static_memory_maximum_size(size); From 8ff4f181e1803808ee53f490ebfc55a327a572be Mon Sep 17 00:00:00 2001 From: Andrew Gutekanst Date: Thu, 18 May 2023 17:57:09 -0400 Subject: [PATCH 2/2] Update config.h to include static_memory_forced config prop --- crates/c-api/include/wasmtime/config.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/c-api/include/wasmtime/config.h b/crates/c-api/include/wasmtime/config.h index 0545323d8894..2a6609c95441 100644 --- a/crates/c-api/include/wasmtime/config.h +++ b/crates/c-api/include/wasmtime/config.h @@ -265,6 +265,16 @@ WASMTIME_CONFIG_PROP(void, cranelift_opt_level, wasmtime_opt_level_t) */ WASMTIME_CONFIG_PROP(void, profiler, wasmtime_profiling_strategy_t) +/** + * \brief Configures the “static” style of memory to always be used. + * + * This setting is `false` by default. + * + * For more information see the Rust documentation at + * https://bytecodealliance.github.io/wasmtime/api/wasmtime/struct.Config.html#method.static_memory_forced. + */ +WASMTIME_CONFIG_PROP(void, static_memory_forced, bool) + /** * \brief Configures the maximum size for memory to be considered "static" *