Bump the wasm-tools crates (#3139)

* Bump the wasm-tools crates

Pulls in some updates here and there, mostly for updating crates to the
latest version to prepare for later memory64 work.

* Update lightbeam
This commit is contained in:
Alex Crichton
2021-08-04 09:53:47 -05:00
committed by GitHub
parent 9419d635c6
commit a33caec9be
30 changed files with 148 additions and 137 deletions

View File

@@ -16,5 +16,5 @@ cranelift-wasm = { path = "../../cranelift/wasm", version = "0.76.0" }
cranelift-codegen = { path = "../../cranelift/codegen", version = "0.76.0" }
cranelift-frontend = { path = "../../cranelift/frontend", version = "0.76.0" }
cranelift-entity = { path = "../../cranelift/entity", version = "0.76.0" }
wasmparser = "0.79.0"
wasmparser = "0.80.0"
target-lexicon = "0.12"

View File

@@ -12,7 +12,7 @@ edition = "2018"
[dependencies]
gimli = "0.25.0"
wasmparser = "0.79"
wasmparser = "0.80"
object = { version = "0.26.0", default-features = false, features = ["read_core", "elf", "write"] }
wasmtime-environ = { path = "../environ", version = "0.29.0" }
target-lexicon = { version = "0.12.0", default-features = false }

View File

@@ -14,7 +14,7 @@ edition = "2018"
cranelift-codegen = { path = "../../cranelift/codegen", version = "0.76.0", features = ["enable-serde"] }
cranelift-entity = { path = "../../cranelift/entity", version = "0.76.0", features = ["enable-serde"] }
cranelift-wasm = { path = "../../cranelift/wasm", version = "0.76.0", features = ["enable-serde"] }
wasmparser = "0.79"
wasmparser = "0.80"
indexmap = { version = "1.0.2", features = ["serde-1"] }
thiserror = "1.0.4"
serde = { version = "1.0.94", features = ["derive"] }

View File

@@ -339,7 +339,7 @@ impl<'data> ModuleEnvironment<'data> {
EntityIndex::Instance(self.result.module.instances.push(ty))
}
EntityType::Module(ty) => EntityIndex::Module(self.result.module.modules.push(ty)),
EntityType::Event(_) => unimplemented!(),
EntityType::Tag(_) => unimplemented!(),
}
}
@@ -1088,7 +1088,7 @@ and for re-adding support for interface types you can see this issue:
EntityType::Module(sig) => {
self.result.module.modules.push(*sig);
}
EntityType::Event(_) => unimplemented!(),
EntityType::Tag(_) => unimplemented!(),
}
self.result
.module

View File

@@ -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.79"
wasmprinter = "0.2.27"
wasmparser = "0.80"
wasmprinter = "0.2.28"
wasmtime = { path = "../wasmtime" }
wasmtime-wast = { path = "../wast" }
wasm-encoder = "0.5.0"

View File

@@ -221,10 +221,7 @@ fn predict_rss(wasm: &[u8]) -> Result<usize> {
// the minimum amount of memory to our predicted rss.
Payload::MemorySection(s) => {
for entry in s {
let initial = match entry? {
MemoryType::M32 { limits, .. } => limits.initial as usize,
MemoryType::M64 { limits, .. } => limits.initial as usize,
};
let initial = entry?.initial as usize;
prediction += initial * 64 * 1024;
}
}
@@ -233,7 +230,7 @@ fn predict_rss(wasm: &[u8]) -> Result<usize> {
// currently this is 3 pointers per table entry.
Payload::TableSection(s) => {
for entry in s {
let initial = entry?.limits.initial as usize;
let initial = entry?.initial as usize;
prediction += initial * 3 * mem::size_of::<usize>();
}
}

View File

@@ -27,7 +27,7 @@ rayon = { version = "1.0", optional = true }
region = "2.2.0"
thiserror = "1.0.4"
target-lexicon = { version = "0.12.0", default-features = false }
wasmparser = "0.79"
wasmparser = "0.80"
more-asserts = "0.2.1"
anyhow = "1.0"
cfg-if = "1.0"

View File

@@ -24,7 +24,7 @@ more-asserts = "0.2.1"
smallvec = "1.6.1"
thiserror = "1.0.9"
typemap = "0.3"
wasmparser = "0.79"
wasmparser = "0.80"
[dev-dependencies]
lazy_static = "1.2"

View File

@@ -440,7 +440,7 @@ impl From<WasmMemoryImmediate> for MemoryImmediate {
assert_eq!(other.memory, 0);
MemoryImmediate {
flags: other.align.into(),
offset: other.offset,
offset: other.offset as u32,
}
}
}

View File

@@ -10,7 +10,7 @@ use memoffset::offset_of;
use std::{convert::TryInto, mem};
use thiserror::Error;
use wasmparser::{FuncType, MemoryType, Parser, Payload, ResizableLimits, Type};
use wasmparser::{FuncType, Parser, Payload, Type};
pub trait AsValueType {
const TYPE: Type;
@@ -104,12 +104,12 @@ pub struct TranslatedModule {
ctx: SimpleContext,
// TODO: Should we wrap this in a `Mutex` so that calling functions from multiple
// threads doesn't cause data races?
memory: Option<ResizableLimits>,
memory: Option<(u64, Option<u64>)>,
}
impl TranslatedModule {
pub fn instantiate(self) -> ExecutableModule {
let mem_size = self.memory.map(|limits| limits.initial).unwrap_or(0) as usize;
let mem_size = self.memory.map(|limits| limits.0 as u32).unwrap_or(0) as usize;
let mem: BoxSlice<_> = vec![0u8; mem_size * WASM_PAGE_SIZE]
.into_boxed_slice()
.into();
@@ -535,19 +535,12 @@ pub fn translate_only(data: &[u8]) -> Result<TranslatedModule, Error> {
if !mem.is_empty() {
let mem = mem[0];
let limits = match mem {
MemoryType::M32 {
limits,
shared: false,
} => limits,
_ => return Err(Error::Input("unsupported memory".to_string())),
};
if Some(limits.initial) != limits.maximum {
if Some(mem.initial) != mem.maximum {
return Err(Error::Input(
"Custom memory limits not supported in lightbeam".to_string(),
));
}
output.memory = Some(limits);
output.memory = Some((mem.initial, mem.maximum));
}
}
Payload::GlobalSection(s) => {

View File

@@ -13,6 +13,6 @@ edition = "2018"
[dependencies]
lightbeam = { path = "..", version = "0.29.0" }
wasmparser = "0.79"
wasmparser = "0.80"
cranelift-codegen = { path = "../../../cranelift/codegen", version = "0.76.0" }
wasmtime-environ = { path = "../../environ", version = "0.29.0" }

View File

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

View File

@@ -217,7 +217,7 @@ impl ExternType {
let ty = &types.instance_signatures[*ty];
InstanceType::from_wasmtime(types, ty).into()
}
EntityType::Event(_) => unimplemented!("wasm event support"),
EntityType::Tag(_) => unimplemented!("wasm tag support"),
}
}
}

View File

@@ -236,7 +236,7 @@ impl MatchCx<'_> {
EntityType::Global(_) => "global",
EntityType::Module(_) => "module",
EntityType::Memory(_) => "memory",
EntityType::Event(_) => "event",
EntityType::Tag(_) => "tag",
EntityType::Instance(_) => "instance",
EntityType::Table(_) => "table",
EntityType::Function(_) => "function",
@@ -301,7 +301,7 @@ impl MatchCx<'_> {
}
_ => bail!("expected module, but found {}", actual_desc),
},
EntityType::Event(_) => unimplemented!(),
EntityType::Tag(_) => unimplemented!(),
}
}
@@ -332,7 +332,7 @@ impl MatchCx<'_> {
Extern::Module(actual) => self.module(*expected, actual),
_ => bail!("expected module, but found {}", actual.desc()),
},
EntityType::Event(_) => unimplemented!(),
EntityType::Tag(_) => unimplemented!(),
}
}
@@ -373,6 +373,6 @@ fn entity_desc(ty: &EntityType) -> &'static str {
EntityType::Function(_) => "func",
EntityType::Instance(_) => "instance",
EntityType::Module(_) => "module",
EntityType::Event(_) => "event",
EntityType::Tag(_) => "tag",
}
}

View File

@@ -12,7 +12,7 @@ edition = "2018"
[dependencies]
anyhow = "1.0.19"
wasmtime = { path = "../wasmtime", version = "0.29.0", default-features = false }
wast = "36.0.0"
wast = "37.0.0"
[badges]
maintenance = { status = "actively-developed" }

View File

@@ -302,9 +302,15 @@ impl<T> WastContext<T> {
}
AssertInvalid {
span: _,
mut module,
module,
message,
} => {
let mut module = match module {
wast::QuoteModule::Module(m) => m,
// This is a `*.wat` parser test which we're not
// interested in.
wast::QuoteModule::Quote(_) => return Ok(()),
};
let bytes = module.encode()?;
let err = match self.module(None, &bytes) {
Ok(()) => bail!("expected module to fail to build"),
@@ -354,6 +360,7 @@ impl<T> WastContext<T> {
)
}
}
AssertUncaughtException { .. } => bail!("unimplemented assert_uncaught_exception"),
}
Ok(())