Update the spec reference testsuite submodule (#3450)
* Update the spec reference testsuite submodule This commit brings in recent updates to the spec test suite. Most of the changes here were already fixed in `wasmparser` with some tweaks to esoteric modules, but Wasmtime also gets a bug fix where where import matching for the size of tables/memories is based on the current runtime size of the table/memory rather than the original type of the table/memory. This means that during type matching the actual value is consulted for its size rather than using the minimum size listed in its type. * Fix now-missing directories in build script
This commit is contained in:
@@ -19,7 +19,7 @@ cranelift-codegen = { path = "../../cranelift/codegen", version = "0.77.0" }
|
||||
cranelift-frontend = { path = "../../cranelift/frontend", version = "0.77.0" }
|
||||
cranelift-entity = { path = "../../cranelift/entity", version = "0.77.0" }
|
||||
cranelift-native = { path = '../../cranelift/native', version = '0.77.0' }
|
||||
wasmparser = "0.80.0"
|
||||
wasmparser = "0.81.0"
|
||||
target-lexicon = "0.12"
|
||||
gimli = { version = "0.25.0", default-features = false, features = ['read', 'std'] }
|
||||
object = { version = "0.26.0", default-features = false, features = ['write'] }
|
||||
|
||||
@@ -14,7 +14,7 @@ edition = "2018"
|
||||
anyhow = "1.0"
|
||||
cranelift-entity = { path = "../../cranelift/entity", version = "0.77.0" }
|
||||
wasmtime-types = { path = "../types", version = "0.30.0" }
|
||||
wasmparser = "0.80"
|
||||
wasmparser = "0.81"
|
||||
indexmap = { version = "1.0.2", features = ["serde-1"] }
|
||||
thiserror = "1.0.4"
|
||||
serde = { version = "1.0.94", features = ["derive"] }
|
||||
|
||||
@@ -527,13 +527,28 @@ impl<'data> ModuleEnvironment<'data> {
|
||||
let mut elements =
|
||||
Vec::with_capacity(usize::try_from(items_reader.get_count()).unwrap());
|
||||
for item in items_reader {
|
||||
elements.push(match item? {
|
||||
ElementItem::Func(f) => {
|
||||
let func = match item? {
|
||||
ElementItem::Func(f) => Some(f),
|
||||
ElementItem::Expr(init) => {
|
||||
match init.get_binary_reader().read_operator()? {
|
||||
Operator::RefNull { .. } => None,
|
||||
Operator::RefFunc { function_index } => Some(function_index),
|
||||
s => {
|
||||
return Err(WasmError::Unsupported(format!(
|
||||
"unsupported init expr in element section: {:?}",
|
||||
s
|
||||
)));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
elements.push(match func {
|
||||
Some(f) => {
|
||||
let f = FuncIndex::from_u32(f);
|
||||
self.flag_func_escaped(f);
|
||||
f
|
||||
}
|
||||
ElementItem::Null(_ty) => FuncIndex::reserved_value(),
|
||||
None => FuncIndex::reserved_value(),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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.80"
|
||||
wasmprinter = "0.2.28"
|
||||
wasmparser = "0.81"
|
||||
wasmprinter = "0.2.31"
|
||||
wasmtime = { path = "../wasmtime" }
|
||||
wasmtime-wast = { path = "../wast" }
|
||||
wasm-encoder = "0.6.0"
|
||||
|
||||
@@ -16,7 +16,7 @@ wasmtime-runtime = { path = "../runtime", version = "0.30.0" }
|
||||
region = "2.2.0"
|
||||
thiserror = "1.0.4"
|
||||
target-lexicon = { version = "0.12.0", default-features = false }
|
||||
wasmparser = "0.80"
|
||||
wasmparser = "0.81"
|
||||
more-asserts = "0.2.1"
|
||||
anyhow = "1.0"
|
||||
cfg-if = "1.0"
|
||||
|
||||
@@ -12,4 +12,4 @@ edition = "2018"
|
||||
cranelift-entity = { path = "../../cranelift/entity", version = "0.77.0", features = ['enable-serde'] }
|
||||
serde = { version = "1.0.94", features = ["derive"] }
|
||||
thiserror = "1.0.4"
|
||||
wasmparser = { version = "0.80", default-features = false }
|
||||
wasmparser = { version = "0.81", default-features = false }
|
||||
|
||||
@@ -20,7 +20,7 @@ wasmtime-cache = { path = "../cache", version = "0.30.0", optional = true }
|
||||
wasmtime-fiber = { path = "../fiber", version = "0.30.0", optional = true }
|
||||
wasmtime-cranelift = { path = "../cranelift", version = "0.30.0", optional = true }
|
||||
target-lexicon = { version = "0.12.0", default-features = false }
|
||||
wasmparser = "0.80"
|
||||
wasmparser = "0.81"
|
||||
anyhow = "1.0.19"
|
||||
region = "2.2.0"
|
||||
libc = "0.2"
|
||||
|
||||
@@ -523,7 +523,10 @@ impl Table {
|
||||
///
|
||||
/// Panics if `store` does not own this table.
|
||||
pub fn size(&self, store: impl AsContext) -> u32 {
|
||||
let store = store.as_context();
|
||||
self.internal_size(store.as_context().0)
|
||||
}
|
||||
|
||||
pub(crate) fn internal_size(&self, store: &StoreOpaque) -> u32 {
|
||||
unsafe { (*store[self.0].definition).current_elements }
|
||||
}
|
||||
|
||||
|
||||
@@ -396,7 +396,11 @@ impl Memory {
|
||||
///
|
||||
/// Panics if this memory doesn't belong to `store`.
|
||||
pub fn data_size(&self, store: impl AsContext) -> usize {
|
||||
unsafe { (*store.as_context()[self.0].definition).current_length }
|
||||
self.internal_data_size(store.as_context().0)
|
||||
}
|
||||
|
||||
pub(crate) fn internal_data_size(&self, store: &StoreOpaque) -> usize {
|
||||
unsafe { (*store[self.0].definition).current_length }
|
||||
}
|
||||
|
||||
/// Returns the size, in WebAssembly pages, of this wasm memory.
|
||||
@@ -405,7 +409,11 @@ impl Memory {
|
||||
///
|
||||
/// Panics if this memory doesn't belong to `store`.
|
||||
pub fn size(&self, store: impl AsContext) -> u64 {
|
||||
(self.data_size(store) / wasmtime_environ::WASM_PAGE_SIZE as usize) as u64
|
||||
self.internal_size(store.as_context().0)
|
||||
}
|
||||
|
||||
pub(crate) fn internal_size(&self, store: &StoreOpaque) -> u64 {
|
||||
(self.internal_data_size(store) / wasmtime_environ::WASM_PAGE_SIZE as usize) as u64
|
||||
}
|
||||
|
||||
/// Grows this WebAssembly memory by `delta` pages.
|
||||
|
||||
@@ -35,15 +35,24 @@ impl MatchCx<'_> {
|
||||
}
|
||||
|
||||
pub fn table(&self, expected: &Table, actual: &crate::Table) -> Result<()> {
|
||||
self.table_ty(expected, actual.wasmtime_ty(self.store.store_data()))
|
||||
self.table_ty(
|
||||
expected,
|
||||
actual.wasmtime_ty(self.store.store_data()),
|
||||
Some(actual.internal_size(self.store)),
|
||||
)
|
||||
}
|
||||
|
||||
fn table_ty(&self, expected: &Table, actual: &Table) -> Result<()> {
|
||||
fn table_ty(
|
||||
&self,
|
||||
expected: &Table,
|
||||
actual: &Table,
|
||||
actual_runtime_size: Option<u32>,
|
||||
) -> Result<()> {
|
||||
match_ty(expected.wasm_ty, actual.wasm_ty, "table")?;
|
||||
match_limits(
|
||||
expected.minimum.into(),
|
||||
expected.maximum.map(|i| i.into()),
|
||||
actual.minimum.into(),
|
||||
actual_runtime_size.unwrap_or(actual.minimum).into(),
|
||||
actual.maximum.map(|i| i.into()),
|
||||
"table",
|
||||
)?;
|
||||
@@ -51,10 +60,19 @@ impl MatchCx<'_> {
|
||||
}
|
||||
|
||||
pub fn memory(&self, expected: &Memory, actual: &crate::Memory) -> Result<()> {
|
||||
self.memory_ty(expected, actual.wasmtime_ty(self.store.store_data()))
|
||||
self.memory_ty(
|
||||
expected,
|
||||
actual.wasmtime_ty(self.store.store_data()),
|
||||
Some(actual.internal_size(self.store)),
|
||||
)
|
||||
}
|
||||
|
||||
fn memory_ty(&self, expected: &Memory, actual: &Memory) -> Result<()> {
|
||||
fn memory_ty(
|
||||
&self,
|
||||
expected: &Memory,
|
||||
actual: &Memory,
|
||||
actual_runtime_size: Option<u64>,
|
||||
) -> Result<()> {
|
||||
match_bool(
|
||||
expected.shared,
|
||||
actual.shared,
|
||||
@@ -72,7 +90,7 @@ impl MatchCx<'_> {
|
||||
match_limits(
|
||||
expected.minimum,
|
||||
expected.maximum,
|
||||
actual.minimum,
|
||||
actual_runtime_size.unwrap_or(actual.minimum),
|
||||
actual.maximum,
|
||||
"memory",
|
||||
)?;
|
||||
@@ -280,11 +298,11 @@ impl MatchCx<'_> {
|
||||
_ => bail!("expected global, but found {}", actual_desc),
|
||||
},
|
||||
EntityType::Table(expected) => match actual_ty {
|
||||
EntityType::Table(actual) => self.table_ty(expected, actual),
|
||||
EntityType::Table(actual) => self.table_ty(expected, actual, None),
|
||||
_ => bail!("expected table, but found {}", actual_desc),
|
||||
},
|
||||
EntityType::Memory(expected) => match actual_ty {
|
||||
EntityType::Memory(actual) => self.memory_ty(expected, actual),
|
||||
EntityType::Memory(actual) => self.memory_ty(expected, actual, None),
|
||||
_ => bail!("expected memory, but found {}", actual_desc),
|
||||
},
|
||||
EntityType::Function(expected) => match *actual_ty {
|
||||
|
||||
Reference in New Issue
Block a user