Upgrade wasmparser to 0.58.0 (#1942)
* Upgrade wasmparser to 0.58.0 * Enable more spec tests
This commit is contained in:
18
Cargo.lock
generated
18
Cargo.lock
generated
@@ -595,7 +595,7 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
"target-lexicon",
|
"target-lexicon",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"wasmparser 0.57.0",
|
"wasmparser 0.58.0",
|
||||||
"wat",
|
"wat",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1123,7 +1123,7 @@ dependencies = [
|
|||||||
"staticvec",
|
"staticvec",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"typemap",
|
"typemap",
|
||||||
"wasmparser 0.57.0",
|
"wasmparser 0.58.0",
|
||||||
"wat",
|
"wat",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -2299,9 +2299,9 @@ checksum = "af931e2e1960c53f4a28b063fec4cacd036f35acbec8ff3a4739125b17382a87"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasmparser"
|
name = "wasmparser"
|
||||||
version = "0.57.0"
|
version = "0.58.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "32fddd575d477c6e9702484139cf9f23dcd554b06d185ed0f56c857dd3a47aa6"
|
checksum = "721a8d79483738d7aef6397edcf8f04cd862640b1ad5973adf5bb50fc10e86db"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasmprinter"
|
name = "wasmprinter"
|
||||||
@@ -2327,7 +2327,7 @@ dependencies = [
|
|||||||
"rustc-demangle",
|
"rustc-demangle",
|
||||||
"target-lexicon",
|
"target-lexicon",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"wasmparser 0.57.0",
|
"wasmparser 0.58.0",
|
||||||
"wasmtime-environ",
|
"wasmtime-environ",
|
||||||
"wasmtime-jit",
|
"wasmtime-jit",
|
||||||
"wasmtime-profiling",
|
"wasmtime-profiling",
|
||||||
@@ -2400,7 +2400,7 @@ dependencies = [
|
|||||||
"object 0.19.0",
|
"object 0.19.0",
|
||||||
"target-lexicon",
|
"target-lexicon",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"wasmparser 0.57.0",
|
"wasmparser 0.58.0",
|
||||||
"wasmtime-environ",
|
"wasmtime-environ",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -2431,7 +2431,7 @@ dependencies = [
|
|||||||
"tempfile",
|
"tempfile",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"toml",
|
"toml",
|
||||||
"wasmparser 0.57.0",
|
"wasmparser 0.58.0",
|
||||||
"winapi",
|
"winapi",
|
||||||
"zstd",
|
"zstd",
|
||||||
]
|
]
|
||||||
@@ -2460,7 +2460,7 @@ dependencies = [
|
|||||||
"env_logger",
|
"env_logger",
|
||||||
"log",
|
"log",
|
||||||
"rayon",
|
"rayon",
|
||||||
"wasmparser 0.57.0",
|
"wasmparser 0.58.0",
|
||||||
"wasmprinter",
|
"wasmprinter",
|
||||||
"wasmtime",
|
"wasmtime",
|
||||||
"wasmtime-wast",
|
"wasmtime-wast",
|
||||||
@@ -2484,7 +2484,7 @@ dependencies = [
|
|||||||
"region",
|
"region",
|
||||||
"target-lexicon",
|
"target-lexicon",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"wasmparser 0.57.0",
|
"wasmparser 0.58.0",
|
||||||
"wasmtime-debug",
|
"wasmtime-debug",
|
||||||
"wasmtime-environ",
|
"wasmtime-environ",
|
||||||
"wasmtime-profiling",
|
"wasmtime-profiling",
|
||||||
|
|||||||
5
build.rs
5
build.rs
@@ -205,11 +205,6 @@ fn ignore(testsuite: &str, testname: &str, strategy: &str) -> bool {
|
|||||||
("simd", "simd_i16x8_arith2") => return true,
|
("simd", "simd_i16x8_arith2") => return true,
|
||||||
("simd", "simd_i8x16_arith2") => return true,
|
("simd", "simd_i8x16_arith2") => return true,
|
||||||
|
|
||||||
// waiting for the upstream spec to get updated with new binary
|
|
||||||
// encodings of operations and for that to propagate to the
|
|
||||||
// testsuite repo.
|
|
||||||
("simd", "simd_const") => return true,
|
|
||||||
|
|
||||||
("reference_types", "table_copy_on_imported_tables")
|
("reference_types", "table_copy_on_imported_tables")
|
||||||
| ("reference_types", "externref_id_function")
|
| ("reference_types", "externref_id_function")
|
||||||
| ("reference_types", "table_size")
|
| ("reference_types", "table_size")
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ keywords = ["webassembly", "wasm"]
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
wasmparser = { version = "0.57.0", default-features = false }
|
wasmparser = { version = "0.58.0", default-features = false }
|
||||||
cranelift-codegen = { path = "../codegen", version = "0.65.0", default-features = false }
|
cranelift-codegen = { path = "../codegen", version = "0.65.0", default-features = false }
|
||||||
cranelift-entity = { path = "../entity", version = "0.65.0" }
|
cranelift-entity = { path = "../entity", version = "0.65.0" }
|
||||||
cranelift-frontend = { path = "../frontend", version = "0.65.0", default-features = false }
|
cranelift-frontend = { path = "../frontend", version = "0.65.0", default-features = false }
|
||||||
|
|||||||
@@ -1575,7 +1575,10 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
|
|||||||
| Operator::I32x4WidenLowI16x8S { .. }
|
| Operator::I32x4WidenLowI16x8S { .. }
|
||||||
| Operator::I32x4WidenHighI16x8S { .. }
|
| Operator::I32x4WidenHighI16x8S { .. }
|
||||||
| Operator::I32x4WidenLowI16x8U { .. }
|
| Operator::I32x4WidenLowI16x8U { .. }
|
||||||
| Operator::I32x4WidenHighI16x8U { .. } => {
|
| Operator::I32x4WidenHighI16x8U { .. }
|
||||||
|
| Operator::I8x16Bitmask
|
||||||
|
| Operator::I16x8Bitmask
|
||||||
|
| Operator::I32x4Bitmask => {
|
||||||
return Err(wasm_unsupported!("proposed SIMD operator {:?}", op));
|
return Err(wasm_unsupported!("proposed SIMD operator {:?}", op));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2007,7 +2010,8 @@ fn type_of(operator: &Operator) -> Type {
|
|||||||
| Operator::I8x16MinU
|
| Operator::I8x16MinU
|
||||||
| Operator::I8x16MaxS
|
| Operator::I8x16MaxS
|
||||||
| Operator::I8x16MaxU
|
| Operator::I8x16MaxU
|
||||||
| Operator::I8x16RoundingAverageU => I8X16,
|
| Operator::I8x16RoundingAverageU
|
||||||
|
| Operator::I8x16Bitmask => I8X16,
|
||||||
|
|
||||||
Operator::I16x8Splat
|
Operator::I16x8Splat
|
||||||
| Operator::V16x8LoadSplat { .. }
|
| Operator::V16x8LoadSplat { .. }
|
||||||
@@ -2041,7 +2045,8 @@ fn type_of(operator: &Operator) -> Type {
|
|||||||
| Operator::I16x8MaxS
|
| Operator::I16x8MaxS
|
||||||
| Operator::I16x8MaxU
|
| Operator::I16x8MaxU
|
||||||
| Operator::I16x8RoundingAverageU
|
| Operator::I16x8RoundingAverageU
|
||||||
| Operator::I16x8Mul => I16X8,
|
| Operator::I16x8Mul
|
||||||
|
| Operator::I16x8Bitmask => I16X8,
|
||||||
|
|
||||||
Operator::I32x4Splat
|
Operator::I32x4Splat
|
||||||
| Operator::V32x4LoadSplat { .. }
|
| Operator::V32x4LoadSplat { .. }
|
||||||
@@ -2071,7 +2076,8 @@ fn type_of(operator: &Operator) -> Type {
|
|||||||
| Operator::I32x4MaxS
|
| Operator::I32x4MaxS
|
||||||
| Operator::I32x4MaxU
|
| Operator::I32x4MaxU
|
||||||
| Operator::F32x4ConvertI32x4S
|
| Operator::F32x4ConvertI32x4S
|
||||||
| Operator::F32x4ConvertI32x4U => I32X4,
|
| Operator::F32x4ConvertI32x4U
|
||||||
|
| Operator::I32x4Bitmask => I32X4,
|
||||||
|
|
||||||
Operator::I64x2Splat
|
Operator::I64x2Splat
|
||||||
| Operator::V64x2LoadSplat { .. }
|
| Operator::V64x2LoadSplat { .. }
|
||||||
|
|||||||
@@ -71,6 +71,11 @@ pub fn translate_module<'data>(
|
|||||||
environ.reserve_passive_data(count)?;
|
environ.reserve_passive_data(count)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SectionContent::Module(_)
|
||||||
|
| SectionContent::ModuleCode(_)
|
||||||
|
| SectionContent::Instance(_)
|
||||||
|
| SectionContent::Alias(_) => unimplemented!("module linking not implemented yet"),
|
||||||
|
|
||||||
SectionContent::Custom {
|
SectionContent::Custom {
|
||||||
name,
|
name,
|
||||||
binary,
|
binary,
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ use wasmparser::{
|
|||||||
ElementKind, ElementSectionReader, Export, ExportSectionReader, ExternalKind,
|
ElementKind, ElementSectionReader, Export, ExportSectionReader, ExternalKind,
|
||||||
FunctionSectionReader, GlobalSectionReader, GlobalType, ImportSectionEntryType,
|
FunctionSectionReader, GlobalSectionReader, GlobalType, ImportSectionEntryType,
|
||||||
ImportSectionReader, MemorySectionReader, MemoryType, NameSectionReader, Naming, NamingReader,
|
ImportSectionReader, MemorySectionReader, MemoryType, NameSectionReader, Naming, NamingReader,
|
||||||
Operator, TableSectionReader, Type, TypeSectionReader,
|
Operator, TableSectionReader, Type, TypeDef, TypeSectionReader,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Parses the Type section of the wasm module.
|
/// Parses the Type section of the wasm module.
|
||||||
@@ -40,8 +40,9 @@ pub fn parse_type_section(
|
|||||||
environ.reserve_signatures(count)?;
|
environ.reserve_signatures(count)?;
|
||||||
|
|
||||||
for entry in types {
|
for entry in types {
|
||||||
let wasm_func_ty = entry?;
|
if let Ok(TypeDef::Func(wasm_func_ty)) = entry {
|
||||||
let mut sig = Signature::new(ModuleEnvironment::target_config(environ).default_call_conv);
|
let mut sig =
|
||||||
|
Signature::new(ModuleEnvironment::target_config(environ).default_call_conv);
|
||||||
sig.params.extend(wasm_func_ty.params.iter().map(|ty| {
|
sig.params.extend(wasm_func_ty.params.iter().map(|ty| {
|
||||||
let cret_arg: ir::Type = type_to_type(*ty, environ)
|
let cret_arg: ir::Type = type_to_type(*ty, environ)
|
||||||
.expect("only numeric types are supported in function signatures");
|
.expect("only numeric types are supported in function signatures");
|
||||||
@@ -56,6 +57,9 @@ pub fn parse_type_section(
|
|||||||
module_translation_state
|
module_translation_state
|
||||||
.wasm_types
|
.wasm_types
|
||||||
.push((wasm_func_ty.params, wasm_func_ty.returns));
|
.push((wasm_func_ty.params, wasm_func_ty.returns));
|
||||||
|
} else {
|
||||||
|
unimplemented!("module linking not implemented yet")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -70,7 +74,7 @@ pub fn parse_import_section<'data>(
|
|||||||
for entry in imports {
|
for entry in imports {
|
||||||
let import = entry?;
|
let import = entry?;
|
||||||
let module_name = import.module;
|
let module_name = import.module;
|
||||||
let field_name = import.field;
|
let field_name = import.field.unwrap(); // TODO Handle error when module linking is implemented.
|
||||||
|
|
||||||
match import.ty {
|
match import.ty {
|
||||||
ImportSectionEntryType::Function(sig) => {
|
ImportSectionEntryType::Function(sig) => {
|
||||||
@@ -80,6 +84,9 @@ pub fn parse_import_section<'data>(
|
|||||||
field_name,
|
field_name,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
|
ImportSectionEntryType::Module(_sig) | ImportSectionEntryType::Instance(_sig) => {
|
||||||
|
unimplemented!("module linking not implemented yet")
|
||||||
|
}
|
||||||
ImportSectionEntryType::Memory(MemoryType {
|
ImportSectionEntryType::Memory(MemoryType {
|
||||||
limits: ref memlimits,
|
limits: ref memlimits,
|
||||||
shared,
|
shared,
|
||||||
@@ -268,6 +275,9 @@ pub fn parse_export_section<'data>(
|
|||||||
ExternalKind::Global => {
|
ExternalKind::Global => {
|
||||||
environ.declare_global_export(GlobalIndex::new(index), field)?
|
environ.declare_global_export(GlobalIndex::new(index), field)?
|
||||||
}
|
}
|
||||||
|
ExternalKind::Type | ExternalKind::Module | ExternalKind::Instance => {
|
||||||
|
unimplemented!("module linking not implemented yet")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ edition = "2018"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
gimli = "0.21.0"
|
gimli = "0.21.0"
|
||||||
wasmparser = "0.57.0"
|
wasmparser = "0.58.0"
|
||||||
object = { version = "0.19", default-features = false, features = ["write"] }
|
object = { version = "0.19", default-features = false, features = ["write"] }
|
||||||
wasmtime-environ = { path = "../environ", version = "0.18.0" }
|
wasmtime-environ = { path = "../environ", version = "0.18.0" }
|
||||||
target-lexicon = { version = "0.10.0", default-features = false }
|
target-lexicon = { version = "0.10.0", default-features = false }
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use gimli::{
|
|||||||
};
|
};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use wasmparser::{self, ModuleReader, SectionCode};
|
use wasmparser::{self, ModuleReader, SectionCode, TypeDef};
|
||||||
|
|
||||||
trait Reader: gimli::Reader<Offset = usize, Endian = LittleEndian> {}
|
trait Reader: gimli::Reader<Offset = usize, Endian = LittleEndian> {}
|
||||||
|
|
||||||
@@ -186,7 +186,13 @@ pub fn read_debuginfo(data: &[u8]) -> Result<DebugInfoData> {
|
|||||||
signatures_params = section
|
signatures_params = section
|
||||||
.get_type_section_reader()?
|
.get_type_section_reader()?
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|ft| Ok(ft?.params))
|
.map(|ft| {
|
||||||
|
if let Ok(TypeDef::Func(ft)) = ft {
|
||||||
|
Ok(ft.params)
|
||||||
|
} else {
|
||||||
|
unimplemented!("module linking not implemented yet")
|
||||||
|
}
|
||||||
|
})
|
||||||
.collect::<Result<Vec<_>>>()?;
|
.collect::<Result<Vec<_>>>()?;
|
||||||
}
|
}
|
||||||
SectionCode::Import => {
|
SectionCode::Import => {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ anyhow = "1.0"
|
|||||||
cranelift-codegen = { path = "../../cranelift/codegen", version = "0.65.0", features = ["enable-serde"] }
|
cranelift-codegen = { path = "../../cranelift/codegen", version = "0.65.0", features = ["enable-serde"] }
|
||||||
cranelift-entity = { path = "../../cranelift/entity", version = "0.65.0", features = ["enable-serde"] }
|
cranelift-entity = { path = "../../cranelift/entity", version = "0.65.0", features = ["enable-serde"] }
|
||||||
cranelift-wasm = { path = "../../cranelift/wasm", version = "0.65.0", features = ["enable-serde"] }
|
cranelift-wasm = { path = "../../cranelift/wasm", version = "0.65.0", features = ["enable-serde"] }
|
||||||
wasmparser = "0.57.0"
|
wasmparser = "0.58.0"
|
||||||
lightbeam = { path = "../lightbeam", optional = true, version = "0.18.0" }
|
lightbeam = { path = "../lightbeam", optional = true, version = "0.18.0" }
|
||||||
indexmap = "1.0.2"
|
indexmap = "1.0.2"
|
||||||
rayon = "1.2.1"
|
rayon = "1.2.1"
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ binaryen = { version = "0.10.0", optional = true }
|
|||||||
env_logger = "0.7.1"
|
env_logger = "0.7.1"
|
||||||
log = "0.4.8"
|
log = "0.4.8"
|
||||||
rayon = "1.2.1"
|
rayon = "1.2.1"
|
||||||
wasmparser = "0.57.0"
|
wasmparser = "0.58.0"
|
||||||
wasmprinter = "0.2.5"
|
wasmprinter = "0.2.5"
|
||||||
wasmtime = { path = "../wasmtime" }
|
wasmtime = { path = "../wasmtime" }
|
||||||
wasmtime-wast = { path = "../wast" }
|
wasmtime-wast = { path = "../wast" }
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ wasmtime-profiling = { path = "../profiling", version = "0.18.0" }
|
|||||||
region = "2.1.0"
|
region = "2.1.0"
|
||||||
thiserror = "1.0.4"
|
thiserror = "1.0.4"
|
||||||
target-lexicon = { version = "0.10.0", default-features = false }
|
target-lexicon = { version = "0.10.0", default-features = false }
|
||||||
wasmparser = "0.57.0"
|
wasmparser = "0.58.0"
|
||||||
more-asserts = "0.2.1"
|
more-asserts = "0.2.1"
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
cfg-if = "0.1.9"
|
cfg-if = "0.1.9"
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ smallvec = "1.0.0"
|
|||||||
staticvec = "0.10"
|
staticvec = "0.10"
|
||||||
thiserror = "1.0.9"
|
thiserror = "1.0.9"
|
||||||
typemap = "0.3"
|
typemap = "0.3"
|
||||||
wasmparser = "0.57.0"
|
wasmparser = "0.58.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
lazy_static = "1.2"
|
lazy_static = "1.2"
|
||||||
|
|||||||
@@ -5,14 +5,18 @@ use cranelift_codegen::{binemit, ir};
|
|||||||
use wasmparser::{
|
use wasmparser::{
|
||||||
CodeSectionReader, DataSectionReader, ElementSectionReader, ExportSectionReader, FuncType,
|
CodeSectionReader, DataSectionReader, ElementSectionReader, ExportSectionReader, FuncType,
|
||||||
FunctionSectionReader, GlobalSectionReader, ImportSectionReader, MemorySectionReader,
|
FunctionSectionReader, GlobalSectionReader, ImportSectionReader, MemorySectionReader,
|
||||||
MemoryType, TableSectionReader, TableType, TypeSectionReader,
|
MemoryType, TableSectionReader, TableType, TypeDef, TypeSectionReader,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Parses the Type section of the wasm module.
|
/// Parses the Type section of the wasm module.
|
||||||
pub fn type_(types_reader: TypeSectionReader) -> Result<Vec<FuncType>, Error> {
|
pub fn type_(types_reader: TypeSectionReader) -> Result<Vec<FuncType>, Error> {
|
||||||
types_reader
|
types_reader
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|r| r.map_err(Into::into))
|
.map(|r| match r {
|
||||||
|
Ok(TypeDef::Func(ft)) => Ok(ft),
|
||||||
|
Ok(_) => unimplemented!("module linking is not implemented yet"),
|
||||||
|
Err(e) => Err(e.into()),
|
||||||
|
})
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ wasmtime-runtime = { path = "../runtime", version = "0.18.0" }
|
|||||||
wasmtime-environ = { path = "../environ", version = "0.18.0" }
|
wasmtime-environ = { path = "../environ", version = "0.18.0" }
|
||||||
wasmtime-jit = { path = "../jit", version = "0.18.0" }
|
wasmtime-jit = { path = "../jit", version = "0.18.0" }
|
||||||
wasmtime-profiling = { path = "../profiling", version = "0.18.0" }
|
wasmtime-profiling = { path = "../profiling", version = "0.18.0" }
|
||||||
wasmparser = "0.57.0"
|
wasmparser = "0.58.0"
|
||||||
target-lexicon = { version = "0.10.0", default-features = false }
|
target-lexicon = { version = "0.10.0", default-features = false }
|
||||||
anyhow = "1.0.19"
|
anyhow = "1.0.19"
|
||||||
region = "2.1.0"
|
region = "2.1.0"
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ impl Config {
|
|||||||
enable_simd: false,
|
enable_simd: false,
|
||||||
enable_multi_value: true,
|
enable_multi_value: true,
|
||||||
enable_tail_call: false,
|
enable_tail_call: false,
|
||||||
|
enable_module_linking: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
flags,
|
flags,
|
||||||
|
|||||||
Reference in New Issue
Block a user