From cd00ad1ba4fb0edc9726ab2c5c40f70255d34a4b Mon Sep 17 00:00:00 2001 From: Robin Freyler Date: Sun, 19 May 2024 15:20:59 +0200 Subject: [PATCH 01/12] update wasmparser dependency to upstream --- crates/wasmi/Cargo.toml | 7 ++-- crates/wasmi/src/engine/config.rs | 33 ++++++++--------- crates/wasmi/src/engine/translator/visit.rs | 4 +-- crates/wasmi/src/lib.rs | 2 +- crates/wasmi/src/module/element.rs | 40 +++++++++------------ crates/wasmi/src/module/init_expr.rs | 10 +++--- crates/wasmi/src/module/parser.rs | 19 ++++++---- crates/wasmi/src/module/utils.rs | 40 ++++++++++++++++++--- crates/wasmi/src/table/element.rs | 16 ++------- crates/wasmi/src/table/mod.rs | 7 ++-- 10 files changed, 97 insertions(+), 81 deletions(-) diff --git a/crates/wasmi/Cargo.toml b/crates/wasmi/Cargo.toml index 8e139b3e13..44e129c531 100644 --- a/crates/wasmi/Cargo.toml +++ b/crates/wasmi/Cargo.toml @@ -19,7 +19,7 @@ exclude = [ ] [dependencies] -wasmparser = { version = "0.100.2", package = "wasmparser-nostd", default-features = false } +wasmparser = { version = "0.207.0", default-features = false, features = ["validate"] } wasmi_core = { workspace = true } wasmi_collections = { workspace = true } spin = { version = "0.9", default-features = false, features = [ @@ -57,7 +57,10 @@ std = [ # malious actors that control their inputs. # # An example of such an environment is `wasm32-unknown-unknown`. -no-hash-maps = ["wasmi_collections/no-hash-maps"] +no-hash-maps = [ + "wasmi_collections/no-hash-maps", + # "wasmparser/no-hash-maps", +] [[bench]] name = "benches" diff --git a/crates/wasmi/src/engine/config.rs b/crates/wasmi/src/engine/config.rs index cce8a76181..45bc4a5871 100644 --- a/crates/wasmi/src/engine/config.rs +++ b/crates/wasmi/src/engine/config.rs @@ -389,24 +389,19 @@ impl Config { /// Returns the [`WasmFeatures`] represented by the [`Config`]. pub(crate) fn wasm_features(&self) -> WasmFeatures { - WasmFeatures { - multi_value: self.multi_value, - mutable_global: self.mutable_global, - saturating_float_to_int: self.saturating_float_to_int, - sign_extension: self.sign_extension, - bulk_memory: self.bulk_memory, - reference_types: self.reference_types, - tail_call: self.tail_call, - extended_const: self.extended_const, - floats: self.floats, - component_model: false, - simd: false, - relaxed_simd: false, - threads: false, - multi_memory: false, - exceptions: false, - memory64: false, - memory_control: false, - } + let mut features = WasmFeatures::empty(); + features.set(WasmFeatures::MUTABLE_GLOBAL, self.mutable_global); + features.set(WasmFeatures::MULTI_VALUE, self.multi_value); + features.set( + WasmFeatures::SATURATING_FLOAT_TO_INT, + self.saturating_float_to_int, + ); + features.set(WasmFeatures::SIGN_EXTENSION, self.sign_extension); + features.set(WasmFeatures::BULK_MEMORY, self.bulk_memory); + features.set(WasmFeatures::REFERENCE_TYPES, self.reference_types); + features.set(WasmFeatures::TAIL_CALL, self.tail_call); + features.set(WasmFeatures::EXTENDED_CONST, self.extended_const); + features.set(WasmFeatures::FLOATS, self.floats); + features } } diff --git a/crates/wasmi/src/engine/translator/visit.rs b/crates/wasmi/src/engine/translator/visit.rs index 3ce93d3394..81680c055b 100644 --- a/crates/wasmi/src/engine/translator/visit.rs +++ b/crates/wasmi/src/engine/translator/visit.rs @@ -1203,9 +1203,9 @@ impl<'a> VisitOperator<'a> for FuncTranslator { Ok(()) } - fn visit_ref_null(&mut self, ty: wasmparser::ValType) -> Self::Output { + fn visit_ref_null(&mut self, hty: wasmparser::HeapType) -> Self::Output { bail_unreachable!(self); - let type_hint = WasmiValueType::from(ty).into_inner(); + let type_hint = WasmiValueType::from(hty).into_inner(); let null = match type_hint { ValType::FuncRef => TypedVal::from(FuncRef::null()), ValType::ExternRef => TypedVal::from(ExternRef::null()), diff --git a/crates/wasmi/src/lib.rs b/crates/wasmi/src/lib.rs index e62f8816c4..9855fa9850 100644 --- a/crates/wasmi/src/lib.rs +++ b/crates/wasmi/src/lib.rs @@ -76,7 +76,7 @@ clippy::default_trait_access, clippy::items_after_statements )] -#![recursion_limit = "750"] +#![recursion_limit = "1000"] #[cfg(not(feature = "std"))] extern crate alloc as std; diff --git a/crates/wasmi/src/module/element.rs b/crates/wasmi/src/module/element.rs index c083745d53..15040bd1fc 100644 --- a/crates/wasmi/src/module/element.rs +++ b/crates/wasmi/src/module/element.rs @@ -1,5 +1,4 @@ use super::{ConstExpr, TableIdx}; -use crate::{core::ValType, module::utils::WasmiValueType}; use std::sync::Arc; /// A table element segment within a [`Module`]. @@ -9,8 +8,6 @@ use std::sync::Arc; pub struct ElementSegment { /// The kind of the [`ElementSegment`]. kind: ElementSegmentKind, - /// The type of elements of the [`ElementSegment`]. - ty: ValType, /// The items of the [`ElementSegment`]. items: ElementSegmentItems, } @@ -37,14 +34,20 @@ impl ElementSegmentItems { }) .map(ConstExpr::new_funcref) .collect::>(), - wasmparser::ElementItems::Expressions(items) => items - .clone() - .into_iter() - .map(|item| { - item.unwrap_or_else(|error| panic!("failed to parse element item: {error}")) - }) - .map(ConstExpr::new) - .collect::>(), + wasmparser::ElementItems::Expressions(reftype, items) => { + assert!(matches!( + *reftype, + wasmparser::RefType::EXTERNREF | wasmparser::RefType::FUNCREF + )); + items + .clone() + .into_iter() + .map(|item| { + item.unwrap_or_else(|error| panic!("failed to parse element item: {error}")) + }) + .map(ConstExpr::new) + .collect::>() + } }; Self { exprs } } @@ -94,7 +97,7 @@ impl From> for ElementSegmentKind { table_index, offset_expr, } => { - let table_index = TableIdx::from(table_index); + let table_index = TableIdx::from(table_index.unwrap_or(0)); let offset = ConstExpr::new(offset_expr); Self::Active(ActiveElementSegment { table_index, @@ -109,15 +112,9 @@ impl From> for ElementSegmentKind { impl From> for ElementSegment { fn from(element: wasmparser::Element<'_>) -> Self { - assert!( - element.ty.is_reference_type(), - "only reftypes are allowed as element types but found: {:?}", - element.ty - ); let kind = ElementSegmentKind::from(element.kind); - let ty = WasmiValueType::from(element.ty).into_inner(); let items = ElementSegmentItems::new(&element.items); - Self { kind, ty, items } + Self { kind, items } } } @@ -127,11 +124,6 @@ impl ElementSegment { &self.kind } - /// Returns the [`ValType`] of the [`ElementSegment`]. - pub fn ty(&self) -> ValType { - self.ty - } - /// Returns the element items of the [`ElementSegment`]. pub fn items_cloned(&self) -> ElementSegmentItems { self.items.clone() diff --git a/crates/wasmi/src/module/init_expr.rs b/crates/wasmi/src/module/init_expr.rs index 5e5b58de18..1bb0eb30a8 100644 --- a/crates/wasmi/src/module/init_expr.rs +++ b/crates/wasmi/src/module/init_expr.rs @@ -267,11 +267,11 @@ impl ConstExpr { wasmparser::Operator::GlobalGet { global_index } => { stack.push(Op::global(global_index)); } - wasmparser::Operator::RefNull { ty } => { - let value = match ty { - wasmparser::ValType::FuncRef => Val::from(FuncRef::null()), - wasmparser::ValType::ExternRef => Val::from(ExternRef::null()), - ty => panic!("encountered invalid value type for RefNull: {ty:?}"), + wasmparser::Operator::RefNull { hty } => { + let value = match hty { + wasmparser::HeapType::Func => Val::from(FuncRef::null()), + wasmparser::HeapType::Extern => Val::from(ExternRef::null()), + invalid => panic!("encountered invalid heap type for RefNull: {invalid:?}"), }; stack.push(Op::constant(value)); } diff --git a/crates/wasmi/src/module/parser.rs b/crates/wasmi/src/module/parser.rs index ef38277b8b..37f2b6ba46 100644 --- a/crates/wasmi/src/module/parser.rs +++ b/crates/wasmi/src/module/parser.rs @@ -111,20 +111,21 @@ impl ModuleParser { } let limits = self.engine.config().get_engine_limits(); let func_types = section.into_iter().map(|result| { - let wasmparser::Type::Func(ty) = result?; + let ty = result?.into_types().next().unwrap(); + let func_ty = ty.unwrap_func(); if let Some(limit) = limits.max_params { - if ty.params().len() > limit { + if func_ty.params().len() > limit { return Err(Error::from(EnforcedLimitsError::TooManyParameters { limit, })); } } if let Some(limit) = limits.max_results { - if ty.results().len() > limit { + if func_ty.results().len() > limit { return Err(Error::from(EnforcedLimitsError::TooManyResults { limit })); } } - Ok(FuncType::from_wasmparser(ty)) + Ok(FuncType::from_wasmparser(func_ty)) }); header.push_func_types(func_types)?; Ok(()) @@ -206,9 +207,13 @@ impl ModuleParser { if let Some(validator) = &mut self.validator { validator.table_section(§ion)?; } - let tables = section - .into_iter() - .map(|table| table.map(TableType::from_wasmparser).map_err(Error::from)); + let tables = section.into_iter().map(|table| match table { + Ok(table) => { + assert!(matches!(table.init, wasmparser::TableInit::RefNull)); + Ok(TableType::from_wasmparser(table.ty)) + } + Err(err) => Err(err.into()), + }); header.push_tables(tables)?; Ok(()) } diff --git a/crates/wasmi/src/module/utils.rs b/crates/wasmi/src/module/utils.rs index be13ecdb06..cd73b57bca 100644 --- a/crates/wasmi/src/module/utils.rs +++ b/crates/wasmi/src/module/utils.rs @@ -9,8 +9,19 @@ impl TableType { /// routine does not become part of the public API of [`TableType`]. pub(crate) fn from_wasmparser(table_type: wasmparser::TableType) -> Self { let element = WasmiValueType::from(table_type.element_type).into_inner(); - let minimum = table_type.initial; - let maximum = table_type.maximum; + let minimum: u32 = table_type + .initial + .try_into() + .unwrap_or_else(|_err| panic!("out of bounds minimum value: {}", table_type.initial)); + let maximum: Option = match table_type.maximum { + Some(maximum) => { + let maximum = maximum + .try_into() + .unwrap_or_else(|_err| panic!("out of bounds maximum value: {}", maximum)); + Some(maximum) + } + None => None, + }; Self::new(element, minimum, maximum) } } @@ -69,7 +80,7 @@ impl FuncType { /// /// We do not use the `From` trait here so that this conversion /// routine does not become part of the public API of [`FuncType`]. - pub(crate) fn from_wasmparser(func_type: wasmparser::FuncType) -> Self { + pub(crate) fn from_wasmparser(func_type: &wasmparser::FuncType) -> Self { /// Returns the [`ValType`] from the given [`wasmparser::Type`]. /// /// # Panics @@ -106,6 +117,26 @@ impl From for WasmiValueType { } } +impl From for WasmiValueType { + fn from(heap_type: wasmparser::HeapType) -> Self { + match heap_type { + wasmparser::HeapType::Func => Self::from(ValType::FuncRef), + wasmparser::HeapType::Extern => Self::from(ValType::ExternRef), + unsupported => panic!("encountered unsupported heap type: {unsupported:?}"), + } + } +} + +impl From for WasmiValueType { + fn from(ref_type: wasmparser::RefType) -> Self { + match ref_type { + wasmparser::RefType::FUNCREF => Self::from(ValType::FuncRef), + wasmparser::RefType::EXTERNREF => Self::from(ValType::ExternRef), + unsupported => panic!("encountered unsupported reference type: {unsupported:?}"), + } + } +} + impl From for WasmiValueType { fn from(value_type: wasmparser::ValType) -> Self { match value_type { @@ -114,8 +145,7 @@ impl From for WasmiValueType { wasmparser::ValType::F32 => Self::from(ValType::F32), wasmparser::ValType::F64 => Self::from(ValType::F64), wasmparser::ValType::V128 => panic!("wasmi does not support the `simd` Wasm proposal"), - wasmparser::ValType::FuncRef => Self::from(ValType::FuncRef), - wasmparser::ValType::ExternRef => Self::from(ValType::ExternRef), + wasmparser::ValType::Ref(ref_type) => WasmiValueType::from(ref_type), } } } diff --git a/crates/wasmi/src/table/element.rs b/crates/wasmi/src/table/element.rs index 1888c6356d..d06f9fb9ea 100644 --- a/crates/wasmi/src/table/element.rs +++ b/crates/wasmi/src/table/element.rs @@ -1,6 +1,5 @@ use crate::{ collections::arena::ArenaIndex, - core::ValType, module, module::{ConstExpr, ElementSegmentItems}, store::Stored, @@ -82,8 +81,6 @@ impl ElementSegment { /// a need to have an instantiated representation of data segments. #[derive(Debug)] pub struct ElementSegmentEntity { - /// The [`ValType`] of elements of this [`ElementSegmentEntity`]. - ty: ValType, /// The underlying items of the instance element segment. /// /// # Note @@ -96,26 +93,19 @@ pub struct ElementSegmentEntity { impl From<&'_ module::ElementSegment> for ElementSegmentEntity { fn from(segment: &'_ module::ElementSegment) -> Self { - let ty = segment.ty(); match segment.kind() { module::ElementSegmentKind::Passive | module::ElementSegmentKind::Active(_) => Self { - ty, items: Some(segment.items_cloned()), }, - module::ElementSegmentKind::Declared => Self::empty(ty), + module::ElementSegmentKind::Declared => Self::empty(), } } } impl ElementSegmentEntity { /// Create an empty [`ElementSegmentEntity`] representing dropped element segments. - fn empty(ty: ValType) -> Self { - Self { ty, items: None } - } - - /// Returns the [`ValType`] of elements in the [`ElementSegmentEntity`]. - pub fn ty(&self) -> ValType { - self.ty + fn empty() -> Self { + Self { items: None } } /// Returns the number of items in the [`ElementSegment`]. diff --git a/crates/wasmi/src/table/mod.rs b/crates/wasmi/src/table/mod.rs index 9f549689a8..2b415bc2ff 100644 --- a/crates/wasmi/src/table/mod.rs +++ b/crates/wasmi/src/table/mod.rs @@ -366,9 +366,10 @@ impl TableEntity { table_type.element().is_ref(), "table.init currently only works on reftypes" ); - table_type - .matches_element_type(element.ty()) - .map_err(|_| TrapCode::BadSignature)?; + // Removed because Element lost its type field in a wasmparser update. + // table_type + // .matches_element_type(element.ty()) + // .map_err(|_| TrapCode::BadSignature)?; // Convert parameters to indices. let dst_index = dst_index as usize; let src_index = src_index as usize; From 183974518f1c613fc3583c5b939669cce20a08ae Mon Sep 17 00:00:00 2001 From: Robin Freyler Date: Fri, 26 Jul 2024 17:04:38 +0200 Subject: [PATCH 02/12] update to wasmparser v0.214.0 --- Cargo.lock | 182 ++++++++++--------- crates/wasmi/Cargo.toml | 4 +- crates/wasmi/src/engine/mod.rs | 13 +- crates/wasmi/src/engine/translator/driver.rs | 16 +- crates/wasmi/src/engine/translator/mod.rs | 27 +++ crates/wasmi/src/engine/translator/visit.rs | 11 +- crates/wasmi/src/module/init_expr.rs | 15 +- crates/wasmi/src/module/utils.rs | 12 +- 8 files changed, 169 insertions(+), 111 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 31422f4506..a61f874280 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -46,9 +46,9 @@ checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" [[package]] name = "anstream" -version = "0.6.14" +version = "0.6.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" +checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" dependencies = [ "anstyle", "anstyle-parse", @@ -61,33 +61,33 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" [[package]] name = "anstyle-parse" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" +checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" +checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" dependencies = [ "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.3" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" +checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" dependencies = [ "anstyle", "windows-sys 0.52.0", @@ -116,9 +116,9 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "assert_cmd" -version = "2.0.14" +version = "2.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed72493ac66d5804837f480ab3766c72bdfab91a65e565fc54fa9e42db0073a8" +checksum = "bc65048dd435533bb1baf2ed9956b9a278fbfdcf90301b39ee117f06c0199d37" dependencies = [ "anstyle", "bstr", @@ -143,7 +143,7 @@ checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -192,9 +192,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.9.1" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05efc5cfd9110c8416e471df0e96702d58690178e206e61b7173706673c93706" +checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" dependencies = [ "memchr", "regex-automata", @@ -286,13 +286,12 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.1.0" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaff6f8ce506b9773fa786672d63fc7a191ffea1be33f72bbd4aeacefca9ffc8" +checksum = "2aba8f4e9906c7ce3c73463f62a7f0c65183ada1a2d47e397cc8810827f9694f" dependencies = [ "jobserver", "libc", - "once_cell", ] [[package]] @@ -330,9 +329,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.9" +version = "4.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64acc1846d54c1fe936a78dc189c34e28d3f5afc348403f28ecf53660b9b8462" +checksum = "35723e6a11662c2afb578bcf0b88bf6ea8e21282a953428f240574fcc3a2b5b3" dependencies = [ "clap_builder", "clap_derive", @@ -340,9 +339,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.9" +version = "4.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8393d67ba2e7bfaf28a23458e4e2b543cc73a99595511eb207fdb8aede942" +checksum = "49eb96cbfa7cfa35017b7cd548c75b14c3118c98b423041d70562665e07fb0fa" dependencies = [ "anstream", "anstyle", @@ -352,21 +351,21 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.8" +version = "4.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bac35c6dafb060fd4d275d9a4ffae97917c13a6327903a8be2153cd964f7085" +checksum = "5d029b67f89d30bbb547c89fd5161293c0aec155fc691d7924b64550662db93e" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] name = "clap_lex" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" +checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" [[package]] name = "cobs" @@ -376,9 +375,9 @@ checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" [[package]] name = "colorchoice" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" +checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" [[package]] name = "cpp_demangle" @@ -504,7 +503,7 @@ dependencies = [ "itertools 0.12.1", "log", "smallvec", - "wasmparser", + "wasmparser 0.207.0", "wasmtime-types", ] @@ -609,7 +608,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -747,9 +746,9 @@ checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" [[package]] name = "flagset" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdeb3aa5e95cf9aabc17f060cfa0ced7b83f042390760ca53bf09df9968acaa1" +checksum = "b3ea1ec5f8307826a5b71094dd91fc04d4ae75d5709b20ad351c7fb4815c86ec" [[package]] name = "fs-set-times" @@ -954,9 +953,9 @@ dependencies = [ [[package]] name = "is_terminal_polyfill" -version = "1.70.0" +version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "itertools" @@ -1004,9 +1003,9 @@ dependencies = [ [[package]] name = "jobserver" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" dependencies = [ "libc", ] @@ -1121,7 +1120,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -1194,9 +1193,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "predicates" -version = "3.1.0" +version = "3.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b87bfd4605926cdfefc1c3b5f8fe560e3feca9d5552cf68c466d3d8236c7e8" +checksum = "7e9086cc7640c29a356d1a29fd134380bee9d8f79a17410aa76e7ad295f42c97" dependencies = [ "anstyle", "difflib", @@ -1205,15 +1204,15 @@ dependencies = [ [[package]] name = "predicates-core" -version = "1.0.6" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b794032607612e7abeb4db69adb4e33590fa6cf1149e95fd7cb00e634b92f174" +checksum = "ae8177bee8e75d6846599c6b9ff679ed51e882816914eec639944d7c9aa11931" [[package]] name = "predicates-tree" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368ba315fb8c5052ab692e68a0eefec6ec57b23a36959c14496f0b0df2c0cecf" +checksum = "41b740d195ed3166cd147c8047ec98db0e22ec019eb8eeb76d343b795304fb13" dependencies = [ "predicates-core", "termtree", @@ -1428,7 +1427,7 @@ checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -1444,9 +1443,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.6" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" +checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" dependencies = [ "serde", ] @@ -1534,9 +1533,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.70" +version = "2.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f0209b68b3613b093e0ec905354eccaedcfe83b8cb37cbdeae64026c3064c16" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" dependencies = [ "proc-macro2", "quote", @@ -1573,22 +1572,22 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "thiserror" -version = "1.0.61" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.61" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -1603,9 +1602,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.14" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f49eb2ab21d2f26bd6db7bf383edc527a7ebaee412d17af4d40fdccd442f335" +checksum = "81967dd0dd2c1ab0bc3468bd7caecc32b8a4aa47d0c8c695d8c2b2108168d62c" dependencies = [ "serde", "serde_spanned", @@ -1615,18 +1614,18 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.6" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" +checksum = "f8fb9f64314842840f1d940ac544da178732128f1c78c21772e876579e0da1db" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.22.15" +version = "0.22.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59a3a72298453f564e2b111fa896f8d07fabb36f51f06d7e875fc5e0b5a3ef1" +checksum = "8d9f8729f5aea9562aac1cc0441f5d6de3cff1ee0c5d67293eeca5eb36ee7c16" dependencies = [ "indexmap", "serde", @@ -1655,7 +1654,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -1705,9 +1704,9 @@ checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "wait-timeout" @@ -1805,9 +1804,9 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.212.0" +version = "0.214.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501940df4418b8929eb6d52f1aade1fdd15a5b86c92453cb696e3c906bd3fc33" +checksum = "ff694f02a8d7a50b6922b197ae03883fbf18cdb2ae9fbee7b6148456f5f44041" dependencies = [ "leb128", ] @@ -1853,7 +1852,7 @@ dependencies = [ "spin", "wasmi_collections", "wasmi_core 0.36.0", - "wasmparser-nostd", + "wasmparser 0.214.0", "wast 70.0.2", "wat", ] @@ -1967,6 +1966,19 @@ dependencies = [ "semver", ] +[[package]] +name = "wasmparser" +version = "0.214.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5309c1090e3e84dad0d382f42064e9933fdaedb87e468cc239f0eabea73ddcb6" +dependencies = [ + "ahash", + "bitflags 2.6.0", + "hashbrown 0.14.5", + "indexmap", + "semver", +] + [[package]] name = "wasmparser-nostd" version = "0.100.2" @@ -1983,7 +1995,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c2d8a7b4dabb460208e6b4334d9db5766e84505038b2529e69c3d07ac619115" dependencies = [ "anyhow", - "wasmparser", + "wasmparser 0.207.0", ] [[package]] @@ -2025,7 +2037,7 @@ dependencies = [ "sptr", "target-lexicon", "wasm-encoder 0.207.0", - "wasmparser", + "wasmparser 0.207.0", "wasmtime-asm-macros", "wasmtime-cache", "wasmtime-component-macro", @@ -2080,7 +2092,7 @@ dependencies = [ "anyhow", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", "wasmtime-component-util", "wasmtime-wit-bindgen", "wit-parser", @@ -2111,7 +2123,7 @@ dependencies = [ "object", "target-lexicon", "thiserror", - "wasmparser", + "wasmparser 0.207.0", "wasmtime-environ", "wasmtime-versioned-export-macros", ] @@ -2135,7 +2147,7 @@ dependencies = [ "serde_derive", "target-lexicon", "wasm-encoder 0.207.0", - "wasmparser", + "wasmparser 0.207.0", "wasmprinter", "wasmtime-component-util", "wasmtime-types", @@ -2196,7 +2208,7 @@ dependencies = [ "serde", "serde_derive", "smallvec", - "wasmparser", + "wasmparser 0.207.0", ] [[package]] @@ -2207,7 +2219,7 @@ checksum = "d4cedc5bfef3db2a85522ee38564b47ef3b7fc7c92e94cacbce99808e63cdd47" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -2221,7 +2233,7 @@ dependencies = [ "gimli", "object", "target-lexicon", - "wasmparser", + "wasmparser 0.207.0", "wasmtime-cranelift", "wasmtime-environ", "winch-codegen", @@ -2263,24 +2275,24 @@ dependencies = [ [[package]] name = "wast" -version = "212.0.0" +version = "214.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4606a05fb0aae5d11dd7d8280a640d88a63ee019360ba9be552da3d294b8d1f5" +checksum = "694bcdb24c49c8709bd8713768b71301a11e823923eee355d530f1d8d0a7f8e9" dependencies = [ "bumpalo", "leb128", "memchr", "unicode-width", - "wasm-encoder 0.212.0", + "wasm-encoder 0.214.0", ] [[package]] name = "wat" -version = "1.212.0" +version = "1.214.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c74ca7f93f11a5d6eed8499f2a8daaad6e225cab0151bc25a091fff3b987532f" +checksum = "347249eb56773fa728df2656cfe3a8c19437ded61a922a0b5e0839d9790e278e" dependencies = [ - "wast 212.0.0", + "wast 214.0.0", ] [[package]] @@ -2368,7 +2380,7 @@ dependencies = [ "regalloc2", "smallvec", "target-lexicon", - "wasmparser", + "wasmparser 0.207.0", "wasmtime-cranelift", "wasmtime-environ", ] @@ -2548,9 +2560,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.13" +version = "0.6.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59b5e5f6c299a3c7890b876a2a587f3115162487e704907d9b6cd29473052ba1" +checksum = "b480ae9340fc261e6be3e95a1ba86d54ae3f9171132a73ce8d4bbaf68339507c" dependencies = [ "memchr", ] @@ -2581,7 +2593,7 @@ dependencies = [ "serde_derive", "serde_json", "unicode-xid", - "wasmparser", + "wasmparser 0.207.0", ] [[package]] @@ -2613,7 +2625,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] diff --git a/crates/wasmi/Cargo.toml b/crates/wasmi/Cargo.toml index 44e129c531..b8f17a251c 100644 --- a/crates/wasmi/Cargo.toml +++ b/crates/wasmi/Cargo.toml @@ -19,7 +19,7 @@ exclude = [ ] [dependencies] -wasmparser = { version = "0.207.0", default-features = false, features = ["validate"] } +wasmparser = { version = "0.214.0", default-features = false, features = ["validate"] } wasmi_core = { workspace = true } wasmi_collections = { workspace = true } spin = { version = "0.9", default-features = false, features = [ @@ -59,7 +59,7 @@ std = [ # An example of such an environment is `wasm32-unknown-unknown`. no-hash-maps = [ "wasmi_collections/no-hash-maps", - # "wasmparser/no-hash-maps", + "wasmparser/no-hash-maps", ] [[bench]] diff --git a/crates/wasmi/src/engine/mod.rs b/crates/wasmi/src/engine/mod.rs index de3f1d9fcc..7c78b5838f 100644 --- a/crates/wasmi/src/engine/mod.rs +++ b/crates/wasmi/src/engine/mod.rs @@ -224,6 +224,7 @@ impl Engine { module: ModuleHeader, func_to_validate: Option>, ) -> Result<(), Error> { + let features = self.config().wasm_features(); match (self.config().get_compilation_mode(), func_to_validate) { (CompilationMode::Eager, Some(func_to_validate)) => { let (translation_allocs, validation_allocs) = self.inner.get_allocs(); @@ -244,7 +245,8 @@ impl Engine { } (CompilationMode::LazyTranslation, Some(func_to_validate)) => { let allocs = self.inner.get_validation_allocs(); - let translator = LazyFuncTranslator::new(func_index, engine_func, module, None); + let translator = + LazyFuncTranslator::new(func_index, engine_func, module, None, features); let validator = func_to_validate.into_validator(allocs); let translator = ValidatingFuncTranslator::new(validator, translator)?; let allocs = FuncTranslationDriver::new(offset, bytes, translator)? @@ -252,8 +254,13 @@ impl Engine { self.inner.recycle_validation_allocs(allocs.validation); } (CompilationMode::Lazy | CompilationMode::LazyTranslation, func_to_validate) => { - let translator = - LazyFuncTranslator::new(func_index, engine_func, module, func_to_validate); + let translator = LazyFuncTranslator::new( + func_index, + engine_func, + module, + func_to_validate, + features, + ); FuncTranslationDriver::new(offset, bytes, translator)? .translate(|func_entity| self.inner.init_func(engine_func, func_entity))?; } diff --git a/crates/wasmi/src/engine/translator/driver.rs b/crates/wasmi/src/engine/translator/driver.rs index 4dc0256bc2..957fbfad6f 100644 --- a/crates/wasmi/src/engine/translator/driver.rs +++ b/crates/wasmi/src/engine/translator/driver.rs @@ -2,7 +2,7 @@ use crate::{ engine::{code_map::CompiledFuncEntity, WasmTranslator}, Error, }; -use wasmparser::FunctionBody; +use wasmparser::{BinaryReader, FunctionBody}; /// Translates Wasm bytecode into Wasmi bytecode for a single Wasm function. pub struct FuncTranslationDriver<'parser, T> { @@ -14,7 +14,10 @@ pub struct FuncTranslationDriver<'parser, T> { translator: T, } -impl<'parser, T> FuncTranslationDriver<'parser, T> { +impl<'parser, T> FuncTranslationDriver<'parser, T> +where + T: WasmTranslator<'parser>, +{ /// Creates a new Wasm to Wasmi bytecode function translator. pub fn new( offset: impl Into>, @@ -22,19 +25,16 @@ impl<'parser, T> FuncTranslationDriver<'parser, T> { translator: T, ) -> Result { let offset = offset.into().unwrap_or(0); - let func_body = FunctionBody::new(offset, bytes); + let features = translator.features(); + let reader = BinaryReader::new(bytes, offset, features); + let func_body = FunctionBody::new(reader); Ok(Self { func_body, bytes, translator, }) } -} -impl<'parser, T> FuncTranslationDriver<'parser, T> -where - T: WasmTranslator<'parser>, -{ /// Starts translation of the Wasm stream into Wasmi bytecode. pub fn translate( mut self, diff --git a/crates/wasmi/src/engine/translator/mod.rs b/crates/wasmi/src/engine/translator/mod.rs index 374f005476..1922f1506f 100644 --- a/crates/wasmi/src/engine/translator/mod.rs +++ b/crates/wasmi/src/engine/translator/mod.rs @@ -71,6 +71,7 @@ use wasmparser::{ MemArg, ValidatorResources, VisitOperator, + WasmFeatures, }; /// Reusable allocations of a [`FuncTranslator`]. @@ -175,6 +176,9 @@ pub trait WasmTranslator<'parser>: VisitOperator<'parser, Output = Result<(), Er /// used for translation of the Wasm function body. fn setup(&mut self, bytes: &[u8]) -> Result; + /// Returns a reference to the [`WasmFeatures`] used by the [`WasmTranslator`]. + fn features(&self) -> WasmFeatures; + /// Translates the given local variables for the translated function. fn translate_locals( &mut self, @@ -258,6 +262,10 @@ where Ok(false) } + fn features(&self) -> WasmFeatures { + self.translator.features() + } + fn translate_locals( &mut self, amount: u32, @@ -366,6 +374,13 @@ pub struct LazyFuncTranslator { module: ModuleHeader, /// Optional information about lazy Wasm validation. func_to_validate: Option>, + /// The Wasm features used for validation and parsing. + /// + /// # ToDo + /// + /// We currently require this field since there is no way to query the + /// [`WasmFeatures`] of a [`FuncValidator`] even though it has one. + features: WasmFeatures, } impl fmt::Debug for LazyFuncTranslator { @@ -386,12 +401,14 @@ impl LazyFuncTranslator { engine_func: EngineFunc, module: ModuleHeader, func_to_validate: Option>, + features: WasmFeatures, ) -> Self { Self { func_idx, engine_func, module, func_to_validate, + features, } } } @@ -419,6 +436,11 @@ impl<'parser> WasmTranslator<'parser> for LazyFuncTranslator { Ok(true) } + #[inline] + fn features(&self) -> WasmFeatures { + self.features + } + #[inline] fn translate_locals( &mut self, @@ -501,6 +523,11 @@ impl<'parser> WasmTranslator<'parser> for FuncTranslator { Ok(false) } + #[inline] + fn features(&self) -> WasmFeatures { + self.engine.config().wasm_features() + } + fn translate_locals( &mut self, amount: u32, diff --git a/crates/wasmi/src/engine/translator/visit.rs b/crates/wasmi/src/engine/translator/visit.rs index 7df616a4ce..6d72bb1822 100644 --- a/crates/wasmi/src/engine/translator/visit.rs +++ b/crates/wasmi/src/engine/translator/visit.rs @@ -679,12 +679,7 @@ impl<'a> VisitOperator<'a> for FuncTranslator { Ok(()) } - fn visit_call_indirect( - &mut self, - type_index: u32, - table_index: u32, - _table_byte: u8, - ) -> Self::Output { + fn visit_call_indirect(&mut self, type_index: u32, table_index: u32) -> Self::Output { bail_unreachable!(self); self.bump_fuel_consumption(FuelCosts::call)?; let type_index = SignatureIdx::from(type_index); @@ -1148,7 +1143,7 @@ impl<'a> VisitOperator<'a> for FuncTranslator { ) } - fn visit_memory_size(&mut self, mem: u32, _mem_byte: u8) -> Self::Output { + fn visit_memory_size(&mut self, mem: u32) -> Self::Output { debug_assert_eq!( mem, 0, "wasmi does not yet support the multi-memory Wasm proposal" @@ -1159,7 +1154,7 @@ impl<'a> VisitOperator<'a> for FuncTranslator { Ok(()) } - fn visit_memory_grow(&mut self, _mem: u32, _mem_byte: u8) -> Self::Output { + fn visit_memory_grow(&mut self, _mem: u32) -> Self::Output { bail_unreachable!(self); let delta = self.alloc.stack.pop(); let delta = >>::new(delta, &mut self.alloc.stack)?; diff --git a/crates/wasmi/src/module/init_expr.rs b/crates/wasmi/src/module/init_expr.rs index 1bb0eb30a8..4e94457d4d 100644 --- a/crates/wasmi/src/module/init_expr.rs +++ b/crates/wasmi/src/module/init_expr.rs @@ -16,6 +16,7 @@ use crate::{ use core::fmt; use smallvec::SmallVec; use std::boxed::Box; +use wasmparser::AbstractHeapType; /// Types that allow evluation given an evaluation context. pub trait Eval { @@ -269,9 +270,17 @@ impl ConstExpr { } wasmparser::Operator::RefNull { hty } => { let value = match hty { - wasmparser::HeapType::Func => Val::from(FuncRef::null()), - wasmparser::HeapType::Extern => Val::from(ExternRef::null()), - invalid => panic!("encountered invalid heap type for RefNull: {invalid:?}"), + wasmparser::HeapType::Abstract { + shared: false, + ty: AbstractHeapType::Func, + } => Val::from(FuncRef::null()), + wasmparser::HeapType::Abstract { + shared: false, + ty: AbstractHeapType::Extern, + } => Val::from(ExternRef::null()), + invalid => { + panic!("encountered invalid heap type for `ref.null`: {invalid:?}") + } }; stack.push(Op::constant(value)); } diff --git a/crates/wasmi/src/module/utils.rs b/crates/wasmi/src/module/utils.rs index cd73b57bca..68b771dccf 100644 --- a/crates/wasmi/src/module/utils.rs +++ b/crates/wasmi/src/module/utils.rs @@ -1,3 +1,5 @@ +use wasmparser::AbstractHeapType; + use crate::{core::ValType, FuncType, GlobalType, MemoryType, Mutability, TableType}; impl TableType { @@ -120,8 +122,14 @@ impl From for WasmiValueType { impl From for WasmiValueType { fn from(heap_type: wasmparser::HeapType) -> Self { match heap_type { - wasmparser::HeapType::Func => Self::from(ValType::FuncRef), - wasmparser::HeapType::Extern => Self::from(ValType::ExternRef), + wasmparser::HeapType::Abstract { + shared: false, + ty: AbstractHeapType::Func, + } => Self::from(ValType::FuncRef), + wasmparser::HeapType::Abstract { + shared: false, + ty: AbstractHeapType::Extern, + } => Self::from(ValType::ExternRef), unsupported => panic!("encountered unsupported heap type: {unsupported:?}"), } } From 181eba61ac9c2478f4b04f43acfb5734fe4e25bf Mon Sep 17 00:00:00 2001 From: Robin Freyler Date: Fri, 26 Jul 2024 17:36:08 +0200 Subject: [PATCH 03/12] use WasmFeatures in Config The new WasmFeatures type requires a bit less stack space due to bitfield usage. Ideally we use our own bitfield based type but this is more work. --- crates/wasmi/src/engine/config.rs | 79 ++++++++++++------------------- 1 file changed, 29 insertions(+), 50 deletions(-) diff --git a/crates/wasmi/src/engine/config.rs b/crates/wasmi/src/engine/config.rs index 2db9bc6bf5..963304294e 100644 --- a/crates/wasmi/src/engine/config.rs +++ b/crates/wasmi/src/engine/config.rs @@ -15,24 +15,8 @@ pub struct Config { stack_limits: StackLimits, /// The amount of Wasm stacks to keep in cache at most. cached_stacks: usize, - /// Is `true` if the `mutable-global` Wasm proposal is enabled. - mutable_global: bool, - /// Is `true` if the `sign-extension` Wasm proposal is enabled. - sign_extension: bool, - /// Is `true` if the `saturating-float-to-int` Wasm proposal is enabled. - saturating_float_to_int: bool, - /// Is `true` if the [`multi-value`] Wasm proposal is enabled. - multi_value: bool, - /// Is `true` if the [`bulk-memory`] Wasm proposal is enabled. - bulk_memory: bool, - /// Is `true` if the [`reference-types`] Wasm proposal is enabled. - reference_types: bool, - /// Is `true` if the [`tail-call`] Wasm proposal is enabled. - tail_call: bool, - /// Is `true` if the [`extended-const`] Wasm proposal is enabled. - extended_const: bool, - /// Is `true` if Wasm instructions on `f32` and `f64` types are allowed. - floats: bool, + /// The Wasm features used when validating or translating functions. + features: WasmFeatures, /// Is `true` if Wasmi executions shall consume fuel. consume_fuel: bool, /// Is `true` if Wasmi shall ignore Wasm custom sections when parsing Wasm modules. @@ -172,15 +156,7 @@ impl Default for Config { Self { stack_limits: StackLimits::default(), cached_stacks: DEFAULT_CACHED_STACKS, - mutable_global: true, - sign_extension: true, - saturating_float_to_int: true, - multi_value: true, - bulk_memory: true, - reference_types: true, - tail_call: true, - extended_const: true, - floats: true, + features: Self::default_features(), consume_fuel: false, ignore_custom_sections: false, fuel_costs: FuelCosts::default(), @@ -191,6 +167,21 @@ impl Default for Config { } impl Config { + /// Returns the default [`WasmFeatures`]. + fn default_features() -> WasmFeatures { + let mut features = WasmFeatures::empty(); + features.set(WasmFeatures::MUTABLE_GLOBAL, true); + features.set(WasmFeatures::MULTI_VALUE, true); + features.set(WasmFeatures::SATURATING_FLOAT_TO_INT, true); + features.set(WasmFeatures::SIGN_EXTENSION, true); + features.set(WasmFeatures::BULK_MEMORY, true); + features.set(WasmFeatures::REFERENCE_TYPES, true); + features.set(WasmFeatures::TAIL_CALL, true); + features.set(WasmFeatures::EXTENDED_CONST, true); + features.set(WasmFeatures::FLOATS, true); + features + } + /// Sets the [`StackLimits`] for the [`Config`]. pub fn set_stack_limits(&mut self, stack_limits: StackLimits) -> &mut Self { self.stack_limits = stack_limits; @@ -225,7 +216,7 @@ impl Config { /// /// [`mutable-global`]: https://github.com/WebAssembly/mutable-global pub fn wasm_mutable_global(&mut self, enable: bool) -> &mut Self { - self.mutable_global = enable; + self.features.set(WasmFeatures::MUTABLE_GLOBAL, enable); self } @@ -237,7 +228,7 @@ impl Config { /// /// [`sign-extension`]: https://github.com/WebAssembly/sign-extension-ops pub fn wasm_sign_extension(&mut self, enable: bool) -> &mut Self { - self.sign_extension = enable; + self.features.set(WasmFeatures::SIGN_EXTENSION, enable); self } @@ -250,7 +241,8 @@ impl Config { /// [`saturating-float-to-int`]: /// https://github.com/WebAssembly/nontrapping-float-to-int-conversions pub fn wasm_saturating_float_to_int(&mut self, enable: bool) -> &mut Self { - self.saturating_float_to_int = enable; + self.features + .set(WasmFeatures::SATURATING_FLOAT_TO_INT, enable); self } @@ -262,7 +254,7 @@ impl Config { /// /// [`multi-value`]: https://github.com/WebAssembly/multi-value pub fn wasm_multi_value(&mut self, enable: bool) -> &mut Self { - self.multi_value = enable; + self.features.set(WasmFeatures::MULTI_VALUE, enable); self } @@ -274,7 +266,7 @@ impl Config { /// /// [`bulk-memory`]: https://github.com/WebAssembly/bulk-memory-operations pub fn wasm_bulk_memory(&mut self, enable: bool) -> &mut Self { - self.bulk_memory = enable; + self.features.set(WasmFeatures::BULK_MEMORY, enable); self } @@ -286,7 +278,7 @@ impl Config { /// /// [`reference-types`]: https://github.com/WebAssembly/reference-types pub fn wasm_reference_types(&mut self, enable: bool) -> &mut Self { - self.reference_types = enable; + self.features.set(WasmFeatures::REFERENCE_TYPES, enable); self } @@ -298,7 +290,7 @@ impl Config { /// /// [`tail-call`]: https://github.com/WebAssembly/tail-call pub fn wasm_tail_call(&mut self, enable: bool) -> &mut Self { - self.tail_call = enable; + self.features.set(WasmFeatures::TAIL_CALL, enable); self } @@ -310,7 +302,7 @@ impl Config { /// /// [`extended-const`]: https://github.com/WebAssembly/extended-const pub fn wasm_extended_const(&mut self, enable: bool) -> &mut Self { - self.extended_const = enable; + self.features.set(WasmFeatures::EXTENDED_CONST, enable); self } @@ -318,7 +310,7 @@ impl Config { /// /// Enabled by default. pub fn floats(&mut self, enable: bool) -> &mut Self { - self.floats = enable; + self.features.set(WasmFeatures::FLOATS, enable); self } @@ -405,19 +397,6 @@ impl Config { /// Returns the [`WasmFeatures`] represented by the [`Config`]. pub(crate) fn wasm_features(&self) -> WasmFeatures { - let mut features = WasmFeatures::empty(); - features.set(WasmFeatures::MUTABLE_GLOBAL, self.mutable_global); - features.set(WasmFeatures::MULTI_VALUE, self.multi_value); - features.set( - WasmFeatures::SATURATING_FLOAT_TO_INT, - self.saturating_float_to_int, - ); - features.set(WasmFeatures::SIGN_EXTENSION, self.sign_extension); - features.set(WasmFeatures::BULK_MEMORY, self.bulk_memory); - features.set(WasmFeatures::REFERENCE_TYPES, self.reference_types); - features.set(WasmFeatures::TAIL_CALL, self.tail_call); - features.set(WasmFeatures::EXTENDED_CONST, self.extended_const); - features.set(WasmFeatures::FLOATS, self.floats); - features + self.features } } From fe664ba6554d94a601aed7aaed2d7f3a0bf6165c Mon Sep 17 00:00:00 2001 From: Robin Freyler Date: Sun, 6 Oct 2024 13:24:01 +0200 Subject: [PATCH 04/12] adjustments after merging with main --- Cargo.lock | 2585 ++++++++++++++++++++++++++++ crates/wasmi/src/engine/mod.rs | 13 +- crates/wasmi/src/module/element.rs | 53 +- crates/wasmi/src/table/element.rs | 6 +- 4 files changed, 2632 insertions(+), 25 deletions(-) create mode 100644 Cargo.lock diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000000..3855025cfb --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,2585 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli", +] + +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "ambient-authority" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9d4ee0d472d1cd2e28c97dfa124b3d8d992e10eb0a035f33f5d12e3a177ba3b" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anes" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" + +[[package]] +name = "anstream" +version = "0.6.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" + +[[package]] +name = "anstyle-parse" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" +dependencies = [ + "anstyle", + "windows-sys 0.52.0", +] + +[[package]] +name = "anyhow" +version = "1.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" + +[[package]] +name = "arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" +dependencies = [ + "derive_arbitrary", +] + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "assert_cmd" +version = "2.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1835b7f27878de8525dc71410b5a31cdcc5f230aed5ba5df968e09c201b23d" +dependencies = [ + "anstyle", + "bstr", + "doc-comment", + "libc", + "predicates", + "predicates-core", + "predicates-tree", + "wait-timeout", +] + +[[package]] +name = "assert_matches" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" + +[[package]] +name = "async-trait" +version = "0.1.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bstr" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" +dependencies = [ + "memchr", + "regex-automata", + "serde", +] + +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "cap-fs-ext" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712695628f77a28acd7c9135b9f05f9c1563f8eb91b317f63876bac550032403" +dependencies = [ + "cap-primitives", + "cap-std", + "io-lifetimes", + "windows-sys 0.52.0", +] + +[[package]] +name = "cap-primitives" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff5bcbaf57897c8f14098cc9ad48a78052930a9948119eea01b80ca224070fa6" +dependencies = [ + "ambient-authority", + "fs-set-times", + "io-extras", + "io-lifetimes", + "ipnet", + "maybe-owned", + "rustix", + "windows-sys 0.52.0", + "winx", +] + +[[package]] +name = "cap-rand" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c780812948b31f362c3bab82d23b902529c26705d0e094888bc7fdb9656908" +dependencies = [ + "ambient-authority", + "rand", +] + +[[package]] +name = "cap-std" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6cf1a22e6eab501e025a9953532b1e95efb8a18d6364bf8a4a7547b30c49186" +dependencies = [ + "cap-primitives", + "io-extras", + "io-lifetimes", + "rustix", +] + +[[package]] +name = "cap-time-ext" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e1547a95cd071db92382c649260bcc6721879ef5d1f0f442af33bff75003dd7" +dependencies = [ + "ambient-authority", + "cap-primitives", + "iana-time-zone", + "once_cell", + "rustix", + "winx", +] + +[[package]] +name = "cast" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" + +[[package]] +name = "cc" +version = "1.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e80e3b6a3ab07840e1cae9b0666a63970dc28e8ed5ffbcdacbfc760c281bfc1" +dependencies = [ + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "ciborium" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" +dependencies = [ + "ciborium-io", + "ciborium-ll", + "serde", +] + +[[package]] +name = "ciborium-io" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" + +[[package]] +name = "ciborium-ll" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" +dependencies = [ + "ciborium-io", + "half", +] + +[[package]] +name = "clap" +version = "4.5.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7be5744db7978a28d9df86a214130d106a89ce49644cbc4e3f0c22c3fba30615" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5fbc17d3ef8278f55b282b2a2e75ae6f6c7d4bb70ed3d0382375104bfafdb4b" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" + +[[package]] +name = "cobs" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" + +[[package]] +name = "colorchoice" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpp_demangle" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96e58d342ad113c2b878f16d5d034c03be492ae460cdbc02b7f0f2284d310c7d" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "cpufeatures" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" +dependencies = [ + "libc", +] + +[[package]] +name = "cranelift-bforest" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29daf137addc15da6bab6eae2c4a11e274b1d270bf2759508e62f6145e863ef6" +dependencies = [ + "cranelift-entity", +] + +[[package]] +name = "cranelift-codegen" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de619867d5de4c644b7fd9904d6e3295269c93d8a71013df796ab338681222d4" +dependencies = [ + "bumpalo", + "cranelift-bforest", + "cranelift-codegen-meta", + "cranelift-codegen-shared", + "cranelift-control", + "cranelift-entity", + "cranelift-isle", + "gimli", + "hashbrown 0.14.5", + "log", + "regalloc2", + "rustc-hash", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-codegen-meta" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29f5cf277490037d8dae9513d35e0ee8134670ae4a964a5ed5b198d4249d7c10" +dependencies = [ + "cranelift-codegen-shared", +] + +[[package]] +name = "cranelift-codegen-shared" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3e22ecad1123343a3c09ac6ecc532bb5c184b6fcb7888df0ea953727f79924" + +[[package]] +name = "cranelift-control" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53ca3ec6d30bce84ccf59c81fead4d16381a3ef0ef75e8403bc1e7385980da09" +dependencies = [ + "arbitrary", +] + +[[package]] +name = "cranelift-entity" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7eabb8d36b0ca8906bec93c78ea516741cac2d7e6b266fa7b0ffddcc09004990" +dependencies = [ + "serde", + "serde_derive", +] + +[[package]] +name = "cranelift-frontend" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44b42630229e49a8cfcae90bdc43c8c4c08f7a7aa4618b67f79265cd2f996dd2" +dependencies = [ + "cranelift-codegen", + "log", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-isle" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "918d1e36361805dfe0b6cdfd5a5ffdb5d03fa796170c5717d2727cbe623b93a0" + +[[package]] +name = "cranelift-native" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75aea85a0d7e1800b14ce9d3f53adf8ad4d1ee8a9e23b0269bdc50285e93b9b3" +dependencies = [ + "cranelift-codegen", + "libc", + "target-lexicon", +] + +[[package]] +name = "cranelift-wasm" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dac491fd3473944781f0cf9528c90cc899d18ad438da21961a839a3a44d57dfb" +dependencies = [ + "cranelift-codegen", + "cranelift-entity", + "cranelift-frontend", + "itertools 0.12.1", + "log", + "smallvec", + "wasmparser 0.207.0", + "wasmtime-types", +] + +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "criterion" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2b12d017a929603d80db1831cd3a24082f8137ce19c69e6447f54f5fc8d692f" +dependencies = [ + "anes", + "cast", + "ciborium", + "clap", + "criterion-plot", + "is-terminal", + "itertools 0.10.5", + "num-traits", + "once_cell", + "oorandom", + "regex", + "serde", + "serde_derive", + "serde_json", + "tinytemplate", + "walkdir", +] + +[[package]] +name = "criterion-plot" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" +dependencies = [ + "cast", + "itertools 0.10.5", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "debugid" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" +dependencies = [ + "uuid", +] + +[[package]] +name = "derive_arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "difflib" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "directories-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + +[[package]] +name = "dirs" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + +[[package]] +name = "doc-comment" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" + +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + +[[package]] +name = "either" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" + +[[package]] +name = "embedded-io" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" + +[[package]] +name = "embedded-io" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" + +[[package]] +name = "encoding_rs" +version = "0.8.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + +[[package]] +name = "fd-lock" +version = "4.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e5768da2206272c81ef0b5e951a41862938a6070da63bcea197899942d3b947" +dependencies = [ + "cfg-if", + "rustix", + "windows-sys 0.52.0", +] + +[[package]] +name = "flagset" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3ea1ec5f8307826a5b71094dd91fc04d4ae75d5709b20ad351c7fb4815c86ec" + +[[package]] +name = "fs-set-times" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "033b337d725b97690d86893f9de22b67b80dcc4e9ad815f348254c38119db8fb" +dependencies = [ + "io-lifetimes", + "rustix", + "windows-sys 0.52.0", +] + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "fxprof-processed-profile" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27d12c0aed7f1e24276a241aadc4cb8ea9f83000f34bc062b7cc2d51e3b0fabd" +dependencies = [ + "bitflags", + "debugid", + "fxhash", + "serde", + "serde_json", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "gimli" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +dependencies = [ + "fallible-iterator", + "indexmap", + "stable_deref_trait", +] + +[[package]] +name = "half" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" +dependencies = [ + "cfg-if", + "crunchy", +] + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" + +[[package]] +name = "iana-time-zone" +version = "0.1.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "id-arena" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" + +[[package]] +name = "indexmap" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +dependencies = [ + "equivalent", + "hashbrown 0.15.0", + "serde", +] + +[[package]] +name = "indexmap-nostd" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" + +[[package]] +name = "io-extras" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9f046b9af244f13b3bd939f55d16830ac3a201e8a9ba9661bfcb03e2be72b9b" +dependencies = [ + "io-lifetimes", + "windows-sys 0.52.0", +] + +[[package]] +name = "io-lifetimes" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a611371471e98973dbcab4e0ec66c31a10bc356eeb4d54a0e05eac8158fe38c" + +[[package]] +name = "ipnet" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" + +[[package]] +name = "is-terminal" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b" +dependencies = [ + "hermit-abi", + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "ittapi" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b996fe614c41395cdaedf3cf408a9534851090959d90d54a535f675550b64b1" +dependencies = [ + "anyhow", + "ittapi-sys", + "log", +] + +[[package]] +name = "ittapi-sys" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52f5385394064fa2c886205dba02598013ce83d3e92d33dbdc0c52fe0e7bf4fc" +dependencies = [ + "cc", +] + +[[package]] +name = "jobserver" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" +dependencies = [ + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "leb128" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" + +[[package]] +name = "libc" +version = "0.2.159" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" + +[[package]] +name = "libfuzzer-sys" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a96cfd5557eb82f2b83fed4955246c988d331975a002961b07c81584d107e7f7" +dependencies = [ + "arbitrary", + "cc", + "once_cell", +] + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "libredox" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +dependencies = [ + "bitflags", + "libc", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "mach2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709" +dependencies = [ + "libc", +] + +[[package]] +name = "maybe-owned" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4facc753ae494aeb6e3c22f839b158aebd4f9270f55cd3c79906c45476c47ab4" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "memfd" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" +dependencies = [ + "rustix", +] + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "multi-stash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "685a9ac4b61f4e728e1d2c6a7844609c16527aeb5e6c865915c08e619c16410f" + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "object" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8dd6c0cdf9429bce006e1362bfce61fa1bfd8c898a643ed8d2b471934701d3d" +dependencies = [ + "crc32fast", + "hashbrown 0.14.5", + "indexmap", + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" + +[[package]] +name = "oorandom" +version = "11.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9" + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" + +[[package]] +name = "pkg-config" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" + +[[package]] +name = "postcard" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f7f0a8d620d71c457dd1d47df76bb18960378da56af4527aaa10f515eee732e" +dependencies = [ + "cobs", + "embedded-io 0.4.0", + "embedded-io 0.6.1", + "serde", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "predicates" +version = "3.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e9086cc7640c29a356d1a29fd134380bee9d8f79a17410aa76e7ad295f42c97" +dependencies = [ + "anstyle", + "difflib", + "predicates-core", +] + +[[package]] +name = "predicates-core" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae8177bee8e75d6846599c6b9ff679ed51e882816914eec639944d7c9aa11931" + +[[package]] +name = "predicates-tree" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41b740d195ed3166cd147c8047ec98db0e22ec019eb8eeb76d343b795304fb13" +dependencies = [ + "predicates-core", + "termtree", +] + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "psm" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa37f80ca58604976033fae9515a8a2989fc13797d953f7c04fb8fa36a11f205" +dependencies = [ + "cc", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rayon" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_users" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" +dependencies = [ + "getrandom", + "libredox", + "thiserror", +] + +[[package]] +name = "regalloc2" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad156d539c879b7a24a363a2016d77961786e71f48f2e2fc8302a92abd2429a6" +dependencies = [ + "hashbrown 0.13.2", + "log", + "rustc-hash", + "slice-group-by", + "smallvec", +] + +[[package]] +name = "regex" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustix" +version = "0.38.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" +dependencies = [ + "bitflags", + "errno", + "itoa", + "libc", + "linux-raw-sys", + "once_cell", + "windows-sys 0.52.0", +] + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" + +[[package]] +name = "serde" +version = "1.0.210" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.210" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.128" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "serde_spanned" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" +dependencies = [ + "serde", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "shellexpand" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ccc8076840c4da029af4f87e4e8daeb0fca6b87bbb02e10cb60b791450e11e4" +dependencies = [ + "dirs", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "slice-group-by" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +dependencies = [ + "serde", +] + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + +[[package]] +name = "sptr" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b9b39299b249ad65f3b7e96443bad61c02ca5cd3589f46cb6d610a0fd6c0d6a" + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "string-interner" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c6a0d765f5807e98a091107bae0a56ea3799f66a5de47b2c84c94a39c09974e" +dependencies = [ + "cfg-if", + "hashbrown 0.14.5", + "serde", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "syn" +version = "2.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "system-interface" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b858526d22750088a9b3cf2e3c2aacebd5377f13adeec02860c30d09113010a6" +dependencies = [ + "bitflags", + "cap-fs-ext", + "cap-std", + "fd-lock", + "io-lifetimes", + "rustix", + "windows-sys 0.52.0", + "winx", +] + +[[package]] +name = "target-lexicon" +version = "0.12.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" + +[[package]] +name = "termtree" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" + +[[package]] +name = "thiserror" +version = "1.0.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tinytemplate" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "toml" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicode-ident" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" + +[[package]] +name = "unicode-width" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "uuid" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wait-timeout" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" +dependencies = [ + "libc", +] + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasi-common" +version = "24.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7336747832c6fe1086c81ef38b63dfeaeec48fc1b7c33a88fd16115cc940d178" +dependencies = [ + "anyhow", + "bitflags", + "cap-fs-ext", + "cap-rand", + "cap-std", + "cap-time-ext", + "fs-set-times", + "io-extras", + "io-lifetimes", + "log", + "once_cell", + "rustix", + "system-interface", + "thiserror", + "tracing", + "wiggle", + "windows-sys 0.52.0", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +dependencies = [ + "cfg-if", + "once_cell", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" + +[[package]] +name = "wasm-encoder" +version = "0.38.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ad2b51884de9c7f4fe2fd1043fccb8dcad4b1e29558146ee57a144d15779f3f" +dependencies = [ + "leb128", +] + +[[package]] +name = "wasm-encoder" +version = "0.41.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "972f97a5d8318f908dded23594188a90bcd09365986b1163e66d70170e5287ae" +dependencies = [ + "leb128", +] + +[[package]] +name = "wasm-encoder" +version = "0.207.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d996306fb3aeaee0d9157adbe2f670df0236caf19f6728b221e92d0f27b3fe17" +dependencies = [ + "leb128", +] + +[[package]] +name = "wasm-encoder" +version = "0.218.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22b896fa8ceb71091ace9bcb81e853f54043183a1c9667cf93422c40252ffa0a" +dependencies = [ + "leb128", +] + +[[package]] +name = "wasm-smith" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58273756970c82a1769b11e13a05bd21f95a767e4a2fab03afd0cff0085ae89d" +dependencies = [ + "arbitrary", + "flagset", + "indexmap", + "leb128", + "wasm-encoder 0.38.1", +] + +[[package]] +name = "wasmi" +version = "0.31.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8281d1d660cdf54c76a3efa9ddd0c270cada1383a995db3ccb43d166456c7" +dependencies = [ + "smallvec", + "spin", + "wasmi_arena", + "wasmi_core 0.13.0", + "wasmparser-nostd", +] + +[[package]] +name = "wasmi" +version = "0.38.0" +dependencies = [ + "anyhow", + "arrayvec", + "assert_matches", + "criterion", + "multi-stash", + "smallvec", + "spin", + "wasmi_collections", + "wasmi_core 0.38.0", + "wasmi_ir", + "wasmparser 0.214.0", + "wast 70.0.2", + "wat", +] + +[[package]] +name = "wasmi_arena" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "104a7f73be44570cac297b3035d76b169d6599637631cf37a1703326a0727073" + +[[package]] +name = "wasmi_c_api" +version = "0.38.0" +dependencies = [ + "wasmi_c_api_impl", +] + +[[package]] +name = "wasmi_c_api_impl" +version = "0.38.0" +dependencies = [ + "wasmi 0.38.0", + "wasmi_c_api_macros", +] + +[[package]] +name = "wasmi_c_api_macros" +version = "0.38.0" +dependencies = [ + "proc-macro2", + "quote", +] + +[[package]] +name = "wasmi_cli" +version = "0.38.0" +dependencies = [ + "anyhow", + "assert_cmd", + "clap", + "wasmi 0.38.0", + "wasmi_wasi", + "wat", +] + +[[package]] +name = "wasmi_collections" +version = "0.38.0" +dependencies = [ + "ahash", + "hashbrown 0.14.5", + "string-interner", +] + +[[package]] +name = "wasmi_core" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf1a7db34bff95b85c261002720c00c3a6168256dcb93041d3fa2054d19856a" +dependencies = [ + "downcast-rs", + "libm", + "num-traits", + "paste", +] + +[[package]] +name = "wasmi_core" +version = "0.38.0" +dependencies = [ + "downcast-rs", + "libm", + "num-traits", + "paste", + "rand", +] + +[[package]] +name = "wasmi_fuzz" +version = "0.0.0" +dependencies = [ + "arbitrary", + "libfuzzer-sys", + "wasm-smith", + "wasmi 0.31.2", + "wasmi 0.38.0", + "wasmtime", +] + +[[package]] +name = "wasmi_ir" +version = "0.38.0" +dependencies = [ + "wasmi_core 0.38.0", +] + +[[package]] +name = "wasmi_wasi" +version = "0.38.0" +dependencies = [ + "wasi-common", + "wasmi 0.38.0", + "wat", + "wiggle", +] + +[[package]] +name = "wasmparser" +version = "0.207.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e19bb9f8ab07616da582ef8adb24c54f1424c7ec876720b7da9db8ec0626c92c" +dependencies = [ + "ahash", + "bitflags", + "hashbrown 0.14.5", + "indexmap", + "semver", +] + +[[package]] +name = "wasmparser" +version = "0.214.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5309c1090e3e84dad0d382f42064e9933fdaedb87e468cc239f0eabea73ddcb6" +dependencies = [ + "ahash", + "bitflags", + "hashbrown 0.14.5", + "indexmap", + "semver", +] + +[[package]] +name = "wasmparser-nostd" +version = "0.100.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5a015fe95f3504a94bb1462c717aae75253e39b9dd6c3fb1062c934535c64aa" +dependencies = [ + "indexmap-nostd", +] + +[[package]] +name = "wasmprinter" +version = "0.207.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c2d8a7b4dabb460208e6b4334d9db5766e84505038b2529e69c3d07ac619115" +dependencies = [ + "anyhow", + "wasmparser 0.207.0", +] + +[[package]] +name = "wasmtime" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f92a1370c66a0022e6d92dcc277e2c84f5dece19569670b8ce7db8162560d8b6" +dependencies = [ + "addr2line", + "anyhow", + "async-trait", + "bumpalo", + "cc", + "cfg-if", + "encoding_rs", + "fxprof-processed-profile", + "gimli", + "hashbrown 0.14.5", + "indexmap", + "ittapi", + "libc", + "libm", + "log", + "mach2", + "memfd", + "memoffset", + "object", + "once_cell", + "paste", + "postcard", + "psm", + "rayon", + "rustix", + "semver", + "serde", + "serde_derive", + "serde_json", + "smallvec", + "sptr", + "target-lexicon", + "wasm-encoder 0.207.0", + "wasmparser 0.207.0", + "wasmtime-asm-macros", + "wasmtime-cache", + "wasmtime-component-macro", + "wasmtime-component-util", + "wasmtime-cranelift", + "wasmtime-environ", + "wasmtime-fiber", + "wasmtime-jit-debug", + "wasmtime-jit-icache-coherence", + "wasmtime-slab", + "wasmtime-versioned-export-macros", + "wasmtime-winch", + "wat", + "windows-sys 0.52.0", +] + +[[package]] +name = "wasmtime-asm-macros" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dee8679c974a7f258c03d60d3c747c426ed219945b6d08cbc77fd2eab15b2d1" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "wasmtime-cache" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b00103ffaf7ee980f4e750fe272b6ada79d9901659892e457c7ca316b16df9ec" +dependencies = [ + "anyhow", + "base64", + "directories-next", + "log", + "postcard", + "rustix", + "serde", + "serde_derive", + "sha2", + "toml", + "windows-sys 0.52.0", + "zstd", +] + +[[package]] +name = "wasmtime-component-macro" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32cae30035f1cf97dcc6657c979cf39f99ce6be93583675eddf4aeaa5548509c" +dependencies = [ + "anyhow", + "proc-macro2", + "quote", + "syn", + "wasmtime-component-util", + "wasmtime-wit-bindgen", + "wit-parser", +] + +[[package]] +name = "wasmtime-component-util" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7ae611f08cea620c67330925be28a96115bf01f8f393a6cbdf4856a86087134" + +[[package]] +name = "wasmtime-cranelift" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2909406a6007e28be964067167890bca4574bd48a9ff18f1fa9f4856d89ea40" +dependencies = [ + "anyhow", + "cfg-if", + "cranelift-codegen", + "cranelift-control", + "cranelift-entity", + "cranelift-frontend", + "cranelift-native", + "cranelift-wasm", + "gimli", + "log", + "object", + "target-lexicon", + "thiserror", + "wasmparser 0.207.0", + "wasmtime-environ", + "wasmtime-versioned-export-macros", +] + +[[package]] +name = "wasmtime-environ" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40e227f9ed2f5421473723d6c0352b5986e6e6044fde5410a274a394d726108f" +dependencies = [ + "anyhow", + "cpp_demangle", + "cranelift-entity", + "gimli", + "indexmap", + "log", + "object", + "postcard", + "rustc-demangle", + "serde", + "serde_derive", + "target-lexicon", + "wasm-encoder 0.207.0", + "wasmparser 0.207.0", + "wasmprinter", + "wasmtime-component-util", + "wasmtime-types", +] + +[[package]] +name = "wasmtime-fiber" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42edb392586d07038c1638e854382db916b6ca7845a2e6a7f8dc49e08907acdd" +dependencies = [ + "anyhow", + "cc", + "cfg-if", + "rustix", + "wasmtime-asm-macros", + "wasmtime-versioned-export-macros", + "windows-sys 0.52.0", +] + +[[package]] +name = "wasmtime-jit-debug" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95b26ef7914af0c0e3ca811bdc32f5f66fbba0fd21e1f8563350e8a7951e3598" +dependencies = [ + "object", + "once_cell", + "rustix", + "wasmtime-versioned-export-macros", +] + +[[package]] +name = "wasmtime-jit-icache-coherence" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afe088f9b56bb353adaf837bf7e10f1c2e1676719dd5be4cac8e37f2ba1ee5bc" +dependencies = [ + "anyhow", + "cfg-if", + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "wasmtime-slab" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ff75cafffe47b04b036385ce3710f209153525b0ed19d57b0cf44a22d446460" + +[[package]] +name = "wasmtime-types" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f2fa462bfea3220711c84e2b549f147e4df89eeb49b8a2a3d89148f6cc4a8b1" +dependencies = [ + "cranelift-entity", + "serde", + "serde_derive", + "smallvec", + "wasmparser 0.207.0", +] + +[[package]] +name = "wasmtime-versioned-export-macros" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4cedc5bfef3db2a85522ee38564b47ef3b7fc7c92e94cacbce99808e63cdd47" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "wasmtime-winch" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b27054fed6be4f3800aba5766f7ef435d4220ce290788f021a08d4fa573108" +dependencies = [ + "anyhow", + "cranelift-codegen", + "gimli", + "object", + "target-lexicon", + "wasmparser 0.207.0", + "wasmtime-cranelift", + "wasmtime-environ", + "winch-codegen", +] + +[[package]] +name = "wasmtime-wit-bindgen" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c936a52ce69c28de2aa3b5fb4f2dbbb2966df304f04cccb7aca4ba56d915fda0" +dependencies = [ + "anyhow", + "heck 0.4.1", + "indexmap", + "wit-parser", +] + +[[package]] +name = "wast" +version = "35.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ef140f1b49946586078353a453a1d28ba90adfc54dde75710bc1931de204d68" +dependencies = [ + "leb128", +] + +[[package]] +name = "wast" +version = "70.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3d5061300042ff5065123dae1e27d00c03f567d34a2937c8472255148a216dc" +dependencies = [ + "bumpalo", + "leb128", + "memchr", + "unicode-width", + "wasm-encoder 0.41.2", +] + +[[package]] +name = "wast" +version = "218.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a53cd1f0fa505df97557e36a58bddb8296e2fcdcd089529545ebfdb18a1b9d7" +dependencies = [ + "bumpalo", + "leb128", + "memchr", + "unicode-width", + "wasm-encoder 0.218.0", +] + +[[package]] +name = "wat" +version = "1.218.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f87f8e14e776762e07927c27c2054d2cf678aab9aae2d431a79b3e31e4dd391" +dependencies = [ + "wast 218.0.0", +] + +[[package]] +name = "wiggle" +version = "24.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc850ca3c02c5835934d23f28cec4c5a3fb66fe0b4ecd968bbb35609dda5ddc0" +dependencies = [ + "anyhow", + "async-trait", + "bitflags", + "thiserror", + "tracing", + "wiggle-macro", +] + +[[package]] +name = "wiggle-generate" +version = "24.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634b8804a67200bcb43ea8af5f7c53e862439a086b68b16fd333454bc74d5aab" +dependencies = [ + "anyhow", + "heck 0.4.1", + "proc-macro2", + "quote", + "shellexpand", + "syn", + "witx", +] + +[[package]] +name = "wiggle-macro" +version = "24.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "474b7cbdb942c74031e619d66c600bba7f73867c5800fc2c2306cf307649be2f" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wiggle-generate", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "winch-codegen" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dc69899ccb2da7daa4df31426dcfd284b104d1a85e1dae35806df0c46187f87" +dependencies = [ + "anyhow", + "cranelift-codegen", + "gimli", + "regalloc2", + "smallvec", + "target-lexicon", + "wasmparser 0.207.0", + "wasmtime-cranelift", + "wasmtime-environ", +] + +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.6.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +dependencies = [ + "memchr", +] + +[[package]] +name = "winx" +version = "0.36.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9643b83820c0cd246ecabe5fa454dd04ba4fa67996369466d0747472d337346" +dependencies = [ + "bitflags", + "windows-sys 0.52.0", +] + +[[package]] +name = "wit-parser" +version = "0.207.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c83dab33a9618d86cfe3563cc864deffd08c17efc5db31a3b7cd1edeffe6e1" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser 0.207.0", +] + +[[package]] +name = "witx" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e366f27a5cabcddb2706a78296a40b8fcc451e1a6aba2fc1d94b4a01bdaaef4b" +dependencies = [ + "anyhow", + "log", + "thiserror", + "wast 35.0.2", +] + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zstd" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcf2b778a664581e31e389454a7072dab1647606d44f7feea22cd5abb9c9f3f9" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "7.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54a3ab4db68cea366acc5c897c7b4d4d1b8994a9cd6e6f841f8964566a419059" +dependencies = [ + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.13+zstd.1.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa" +dependencies = [ + "cc", + "pkg-config", +] diff --git a/crates/wasmi/src/engine/mod.rs b/crates/wasmi/src/engine/mod.rs index d9a130f768..089fccf9d6 100644 --- a/crates/wasmi/src/engine/mod.rs +++ b/crates/wasmi/src/engine/mod.rs @@ -622,6 +622,7 @@ impl EngineInner { module: ModuleHeader, func_to_validate: Option>, ) -> Result<(), Error> { + let features = self.config().wasm_features(); match (self.config.get_compilation_mode(), func_to_validate) { (CompilationMode::Eager, Some(func_to_validate)) => { let (translation_allocs, validation_allocs) = self.get_allocs(); @@ -641,7 +642,8 @@ impl EngineInner { } (CompilationMode::LazyTranslation, Some(func_to_validate)) => { let allocs = self.get_validation_allocs(); - let translator = LazyFuncTranslator::new(func_index, engine_func, module, None); + let translator = + LazyFuncTranslator::new(func_index, engine_func, module, None, features); let validator = func_to_validate.into_validator(allocs); let translator = ValidatingFuncTranslator::new(validator, translator)?; let allocs = FuncTranslationDriver::new(offset, bytes, translator)? @@ -649,8 +651,13 @@ impl EngineInner { self.recycle_validation_allocs(allocs.validation); } (CompilationMode::Lazy | CompilationMode::LazyTranslation, func_to_validate) => { - let translator = - LazyFuncTranslator::new(func_index, engine_func, module, func_to_validate); + let translator = LazyFuncTranslator::new( + func_index, + engine_func, + module, + func_to_validate, + features, + ); FuncTranslationDriver::new(offset, bytes, translator)? .translate(|func_entity| self.init_func(engine_func, func_entity))?; } diff --git a/crates/wasmi/src/module/element.rs b/crates/wasmi/src/module/element.rs index 62c9801897..90ee7da3b5 100644 --- a/crates/wasmi/src/module/element.rs +++ b/crates/wasmi/src/module/element.rs @@ -1,5 +1,5 @@ use super::{ConstExpr, TableIdx}; -use crate::{core::ValType, module::utils::WasmiValueType}; +use crate::core::ValType; use std::boxed::Box; /// A table element segment within a [`Module`]. @@ -9,10 +9,19 @@ use std::boxed::Box; pub struct ElementSegment { /// The kind of the [`ElementSegment`]. kind: ElementSegmentKind, + /// The type of elements of the [`ElementSegment`]. + ty: ValType, /// The items of the [`ElementSegment`]. items: Box<[ConstExpr]>, } +impl ElementSegment { + /// Returns the [`ValType`] of elements in the [`ElementSegment`]. + pub fn ty(&self) -> ValType { + self.ty + } +} + /// The kind of a Wasm [`ElementSegment`]. #[derive(Debug)] pub enum ElementSegmentKind { @@ -68,22 +77,32 @@ impl From> for ElementSegmentKind { impl From> for ElementSegment { fn from(element: wasmparser::Element<'_>) -> Self { let kind = ElementSegmentKind::from(element.kind); - let ty = WasmiValueType::from(element.ty).into_inner(); - let items = match element.items { - wasmparser::ElementItems::Functions(items) => items - .into_iter() - .map(|item| { - item.unwrap_or_else(|error| panic!("failed to parse element item: {error}")) - }) - .map(ConstExpr::new_funcref) - .collect::>(), - wasmparser::ElementItems::Expressions(items) => items - .into_iter() - .map(|item| { - item.unwrap_or_else(|error| panic!("failed to parse element item: {error}")) - }) - .map(ConstExpr::new) - .collect::>(), + let (items, ty) = match element.items { + wasmparser::ElementItems::Functions(items) => { + let items = items + .into_iter() + .map(|item| { + item.unwrap_or_else(|error| panic!("failed to parse element item: {error}")) + }) + .map(ConstExpr::new_funcref) + .collect::>(); + (items, ValType::FuncRef) + } + wasmparser::ElementItems::Expressions(ref_ty, items) => { + let ty = match ref_ty { + ty if ty.is_func_ref() => ValType::FuncRef, + ty if ty.is_extern_ref() => ValType::ExternRef, + _ => panic!("unsupported Wasm reference type"), + }; + let items = items + .into_iter() + .map(|item| { + item.unwrap_or_else(|error| panic!("failed to parse element item: {error}")) + }) + .map(ConstExpr::new) + .collect::>(); + (items, ty) + } }; Self { kind, ty, items } } diff --git a/crates/wasmi/src/table/element.rs b/crates/wasmi/src/table/element.rs index dff4a86c70..e7d2bdcc94 100644 --- a/crates/wasmi/src/table/element.rs +++ b/crates/wasmi/src/table/element.rs @@ -107,11 +107,7 @@ impl ElementSegmentEntity { panic!("unexpected failed initialization of constant expression: {const_expr:?}") }) }).collect::>(); - Self { - ty, - // items: Some(elem.items_cloned()), - items, - } + Self { ty, items } } module::ElementSegmentKind::Declared => Self::empty(ty), } From b70b16d6b8d51c69dda1654cd0b1efeb86226030 Mon Sep 17 00:00:00 2001 From: Robin Freyler Date: Sun, 6 Oct 2024 13:25:32 +0200 Subject: [PATCH 05/12] reinstate type check in TableEntity::init --- crates/wasmi/src/table/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/wasmi/src/table/mod.rs b/crates/wasmi/src/table/mod.rs index 8e82ba9d42..6be9bccc3e 100644 --- a/crates/wasmi/src/table/mod.rs +++ b/crates/wasmi/src/table/mod.rs @@ -358,9 +358,9 @@ impl TableEntity { "table.init currently only works on reftypes" ); // Removed because Element lost its type field in a wasmparser update. - // table_type - // .matches_element_type(element.ty()) - // .map_err(|_| TrapCode::BadSignature)?; + table_type + .matches_element_type(element.ty()) + .map_err(|_| TrapCode::BadSignature)?; // Convert parameters to indices. let dst_index = dst_index as usize; let src_index = src_index as usize; From 08d7f611062f1d8bc385940d2ca213a90a38d2b4 Mon Sep 17 00:00:00 2001 From: Robin Freyler Date: Sun, 6 Oct 2024 13:39:51 +0200 Subject: [PATCH 06/12] update to wasmparser v0.218.0 --- Cargo.lock | 6 +++--- crates/wasmi/Cargo.toml | 2 +- crates/wasmi/src/engine/translator/driver.rs | 2 +- crates/wasmi/src/engine/translator/mod.rs | 8 ++++---- crates/wasmi/src/engine/translator/visit.rs | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3855025cfb..c70eaefef4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1857,7 +1857,7 @@ dependencies = [ "wasmi_collections", "wasmi_core 0.38.0", "wasmi_ir", - "wasmparser 0.214.0", + "wasmparser 0.218.0", "wast 70.0.2", "wat", ] @@ -1979,9 +1979,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.214.0" +version = "0.218.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5309c1090e3e84dad0d382f42064e9933fdaedb87e468cc239f0eabea73ddcb6" +checksum = "b09e46c7fceceaa72b2dd1a8a137ea7fd8f93dfaa69806010a709918e496c5dc" dependencies = [ "ahash", "bitflags", diff --git a/crates/wasmi/Cargo.toml b/crates/wasmi/Cargo.toml index ab334ee53c..bbf0f6d505 100644 --- a/crates/wasmi/Cargo.toml +++ b/crates/wasmi/Cargo.toml @@ -19,7 +19,7 @@ exclude = [ ] [dependencies] -wasmparser = { version = "0.214.0", default-features = false, features = ["validate"] } +wasmparser = { version = "0.218.0", default-features = false, features = ["validate", "features"] } wasmi_core = { workspace = true } wasmi_collections = { workspace = true } wasmi_ir = { workspace = true } diff --git a/crates/wasmi/src/engine/translator/driver.rs b/crates/wasmi/src/engine/translator/driver.rs index 957fbfad6f..75062be1f8 100644 --- a/crates/wasmi/src/engine/translator/driver.rs +++ b/crates/wasmi/src/engine/translator/driver.rs @@ -26,7 +26,7 @@ where ) -> Result { let offset = offset.into().unwrap_or(0); let features = translator.features(); - let reader = BinaryReader::new(bytes, offset, features); + let reader = BinaryReader::new_features(bytes, offset, features); let func_body = FunctionBody::new(reader); Ok(Self { func_body, diff --git a/crates/wasmi/src/engine/translator/mod.rs b/crates/wasmi/src/engine/translator/mod.rs index 402e3cd21f..425e42635b 100644 --- a/crates/wasmi/src/engine/translator/mod.rs +++ b/crates/wasmi/src/engine/translator/mod.rs @@ -328,7 +328,7 @@ where } macro_rules! impl_visit_operator { - ( @mvp BrTable { $arg:ident: $argty:ty } => $visit:ident $($rest:tt)* ) => { + ( @mvp BrTable { $arg:ident: $argty:ty } => $visit:ident $_ann:tt $($rest:tt)* ) => { // We need to special case the `BrTable` operand since its // arguments (a.k.a. `BrTable<'a>`) are not `Copy` which all // the other impls make use of. @@ -359,7 +359,7 @@ macro_rules! impl_visit_operator { ( @tail_call $($rest:tt)* ) => { impl_visit_operator!(@@supported $($rest)*); }; - ( @@supported $op:ident $({ $($arg:ident: $argty:ty),* })? => $visit:ident $($rest:tt)* ) => { + ( @@supported $op:ident $({ $($arg:ident: $argty:ty),* })? => $visit:ident $_ann:tt $($rest:tt)* ) => { fn $visit(&mut self $($(,$arg: $argty)*)?) -> Self::Output { let offset = self.current_pos(); self.validate_then_translate( @@ -369,7 +369,7 @@ macro_rules! impl_visit_operator { } impl_visit_operator!($($rest)*); }; - ( @$proposal:ident $op:ident $({ $($arg:ident: $argty:ty),* })? => $visit:ident $($rest:tt)* ) => { + ( @$proposal:ident $op:ident $({ $($arg:ident: $argty:ty),* })? => $visit:ident $ann:tt $($rest:tt)* ) => { // Wildcard match arm for all the other (yet) unsupported Wasm proposals. fn $visit(&mut self $($(, $arg: $argty)*)?) -> Self::Output { let offset = self.current_pos(); @@ -493,7 +493,7 @@ impl WasmTranslator<'_> for LazyFuncTranslator { } macro_rules! impl_visit_operator { - ( @$proposal:ident $op:ident $({ $($arg:ident: $argty:ty),* })? => $visit:ident $($rest:tt)* ) => { + ( @$proposal:ident $op:ident $({ $($arg:ident: $argty:ty),* })? => $visit:ident $ann:tt $($rest:tt)* ) => { #[inline] fn $visit(&mut self $($(, $arg: $argty)*)?) -> Self::Output { Ok(()) diff --git a/crates/wasmi/src/engine/translator/visit.rs b/crates/wasmi/src/engine/translator/visit.rs index 334384e73a..4387d28532 100644 --- a/crates/wasmi/src/engine/translator/visit.rs +++ b/crates/wasmi/src/engine/translator/visit.rs @@ -58,11 +58,11 @@ macro_rules! impl_visit_operator { ( @tail_call $($rest:tt)* ) => { impl_visit_operator!(@@skipped $($rest)*); }; - ( @@skipped $op:ident $({ $($arg:ident: $argty:ty),* })? => $visit:ident $($rest:tt)* ) => { + ( @@skipped $op:ident $({ $($arg:ident: $argty:ty),* })? => $visit:ident $_ann:tt $($rest:tt)* ) => { // We skip Wasm operators that we already implement manually. impl_visit_operator!($($rest)*); }; - ( @$proposal:ident $op:ident $({ $($arg:ident: $argty:ty),* })? => $visit:ident $($rest:tt)* ) => { + ( @$proposal:ident $op:ident $({ $($arg:ident: $argty:ty),* })? => $visit:ident $_ann:tt $($rest:tt)* ) => { // Wildcard match arm for all the other (yet) unsupported Wasm proposals. fn $visit(&mut self $($(, $arg: $argty)*)?) -> Self::Output { self.unsupported_operator(stringify!($op)) From 7958bc1252a7e6853b78d67510fa398d15146566 Mon Sep 17 00:00:00 2001 From: Robin Freyler Date: Sun, 6 Oct 2024 13:45:49 +0200 Subject: [PATCH 07/12] enable GC_TYPES when REFERENCE_TYPES is enabled --- crates/wasmi/src/engine/config.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/wasmi/src/engine/config.rs b/crates/wasmi/src/engine/config.rs index b494b35d94..aba5bd7df4 100644 --- a/crates/wasmi/src/engine/config.rs +++ b/crates/wasmi/src/engine/config.rs @@ -177,6 +177,7 @@ impl Config { features.set(WasmFeatures::SIGN_EXTENSION, true); features.set(WasmFeatures::BULK_MEMORY, true); features.set(WasmFeatures::REFERENCE_TYPES, true); + features.set(WasmFeatures::GC_TYPES, true); // required by reference-types features.set(WasmFeatures::TAIL_CALL, true); features.set(WasmFeatures::EXTENDED_CONST, true); features.set(WasmFeatures::FLOATS, true); @@ -292,6 +293,7 @@ impl Config { /// [`reference-types`]: https://github.com/WebAssembly/reference-types pub fn wasm_reference_types(&mut self, enable: bool) -> &mut Self { self.features.set(WasmFeatures::REFERENCE_TYPES, enable); + self.features.set(WasmFeatures::GC_TYPES, enable); self } From 956471ee683693d7770d9cae534dc49adec4bc5f Mon Sep 17 00:00:00 2001 From: Robin Freyler Date: Sun, 6 Oct 2024 13:54:53 +0200 Subject: [PATCH 08/12] shift method to reduce diff --- crates/wasmi/src/module/element.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/crates/wasmi/src/module/element.rs b/crates/wasmi/src/module/element.rs index 90ee7da3b5..b6d5876ac3 100644 --- a/crates/wasmi/src/module/element.rs +++ b/crates/wasmi/src/module/element.rs @@ -15,13 +15,6 @@ pub struct ElementSegment { items: Box<[ConstExpr]>, } -impl ElementSegment { - /// Returns the [`ValType`] of elements in the [`ElementSegment`]. - pub fn ty(&self) -> ValType { - self.ty - } -} - /// The kind of a Wasm [`ElementSegment`]. #[derive(Debug)] pub enum ElementSegmentKind { @@ -114,6 +107,11 @@ impl ElementSegment { &self.kind } + /// Returns the [`ValType`] of the [`ElementSegment`]. + pub fn ty(&self) -> ValType { + self.ty + } + /// Returns the element items of the [`ElementSegment`]. pub fn items(&self) -> &[ConstExpr] { &self.items[..] From f93b112d0b947048717b20747c39734cff4f065e Mon Sep 17 00:00:00 2001 From: Robin Freyler Date: Sun, 6 Oct 2024 13:56:20 +0200 Subject: [PATCH 09/12] remove outdated comment --- crates/wasmi/src/table/mod.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/wasmi/src/table/mod.rs b/crates/wasmi/src/table/mod.rs index 6be9bccc3e..ebae69237e 100644 --- a/crates/wasmi/src/table/mod.rs +++ b/crates/wasmi/src/table/mod.rs @@ -357,7 +357,6 @@ impl TableEntity { table_type.element().is_ref(), "table.init currently only works on reftypes" ); - // Removed because Element lost its type field in a wasmparser update. table_type .matches_element_type(element.ty()) .map_err(|_| TrapCode::BadSignature)?; From 2ba92d3b8491cbbd50ddfb33375dc350a1239b21 Mon Sep 17 00:00:00 2001 From: Robin Freyler Date: Sun, 6 Oct 2024 14:26:42 +0200 Subject: [PATCH 10/12] refactor: shrink LazyFuncTranslator stack size --- crates/wasmi/src/engine/mod.rs | 17 ++--- crates/wasmi/src/engine/translator/mod.rs | 77 +++++++++++++++++------ 2 files changed, 68 insertions(+), 26 deletions(-) diff --git a/crates/wasmi/src/engine/mod.rs b/crates/wasmi/src/engine/mod.rs index 089fccf9d6..d17a9250d5 100644 --- a/crates/wasmi/src/engine/mod.rs +++ b/crates/wasmi/src/engine/mod.rs @@ -643,7 +643,7 @@ impl EngineInner { (CompilationMode::LazyTranslation, Some(func_to_validate)) => { let allocs = self.get_validation_allocs(); let translator = - LazyFuncTranslator::new(func_index, engine_func, module, None, features); + LazyFuncTranslator::new_unchecked(func_index, engine_func, module, features); let validator = func_to_validate.into_validator(allocs); let translator = ValidatingFuncTranslator::new(validator, translator)?; let allocs = FuncTranslationDriver::new(offset, bytes, translator)? @@ -651,13 +651,14 @@ impl EngineInner { self.recycle_validation_allocs(allocs.validation); } (CompilationMode::Lazy | CompilationMode::LazyTranslation, func_to_validate) => { - let translator = LazyFuncTranslator::new( - func_index, - engine_func, - module, - func_to_validate, - features, - ); + let translator = match func_to_validate { + Some(func_to_validate) => { + LazyFuncTranslator::new(func_index, engine_func, module, func_to_validate) + } + None => { + LazyFuncTranslator::new_unchecked(func_index, engine_func, module, features) + } + }; FuncTranslationDriver::new(offset, bytes, translator)? .translate(|func_entity| self.init_func(engine_func, func_entity))?; } diff --git a/crates/wasmi/src/engine/translator/mod.rs b/crates/wasmi/src/engine/translator/mod.rs index 425e42635b..bea8c7f2b1 100644 --- a/crates/wasmi/src/engine/translator/mod.rs +++ b/crates/wasmi/src/engine/translator/mod.rs @@ -58,7 +58,7 @@ use crate::{ FuncRef, FuncType, }; -use core::fmt; +use core::{fmt, mem}; use stack::RegisterSpace; use std::vec::Vec; use utils::Wrap; @@ -390,6 +390,7 @@ where } /// A lazy Wasm function translator that defers translation when the function is first used. +#[derive(Debug)] pub struct LazyFuncTranslator { /// The index of the lazily compiled function within its module. func_idx: FuncIdx, @@ -397,24 +398,51 @@ pub struct LazyFuncTranslator { engine_func: EngineFunc, /// The Wasm module header information used for translation. module: ModuleHeader, - /// Optional information about lazy Wasm validation. - func_to_validate: Option>, - /// The Wasm features used for validation and parsing. + /// Information about Wasm validation during lazy translation. + validation: Validation, +} + +/// Information about Wasm validation for lazy translation. +enum Validation { + /// Wasm validation is performed. + Checked(FuncToValidate), + /// Wasm validation is checked. /// - /// # ToDo + /// # Dev. Note /// - /// We currently require this field since there is no way to query the - /// [`WasmFeatures`] of a [`FuncValidator`] even though it has one. - features: WasmFeatures, + /// We still need Wasm features to properly parse the Wasm. + Unchecked(WasmFeatures), +} + +impl Validation { + /// Returns `true` if `self` performs validates Wasm upon lazy translation. + pub fn is_checked(&self) -> bool { + matches!(self, Self::Checked(_)) + } + + /// Returns the [`WasmFeatures`] used for Wasm parsing and validation. + pub fn features(&self) -> WasmFeatures { + match self { + Validation::Checked(func_to_validate) => func_to_validate.features, + Validation::Unchecked(wasm_features) => *wasm_features, + } + } + + /// Returns the [`FuncToValidate`] if `self` is checked. + pub fn take_func_to_validate(&mut self) -> Option> { + let features = self.features(); + match mem::replace(self, Self::Unchecked(features)) { + Self::Checked(func_to_validate) => Some(func_to_validate), + Self::Unchecked(_) => None, + } + } } -impl fmt::Debug for LazyFuncTranslator { +impl fmt::Debug for Validation { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("LazyFuncTranslator") - .field("func_idx", &self.func_idx) - .field("engine_func", &self.engine_func) - .field("module", &self.module) - .field("validate", &self.func_to_validate.is_some()) + .field("validate", &self.is_checked()) + .field("features", &self.features()) .finish() } } @@ -425,15 +453,28 @@ impl LazyFuncTranslator { func_idx: FuncIdx, engine_func: EngineFunc, module: ModuleHeader, - func_to_validate: Option>, + func_to_validate: FuncToValidate, + ) -> Self { + Self { + func_idx, + engine_func, + module, + validation: Validation::Checked(func_to_validate), + } + } + + /// Create a new [`LazyFuncTranslator`] that does not validate Wasm upon lazy translation. + pub fn new_unchecked( + func_idx: FuncIdx, + engine_func: EngineFunc, + module: ModuleHeader, features: WasmFeatures, ) -> Self { Self { func_idx, engine_func, module, - func_to_validate, - features, + validation: Validation::Unchecked(features), } } } @@ -456,14 +497,14 @@ impl WasmTranslator<'_> for LazyFuncTranslator { self.engine_func, bytes, &self.module, - self.func_to_validate.take(), + self.validation.take_func_to_validate(), ); Ok(true) } #[inline] fn features(&self) -> WasmFeatures { - self.features + self.validation.features() } #[inline] From 47bf45a70cd74d8e59aa4272fe7743e9f6a5249e Mon Sep 17 00:00:00 2001 From: Robin Freyler Date: Tue, 8 Oct 2024 22:55:46 +0200 Subject: [PATCH 11/12] update wasmparser to v0.219.0 --- Cargo.lock | 35 ++++++++++++++++++----------------- crates/wasmi/Cargo.toml | 2 +- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 34ce1b0d9b..6c204cf07e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -323,9 +323,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.19" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7be5744db7978a28d9df86a214130d106a89ce49644cbc4e3f0c22c3fba30615" +checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" dependencies = [ "clap_builder", "clap_derive", @@ -333,9 +333,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.19" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5fbc17d3ef8278f55b282b2a2e75ae6f6c7d4bb70ed3d0382375104bfafdb4b" +checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" dependencies = [ "anstream", "anstyle", @@ -1207,9 +1207,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" dependencies = [ "unicode-ident", ] @@ -1810,11 +1810,12 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.218.0" +version = "0.219.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22b896fa8ceb71091ace9bcb81e853f54043183a1c9667cf93422c40252ffa0a" +checksum = "e2b1b95711b3ad655656a341e301cc64e33cbee94de9a99a1c5a2ab88efab79d" dependencies = [ "leb128", + "wasmparser 0.219.0", ] [[package]] @@ -1858,7 +1859,7 @@ dependencies = [ "wasmi_collections", "wasmi_core 0.38.0", "wasmi_ir", - "wasmparser 0.218.0", + "wasmparser 0.219.0", "wast 70.0.2", "wat", ] @@ -1980,9 +1981,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.218.0" +version = "0.219.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b09e46c7fceceaa72b2dd1a8a137ea7fd8f93dfaa69806010a709918e496c5dc" +checksum = "324b4e56d24439495b88cd81439dad5e97f3c7b1eedc3c7e10455ed1e045e9a2" dependencies = [ "ahash", "bitflags", @@ -2287,24 +2288,24 @@ dependencies = [ [[package]] name = "wast" -version = "218.0.0" +version = "219.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a53cd1f0fa505df97557e36a58bddb8296e2fcdcd089529545ebfdb18a1b9d7" +checksum = "06880ecb25662bc21db6a83f4fcc27c41f71fbcba4f1980b650c88ada92728e1" dependencies = [ "bumpalo", "leb128", "memchr", "unicode-width", - "wasm-encoder 0.218.0", + "wasm-encoder 0.219.0", ] [[package]] name = "wat" -version = "1.218.0" +version = "1.219.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f87f8e14e776762e07927c27c2054d2cf678aab9aae2d431a79b3e31e4dd391" +checksum = "11e56dbf9fc89111b0d97c91e683d7895b1a6e5633a729f2ccad2303724005b6" dependencies = [ - "wast 218.0.0", + "wast 219.0.0", ] [[package]] diff --git a/crates/wasmi/Cargo.toml b/crates/wasmi/Cargo.toml index bbf0f6d505..b61a0c4c9b 100644 --- a/crates/wasmi/Cargo.toml +++ b/crates/wasmi/Cargo.toml @@ -19,7 +19,7 @@ exclude = [ ] [dependencies] -wasmparser = { version = "0.218.0", default-features = false, features = ["validate", "features"] } +wasmparser = { version = "0.219.0", default-features = false, features = ["validate", "features"] } wasmi_core = { workspace = true } wasmi_collections = { workspace = true } wasmi_ir = { workspace = true } From fb212834c7d6fcc4d3cba0cbf3d40e0f88454650 Mon Sep 17 00:00:00 2001 From: Robin Freyler Date: Sat, 19 Oct 2024 13:20:10 +0200 Subject: [PATCH 12/12] use new FuncBody::as_bytes API where useful This allows us to avoid a nasty work around. --- crates/wasmi/src/module/parser/buffered.rs | 6 ++---- crates/wasmi/src/module/parser/streaming.rs | 4 +--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/crates/wasmi/src/module/parser/buffered.rs b/crates/wasmi/src/module/parser/buffered.rs index bb3d145ea1..8217ec3854 100644 --- a/crates/wasmi/src/module/parser/buffered.rs +++ b/crates/wasmi/src/module/parser/buffered.rs @@ -162,10 +162,8 @@ impl ModuleParser { // to return the byte slice for the respective code section // entry payload. Please remove this work around as soon as // such an API becomes available. - let bytes = Self::consume_buffer(consumed, buffer); - let remaining = func_body.get_binary_reader().bytes_remaining(); - let start = consumed - remaining; - let bytes = &bytes[start..]; + Self::consume_buffer(consumed, buffer); + let bytes = func_body.as_bytes(); self.process_code_entry(func_body, bytes, &header)?; } _ => break, diff --git a/crates/wasmi/src/module/parser/streaming.rs b/crates/wasmi/src/module/parser/streaming.rs index 6d24a4fb2b..bd1cd7d211 100644 --- a/crates/wasmi/src/module/parser/streaming.rs +++ b/crates/wasmi/src/module/parser/streaming.rs @@ -237,9 +237,7 @@ impl ModuleParser { // to return the byte slice for the respective code section // entry payload. Please remove this work around as soon as // such an API becomes available. - let remaining = func_body.get_binary_reader().bytes_remaining(); - let start = consumed - remaining; - let bytes = &buffer[start..consumed]; + let bytes = func_body.as_bytes(); self.process_code_entry(func_body, bytes, &header)?; } _ => break,