A lightweight WebAssembly runtime that is fast, secure, and standards-compliant
[stack-switching] C API (#15148)
Daniel Hillerström9cb229e5ce6b
diff --git a/crates/c-api/Cargo.toml b/crates/c-api/Cargo.tomlindex 3c1318d2df..c61951bb18 100644--- a/crates/c-api/Cargo.toml+++ b/crates/c-api/Cargo.toml@@ -52,6 +52,7 @@ disable-logging = ["log/max_level_off", "tracing/max_level_off"]coredump = ["wasmtime/coredump"]addr2line = ["wasmtime/addr2line"]demangle = ["wasmtime/demangle"]+stack-switching = ["wasmtime/stack-switching"]threads = ["wasmtime/threads"]gc = ["wasmtime/gc"]gc-drc = ["wasmtime/gc-drc"]diff --git a/crates/c-api/artifact/Cargo.toml b/crates/c-api/artifact/Cargo.tomlindex 63cae9f6b2..3003578d06 100644--- a/crates/c-api/artifact/Cargo.toml+++ b/crates/c-api/artifact/Cargo.toml@@ -63,6 +63,7 @@ coredump = ["wasmtime-c-api/coredump"]addr2line = ["wasmtime-c-api/addr2line"]demangle = ["wasmtime-c-api/demangle"]wat = ["wasmtime-c-api/wat"]+stack-switching = ["wasmtime-c-api/stack-switching"]threads = ["wasmtime-c-api/threads"]gc = ["wasmtime-c-api/gc"]gc-drc = ["wasmtime-c-api/gc-drc"]diff --git a/crates/c-api/build.rs b/crates/c-api/build.rsindex a5ca742ea0..491d01e73f 100644--- a/crates/c-api/build.rs+++ b/crates/c-api/build.rs@@ -14,6 +14,7 @@ const FEATURES: &[&str] = &["COREDUMP","ADDR2LINE","DEMANGLE",+ "STACK_SWITCHING","THREADS","GC","GC_DRC",diff --git a/crates/c-api/cmake/features.cmake b/crates/c-api/cmake/features.cmakeindex fd4d4dcda2..dcfb6f4b49 100644--- a/crates/c-api/cmake/features.cmake+++ b/crates/c-api/cmake/features.cmake@@ -37,6 +37,7 @@ feature(disable-logging OFF)feature(coredump ON)feature(addr2line ON)feature(demangle ON)+feature(stack-switching OFF)feature(threads ON)feature(gc ON)feature(gc-drc ON)diff --git a/crates/c-api/include/wasmtime/conf.h.in b/crates/c-api/include/wasmtime/conf.h.inindex e3c3d7621c..b8edd9d974 100644--- a/crates/c-api/include/wasmtime/conf.h.in+++ b/crates/c-api/include/wasmtime/conf.h.in@@ -19,6 +19,7 @@#cmakedefine WASMTIME_FEATURE_COREDUMP#cmakedefine WASMTIME_FEATURE_ADDR2LINE#cmakedefine WASMTIME_FEATURE_DEMANGLE+#cmakedefine WASMTIME_FEATURE_STACK_SWITCHING#cmakedefine WASMTIME_FEATURE_THREADS#cmakedefine WASMTIME_FEATURE_GC#cmakedefine WASMTIME_FEATURE_GC_DRCdiff --git a/crates/c-api/include/wasmtime/config.h b/crates/c-api/include/wasmtime/config.hindex a34d458933..eca01949e7 100644--- a/crates/c-api/include/wasmtime/config.h+++ b/crates/c-api/include/wasmtime/config.h@@ -241,6 +241,14 @@ WASMTIME_CONFIG_PROP(void, wasm_gc, bool)*/WASMTIME_CONFIG_PROP(void, gc_support, bool)+/**+ * \brief Configures whether the WebAssembly stack switching+ * proposal is enabled.+ *+ * This setting is `false` by default.+ */+WASMTIME_CONFIG_PROP(void, wasm_stack_switching, bool)+/*** \brief Configures whether the WebAssembly SIMD proposal is* enabled.@@ -342,14 +350,6 @@ WASMTIME_CONFIG_PROP(void, wasm_compact_imports, bool)#ifdef WASMTIME_FEATURE_COMPILER-/**- * \brief Configures whether the WebAssembly stack switching- * proposal is enabled.- *- * This setting is `false` by default.- */-WASMTIME_CONFIG_PROP(void, wasm_stack_switching, bool)-/*** \brief Configures how JIT code will be compiled.*diff --git a/crates/c-api/include/wasmtime/config.hh b/crates/c-api/include/wasmtime/config.hhindex f862be5997..81177b282d 100644--- a/crates/c-api/include/wasmtime/config.hh+++ b/crates/c-api/include/wasmtime/config.hh@@ -433,6 +433,14 @@ class Config {wasmtime_config_wasm_memory64_set(ptr.get(), enable);}+ /// \brief Configures whether the WebAssembly stack switching proposal is+ /// enabled+ ///+ /// https://docs.wasmtime.dev/api/wasmtime/struct.Config.html#method.wasm_stack_switching+ void wasm_stack_switching(bool enable) {+ wasmtime_config_wasm_stack_switching_set(ptr.get(), enable);+ }+#ifdef WASMTIME_FEATURE_GC/// \brief Configures whether the WebAssembly Garbage Collection proposal will/// be enableddiff --git a/crates/c-api/tests/config.cc b/crates/c-api/tests/config.ccindex 12e4423c73..6a36489a7b 100644--- a/crates/c-api/tests/config.cc+++ b/crates/c-api/tests/config.cc@@ -49,6 +49,7 @@ TEST(Config, Smoke) {config.wasm_multi_value(false);config.wasm_multi_memory(false);config.wasm_memory64(false);+ config.wasm_stack_switching(false);config.wasm_wide_arithmetic(false);config.wasm_component_model(false);config.wasm_exceptions(false);