summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/tinywasm/src/interpreter/executor.rs13
-rw-r--r--crates/tinywasm/src/interpreter/simd.rs157
-rw-r--r--crates/tinywasm/src/interpreter/stack/value_stack.rs14
-rw-r--r--crates/tinywasm/src/interpreter/values.rs8
-rw-r--r--crates/tinywasm/src/store/table.rs11
-rw-r--r--crates/tinywasm/tests/generated/wasm-simd.csv2
-rw-r--r--crates/tinywasm/tests/testsuite/util.rs2
-rw-r--r--crates/types/src/instructions.rs8
8 files changed, 61 insertions, 154 deletions
diff --git a/crates/tinywasm/src/interpreter/executor.rs b/crates/tinywasm/src/interpreter/executor.rs
index 774927c..2b64942 100644
--- a/crates/tinywasm/src/interpreter/executor.rs
+++ b/crates/tinywasm/src/interpreter/executor.rs
@@ -4,6 +4,7 @@ use super::no_std_floats::NoStdFloatExt;
use alloc::{format, rc::Rc, string::ToString};
use core::ops::ControlFlow;
+use interpreter::simd::exec_next_simd;
use interpreter::stack::CallFrame;
use tinywasm_types::*;
@@ -12,11 +13,11 @@ use super::stack::{BlockFrame, BlockType, Stack};
use super::values::*;
use crate::*;
-pub(super) struct Executor<'store, 'stack> {
- cf: CallFrame,
- module: ModuleInstance,
- store: &'store mut Store,
- stack: &'stack mut Stack,
+pub(crate) struct Executor<'store, 'stack> {
+ pub(crate) cf: CallFrame,
+ pub(crate) module: ModuleInstance,
+ pub(crate) store: &'store mut Store,
+ pub(crate) stack: &'stack mut Stack,
}
impl<'store, 'stack> Executor<'store, 'stack> {
@@ -302,7 +303,7 @@ impl<'store, 'stack> Executor<'store, 'stack> {
LocalCopy128(from, to) => self.exec_local_copy::<Value128>(*from, *to),
LocalCopyRef(from, to) => self.exec_local_copy::<ValueRef>(*from, *to),
- Simd(op) => unimplemented!("simd instruction {:?}", op),
+ Simd(op) => exec_next_simd(self, *op).to_cf()?,
};
self.cf.incr_instr_ptr();
diff --git a/crates/tinywasm/src/interpreter/simd.rs b/crates/tinywasm/src/interpreter/simd.rs
index eb798d4..e996edc 100644
--- a/crates/tinywasm/src/interpreter/simd.rs
+++ b/crates/tinywasm/src/interpreter/simd.rs
@@ -1,133 +1,32 @@
-// #[cfg(not(feature = "std"))]
-// #[allow(unused_imports)]
-// use super::no_std_floats::NoStdFloatExt;
+use tinywasm_types::SimdInstruction;
-// // WIP
-// struct V128([u8; 16]);
+use crate::Result;
-// impl V128 {
-// fn f32x4(&self) -> [f32; 4] {
-// let mut res = [0.0; 4];
-// for i in 0..4 {
-// let mut f = [0; 4];
-// for j in 0..4 {
-// f[j] = self.0[i * 4 + j];
-// }
-// res[i] = f32::from_le_bytes(f);
-// }
-// res
-// }
+#[cfg(not(feature = "std"))]
+#[allow(unused_imports)]
+use super::no_std_floats::NoStdFloatExt;
+use super::{executor::Executor, Value128};
-// fn i32x4(&self) -> [i32; 4] {
-// let mut res = [0; 4];
-// for i in 0..4 {
-// let mut f = [0; 4];
-// for j in 0..4 {
-// f[j] = self.0[i * 4 + j];
-// }
-// res[i] = i32::from_le_bytes(f);
-// }
-// res
-// }
+#[inline(always)]
+pub(crate) fn exec_next_simd(e: &mut Executor<'_, '_>, op: SimdInstruction) -> Result<()> {
+ match op {
+ // unops
+ SimdInstruction::V128Not => e.stack.values.replace_top_same(|a: Value128| Ok(!a))?,
+ // binops
+ SimdInstruction::V128And => e.stack.values.calculate_same(|a: Value128, b: Value128| Ok(a & b))?,
+ SimdInstruction::V128AndNot => e.stack.values.calculate_same(|a: Value128, b: Value128| Ok(a & !b))?,
+ SimdInstruction::V128Or => e.stack.values.calculate_same(|a: Value128, b: Value128| Ok(a | b))?,
+ SimdInstruction::V128Xor => e.stack.values.calculate_same(|a: Value128, b: Value128| Ok(a ^ b))?,
+ // ternops
+ SimdInstruction::V128Bitselect => {
+ let c: Value128 = e.stack.values.pop();
+ e.stack.values.calculate(|a: Value128, b: Value128| Ok((a & b) | (!a & c)))?;
+ }
+ // shifts
+ _ => {}
+ }
+ Ok(())
+}
-// fn i64x2(&self) -> [i64; 2] {
-// let mut res = [0; 2];
-// for i in 0..2 {
-// let mut f = [0; 8];
-// for j in 0..8 {
-// f[j] = self.0[i * 8 + j];
-// }
-// res[i] = i64::from_le_bytes(f);
-// }
-// res
-// }
-
-// fn f64x2(&self) -> [f64; 2] {
-// let mut res = [0.0; 2];
-// for i in 0..2 {
-// let mut f = [0; 8];
-// for j in 0..8 {
-// f[j] = self.0[i * 8 + j];
-// }
-// res[i] = f64::from_le_bytes(f);
-// }
-// res
-// }
-
-// fn i16x8(&self) -> [i16; 8] {
-// let mut res = [0; 8];
-// for i in 0..8 {
-// let mut f = [0; 2];
-// for j in 0..2 {
-// f[j] = self.0[i * 2 + j];
-// }
-// res[i] = i16::from_le_bytes(f);
-// }
-// res
-// }
-
-// fn i8x16(&self) -> [i8; 16] {
-// let mut res = [0; 16];
-// for i in 0..16 {
-// res[i] = i8::from_le_bytes([self.0[i]]);
-// }
-// res
-// }
-// }
-
-// fn vvunop(c1: V128) -> V128 {
-// let mut res = [0; 16];
-// for i in 0..16 {
-// res[i] = !c1.0[i];
-// }
-// V128(res)
-// }
-
-// fn vvbinop(c1: V128, c2: V128) -> V128 {
-// let mut res = [0; 16];
-// for i in 0..16 {
-// res[i] = c1.0[i] & c2.0[i];
-// }
-// V128(res)
-// }
-
-// fn vvternop(c1: V128, c2: V128, c3: V128) -> V128 {
-// let mut res = [0; 16];
-// for i in 0..16 {
-// res[i] = c1.0[i] & c2.0[i] | !c1.0[i] & c3.0[i];
-// }
-// V128(res)
-// }
-
-// fn any_true(val: V128) -> bool {
-// val.0.iter().any(|&x| x != 0)
-// }
-
-// fn i8x16_swizzle(c1: V128, c2: V128) -> V128 {
-// let mut res = [0; 16];
-// for i in 0..16 {
-// res[i] = c1.0[c2.0[i] as usize];
-// }
-// V128(res)
-// }
-
-// fn i18x16_shuffle(c1: V128, c2: V128) -> V128 {
-// let mut res = [0; 16];
-// for i in 0..16 {
-// res[i] = c1.0[(c2.0[i] & 0xf) as usize];
-// }
-// V128(res)
-// }
-
-// fn f32x4_abs(val: V128) -> V128 {
-// let mut res = [0; 16];
-// for i in 0..4 {
-// let f = val.f32x4();
-// let f = f32::abs(f[i]);
-// let f = f.to_le_bytes();
-// for j in 0..4 {
-// res[i * 4 + j] = f[j];
-// }
-// }
-// V128(res)
-// }
+// trait SimdExt {}
+// impl SimdExt for Value128 {}
diff --git a/crates/tinywasm/src/interpreter/stack/value_stack.rs b/crates/tinywasm/src/interpreter/stack/value_stack.rs
index 7cbf612..ab739a3 100644
--- a/crates/tinywasm/src/interpreter/stack/value_stack.rs
+++ b/crates/tinywasm/src/interpreter/stack/value_stack.rs
@@ -67,12 +67,15 @@ impl ValueStack {
}
#[inline]
- pub(crate) fn calculate_same<T: InternalValue>(&mut self, func: fn(T, T) -> Result<T>) -> Result<()> {
+ pub(crate) fn calculate_same<T: InternalValue>(&mut self, func: impl FnOnce(T, T) -> Result<T>) -> Result<()> {
T::stack_calculate(self, func)
}
#[inline]
- pub(crate) fn calculate<T: InternalValue, U: InternalValue>(&mut self, func: fn(T, T) -> Result<U>) -> Result<()> {
+ pub(crate) fn calculate<T: InternalValue, U: InternalValue>(
+ &mut self,
+ func: impl FnOnce(T, T) -> Result<U>,
+ ) -> Result<()> {
let v2 = T::stack_pop(self);
let v1 = T::stack_pop(self);
U::stack_push(self, func(v1, v2)?);
@@ -80,14 +83,17 @@ impl ValueStack {
}
#[inline]
- pub(crate) fn replace_top<T: InternalValue, U: InternalValue>(&mut self, func: fn(T) -> Result<U>) -> Result<()> {
+ pub(crate) fn replace_top<T: InternalValue, U: InternalValue>(
+ &mut self,
+ func: impl FnOnce(T) -> Result<U>,
+ ) -> Result<()> {
let v1 = T::stack_pop(self);
U::stack_push(self, func(v1)?);
Ok(())
}
#[inline]
- pub(crate) fn replace_top_same<T: InternalValue>(&mut self, func: fn(T) -> Result<T>) -> Result<()> {
+ pub(crate) fn replace_top_same<T: InternalValue>(&mut self, func: impl Fn(T) -> Result<T>) -> Result<()> {
T::replace_top(self, func)
}
diff --git a/crates/tinywasm/src/interpreter/values.rs b/crates/tinywasm/src/interpreter/values.rs
index 99cf443..efee9b8 100644
--- a/crates/tinywasm/src/interpreter/values.rs
+++ b/crates/tinywasm/src/interpreter/values.rs
@@ -146,10 +146,10 @@ mod sealed {
pub(crate) trait InternalValue: sealed::Sealed + Into<TinyWasmValue> {
fn stack_push(stack: &mut ValueStack, value: Self);
- fn replace_top(stack: &mut ValueStack, func: fn(Self) -> Result<Self>) -> Result<()>
+ fn replace_top(stack: &mut ValueStack, func: impl FnOnce(Self) -> Result<Self>) -> Result<()>
where
Self: Sized;
- fn stack_calculate(stack: &mut ValueStack, func: fn(Self, Self) -> Result<Self>) -> Result<()>
+ fn stack_calculate(stack: &mut ValueStack, func: impl FnOnce(Self, Self) -> Result<Self>) -> Result<()>
where
Self: Sized;
@@ -197,7 +197,7 @@ macro_rules! impl_internalvalue {
}
#[inline(always)]
- fn stack_calculate(stack: &mut ValueStack, func: fn(Self, Self) -> Result<Self>) -> Result<()> {
+ fn stack_calculate(stack: &mut ValueStack, func: impl FnOnce(Self, Self) -> Result<Self>) -> Result<()> {
let v2 = stack.$stack.pop();
let v1 = stack.$stack.last_mut();
let (Some(v1), Some(v2)) = (v1, v2) else {
@@ -209,7 +209,7 @@ macro_rules! impl_internalvalue {
}
#[inline(always)]
- fn replace_top(stack: &mut ValueStack, func: fn(Self) -> Result<Self>) -> Result<()> {
+ fn replace_top(stack: &mut ValueStack, func: impl FnOnce(Self) -> Result<Self>) -> Result<()> {
let Some(v) = stack.$stack.last_mut() else {
unreachable!("ValueStack underflow, this is a bug");
};
diff --git a/crates/tinywasm/src/store/table.rs b/crates/tinywasm/src/store/table.rs
index 200d331..5520faf 100644
--- a/crates/tinywasm/src/store/table.rs
+++ b/crates/tinywasm/src/store/table.rs
@@ -48,10 +48,11 @@ impl TableInstance {
}
pub(crate) fn get(&self, addr: TableAddr) -> Result<&TableElement> {
- // self.elements.get(addr as usize).ok_or_else(|| Error::Trap(Trap::UndefinedElement { index: addr as usize }))
- self.elements.get(addr as usize).ok_or({
- Error::Trap(Trap::TableOutOfBounds { offset: addr as usize, len: 1, max: self.elements.len() })
- })
+ self.elements.get(addr as usize).ok_or(Error::Trap(Trap::TableOutOfBounds {
+ offset: addr as usize,
+ len: 1,
+ max: self.elements.len(),
+ }))
}
pub(crate) fn copy_from_slice(&mut self, dst: usize, src: &[TableElement]) -> Result<()> {
@@ -172,7 +173,7 @@ impl TableElement {
}
}
- pub(crate) fn map<F: FnOnce(Addr) -> Addr>(self, f: F) -> Self {
+ pub(crate) fn map(self, f: impl FnOnce(Addr) -> Addr) -> Self {
match self {
TableElement::Uninitialized => TableElement::Uninitialized,
TableElement::Initialized(addr) => TableElement::Initialized(f(addr)),
diff --git a/crates/tinywasm/tests/generated/wasm-simd.csv b/crates/tinywasm/tests/generated/wasm-simd.csv
index a7fc7ef..d695dfa 100644
--- a/crates/tinywasm/tests/generated/wasm-simd.csv
+++ b/crates/tinywasm/tests/generated/wasm-simd.csv
@@ -1,2 +1,2 @@
0.8.0,1300,24679,[{"name":"simd_address.wast","passed":4,"failed":45},{"name":"simd_align.wast","passed":46,"failed":54},{"name":"simd_bit_shift.wast","passed":39,"failed":213},{"name":"simd_bitwise.wast","passed":28,"failed":141},{"name":"simd_boolean.wast","passed":16,"failed":261},{"name":"simd_const.wast","passed":301,"failed":456},{"name":"simd_conversions.wast","passed":48,"failed":234},{"name":"simd_f32x4.wast","passed":16,"failed":774},{"name":"simd_f32x4_arith.wast","passed":16,"failed":1806},{"name":"simd_f32x4_cmp.wast","passed":24,"failed":2583},{"name":"simd_f32x4_pmin_pmax.wast","passed":14,"failed":3873},{"name":"simd_f32x4_rounding.wast","passed":24,"failed":177},{"name":"simd_f64x2.wast","passed":8,"failed":795},{"name":"simd_f64x2_arith.wast","passed":16,"failed":1809},{"name":"simd_f64x2_cmp.wast","passed":24,"failed":2661},{"name":"simd_f64x2_pmin_pmax.wast","passed":14,"failed":3873},{"name":"simd_f64x2_rounding.wast","passed":24,"failed":177},{"name":"simd_i16x8_arith.wast","passed":11,"failed":183},{"name":"simd_i16x8_arith2.wast","passed":19,"failed":153},{"name":"simd_i16x8_cmp.wast","passed":30,"failed":435},{"name":"simd_i16x8_extadd_pairwise_i8x16.wast","passed":4,"failed":17},{"name":"simd_i16x8_extmul_i8x16.wast","passed":12,"failed":105},{"name":"simd_i16x8_q15mulr_sat_s.wast","passed":3,"failed":27},{"name":"simd_i16x8_sat_arith.wast","passed":16,"failed":206},{"name":"simd_i32x4_arith.wast","passed":11,"failed":183},{"name":"simd_i32x4_arith2.wast","passed":26,"failed":123},{"name":"simd_i32x4_cmp.wast","passed":40,"failed":435},{"name":"simd_i32x4_dot_i16x8.wast","passed":3,"failed":27},{"name":"simd_i32x4_extadd_pairwise_i16x8.wast","passed":4,"failed":17},{"name":"simd_i32x4_extmul_i16x8.wast","passed":12,"failed":105},{"name":"simd_i32x4_trunc_sat_f32x4.wast","passed":4,"failed":103},{"name":"simd_i32x4_trunc_sat_f64x2.wast","passed":4,"failed":103},{"name":"simd_i64x2_arith.wast","passed":11,"failed":189},{"name":"simd_i64x2_arith2.wast","passed":2,"failed":23},{"name":"simd_i64x2_cmp.wast","passed":10,"failed":103},{"name":"simd_i64x2_extmul_i32x4.wast","passed":12,"failed":105},{"name":"simd_i8x16_arith.wast","passed":8,"failed":123},{"name":"simd_i8x16_arith2.wast","passed":25,"failed":186},{"name":"simd_i8x16_cmp.wast","passed":30,"failed":415},{"name":"simd_i8x16_sat_arith.wast","passed":24,"failed":190},{"name":"simd_int_to_int_extend.wast","passed":24,"failed":229},{"name":"simd_lane.wast","passed":189,"failed":286},{"name":"simd_linking.wast","passed":0,"failed":3},{"name":"simd_load.wast","passed":8,"failed":31},{"name":"simd_load16_lane.wast","passed":3,"failed":33},{"name":"simd_load32_lane.wast","passed":3,"failed":21},{"name":"simd_load64_lane.wast","passed":3,"failed":13},{"name":"simd_load8_lane.wast","passed":3,"failed":49},{"name":"simd_load_extend.wast","passed":18,"failed":86},{"name":"simd_load_splat.wast","passed":12,"failed":114},{"name":"simd_load_zero.wast","passed":10,"failed":29},{"name":"simd_splat.wast","passed":23,"failed":162},{"name":"simd_store.wast","passed":9,"failed":19},{"name":"simd_store16_lane.wast","passed":3,"failed":33},{"name":"simd_store32_lane.wast","passed":3,"failed":21},{"name":"simd_store64_lane.wast","passed":3,"failed":13},{"name":"simd_store8_lane.wast","passed":3,"failed":49}]
-0.9.0-alpha.0,1702,24277,[{"name":"simd_address.wast","passed":7,"failed":42},{"name":"simd_align.wast","passed":92,"failed":8},{"name":"simd_bit_shift.wast","passed":41,"failed":211},{"name":"simd_bitwise.wast","passed":30,"failed":139},{"name":"simd_boolean.wast","passed":18,"failed":259},{"name":"simd_const.wast","passed":551,"failed":206},{"name":"simd_conversions.wast","passed":50,"failed":232},{"name":"simd_f32x4.wast","passed":18,"failed":772},{"name":"simd_f32x4_arith.wast","passed":19,"failed":1803},{"name":"simd_f32x4_cmp.wast","passed":26,"failed":2581},{"name":"simd_f32x4_pmin_pmax.wast","passed":15,"failed":3872},{"name":"simd_f32x4_rounding.wast","passed":25,"failed":176},{"name":"simd_f64x2.wast","passed":10,"failed":793},{"name":"simd_f64x2_arith.wast","passed":19,"failed":1806},{"name":"simd_f64x2_cmp.wast","passed":26,"failed":2659},{"name":"simd_f64x2_pmin_pmax.wast","passed":15,"failed":3872},{"name":"simd_f64x2_rounding.wast","passed":25,"failed":176},{"name":"simd_i16x8_arith.wast","passed":13,"failed":181},{"name":"simd_i16x8_arith2.wast","passed":21,"failed":151},{"name":"simd_i16x8_cmp.wast","passed":32,"failed":433},{"name":"simd_i16x8_extadd_pairwise_i8x16.wast","passed":5,"failed":16},{"name":"simd_i16x8_extmul_i8x16.wast","passed":13,"failed":104},{"name":"simd_i16x8_q15mulr_sat_s.wast","passed":4,"failed":26},{"name":"simd_i16x8_sat_arith.wast","passed":18,"failed":204},{"name":"simd_i32x4_arith.wast","passed":13,"failed":181},{"name":"simd_i32x4_arith2.wast","passed":28,"failed":121},{"name":"simd_i32x4_cmp.wast","passed":42,"failed":433},{"name":"simd_i32x4_dot_i16x8.wast","passed":4,"failed":26},{"name":"simd_i32x4_extadd_pairwise_i16x8.wast","passed":5,"failed":16},{"name":"simd_i32x4_extmul_i16x8.wast","passed":13,"failed":104},{"name":"simd_i32x4_trunc_sat_f32x4.wast","passed":5,"failed":102},{"name":"simd_i32x4_trunc_sat_f64x2.wast","passed":5,"failed":102},{"name":"simd_i64x2_arith.wast","passed":13,"failed":187},{"name":"simd_i64x2_arith2.wast","passed":4,"failed":21},{"name":"simd_i64x2_cmp.wast","passed":11,"failed":102},{"name":"simd_i64x2_extmul_i32x4.wast","passed":13,"failed":104},{"name":"simd_i8x16_arith.wast","passed":10,"failed":121},{"name":"simd_i8x16_arith2.wast","passed":27,"failed":184},{"name":"simd_i8x16_cmp.wast","passed":32,"failed":413},{"name":"simd_i8x16_sat_arith.wast","passed":26,"failed":188},{"name":"simd_int_to_int_extend.wast","passed":25,"failed":228},{"name":"simd_lane.wast","passed":200,"failed":275},{"name":"simd_linking.wast","passed":0,"failed":3},{"name":"simd_load.wast","passed":22,"failed":17},{"name":"simd_load16_lane.wast","passed":4,"failed":32},{"name":"simd_load32_lane.wast","passed":4,"failed":20},{"name":"simd_load64_lane.wast","passed":4,"failed":12},{"name":"simd_load8_lane.wast","passed":4,"failed":48},{"name":"simd_load_extend.wast","passed":20,"failed":84},{"name":"simd_load_splat.wast","passed":14,"failed":112},{"name":"simd_load_zero.wast","passed":12,"failed":27},{"name":"simd_splat.wast","passed":26,"failed":159},{"name":"simd_store.wast","passed":11,"failed":17},{"name":"simd_store16_lane.wast","passed":3,"failed":33},{"name":"simd_store32_lane.wast","passed":3,"failed":21},{"name":"simd_store64_lane.wast","passed":3,"failed":13},{"name":"simd_store8_lane.wast","passed":3,"failed":49}]
+0.9.0-alpha.0,1741,24238,[{"name":"simd_address.wast","passed":7,"failed":42},{"name":"simd_align.wast","passed":93,"failed":7},{"name":"simd_bit_shift.wast","passed":41,"failed":211},{"name":"simd_bitwise.wast","passed":30,"failed":139},{"name":"simd_boolean.wast","passed":18,"failed":259},{"name":"simd_const.wast","passed":551,"failed":206},{"name":"simd_conversions.wast","passed":50,"failed":232},{"name":"simd_f32x4.wast","passed":18,"failed":772},{"name":"simd_f32x4_arith.wast","passed":19,"failed":1803},{"name":"simd_f32x4_cmp.wast","passed":26,"failed":2581},{"name":"simd_f32x4_pmin_pmax.wast","passed":15,"failed":3872},{"name":"simd_f32x4_rounding.wast","passed":25,"failed":176},{"name":"simd_f64x2.wast","passed":10,"failed":793},{"name":"simd_f64x2_arith.wast","passed":19,"failed":1806},{"name":"simd_f64x2_cmp.wast","passed":26,"failed":2659},{"name":"simd_f64x2_pmin_pmax.wast","passed":15,"failed":3872},{"name":"simd_f64x2_rounding.wast","passed":25,"failed":176},{"name":"simd_i16x8_arith.wast","passed":13,"failed":181},{"name":"simd_i16x8_arith2.wast","passed":21,"failed":151},{"name":"simd_i16x8_cmp.wast","passed":32,"failed":433},{"name":"simd_i16x8_extadd_pairwise_i8x16.wast","passed":5,"failed":16},{"name":"simd_i16x8_extmul_i8x16.wast","passed":13,"failed":104},{"name":"simd_i16x8_q15mulr_sat_s.wast","passed":4,"failed":26},{"name":"simd_i16x8_sat_arith.wast","passed":18,"failed":204},{"name":"simd_i32x4_arith.wast","passed":13,"failed":181},{"name":"simd_i32x4_arith2.wast","passed":28,"failed":121},{"name":"simd_i32x4_cmp.wast","passed":42,"failed":433},{"name":"simd_i32x4_dot_i16x8.wast","passed":4,"failed":26},{"name":"simd_i32x4_extadd_pairwise_i16x8.wast","passed":5,"failed":16},{"name":"simd_i32x4_extmul_i16x8.wast","passed":13,"failed":104},{"name":"simd_i32x4_trunc_sat_f32x4.wast","passed":5,"failed":102},{"name":"simd_i32x4_trunc_sat_f64x2.wast","passed":5,"failed":102},{"name":"simd_i64x2_arith.wast","passed":13,"failed":187},{"name":"simd_i64x2_arith2.wast","passed":4,"failed":21},{"name":"simd_i64x2_cmp.wast","passed":11,"failed":102},{"name":"simd_i64x2_extmul_i32x4.wast","passed":13,"failed":104},{"name":"simd_i8x16_arith.wast","passed":10,"failed":121},{"name":"simd_i8x16_arith2.wast","passed":27,"failed":184},{"name":"simd_i8x16_cmp.wast","passed":32,"failed":413},{"name":"simd_i8x16_sat_arith.wast","passed":26,"failed":188},{"name":"simd_int_to_int_extend.wast","passed":25,"failed":228},{"name":"simd_lane.wast","passed":209,"failed":266},{"name":"simd_linking.wast","passed":0,"failed":3},{"name":"simd_load.wast","passed":24,"failed":15},{"name":"simd_load16_lane.wast","passed":4,"failed":32},{"name":"simd_load32_lane.wast","passed":4,"failed":20},{"name":"simd_load64_lane.wast","passed":4,"failed":12},{"name":"simd_load8_lane.wast","passed":4,"failed":48},{"name":"simd_load_extend.wast","passed":24,"failed":80},{"name":"simd_load_splat.wast","passed":17,"failed":109},{"name":"simd_load_zero.wast","passed":12,"failed":27},{"name":"simd_splat.wast","passed":37,"failed":148},{"name":"simd_store.wast","passed":20,"failed":8},{"name":"simd_store16_lane.wast","passed":3,"failed":33},{"name":"simd_store32_lane.wast","passed":3,"failed":21},{"name":"simd_store64_lane.wast","passed":3,"failed":13},{"name":"simd_store8_lane.wast","passed":3,"failed":49}]
diff --git a/crates/tinywasm/tests/testsuite/util.rs b/crates/tinywasm/tests/testsuite/util.rs
index 53eb5ff..a66a4da 100644
--- a/crates/tinywasm/tests/testsuite/util.rs
+++ b/crates/tinywasm/tests/testsuite/util.rs
@@ -46,7 +46,7 @@ pub fn exec_fn(
instance.exported_func_untyped(&store, name)?.call(&mut store, args)
}
-pub fn catch_unwind_silent<F: FnOnce() -> R, R>(f: F) -> std::thread::Result<R> {
+pub fn catch_unwind_silent<R>(f: impl FnOnce() -> R) -> std::thread::Result<R> {
let prev_hook = panic::take_hook();
panic::set_hook(Box::new(|_| {}));
let result = panic::catch_unwind(AssertUnwindSafe(f));
diff --git a/crates/types/src/instructions.rs b/crates/types/src/instructions.rs
index 1edfef7..fb3c1cc 100644
--- a/crates/types/src/instructions.rs
+++ b/crates/types/src/instructions.rs
@@ -52,7 +52,7 @@ pub enum ConstInstruction {
/// This makes it easier to implement the label stack iteratively.
///
/// See <https://webassembly.github.io/spec/core/binary/instructions.html>
-#[derive(Debug, Clone, PartialEq)]
+#[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "archive", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))]
// should be kept as small as possible (16 bytes max)
#[rustfmt::skip]
@@ -193,10 +193,10 @@ impl From<SimdInstruction> for Instruction {
}
}
-#[derive(Debug, Clone, PartialEq)]
+#[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "archive", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))]
#[rustfmt::skip]
-pub enum SimdInstruction {
+pub enum SimdInstruction {
V128Load(MemoryArg),
V128Load8x8S(MemoryArg), V128Load8x8U(MemoryArg),
V128Load16x4S(MemoryArg), V128Load16x4U(MemoryArg),
@@ -204,7 +204,7 @@ pub enum SimdInstruction {
V128Load8Splat(MemoryArg), V128Load16Splat(MemoryArg), V128Load32Splat(MemoryArg), V128Load64Splat(MemoryArg),
V128Load8Lane(MemoryArg, u8), V128Load16Lane(MemoryArg, u8), V128Load32Lane(MemoryArg, u8), V128Load64Lane(MemoryArg, u8),
-
+
V128Load32Zero(MemoryArg), V128Load64Zero(MemoryArg),
V128Store(MemoryArg), V128Store8Lane(MemoryArg, u8), V128Store16Lane(MemoryArg, u8), V128Store32Lane(MemoryArg, u8), V128Store64Lane(MemoryArg, u8),