Skip to content

Commit

Permalink
[c-api]: Expose more configuration options (bytecodealliance#6896)
Browse files Browse the repository at this point in the history
Specifically dynamic_memory_reserved_for_growth and native_unwind_info

Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
  • Loading branch information
rockwotj authored and eduardomourar committed Sep 6, 2023
1 parent d393299 commit 8cc0fea
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
18 changes: 18 additions & 0 deletions crates/c-api/include/wasmtime/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
13 changes: 13 additions & 0 deletions crates/c-api/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit 8cc0fea

Please sign in to comment.