Skip to content

Commit cbf7c01

Browse files
authored
threads: add initial flags for shared-everything-threads (#1475)
The [shared-everything-threads] proposal adds new `shared` annotations in more places, new atomic instructions, new component model thread intrinsics, etc. This change just sets the ground work by adding the shared-everything-threads flags in all the places I found to be needed; more PRs to follow. [shared-everything-threads]: https://github.com/WebAssembly/shared-everything-threads
1 parent 6de5fbf commit cbf7c01

7 files changed

Lines changed: 17 additions & 0 deletions

File tree

crates/wasm-shrink/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ impl ShrinkRun {
223223
bulk_memory: true,
224224
simd: true,
225225
threads: true,
226+
shared_everything_threads: false,
226227
tail_call: true,
227228
multi_memory: true,
228229
exceptions: true,

crates/wasm-smith/tests/common/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub fn parser_features_from_config(config: &Config) -> WasmFeatures {
1919
gc: config.gc_enabled,
2020

2121
threads: false,
22+
shared_everything_threads: false,
2223
floats: true,
2324
extended_const: false,
2425
component_model: false,

crates/wasm-smith/tests/core.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ fn parser_features_from_config(config: &Config) -> WasmFeatures {
168168
tail_call: config.tail_call_enabled,
169169

170170
threads: false,
171+
shared_everything_threads: false,
171172
floats: true,
172173
extended_const: false,
173174
component_model: false,

crates/wasmparser/src/validator.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,9 @@ pub struct WasmFeatures {
218218
pub relaxed_simd: bool,
219219
/// The WebAssembly threads proposal (enabled by default)
220220
pub threads: bool,
221+
/// The WebAssembly shared-everything-threads proposal; includes new
222+
/// component model built-ins.
223+
pub shared_everything_threads: bool,
221224
/// The WebAssembly tail-call proposal (enabled by default)
222225
pub tail_call: bool,
223226
/// Whether or not floating-point instructions are enabled.
@@ -266,6 +269,7 @@ impl WasmFeatures {
266269
simd: true,
267270
relaxed_simd: true,
268271
threads: true,
272+
shared_everything_threads: true,
269273
tail_call: true,
270274
floats: true,
271275
multi_memory: true,
@@ -377,6 +381,7 @@ impl Default for WasmFeatures {
377381
gc: false,
378382
component_model_values: false,
379383
component_model_nested_names: false,
384+
shared_everything_threads: false,
380385

381386
// On-by-default features (phase 4 or greater).
382387
mutable_global: true,

fuzz/src/validate.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ pub fn validate_raw_bytes(u: &mut Unstructured<'_>) -> Result<()> {
3232
reference_types: u.arbitrary()?,
3333
multi_value: u.arbitrary()?,
3434
threads: u.arbitrary()?,
35+
shared_everything_threads: u.arbitrary()?,
3536
simd: u.arbitrary()?,
3637
component_model: u.arbitrary()?,
3738
tail_call: u.arbitrary()?,

src/bin/wasm-tools/validate.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ fn parse_features(arg: &str) -> Result<WasmFeatures> {
102102
("function-references", |f| &mut f.function_references),
103103
("simd", |f| &mut f.simd),
104104
("threads", |f| &mut f.threads),
105+
("shared-everything-threads", |f| {
106+
&mut f.shared_everything_threads
107+
}),
105108
("bulk-memory", |f| &mut f.bulk_memory),
106109
("multi-value", |f| &mut f.multi_value),
107110
("tail-call", |f| &mut f.tail_call),

tests/roundtrip.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,7 @@ impl TestState {
578578
fn wasmparser_validator_for(&self, test: &Path) -> Validator {
579579
let mut features = WasmFeatures {
580580
threads: true,
581+
shared_everything_threads: false,
581582
reference_types: true,
582583
simd: true,
583584
relaxed_simd: true,
@@ -637,6 +638,10 @@ impl TestState {
637638
"tail-call" => features.tail_call = true,
638639
"memory64" => features.memory64 = true,
639640
"component-model" => features.component_model = true,
641+
"shared-everything-threads" => {
642+
features.component_model = true;
643+
features.shared_everything_threads = true;
644+
}
640645
"multi-memory" => features.multi_memory = true,
641646
"extended-const" => features.extended_const = true,
642647
"function-references" => features.function_references = true,

0 commit comments

Comments
 (0)