Skip to content

Commit 5a574c2

Browse files
authored
Split out MVP from WASM1 feature (bytecodealliance#1889)
I recently learned that these were actually two distinct points in time, so while the points-in-time are all listed out may as well try to be accurate along the way.
1 parent 6a76d04 commit 5a574c2

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

crates/wasmparser/src/features.rs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,19 +233,34 @@ define_wasm_features! {
233233
}
234234

235235
impl WasmFeatures {
236+
/// The feature set associated with the MVP release of WebAssembly (its
237+
/// first release).
238+
//
239+
// Note that the features listed here are the wasmparser-specific built-in
240+
// features such as "floats" and "gc-types". These don't actually correspond
241+
// to any wasm proposals themselves and instead just gate constructs in
242+
// wasm. They're listed here so they otherwise don't have to be listed
243+
// below, but for example wasm with `externref` will be rejected due to lack
244+
// of `externref` first.
245+
#[cfg(feature = "features")]
246+
pub const MVP: WasmFeatures = WasmFeatures::FLOATS.union(WasmFeatures::GC_TYPES);
247+
236248
/// The feature set associated with the 1.0 version of the
237-
/// WebAssembly specification or the "MVP" feature set.
249+
/// WebAssembly specification circa 2017.
250+
///
251+
/// <https://webassembly.github.io/spec/versions/core/WebAssembly-1.0.pdf>
238252
#[cfg(feature = "features")]
239-
pub const WASM1: WasmFeatures = WasmFeatures::FLOATS.union(WasmFeatures::GC_TYPES);
253+
pub const WASM1: WasmFeatures = WasmFeatures::MVP.union(WasmFeatures::MUTABLE_GLOBAL);
240254

241255
/// The feature set associated with the 2.0 version of the
242-
/// WebAssembly specification.
256+
/// WebAssembly specification circa 2022.
257+
///
258+
/// <https://webassembly.github.io/spec/versions/core/WebAssembly-2.0.pdf>
243259
#[cfg(feature = "features")]
244260
pub const WASM2: WasmFeatures = WasmFeatures::WASM1
245261
.union(WasmFeatures::BULK_MEMORY)
246262
.union(WasmFeatures::REFERENCE_TYPES)
247263
.union(WasmFeatures::SIGN_EXTENSION)
248-
.union(WasmFeatures::MUTABLE_GLOBAL)
249264
.union(WasmFeatures::SATURATING_FLOAT_TO_INT)
250265
.union(WasmFeatures::MULTI_VALUE)
251266
.union(WasmFeatures::SIMD);
@@ -256,6 +271,9 @@ impl WasmFeatures {
256271
/// Note that as of the time of this writing the 3.0 version of the
257272
/// specification is not yet published. The precise set of features set
258273
/// here may change as that continues to evolve.
274+
///
275+
/// (draft)
276+
/// <https://webassembly.github.io/spec/versions/core/WebAssembly-3.0-draft.pdf>
259277
#[cfg(feature = "features")]
260278
pub const WASM3: WasmFeatures = WasmFeatures::WASM2
261279
.union(WasmFeatures::GC)

src/bin/wasm-tools/validate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ fn parse_features(arg: &str) -> Result<Vec<FeatureAction>> {
213213
let mut ret = Vec::new();
214214

215215
const GROUPS: &[(&str, WasmFeatures)] = &[
216-
("mvp", WasmFeatures::WASM1),
216+
("mvp", WasmFeatures::MVP),
217217
("wasm1", WasmFeatures::WASM1),
218218
("wasm2", WasmFeatures::WASM2),
219219
("wasm3", WasmFeatures::WASM3),

0 commit comments

Comments
 (0)