diff --git a/crates/fuzzing/src/generators/config.rs b/crates/fuzzing/src/generators/config.rs index a8fe0572d249..9da39c3a7455 100644 --- a/crates/fuzzing/src/generators/config.rs +++ b/crates/fuzzing/src/generators/config.rs @@ -131,6 +131,7 @@ impl Config { custom_page_sizes, multi_memory, threads, + shared_everything_threads, gc, function_references, relaxed_simd, @@ -173,6 +174,7 @@ impl Config { config.tail_call_enabled = tail_call.unwrap_or(false); config.custom_page_sizes_enabled = custom_page_sizes.unwrap_or(false); config.threads_enabled = threads.unwrap_or(false); + config.shared_everything_threads_enabled = shared_everything_threads.unwrap_or(false); config.gc_enabled = gc.unwrap_or(false); config.reference_types_enabled = config.gc_enabled || self.module_config.function_references_enabled diff --git a/crates/test-util/src/wasmtime_wast.rs b/crates/test-util/src/wasmtime_wast.rs index d4bafab12f69..7bb14ee8cada 100644 --- a/crates/test-util/src/wasmtime_wast.rs +++ b/crates/test-util/src/wasmtime_wast.rs @@ -29,6 +29,7 @@ pub fn apply_test_config(config: &mut Config, test_config: &wast::TestConfig) { custom_page_sizes, multi_memory, threads, + shared_everything_threads, gc, function_references, relaxed_simd, @@ -54,6 +55,7 @@ pub fn apply_test_config(config: &mut Config, test_config: &wast::TestConfig) { let custom_page_sizes = custom_page_sizes.unwrap_or(false); let multi_memory = multi_memory.unwrap_or(false); let threads = threads.unwrap_or(false); + let shared_everything_threads = shared_everything_threads.unwrap_or(false); let gc = gc.unwrap_or(false); let tail_call = tail_call.unwrap_or(false); let extended_const = extended_const.unwrap_or(false); @@ -78,6 +80,7 @@ pub fn apply_test_config(config: &mut Config, test_config: &wast::TestConfig) { config .wasm_multi_memory(multi_memory) .wasm_threads(threads) + .wasm_shared_everything_threads(shared_everything_threads) .wasm_memory64(memory64) .wasm_function_references(function_references) .wasm_gc(gc) diff --git a/crates/test-util/src/wast.rs b/crates/test-util/src/wast.rs index 856385030c00..8bfdec93a800 100644 --- a/crates/test-util/src/wast.rs +++ b/crates/test-util/src/wast.rs @@ -230,6 +230,7 @@ macro_rules! foreach_config_option { custom_page_sizes multi_memory threads + shared_everything_threads gc function_references relaxed_simd diff --git a/crates/wasmtime/src/config.rs b/crates/wasmtime/src/config.rs index 79a6f1b60143..443d3a253e59 100644 --- a/crates/wasmtime/src/config.rs +++ b/crates/wasmtime/src/config.rs @@ -848,6 +848,21 @@ impl Config { self } + /// Configures whether the WebAssembly [shared-everything-threads] proposal + /// will be enabled for compilation. + /// + /// This feature gates extended use of the `shared` attribute on items other + /// than memories, extra atomic instructions, and new component model + /// intrinsics for spawning threads. It depends on the + /// [`wasm_threads`][Self::wasm_threads] being enabled. + /// + /// [shared-everything-threads]: + /// https://github.com/webassembly/shared-everything-threads + pub fn wasm_shared_everything_threads(&mut self, enable: bool) -> &mut Self { + self.wasm_feature(WasmFeatures::SHARED_EVERYTHING_THREADS, enable); + self + } + /// Configures whether the [WebAssembly reference types proposal][proposal] /// will be enabled for compilation. /// diff --git a/crates/wasmtime/src/engine/serialization.rs b/crates/wasmtime/src/engine/serialization.rs index 928f0b8b6008..e0089935514e 100644 --- a/crates/wasmtime/src/engine/serialization.rs +++ b/crates/wasmtime/src/engine/serialization.rs @@ -192,6 +192,7 @@ struct WasmFeatures { simd: bool, tail_call: bool, threads: bool, + shared_everything_threads: bool, multi_memory: bool, exceptions: bool, legacy_exceptions: bool, @@ -219,6 +220,7 @@ impl Metadata<'_> { component_model, simd, threads, + shared_everything_threads, tail_call, multi_memory, exceptions, @@ -229,7 +231,6 @@ impl Metadata<'_> { function_references, gc, custom_page_sizes, - shared_everything_threads, cm_async, cm_async_builtins, cm_async_stackful, @@ -253,7 +254,6 @@ impl Metadata<'_> { assert!(!memory_control); assert!(!cm_nested_names); assert!(!cm_values); - assert!(!shared_everything_threads); Metadata { target: engine.compiler().triple().to_string(), @@ -267,6 +267,7 @@ impl Metadata<'_> { component_model, simd, threads, + shared_everything_threads, tail_call, multi_memory, exceptions, @@ -481,6 +482,7 @@ impl Metadata<'_> { simd, tail_call, threads, + shared_everything_threads, multi_memory, exceptions, legacy_exceptions, @@ -540,6 +542,11 @@ impl Metadata<'_> { other.contains(F::THREADS), "WebAssembly threads support", )?; + Self::check_bool( + shared_everything_threads, + other.contains(F::SHARED_EVERYTHING_THREADS), + "WebAssembly shared-everything-threads support", + )?; Self::check_bool( multi_memory, other.contains(F::MULTI_MEMORY), diff --git a/tests/misc_testsuite/shared-everything-threads/flags.wast b/tests/misc_testsuite/shared-everything-threads/flags.wast new file mode 100644 index 000000000000..6e580f128f07 --- /dev/null +++ b/tests/misc_testsuite/shared-everything-threads/flags.wast @@ -0,0 +1,3 @@ +;;! shared_everything_threads = true + +(module)