From 6bb6b66e6b2c3bc04569dfafae28db6580288ec3 Mon Sep 17 00:00:00 2001 From: Tyler Rockwood Date: Wed, 23 Aug 2023 21:25:11 -0500 Subject: [PATCH] [c-api]: Expose more configuration options Specifically dynamic_memory_reserved_for_growth and native_unwind_info Signed-off-by: Tyler Rockwood --- crates/c-api/include/wasmtime/config.h | 18 ++++++++++++++++++ crates/c-api/src/config.rs | 13 +++++++++++++ 2 files changed, 31 insertions(+) diff --git a/crates/c-api/include/wasmtime/config.h b/crates/c-api/include/wasmtime/config.h index 3518b8e45eeb..d82e35816ee3 100644 --- a/crates/c-api/include/wasmtime/config.h +++ b/crates/c-api/include/wasmtime/config.h @@ -299,6 +299,24 @@ WASMTIME_CONFIG_PROP(void, static_memory_guard_size, uint64_t) */ WASMTIME_CONFIG_PROP(void, dynamic_memory_guard_size, uint64_t) +/** + * \brief Configures the size, in bytes, of the extra virtual memory space reserved after a “dynamic” memory for growing into. + * + * For more information see the Rust documentation at + * https://docs.wasmtime.dev/api/wasmtime/struct.Config.html#method.dynamic_memory_reserved_for_growth + */ +WASMTIME_CONFIG_PROP(void, dynamic_memory_reserved_for_growth, uint64_t) + +/** + * \brief Configures whether to generate native unwind information (e.g. .eh_frame on Linux). + * + * This option defaults to true. + * + * For more information see the Rust documentation at + * https://docs.wasmtime.dev/api/wasmtime/struct.Config.html#method.native_unwind_info + */ +WASMTIME_CONFIG_PROP(void, native_unwind_info, bool) + /** * \brief Enables Wasmtime's cache and loads configuration from the specified * path. diff --git a/crates/c-api/src/config.rs b/crates/c-api/src/config.rs index 42032d0f6891..1819f5622de3 100644 --- a/crates/c-api/src/config.rs +++ b/crates/c-api/src/config.rs @@ -213,3 +213,16 @@ pub extern "C" fn wasmtime_config_static_memory_guard_size_set(c: &mut wasm_conf pub extern "C" fn wasmtime_config_dynamic_memory_guard_size_set(c: &mut wasm_config_t, size: u64) { c.config.dynamic_memory_guard_size(size); } + +#[no_mangle] +pub extern "C" fn wasmtime_config_dynamic_memory_reserved_for_growth_set( + c: &mut wasm_config_t, + size: u64, +) { + c.config.dynamic_memory_reserved_for_growth(size); +} + +#[no_mangle] +pub extern "C" fn wasmtime_config_native_unwind_info_set(c: &mut wasm_config_t, enabled: bool) { + c.config.native_unwind_info(enabled); +}