From 64ed1bf86950c52e3400c0a536e223a53f48a4b7 Mon Sep 17 00:00:00 2001 From: Henry Gressmann Date: Thu, 25 Jan 2024 01:01:25 +0100 Subject: feat: pass full wasm 1.0 testsuite Signed-off-by: Henry Gressmann --- .github/workflows/test.yaml | 6 ++ crates/cli/src/args.rs | 27 ++------ crates/cli/src/bin.rs | 7 +- crates/parser/src/error.rs | 5 +- crates/tinywasm/src/error.rs | 4 ++ crates/tinywasm/src/func.rs | 2 - crates/tinywasm/src/imports.rs | 81 ++++++---------------- crates/tinywasm/src/instance.rs | 2 +- crates/tinywasm/src/runtime/executor/mod.rs | 6 -- crates/tinywasm/src/runtime/stack/blocks.rs | 7 +- crates/tinywasm/src/store.rs | 101 +++++++++++++++++++--------- crates/tinywasm/tests/generated/mvp.csv | 2 +- crates/tinywasm/tests/testsuite/indexmap.rs | 5 +- 13 files changed, 111 insertions(+), 144 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 0baaba9..24d4277 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -27,6 +27,9 @@ jobs: - name: Run tests (stable) run: cargo +stable test --workspace --exclude wasm-testsuite + - name: Run MVP testsuite + run: cargo +stable test-mvp + test-no-std: name: Test without default features on nightly Rust runs-on: ubuntu-latest @@ -43,3 +46,6 @@ jobs: - name: Run tests (nightly, no default features) run: cargo +nightly test --workspace --exclude wasm-testsuite --no-default-features + + - name: Run MVP testsuite (nightly) + run: cargo +nightly test-mvp diff --git a/crates/cli/src/args.rs b/crates/cli/src/args.rs index 379ecf8..3959572 100644 --- a/crates/cli/src/args.rs +++ b/crates/cli/src/args.rs @@ -17,29 +17,14 @@ impl From for WasmValue { impl FromStr for WasmArg { type Err = String; fn from_str(s: &str) -> std::prelude::v1::Result { - let [ty, val]: [&str; 2] = s - .split(':') - .collect::>() - .try_into() - .map_err(|e| format!("invalid arguments: {:?}", e))?; + let [ty, val]: [&str; 2] = + s.split(':').collect::>().try_into().map_err(|e| format!("invalid arguments: {:?}", e))?; let arg: WasmValue = match ty { - "i32" => val - .parse::() - .map_err(|e| format!("invalid argument value for i32: {e:?}"))? - .into(), - "i64" => val - .parse::() - .map_err(|e| format!("invalid argument value for i64: {e:?}"))? - .into(), - "f32" => val - .parse::() - .map_err(|e| format!("invalid argument value for f32: {e:?}"))? - .into(), - "f64" => val - .parse::() - .map_err(|e| format!("invalid argument value for f64: {e:?}"))? - .into(), + "i32" => val.parse::().map_err(|e| format!("invalid argument value for i32: {e:?}"))?.into(), + "i64" => val.parse::().map_err(|e| format!("invalid argument value for i64: {e:?}"))?.into(), + "f32" => val.parse::().map_err(|e| format!("invalid argument value for f32: {e:?}"))?.into(), + "f64" => val.parse::().map_err(|e| format!("invalid argument value for f64: {e:?}"))?.into(), t => return Err(format!("Invalid arg type: {}", t)), }; diff --git a/crates/cli/src/bin.rs b/crates/cli/src/bin.rs index c8ab379..1c166cf 100644 --- a/crates/cli/src/bin.rs +++ b/crates/cli/src/bin.rs @@ -84,12 +84,7 @@ fn main() -> Result<()> { let cwd = std::env::current_dir()?; match args.nested { - TinyWasmSubcommand::Run(Run { - wasm_file, - engine, - args, - func, - }) => { + TinyWasmSubcommand::Run(Run { wasm_file, engine, args, func }) => { debug!("args: {:?}", args); let path = cwd.join(wasm_file.clone()); diff --git a/crates/parser/src/error.rs b/crates/parser/src/error.rs index acacfa0..714535a 100644 --- a/crates/parser/src/error.rs +++ b/crates/parser/src/error.rs @@ -43,10 +43,7 @@ impl crate::std::error::Error for ParseError {} impl From for ParseError { fn from(value: wasmparser::BinaryReaderError) -> Self { - Self::ParseError { - message: value.message().to_string(), - offset: value.offset(), - } + Self::ParseError { message: value.message().to_string(), offset: value.offset() } } } diff --git a/crates/tinywasm/src/error.rs b/crates/tinywasm/src/error.rs index 22dae60..f9b41be 100644 --- a/crates/tinywasm/src/error.rs +++ b/crates/tinywasm/src/error.rs @@ -70,6 +70,10 @@ impl LinkingError { pub(crate) fn incompatible_import_type(import: &tinywasm_types::Import) -> Self { Self::IncompatibleImportType { module: import.module.to_string(), name: import.name.to_string() } } + + pub(crate) fn unknown_import(import: &tinywasm_types::Import) -> Self { + Self::UnknownImport { module: import.module.to_string(), name: import.name.to_string() } + } } #[derive(Debug)] diff --git a/crates/tinywasm/src/func.rs b/crates/tinywasm/src/func.rs index 8518af0..19d1325 100644 --- a/crates/tinywasm/src/func.rs +++ b/crates/tinywasm/src/func.rs @@ -168,8 +168,6 @@ macro_rules! impl_from_wasm_value_tuple { #[allow(unused_variables, unused_mut)] let mut iter = values.into_iter(); - log::error!("from_wasm_value_tuple: {:?}", iter); - Ok(( $( $T::try_from( diff --git a/crates/tinywasm/src/imports.rs b/crates/tinywasm/src/imports.rs index f9c5cda..804aa12 100644 --- a/crates/tinywasm/src/imports.rs +++ b/crates/tinywasm/src/imports.rs @@ -162,10 +162,8 @@ impl Extern { R: IntoWasmValueTuple + ValTypesFromTuple + Debug, { let inner_func = move |ctx: FuncContext<'_>, args: &[WasmValue]| -> Result> { - log::error!("args: {:?}", args); let args = P::from_wasm_value_tuple(args.to_vec())?; let result = func(ctx, args)?; - log::error!("result: {:?}", result); Ok(result.into_wasm_value_tuple()) }; @@ -290,18 +288,6 @@ impl Imports { _ => {} } - // if expected.size_max.is_none() && actual.size_max.is_some() { - // return Err(LinkingError::incompatible_import_type(import).into()); - // } - - // if expected.size_max.unwrap_or(0) < actual.size_max.unwrap_or(0) { - // return Err(LinkingError::incompatible_import_type(import).into()); - // } - - log::error!("size_initial: expected: {:?} got: {:?}", expected.size_initial, actual.size_initial); - log::error!("size_max: expected: {:?} got: {:?}", expected.size_max, actual.size_max); - // TODO: check limits - Ok(()) } @@ -331,11 +317,6 @@ impl Imports { _ => {} } - log::error!("size_initial: {:?} {:?}", expected.page_count_initial, actual.page_count_initial); - log::error!("size_max: {:?} {:?}", expected.page_count_max, actual.page_count_max); - - // TODO: check limits - Ok(()) } @@ -348,13 +329,7 @@ impl Imports { let mut imports = ResolvedImports::new(); for import in module.data.imports.iter() { - let Some(val) = self.take(store, import) else { - return Err(crate::LinkingError::UnknownImport { - module: import.module.to_string(), - name: import.name.to_string(), - } - .into()); - }; + let val = self.take(store, import).ok_or_else(|| LinkingError::unknown_import(import))?; match val { // A link to something that needs to be added to the store @@ -364,42 +339,31 @@ impl Imports { imports.globals.push(store.add_global(extern_global.ty, extern_global.val.into(), idx)?); } (Extern::Table(extern_table), ImportKind::Table(ty)) => { - Self::compare_table_types(import, &extern_table.ty, &ty)?; + Self::compare_table_types(import, &extern_table.ty, ty)?; imports.tables.push(store.add_table(extern_table.ty, idx)?); } (Extern::Memory(extern_memory), ImportKind::Memory(ty)) => { - Self::compare_memory_types(import, &extern_memory.ty, &ty, None)?; + Self::compare_memory_types(import, &extern_memory.ty, ty, None)?; imports.memories.push(store.add_mem(extern_memory.ty, idx)?); } (Extern::Function(extern_func), ImportKind::Function(ty)) => { - let import_func_type = module.data.func_types.get(*ty as usize).ok_or_else(|| { - crate::LinkingError::IncompatibleImportType { - module: import.module.to_string(), - name: import.name.to_string(), - } - })?; + let import_func_type = module + .data + .func_types + .get(*ty as usize) + .ok_or_else(|| LinkingError::incompatible_import_type(import))?; Self::compare_types(import, extern_func.ty(), import_func_type)?; imports.funcs.push(store.add_func(extern_func, *ty, idx)?); } - _ => { - return Err(crate::LinkingError::IncompatibleImportType { - module: import.module.to_string(), - name: import.name.to_string(), - } - .into()); - } + _ => return Err(LinkingError::incompatible_import_type(import).into()), }, // A link to something already in the store ResolvedExtern::Store(val) => { // check if the kind matches if val.kind() != (&import.kind).into() { - return Err(crate::LinkingError::IncompatibleImportType { - module: import.module.to_string(), - name: import.name.to_string(), - } - .into()); + return Err(LinkingError::incompatible_import_type(import).into()); } match (val, &import.kind) { @@ -410,37 +374,30 @@ impl Imports { } (ExternVal::Table(table_addr), ImportKind::Table(ty)) => { let table = store.get_table(table_addr as usize)?; - Self::compare_table_types(import, &table.borrow().kind, &ty)?; + Self::compare_table_types(import, &table.borrow().kind, ty)?; imports.tables.push(table_addr); } (ExternVal::Mem(memory_addr), ImportKind::Memory(ty)) => { let mem = store.get_mem(memory_addr as usize)?; let (size, kind) = { let mem = mem.borrow(); - (mem.page_count(), mem.kind.clone()) + (mem.page_count(), mem.kind) }; - Self::compare_memory_types(import, &kind, &ty, Some(size))?; + Self::compare_memory_types(import, &kind, ty, Some(size))?; imports.memories.push(memory_addr); } (ExternVal::Func(func_addr), ImportKind::Function(ty)) => { let func = store.get_func(func_addr as usize)?; - let import_func_type = module.data.func_types.get(*ty as usize).ok_or_else(|| { - crate::LinkingError::IncompatibleImportType { - module: import.module.to_string(), - name: import.name.to_string(), - } - })?; + let import_func_type = module + .data + .func_types + .get(*ty as usize) + .ok_or_else(|| LinkingError::incompatible_import_type(import))?; Self::compare_types(import, func.func.ty(), import_func_type)?; imports.funcs.push(func_addr); } - _ => { - return Err(crate::LinkingError::IncompatibleImportType { - module: import.module.to_string(), - name: import.name.to_string(), - } - .into()); - } + _ => return Err(LinkingError::incompatible_import_type(import).into()), } } } diff --git a/crates/tinywasm/src/instance.rs b/crates/tinywasm/src/instance.rs index 91044f5..d1fbd6f 100644 --- a/crates/tinywasm/src/instance.rs +++ b/crates/tinywasm/src/instance.rs @@ -70,7 +70,7 @@ impl ModuleInstance { addrs.tables.extend(store.init_tables(data.table_types.into(), idx)?); addrs.memories.extend(store.init_memories(data.memory_types.into(), idx)?); - let global_addrs = store.init_globals(addrs.globals, data.globals.into(), idx)?; + let global_addrs = store.init_globals(addrs.globals, data.globals.into(), &addrs.funcs, idx)?; let (elem_addrs, elem_trapped) = store.init_elements(&addrs.tables, &addrs.funcs, &global_addrs, data.elements.into(), idx)?; let (data_addrs, data_trapped) = store.init_datas(&addrs.memories, data.data.into(), idx)?; diff --git a/crates/tinywasm/src/runtime/executor/mod.rs b/crates/tinywasm/src/runtime/executor/mod.rs index aa52923..d0f011f 100644 --- a/crates/tinywasm/src/runtime/executor/mod.rs +++ b/crates/tinywasm/src/runtime/executor/mod.rs @@ -139,7 +139,6 @@ fn exec_one( } Call(v) => { - log::info!("start call"); // prepare the call frame let func_idx = module.resolve_func_addr(*v); let func_inst = store.get_func(func_idx as usize)?.clone(); @@ -148,9 +147,7 @@ fn exec_one( crate::Function::Wasm(ref f) => (f.locals.to_vec(), f.ty.clone()), crate::Function::Host(host_func) => { let func = host_func.func.clone(); - log::info!("Getting params: {:?}", host_func.ty.params); let params = stack.values.pop_params(&host_func.ty.params)?; - log::error!("Calling host function, params: {:?}", params); let res = (func)(FuncContext { store, module }, ¶ms)?; stack.values.extend_from_typed(&res); return Ok(ExecResult::Ok); @@ -158,9 +155,6 @@ fn exec_one( }; let params = stack.values.pop_n_rev(ty.params.len())?; - log::info!("call: current fn owner: {:?}", module.id()); - log::info!("call: func owner: {:?}", func_inst.owner); - let call_frame = CallFrame::new_raw(func_inst, ¶ms, locals); // push the call frame diff --git a/crates/tinywasm/src/runtime/stack/blocks.rs b/crates/tinywasm/src/runtime/stack/blocks.rs index f5a0d8d..76252b5 100644 --- a/crates/tinywasm/src/runtime/stack/blocks.rs +++ b/crates/tinywasm/src/runtime/stack/blocks.rs @@ -72,10 +72,9 @@ impl LabelArgs { Ok(match args { BlockArgs::Empty => LabelArgs { params: 0, results: 0 }, BlockArgs::Type(_) => LabelArgs { params: 0, results: 1 }, - BlockArgs::FuncType(t) => LabelArgs { - params: module.func_ty(t).params.len(), - results: module.func_ty(t).results.len(), - }, + BlockArgs::FuncType(t) => { + LabelArgs { params: module.func_ty(t).params.len(), results: module.func_ty(t).results.len() } + } }) } } diff --git a/crates/tinywasm/src/store.rs b/crates/tinywasm/src/store.rs index 6144597..aabbf71 100644 --- a/crates/tinywasm/src/store.rs +++ b/crates/tinywasm/src/store.rs @@ -162,6 +162,7 @@ impl Store { &mut self, mut imported_globals: Vec, new_globals: Vec, + func_addrs: &[FuncAddr], idx: ModuleInstanceAddr, ) -> Result> { let global_count = self.data.globals.len(); @@ -171,7 +172,7 @@ impl Store { for (i, global) in new_globals.iter().enumerate() { self.data.globals.push(Rc::new(RefCell::new(GlobalInstance::new( global.ty, - self.eval_const(&global.init, &global_addrs)?, + self.eval_const(&global.init, &global_addrs, func_addrs)?, idx, )))); global_addrs.push((i + global_count) as Addr); @@ -180,10 +181,13 @@ impl Store { Ok(global_addrs) } - fn elem_addr(&self, item: &ElementItem, globals: &[Addr]) -> Result> { + fn elem_addr(&self, item: &ElementItem, globals: &[Addr], funcs: &[FuncAddr]) -> Result> { let res = match item { - ElementItem::Func(addr) => Some(*addr), - ElementItem::Expr(ConstInstruction::RefFunc(addr)) => Some(*addr), + ElementItem::Func(addr) | ElementItem::Expr(ConstInstruction::RefFunc(addr)) => { + Some(funcs.get(*addr as usize).copied().ok_or_else(|| { + Error::Other(format!("function {} not found. This should have been caught by the validator", addr)) + })?) + } ElementItem::Expr(ConstInstruction::RefNull(_ty)) => None, ElementItem::Expr(ConstInstruction::GlobalGet(addr)) => { let addr = globals.get(*addr as usize).copied().ok_or_else(|| { @@ -191,8 +195,14 @@ impl Store { })?; let global = self.data.globals[addr as usize].clone(); - let val = global.borrow().value; - Some(val.into()) + let val = i64::from(global.borrow().value); + log::error!("global: {}", val); + if val < 0 { + // the global is actually a null reference + None + } else { + Some(val as u32) + } } _ => return Err(Error::UnsupportedFeature(format!("const expression other than ref: {:?}", item))), }; @@ -213,8 +223,11 @@ impl Store { let elem_count = self.data.elements.len(); let mut elem_addrs = Vec::with_capacity(elem_count); for (i, element) in elements.into_iter().enumerate() { - let init = - element.items.iter().map(|item| self.elem_addr(item, global_addrs)).collect::>>()?; + let init = element + .items + .iter() + .map(|item| Ok(TableElement::from(self.elem_addr(item, global_addrs, func_addrs)?))) + .collect::>>()?; log::error!("element kind: {:?}", element.kind); @@ -242,7 +255,7 @@ impl Store { // This isn't mentioned in the spec, but the "unofficial" testsuite has a test for it: // https://github.com/WebAssembly/testsuite/blob/5a1a590603d81f40ef471abba70a90a9ae5f4627/linking.wast#L264-L276 // I have NO IDEA why this is allowed, but it is. - if let Err(Error::Trap(trap)) = table.borrow_mut().init(func_addrs, offset, &init) { + if let Err(Error::Trap(trap)) = table.borrow_mut().init_raw(offset, &init) { return Ok((elem_addrs.into_boxed_slice(), Some(trap))); } } else { @@ -355,6 +368,7 @@ impl Store { &self, const_instr: &tinywasm_types::ConstInstruction, module_global_addrs: &[Addr], + module_func_addrs: &[FuncAddr], ) -> Result { use tinywasm_types::ConstInstruction::*; let val = match const_instr { @@ -367,12 +381,15 @@ impl Store { Error::Other(format!("global {} not found. This should have been caught by the validator", addr)) })?; - let global = self.data.globals[addr as usize].clone(); - let val = global.borrow().value; - val + let global = + self.data.globals.get(addr as usize).expect("global not found. This should be unreachable"); + + global.borrow().value } RefNull(t) => RawWasmValue::from(t.default_value()), - RefFunc(idx) => RawWasmValue::from(*idx as i64), + RefFunc(idx) => RawWasmValue::from(module_func_addrs.get(*idx as usize).copied().ok_or_else(|| { + Error::Other(format!("function {} not found. This should have been caught by the validator", idx)) + })?), }; Ok(val) } @@ -404,9 +421,6 @@ impl Store { /// Get the global at the actual index in the store pub fn get_global_val(&self, addr: usize) -> Result { - log::error!("getting global: {}", addr); - log::error!("globals: {:?}", self.data.globals); - self.data .globals .get(addr) @@ -456,6 +470,15 @@ pub(crate) enum TableElement { Initialized(Addr), } +impl From> for TableElement { + fn from(addr: Option) -> Self { + match addr { + None => TableElement::Uninitialized, + Some(addr) => TableElement::Initialized(addr), + } + } +} + impl TableElement { pub(crate) fn addr(&self) -> Option { match self { @@ -463,6 +486,13 @@ impl TableElement { TableElement::Initialized(addr) => Some(*addr), } } + + pub(crate) fn map Addr>(self, f: F) -> Self { + match self { + TableElement::Uninitialized => TableElement::Uninitialized, + TableElement::Initialized(addr) => TableElement::Initialized(f(addr)), + } + } } const MAX_TABLE_SIZE: u32 = 10000000; @@ -515,20 +545,18 @@ impl TableInstance { self.elements.len() as i32 } - pub(crate) fn init(&mut self, func_addrs: &[u32], offset: i32, init: &[Option]) -> Result<()> { - let init = init - .iter() - .map(|item| match item { - None => TableElement::Uninitialized, - Some(item) => TableElement::Initialized(match self.kind.element_type == ValType::RefFunc { - true => *func_addrs.get(*item as usize).expect( - "error initializing table: function not found. This should have been caught by the validator", - ), - false => *item, - }), - }) - .collect::>(); + fn resolve_func_ref(&self, func_addrs: &[u32], addr: Addr) -> Addr { + if self.kind.element_type != ValType::RefFunc { + return addr; + } + *func_addrs + .get(addr as usize) + .expect("error initializing table: function not found. This should have been caught by the validator") + } + + // Initialize the table with the given elements + pub(crate) fn init_raw(&mut self, offset: i32, init: &[TableElement]) -> Result<()> { let offset = offset as usize; let end = offset.checked_add(init.len()).ok_or_else(|| { Error::Trap(crate::Trap::TableOutOfBounds { offset, len: init.len(), max: self.elements.len() }) @@ -538,10 +566,17 @@ impl TableInstance { return Err(crate::Trap::TableOutOfBounds { offset, len: init.len(), max: self.elements.len() }.into()); } - self.elements[offset..end].copy_from_slice(&init); + self.elements[offset..end].copy_from_slice(init); log::debug!("table: {:?}", self.elements); Ok(()) } + + // Initialize the table with the given elements (resolves function references) + pub(crate) fn init(&mut self, func_addrs: &[u32], offset: i32, init: &[TableElement]) -> Result<()> { + let init = init.iter().map(|item| item.map(|addr| self.resolve_func_ref(func_addrs, addr))).collect::>(); + + self.init_raw(offset, &init) + } } pub(crate) const PAGE_SIZE: usize = 65536; @@ -663,12 +698,12 @@ impl GlobalInstance { #[derive(Debug)] pub(crate) struct ElementInstance { pub(crate) kind: ElementKind, - pub(crate) items: Option>>, // none is the element was dropped - _owner: ModuleInstanceAddr, // index into store.module_instances + pub(crate) items: Option>, // none is the element was dropped + _owner: ModuleInstanceAddr, // index into store.module_instances } impl ElementInstance { - pub(crate) fn new(kind: ElementKind, owner: ModuleInstanceAddr, items: Option>>) -> Self { + pub(crate) fn new(kind: ElementKind, owner: ModuleInstanceAddr, items: Option>) -> Self { Self { kind, _owner: owner, items } } } diff --git a/crates/tinywasm/tests/generated/mvp.csv b/crates/tinywasm/tests/generated/mvp.csv index df4ec19..7e16714 100644 --- a/crates/tinywasm/tests/generated/mvp.csv +++ b/crates/tinywasm/tests/generated/mvp.csv @@ -2,4 +2,4 @@ 0.0.5,11135,9093,[{"name":"address.wast","passed":1,"failed":259},{"name":"align.wast","passed":108,"failed":48},{"name":"binary-leb128.wast","passed":78,"failed":13},{"name":"binary.wast","passed":107,"failed":5},{"name":"block.wast","passed":170,"failed":53},{"name":"br.wast","passed":20,"failed":77},{"name":"br_if.wast","passed":29,"failed":89},{"name":"br_table.wast","passed":24,"failed":150},{"name":"call.wast","passed":18,"failed":73},{"name":"call_indirect.wast","passed":34,"failed":136},{"name":"comments.wast","passed":5,"failed":3},{"name":"const.wast","passed":778,"failed":0},{"name":"conversions.wast","passed":25,"failed":594},{"name":"custom.wast","passed":10,"failed":1},{"name":"data.wast","passed":22,"failed":39},{"name":"elem.wast","passed":27,"failed":72},{"name":"endianness.wast","passed":1,"failed":68},{"name":"exports.wast","passed":90,"failed":6},{"name":"f32.wast","passed":1018,"failed":1496},{"name":"f32_bitwise.wast","passed":4,"failed":360},{"name":"f32_cmp.wast","passed":2407,"failed":0},{"name":"f64.wast","passed":1018,"failed":1496},{"name":"f64_bitwise.wast","passed":4,"failed":360},{"name":"f64_cmp.wast","passed":2407,"failed":0},{"name":"fac.wast","passed":1,"failed":7},{"name":"float_exprs.wast","passed":275,"failed":625},{"name":"float_literals.wast","passed":112,"failed":51},{"name":"float_memory.wast","passed":0,"failed":90},{"name":"float_misc.wast","passed":138,"failed":303},{"name":"forward.wast","passed":1,"failed":4},{"name":"func.wast","passed":81,"failed":91},{"name":"func_ptrs.wast","passed":7,"failed":29},{"name":"global.wast","passed":50,"failed":60},{"name":"i32.wast","passed":85,"failed":375},{"name":"i64.wast","passed":31,"failed":385},{"name":"if.wast","passed":116,"failed":125},{"name":"imports.wast","passed":23,"failed":160},{"name":"inline-module.wast","passed":1,"failed":0},{"name":"int_exprs.wast","passed":38,"failed":70},{"name":"int_literals.wast","passed":25,"failed":26},{"name":"labels.wast","passed":13,"failed":16},{"name":"left-to-right.wast","passed":0,"failed":96},{"name":"linking.wast","passed":5,"failed":127},{"name":"load.wast","passed":59,"failed":38},{"name":"local_get.wast","passed":18,"failed":18},{"name":"local_set.wast","passed":38,"failed":15},{"name":"local_tee.wast","passed":41,"failed":56},{"name":"loop.wast","passed":42,"failed":78},{"name":"memory.wast","passed":30,"failed":49},{"name":"memory_grow.wast","passed":11,"failed":85},{"name":"memory_redundancy.wast","passed":1,"failed":7},{"name":"memory_size.wast","passed":6,"failed":36},{"name":"memory_trap.wast","passed":1,"failed":181},{"name":"names.wast","passed":484,"failed":2},{"name":"nop.wast","passed":4,"failed":84},{"name":"return.wast","passed":20,"failed":64},{"name":"select.wast","passed":28,"failed":120},{"name":"skip-stack-guard-page.wast","passed":1,"failed":10},{"name":"stack.wast","passed":2,"failed":5},{"name":"start.wast","passed":4,"failed":16},{"name":"store.wast","passed":59,"failed":9},{"name":"switch.wast","passed":2,"failed":26},{"name":"token.wast","passed":39,"failed":19},{"name":"traps.wast","passed":4,"failed":32},{"name":"type.wast","passed":3,"failed":0},{"name":"unreachable.wast","passed":0,"failed":64},{"name":"unreached-invalid.wast","passed":118,"failed":0},{"name":"unwind.wast","passed":9,"failed":41},{"name":"utf8-custom-section-id.wast","passed":176,"failed":0},{"name":"utf8-import-field.wast","passed":176,"failed":0},{"name":"utf8-import-module.wast","passed":176,"failed":0},{"name":"utf8-invalid-encoding.wast","passed":176,"failed":0}] 0.1.0,17630,2598,[{"name":"address.wast","passed":5,"failed":255},{"name":"align.wast","passed":108,"failed":48},{"name":"binary-leb128.wast","passed":91,"failed":0},{"name":"binary.wast","passed":110,"failed":2},{"name":"block.wast","passed":193,"failed":30},{"name":"br.wast","passed":84,"failed":13},{"name":"br_if.wast","passed":90,"failed":28},{"name":"br_table.wast","passed":25,"failed":149},{"name":"call.wast","passed":29,"failed":62},{"name":"call_indirect.wast","passed":36,"failed":134},{"name":"comments.wast","passed":7,"failed":1},{"name":"const.wast","passed":778,"failed":0},{"name":"conversions.wast","passed":371,"failed":248},{"name":"custom.wast","passed":11,"failed":0},{"name":"data.wast","passed":47,"failed":14},{"name":"elem.wast","passed":50,"failed":49},{"name":"endianness.wast","passed":1,"failed":68},{"name":"exports.wast","passed":92,"failed":4},{"name":"f32.wast","passed":2514,"failed":0},{"name":"f32_bitwise.wast","passed":364,"failed":0},{"name":"f32_cmp.wast","passed":2407,"failed":0},{"name":"f64.wast","passed":2514,"failed":0},{"name":"f64_bitwise.wast","passed":364,"failed":0},{"name":"f64_cmp.wast","passed":2407,"failed":0},{"name":"fac.wast","passed":2,"failed":6},{"name":"float_exprs.wast","passed":761,"failed":139},{"name":"float_literals.wast","passed":163,"failed":0},{"name":"float_memory.wast","passed":6,"failed":84},{"name":"float_misc.wast","passed":437,"failed":4},{"name":"forward.wast","passed":1,"failed":4},{"name":"func.wast","passed":124,"failed":48},{"name":"func_ptrs.wast","passed":10,"failed":26},{"name":"global.wast","passed":51,"failed":59},{"name":"i32.wast","passed":460,"failed":0},{"name":"i64.wast","passed":416,"failed":0},{"name":"if.wast","passed":120,"failed":121},{"name":"imports.wast","passed":74,"failed":109},{"name":"inline-module.wast","passed":1,"failed":0},{"name":"int_exprs.wast","passed":108,"failed":0},{"name":"int_literals.wast","passed":51,"failed":0},{"name":"labels.wast","passed":14,"failed":15},{"name":"left-to-right.wast","passed":1,"failed":95},{"name":"linking.wast","passed":21,"failed":111},{"name":"load.wast","passed":60,"failed":37},{"name":"local_get.wast","passed":32,"failed":4},{"name":"local_set.wast","passed":50,"failed":3},{"name":"local_tee.wast","passed":68,"failed":29},{"name":"loop.wast","passed":93,"failed":27},{"name":"memory.wast","passed":34,"failed":45},{"name":"memory_grow.wast","passed":12,"failed":84},{"name":"memory_redundancy.wast","passed":1,"failed":7},{"name":"memory_size.wast","passed":6,"failed":36},{"name":"memory_trap.wast","passed":2,"failed":180},{"name":"names.wast","passed":485,"failed":1},{"name":"nop.wast","passed":46,"failed":42},{"name":"return.wast","passed":73,"failed":11},{"name":"select.wast","passed":86,"failed":62},{"name":"skip-stack-guard-page.wast","passed":1,"failed":10},{"name":"stack.wast","passed":2,"failed":5},{"name":"start.wast","passed":9,"failed":11},{"name":"store.wast","passed":59,"failed":9},{"name":"switch.wast","passed":2,"failed":26},{"name":"token.wast","passed":58,"failed":0},{"name":"traps.wast","passed":22,"failed":14},{"name":"type.wast","passed":3,"failed":0},{"name":"unreachable.wast","passed":50,"failed":14},{"name":"unreached-invalid.wast","passed":118,"failed":0},{"name":"unwind.wast","passed":35,"failed":15},{"name":"utf8-custom-section-id.wast","passed":176,"failed":0},{"name":"utf8-import-field.wast","passed":176,"failed":0},{"name":"utf8-import-module.wast","passed":176,"failed":0},{"name":"utf8-invalid-encoding.wast","passed":176,"failed":0}] 0.2.0,19344,884,[{"name":"address.wast","passed":181,"failed":79},{"name":"align.wast","passed":156,"failed":0},{"name":"binary-leb128.wast","passed":91,"failed":0},{"name":"binary.wast","passed":112,"failed":0},{"name":"block.wast","passed":220,"failed":3},{"name":"br.wast","passed":97,"failed":0},{"name":"br_if.wast","passed":118,"failed":0},{"name":"br_table.wast","passed":171,"failed":3},{"name":"call.wast","passed":73,"failed":18},{"name":"call_indirect.wast","passed":50,"failed":120},{"name":"comments.wast","passed":7,"failed":1},{"name":"const.wast","passed":778,"failed":0},{"name":"conversions.wast","passed":439,"failed":180},{"name":"custom.wast","passed":11,"failed":0},{"name":"data.wast","passed":47,"failed":14},{"name":"elem.wast","passed":56,"failed":43},{"name":"endianness.wast","passed":29,"failed":40},{"name":"exports.wast","passed":92,"failed":4},{"name":"f32.wast","passed":2514,"failed":0},{"name":"f32_bitwise.wast","passed":364,"failed":0},{"name":"f32_cmp.wast","passed":2407,"failed":0},{"name":"f64.wast","passed":2514,"failed":0},{"name":"f64_bitwise.wast","passed":364,"failed":0},{"name":"f64_cmp.wast","passed":2407,"failed":0},{"name":"fac.wast","passed":6,"failed":2},{"name":"float_exprs.wast","passed":890,"failed":10},{"name":"float_literals.wast","passed":163,"failed":0},{"name":"float_memory.wast","passed":78,"failed":12},{"name":"float_misc.wast","passed":437,"failed":4},{"name":"forward.wast","passed":5,"failed":0},{"name":"func.wast","passed":168,"failed":4},{"name":"func_ptrs.wast","passed":10,"failed":26},{"name":"global.wast","passed":103,"failed":7},{"name":"i32.wast","passed":460,"failed":0},{"name":"i64.wast","passed":416,"failed":0},{"name":"if.wast","passed":231,"failed":10},{"name":"imports.wast","passed":80,"failed":103},{"name":"inline-module.wast","passed":1,"failed":0},{"name":"int_exprs.wast","passed":108,"failed":0},{"name":"int_literals.wast","passed":51,"failed":0},{"name":"labels.wast","passed":26,"failed":3},{"name":"left-to-right.wast","passed":92,"failed":4},{"name":"linking.wast","passed":29,"failed":103},{"name":"load.wast","passed":93,"failed":4},{"name":"local_get.wast","passed":36,"failed":0},{"name":"local_set.wast","passed":53,"failed":0},{"name":"local_tee.wast","passed":93,"failed":4},{"name":"loop.wast","passed":116,"failed":4},{"name":"memory.wast","passed":78,"failed":1},{"name":"memory_grow.wast","passed":91,"failed":5},{"name":"memory_redundancy.wast","passed":8,"failed":0},{"name":"memory_size.wast","passed":35,"failed":7},{"name":"memory_trap.wast","passed":180,"failed":2},{"name":"names.wast","passed":485,"failed":1},{"name":"nop.wast","passed":78,"failed":10},{"name":"return.wast","passed":84,"failed":0},{"name":"select.wast","passed":114,"failed":34},{"name":"skip-stack-guard-page.wast","passed":1,"failed":10},{"name":"stack.wast","passed":7,"failed":0},{"name":"start.wast","passed":11,"failed":9},{"name":"store.wast","passed":68,"failed":0},{"name":"switch.wast","passed":28,"failed":0},{"name":"token.wast","passed":58,"failed":0},{"name":"traps.wast","passed":36,"failed":0},{"name":"type.wast","passed":3,"failed":0},{"name":"unreachable.wast","passed":64,"failed":0},{"name":"unreached-invalid.wast","passed":118,"failed":0},{"name":"unwind.wast","passed":50,"failed":0},{"name":"utf8-custom-section-id.wast","passed":176,"failed":0},{"name":"utf8-import-field.wast","passed":176,"failed":0},{"name":"utf8-import-module.wast","passed":176,"failed":0},{"name":"utf8-invalid-encoding.wast","passed":176,"failed":0}] -0.3.0-alpha.0,20253,1,[{"name":"address.wast","passed":260,"failed":0},{"name":"align.wast","passed":156,"failed":0},{"name":"binary-leb128.wast","passed":91,"failed":0},{"name":"binary.wast","passed":112,"failed":0},{"name":"block.wast","passed":223,"failed":0},{"name":"br.wast","passed":97,"failed":0},{"name":"br_if.wast","passed":118,"failed":0},{"name":"br_table.wast","passed":174,"failed":0},{"name":"call.wast","passed":91,"failed":0},{"name":"call_indirect.wast","passed":170,"failed":0},{"name":"comments.wast","passed":8,"failed":0},{"name":"const.wast","passed":778,"failed":0},{"name":"conversions.wast","passed":619,"failed":0},{"name":"custom.wast","passed":11,"failed":0},{"name":"data.wast","passed":61,"failed":0},{"name":"elem.wast","passed":98,"failed":1},{"name":"endianness.wast","passed":69,"failed":0},{"name":"exports.wast","passed":96,"failed":0},{"name":"f32.wast","passed":2514,"failed":0},{"name":"f32_bitwise.wast","passed":364,"failed":0},{"name":"f32_cmp.wast","passed":2407,"failed":0},{"name":"f64.wast","passed":2514,"failed":0},{"name":"f64_bitwise.wast","passed":364,"failed":0},{"name":"f64_cmp.wast","passed":2407,"failed":0},{"name":"fac.wast","passed":8,"failed":0},{"name":"float_exprs.wast","passed":900,"failed":0},{"name":"float_literals.wast","passed":163,"failed":0},{"name":"float_memory.wast","passed":90,"failed":0},{"name":"float_misc.wast","passed":441,"failed":0},{"name":"forward.wast","passed":5,"failed":0},{"name":"func.wast","passed":172,"failed":0},{"name":"func_ptrs.wast","passed":36,"failed":0},{"name":"global.wast","passed":110,"failed":0},{"name":"i32.wast","passed":460,"failed":0},{"name":"i64.wast","passed":416,"failed":0},{"name":"if.wast","passed":241,"failed":0},{"name":"imports.wast","passed":183,"failed":0},{"name":"inline-module.wast","passed":1,"failed":0},{"name":"int_exprs.wast","passed":108,"failed":0},{"name":"int_literals.wast","passed":51,"failed":0},{"name":"labels.wast","passed":29,"failed":0},{"name":"left-to-right.wast","passed":96,"failed":0},{"name":"linking.wast","passed":132,"failed":0},{"name":"load.wast","passed":97,"failed":0},{"name":"local_get.wast","passed":36,"failed":0},{"name":"local_set.wast","passed":53,"failed":0},{"name":"local_tee.wast","passed":97,"failed":0},{"name":"loop.wast","passed":120,"failed":0},{"name":"memory.wast","passed":79,"failed":0},{"name":"memory_grow.wast","passed":96,"failed":0},{"name":"memory_redundancy.wast","passed":8,"failed":0},{"name":"memory_size.wast","passed":42,"failed":0},{"name":"memory_trap.wast","passed":182,"failed":0},{"name":"names.wast","passed":486,"failed":0},{"name":"nop.wast","passed":88,"failed":0},{"name":"return.wast","passed":84,"failed":0},{"name":"select.wast","passed":148,"failed":0},{"name":"skip-stack-guard-page.wast","passed":11,"failed":0},{"name":"stack.wast","passed":7,"failed":0},{"name":"start.wast","passed":20,"failed":0},{"name":"store.wast","passed":68,"failed":0},{"name":"switch.wast","passed":28,"failed":0},{"name":"table.wast","passed":19,"failed":0},{"name":"token.wast","passed":58,"failed":0},{"name":"traps.wast","passed":36,"failed":0},{"name":"type.wast","passed":3,"failed":0},{"name":"unreachable.wast","passed":64,"failed":0},{"name":"unreached-invalid.wast","passed":118,"failed":0},{"name":"unreached-valid.wast","passed":7,"failed":0},{"name":"unwind.wast","passed":50,"failed":0},{"name":"utf8-custom-section-id.wast","passed":176,"failed":0},{"name":"utf8-import-field.wast","passed":176,"failed":0},{"name":"utf8-import-module.wast","passed":176,"failed":0},{"name":"utf8-invalid-encoding.wast","passed":176,"failed":0}] +0.3.0-alpha.0,20254,0,[{"name":"address.wast","passed":260,"failed":0},{"name":"align.wast","passed":156,"failed":0},{"name":"binary-leb128.wast","passed":91,"failed":0},{"name":"binary.wast","passed":112,"failed":0},{"name":"block.wast","passed":223,"failed":0},{"name":"br.wast","passed":97,"failed":0},{"name":"br_if.wast","passed":118,"failed":0},{"name":"br_table.wast","passed":174,"failed":0},{"name":"call.wast","passed":91,"failed":0},{"name":"call_indirect.wast","passed":170,"failed":0},{"name":"comments.wast","passed":8,"failed":0},{"name":"const.wast","passed":778,"failed":0},{"name":"conversions.wast","passed":619,"failed":0},{"name":"custom.wast","passed":11,"failed":0},{"name":"data.wast","passed":61,"failed":0},{"name":"elem.wast","passed":99,"failed":0},{"name":"endianness.wast","passed":69,"failed":0},{"name":"exports.wast","passed":96,"failed":0},{"name":"f32.wast","passed":2514,"failed":0},{"name":"f32_bitwise.wast","passed":364,"failed":0},{"name":"f32_cmp.wast","passed":2407,"failed":0},{"name":"f64.wast","passed":2514,"failed":0},{"name":"f64_bitwise.wast","passed":364,"failed":0},{"name":"f64_cmp.wast","passed":2407,"failed":0},{"name":"fac.wast","passed":8,"failed":0},{"name":"float_exprs.wast","passed":900,"failed":0},{"name":"float_literals.wast","passed":163,"failed":0},{"name":"float_memory.wast","passed":90,"failed":0},{"name":"float_misc.wast","passed":441,"failed":0},{"name":"forward.wast","passed":5,"failed":0},{"name":"func.wast","passed":172,"failed":0},{"name":"func_ptrs.wast","passed":36,"failed":0},{"name":"global.wast","passed":110,"failed":0},{"name":"i32.wast","passed":460,"failed":0},{"name":"i64.wast","passed":416,"failed":0},{"name":"if.wast","passed":241,"failed":0},{"name":"imports.wast","passed":183,"failed":0},{"name":"inline-module.wast","passed":1,"failed":0},{"name":"int_exprs.wast","passed":108,"failed":0},{"name":"int_literals.wast","passed":51,"failed":0},{"name":"labels.wast","passed":29,"failed":0},{"name":"left-to-right.wast","passed":96,"failed":0},{"name":"linking.wast","passed":132,"failed":0},{"name":"load.wast","passed":97,"failed":0},{"name":"local_get.wast","passed":36,"failed":0},{"name":"local_set.wast","passed":53,"failed":0},{"name":"local_tee.wast","passed":97,"failed":0},{"name":"loop.wast","passed":120,"failed":0},{"name":"memory.wast","passed":79,"failed":0},{"name":"memory_grow.wast","passed":96,"failed":0},{"name":"memory_redundancy.wast","passed":8,"failed":0},{"name":"memory_size.wast","passed":42,"failed":0},{"name":"memory_trap.wast","passed":182,"failed":0},{"name":"names.wast","passed":486,"failed":0},{"name":"nop.wast","passed":88,"failed":0},{"name":"return.wast","passed":84,"failed":0},{"name":"select.wast","passed":148,"failed":0},{"name":"skip-stack-guard-page.wast","passed":11,"failed":0},{"name":"stack.wast","passed":7,"failed":0},{"name":"start.wast","passed":20,"failed":0},{"name":"store.wast","passed":68,"failed":0},{"name":"switch.wast","passed":28,"failed":0},{"name":"table.wast","passed":19,"failed":0},{"name":"token.wast","passed":58,"failed":0},{"name":"traps.wast","passed":36,"failed":0},{"name":"type.wast","passed":3,"failed":0},{"name":"unreachable.wast","passed":64,"failed":0},{"name":"unreached-invalid.wast","passed":118,"failed":0},{"name":"unreached-valid.wast","passed":7,"failed":0},{"name":"unwind.wast","passed":50,"failed":0},{"name":"utf8-custom-section-id.wast","passed":176,"failed":0},{"name":"utf8-import-field.wast","passed":176,"failed":0},{"name":"utf8-import-module.wast","passed":176,"failed":0},{"name":"utf8-invalid-encoding.wast","passed":176,"failed":0}] diff --git a/crates/tinywasm/tests/testsuite/indexmap.rs b/crates/tinywasm/tests/testsuite/indexmap.rs index d4e3869..1642ce2 100644 --- a/crates/tinywasm/tests/testsuite/indexmap.rs +++ b/crates/tinywasm/tests/testsuite/indexmap.rs @@ -8,10 +8,7 @@ where K: std::cmp::Eq + std::hash::Hash + Clone, { pub fn new() -> Self { - Self { - map: std::collections::HashMap::new(), - keys: Vec::new(), - } + Self { map: std::collections::HashMap::new(), keys: Vec::new() } } pub fn insert(&mut self, key: K, value: V) -> Option { -- cgit v1.3.1