Browse Source

Merge pull request #3756 from alexcrichton/update-wasm-tools

Update wasm-tools crates
pull/3760/head
Nick Fitzgerald 3 years ago
committed by GitHub
parent
commit
605c79fd05
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 28
      Cargo.lock
  2. 6
      Cargo.toml
  3. 2
      cranelift/wasm/Cargo.toml
  4. 19
      cranelift/wasm/src/code_translator.rs
  5. 13
      cranelift/wasm/src/sections_translator.rs
  6. 2
      crates/cranelift/Cargo.toml
  7. 2
      crates/environ/Cargo.toml
  8. 13
      crates/environ/src/module_environ.rs
  9. 4
      crates/fuzzing/Cargo.toml
  10. 2
      crates/fuzzing/src/generators/table_ops.rs
  11. 2
      crates/types/Cargo.toml
  12. 2
      crates/wasmtime/Cargo.toml
  13. 42
      crates/wasmtime/src/module/serialization.rs
  14. 2
      crates/wast/Cargo.toml
  15. 7
      crates/wast/src/wast.rs
  16. 4
      tests/misc_testsuite/multi-memory/simple.wast

28
Cargo.lock

@ -3042,9 +3042,9 @@ checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796"
[[package]]
name = "unicode-width"
version = "0.1.8"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
[[package]]
name = "unicode-xid"
@ -3349,15 +3349,15 @@ dependencies = [
[[package]]
name = "wasmparser"
version = "0.81.0"
version = "0.82.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98930446519f63d00a836efdc22f67766ceae8dbcc1571379f2bcabc6b2b9abc"
checksum = "0559cc0f1779240d6f894933498877ea94f693d84f3ee39c9a9932c6c312bd70"
[[package]]
name = "wasmprinter"
version = "0.2.31"
version = "0.2.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a00ad4a51ba74183137c776ab37dea50b9f71db7454d7b654c2ba69ac5d9b223"
checksum = "6d7e1e9d5e3540363f038518bc21f568caabaad20d4e371deabe37424ef15a8d"
dependencies = [
"anyhow",
"wasmparser",
@ -3493,7 +3493,7 @@ dependencies = [
"wasmtime-wasi-crypto",
"wasmtime-wasi-nn",
"wasmtime-wast",
"wast 38.0.1",
"wast 39.0.0",
"wat",
"winapi",
]
@ -3682,7 +3682,7 @@ version = "0.33.0"
dependencies = [
"anyhow",
"wasmtime",
"wast 38.0.1",
"wast 39.0.0",
]
[[package]]
@ -3696,20 +3696,22 @@ dependencies = [
[[package]]
name = "wast"
version = "38.0.1"
version = "39.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae0d7b256bef26c898fa7344a2d627e8499f5a749432ce0a05eae1a64ff0c271"
checksum = "e9bbbd53432b267421186feee3e52436531fa69a7cfee9403f5204352df3dd05"
dependencies = [
"leb128",
"memchr",
"unicode-width",
]
[[package]]
name = "wat"
version = "1.0.40"
version = "1.0.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adcfaeb27e2578d2c6271a45609f4a055e6d7ba3a12eff35b1fd5ba147bdf046"
checksum = "ab98ed25494f97c69f28758617f27c3e92e5336040b5c3a14634f2dd3fe61830"
dependencies = [
"wast 38.0.1",
"wast 39.0.0",
]
[[package]]

6
Cargo.toml

@ -37,7 +37,7 @@ file-per-thread-logger = "0.1.1"
libc = "0.2.60"
rayon = "1.5.0"
humantime = "2.0.0"
wasmparser = "0.81.0"
wasmparser = "0.82.0"
lazy_static = "1.4.0"
[target.'cfg(unix)'.dependencies]
@ -54,13 +54,13 @@ test-programs = { path = "crates/test-programs" }
wasmtime-runtime = { path = "crates/runtime" }
tokio = { version = "1.8.0", features = ["rt", "time", "macros", "rt-multi-thread"] }
tracing-subscriber = "0.3.1"
wast = "38.0.0"
wast = "39.0.0"
criterion = "0.3.4"
num_cpus = "1.13.0"
winapi = { version = "0.3.9", features = ['memoryapi'] }
memchr = "2.4"
async-trait = "0.1"
wat = "1.0.40"
wat = "1.0.41"
[build-dependencies]
anyhow = "1.0.19"

2
cranelift/wasm/Cargo.toml

@ -12,7 +12,7 @@ keywords = ["webassembly", "wasm"]
edition = "2018"
[dependencies]
wasmparser = { version = "0.81", default-features = false }
wasmparser = { version = "0.82", default-features = false }
cranelift-codegen = { path = "../codegen", version = "0.80.0", default-features = false }
cranelift-entity = { path = "../entity", version = "0.80.0" }
cranelift-frontend = { path = "../frontend", version = "0.80.0", default-features = false }

19
cranelift/wasm/src/code_translator.rs

@ -2013,6 +2013,25 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
Operator::ReturnCall { .. } | Operator::ReturnCallIndirect { .. } => {
return Err(wasm_unsupported!("proposed tail-call operator {:?}", op));
}
Operator::I8x16SwizzleRelaxed
| Operator::I32x4TruncSatF32x4SRelaxed
| Operator::I32x4TruncSatF32x4URelaxed
| Operator::I32x4TruncSatF64x2SZeroRelaxed
| Operator::I32x4TruncSatF64x2UZeroRelaxed
| Operator::F32x4FmaRelaxed
| Operator::F32x4FmsRelaxed
| Operator::F64x2FmaRelaxed
| Operator::F64x2FmsRelaxed
| Operator::I8x16LaneSelect
| Operator::I16x8LaneSelect
| Operator::I32x4LaneSelect
| Operator::I64x2LaneSelect
| Operator::F32x4MinRelaxed
| Operator::F64x2MinRelaxed
| Operator::F32x4MaxRelaxed
| Operator::F64x2MaxRelaxed => {
return Err(wasm_unsupported!("proposed relaxed-simd operator {:?}", op));
}
};
Ok(())
}

13
cranelift/wasm/src/sections_translator.rs

@ -362,7 +362,12 @@ pub fn parse_element_section<'data>(
environ.reserve_table_elements(elements.get_count())?;
for (index, entry) in elements.into_iter().enumerate() {
let Element { kind, items, ty: _ } = entry?;
let Element {
kind,
items,
ty: _,
range: _,
} = entry?;
let segments = read_elems(&items)?;
match kind {
ElementKind::Active {
@ -409,7 +414,11 @@ pub fn parse_data_section<'data>(
environ.reserve_data_initializers(data.get_count())?;
for (index, entry) in data.into_iter().enumerate() {
let Data { kind, data } = entry?;
let Data {
kind,
data,
range: _,
} = entry?;
match kind {
DataKind::Active {
memory_index,

2
crates/cranelift/Cargo.toml

@ -19,7 +19,7 @@ cranelift-codegen = { path = "../../cranelift/codegen", version = "0.80.0" }
cranelift-frontend = { path = "../../cranelift/frontend", version = "0.80.0" }
cranelift-entity = { path = "../../cranelift/entity", version = "0.80.0" }
cranelift-native = { path = "../../cranelift/native", version = "0.80.0" }
wasmparser = "0.81.0"
wasmparser = "0.82.0"
target-lexicon = "0.12"
gimli = { version = "0.26.0", default-features = false, features = ['read', 'std'] }
object = { version = "0.27.0", default-features = false, features = ['write'] }

2
crates/environ/Cargo.toml

@ -14,7 +14,7 @@ edition = "2018"
anyhow = "1.0"
cranelift-entity = { path = "../../cranelift/entity", version = "0.80.0" }
wasmtime-types = { path = "../types", version = "0.33.0" }
wasmparser = "0.81"
wasmparser = "0.82"
indexmap = { version = "1.0.2", features = ["serde-1"] }
thiserror = "1.0.4"
serde = { version = "1.0.94", features = ["derive"] }

13
crates/environ/src/module_environ.rs

@ -516,7 +516,12 @@ impl<'data> ModuleEnvironment<'data> {
self.result.module.table_initializers.reserve_exact(cnt);
for (index, entry) in elements.into_iter().enumerate() {
let wasmparser::Element { kind, items, ty: _ } = entry?;
let wasmparser::Element {
kind,
items,
ty: _,
range: _,
} = entry?;
// Build up a list of `FuncIndex` corresponding to all the
// entries listed in this segment. Note that it's not
@ -646,7 +651,11 @@ impl<'data> ModuleEnvironment<'data> {
self.result.data.reserve_exact(cnt);
for (index, entry) in data.into_iter().enumerate() {
let wasmparser::Data { kind, data } = entry?;
let wasmparser::Data {
kind,
data,
range: _,
} = entry?;
let mk_range = |total: &mut u32| -> Result<_, WasmError> {
let range = u32::try_from(data.len())
.ok()

4
crates/fuzzing/Cargo.toml

@ -13,8 +13,8 @@ arbitrary = { version = "1.0.0", features = ["derive"] }
env_logger = "0.8.1"
log = "0.4.8"
rayon = "1.2.1"
wasmparser = "0.81"
wasmprinter = "0.2.31"
wasmparser = "0.82"
wasmprinter = "0.2.32"
wasmtime = { path = "../wasmtime" }
wasmtime-wast = { path = "../wast" }
wasm-encoder = "0.6.0"

2
crates/fuzzing/src/generators/table_ops.rs

@ -424,7 +424,7 @@ mod tests {
br 0 (;@1;)
end)
(table (;0;) 20 externref)
(global (;0;) (mut externref) (ref.null extern))
(global (;0;) (mut externref) ref.null extern)
(export "run" (func 3)))
"#;
eprintln!("expected WAT = {}", expected);

2
crates/types/Cargo.toml

@ -12,4 +12,4 @@ edition = "2018"
cranelift-entity = { path = "../../cranelift/entity", version = "0.80.0", features = ['enable-serde'] }
serde = { version = "1.0.94", features = ["derive"] }
thiserror = "1.0.4"
wasmparser = { version = "0.81", default-features = false }
wasmparser = { version = "0.82", default-features = false }

2
crates/wasmtime/Cargo.toml

@ -20,7 +20,7 @@ wasmtime-cache = { path = "../cache", version = "=0.33.0", optional = true }
wasmtime-fiber = { path = "../fiber", version = "=0.33.0", optional = true }
wasmtime-cranelift = { path = "../cranelift", version = "=0.33.0", optional = true }
target-lexicon = { version = "0.12.0", default-features = false }
wasmparser = "0.81"
wasmparser = "0.82"
anyhow = "1.0.19"
region = "2.2.0"
libc = "0.2"

42
crates/wasmtime/src/module/serialization.rs

@ -77,6 +77,8 @@ struct WasmFeatures {
pub multi_memory: bool,
pub exceptions: bool,
pub memory64: bool,
pub relaxed_simd: bool,
pub extended_const: bool,
}
impl From<&wasmparser::WasmFeatures> for WasmFeatures {
@ -93,20 +95,24 @@ impl From<&wasmparser::WasmFeatures> for WasmFeatures {
multi_memory,
exceptions,
memory64,
} = other;
relaxed_simd,
extended_const,
} = *other;
Self {
reference_types: *reference_types,
multi_value: *multi_value,
bulk_memory: *bulk_memory,
module_linking: *module_linking,
simd: *simd,
threads: *threads,
tail_call: *tail_call,
deterministic_only: *deterministic_only,
multi_memory: *multi_memory,
exceptions: *exceptions,
memory64: *memory64,
reference_types,
multi_value,
bulk_memory,
module_linking,
simd,
threads,
tail_call,
deterministic_only,
multi_memory,
exceptions,
memory64,
relaxed_simd,
extended_const,
}
}
}
@ -674,6 +680,8 @@ impl<'a> SerializedModule<'a> {
multi_memory,
exceptions,
memory64,
relaxed_simd,
extended_const,
} = self.metadata.features;
Self::check_bool(
@ -719,6 +727,16 @@ impl<'a> SerializedModule<'a> {
other.memory64,
"WebAssembly 64-bit memory support",
)?;
Self::check_bool(
extended_const,
other.extended_const,
"WebAssembly extended-const support",
)?;
Self::check_bool(
relaxed_simd,
other.relaxed_simd,
"WebAssembly relaxed-simd support",
)?;
Ok(())
}

2
crates/wast/Cargo.toml

@ -12,7 +12,7 @@ edition = "2018"
[dependencies]
anyhow = "1.0.19"
wasmtime = { path = "../wasmtime", version = "0.33.0", default-features = false, features = ['cranelift'] }
wast = "38.0.0"
wast = "39.0.0"
[badges]
maintenance = { status = "actively-developed" }

7
crates/wast/src/wast.rs

@ -4,6 +4,7 @@ use std::fmt::{Display, LowerHex};
use std::path::Path;
use std::str;
use wasmtime::*;
use wast::lexer::Lexer;
use wast::Wat;
use wast::{
parser::{self, ParseBuffer},
@ -215,8 +216,10 @@ impl<T> WastContext<T> {
err
};
let buf = wast::parser::ParseBuffer::new(wast).map_err(adjust_wast)?;
let ast = wast::parser::parse::<wast::Wast>(&buf).map_err(adjust_wast)?;
let mut lexer = Lexer::new(wast);
lexer.allow_confusing_unicode(filename.ends_with("names.wast"));
let buf = ParseBuffer::new_with_lexer(lexer).map_err(adjust_wast)?;
let ast = parser::parse::<wast::Wast>(&buf).map_err(adjust_wast)?;
for directive in ast.directives {
let sp = directive.span();

4
tests/misc_testsuite/multi-memory/simple.wast

@ -118,7 +118,7 @@
i32.const 1
i32.const 0
i32.const 4
memory.init $d $m1
memory.init $m1 $d
i32.const 1
i32.load)
@ -126,7 +126,7 @@
i32.const 1
i32.const 4
i32.const 4
memory.init $d $m2
memory.init $m2 $d
i32.const 1
i32.load (memory $m2))

Loading…
Cancel
Save