summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/tinywasm/src/interpreter/num_helpers.rs23
-rw-r--r--crates/tinywasm/src/interpreter/value128.rs260
-rw-r--r--crates/tinywasm/tests/generated/wasm-annotations.csv2
-rw-r--r--crates/tinywasm/tests/generated/wasm-memory64.csv2
-rw-r--r--crates/tinywasm/tests/generated/wasm-multi-memory.csv2
-rw-r--r--crates/tinywasm/tests/test-wasm-annotations.rs1
-rw-r--r--crates/tinywasm/tests/test-wasm-multi-memory.rs1
-rw-r--r--examples/rust/src/tinywasm.rs2
-rw-r--r--examples/rust/src/tinywasm_no_std.rs2
9 files changed, 149 insertions, 146 deletions
diff --git a/crates/tinywasm/src/interpreter/num_helpers.rs b/crates/tinywasm/src/interpreter/num_helpers.rs
index 5b9e7b9..12d3022 100644
--- a/crates/tinywasm/src/interpreter/num_helpers.rs
+++ b/crates/tinywasm/src/interpreter/num_helpers.rs
@@ -9,20 +9,17 @@ where
/// Doing the actual conversion from float to int is a bit tricky, because
/// we need to check for overflow. This macro generates the min/max values
/// for a specific conversion, which are then used in the actual conversion.
-/// Rust sadly doesn't have wrapping casts for floats yet, maybe never.
-/// Alternatively, <https://crates.io/crates/az> could be used for this but
-/// it's not worth the dependency.
-#[rustfmt::skip]
+/// Rust sadly doesn't have wrapping casts for floats yet.
+#[rustfmt::skip]
macro_rules! float_min_max {
- (f32, i32) => {(-2147483904.0_f32, 2147483648.0_f32)};
- (f64, i32) => {(-2147483649.0_f64, 2147483648.0_f64)};
- (f32, u32) => {(-1.0_f32, 4294967296.0_f32)}; // 2^32
- (f64, u32) => {(-1.0_f64, 4294967296.0_f64)}; // 2^32
- (f32, i64) => {(-9223373136366403584.0_f32, 9223372036854775808.0_f32)}; // 2^63 + 2^40 | 2^63
- (f64, i64) => {(-9223372036854777856.0_f64, 9223372036854775808.0_f64)}; // 2^63 + 2^40 | 2^63
- (f32, u64) => {(-1.0_f32, 18446744073709551616.0_f32)}; // 2^64
- (f64, u64) => {(-1.0_f64, 18446744073709551616.0_f64)}; // 2^64
- // other conversions are not allowed
+ (f32, i32) => {(i32::MIN as f32 - (1 << 8) as f32, i32::MAX as f32 + 1.0)}; // 2^8: f32 precision margin
+ (f64, i32) => {(i32::MIN as f64 - 1.0, i32::MAX as f64 + 1.0)};
+ (f32, u32) => {(-1.0_f32, u32::MAX as f32 + 1.0)};
+ (f64, u32) => {(-1.0_f64, u32::MAX as f64 + 1.0)};
+ (f32, i64) => {(i64::MIN as f32 - (1i64 << 40) as f32, i64::MAX as f32 + 1.0)}; // 2^40: f32 has 23 mantissa bits
+ (f64, i64) => {(i64::MIN as f64 - (1i64 << 11) as f64, i64::MAX as f64 + 1.0)}; // 2^11: f64 precision margin
+ (f32, u64) => {(-1.0_f32, u64::MAX as f32 + 1.0)};
+ (f64, u64) => {(-1.0_f64, u64::MAX as f64 + 1.0)};
($from:ty, $to:ty) => {compile_error!("invalid float conversion")};
}
diff --git a/crates/tinywasm/src/interpreter/value128.rs b/crates/tinywasm/src/interpreter/value128.rs
index 60e709c..e2fa448 100644
--- a/crates/tinywasm/src/interpreter/value128.rs
+++ b/crates/tinywasm/src/interpreter/value128.rs
@@ -1,90 +1,12 @@
use super::num_helpers::TinywasmFloatExt;
+#[cfg(not(feature = "std"))]
+use super::no_std_floats::NoStdFloatExt;
+
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
pub struct Value128(i128);
impl Value128 {
- #[inline]
- fn canonicalize_simd_f32_nan(x: f32) -> f32 {
- #[cfg(feature = "canonicalize_nans")]
- if x.is_nan() {
- f32::NAN
- } else {
- x
- }
- #[cfg(not(feature = "canonicalize_nans"))]
- x
- }
-
- #[inline]
- fn canonicalize_simd_f64_nan(x: f64) -> f64 {
- #[cfg(feature = "canonicalize_nans")]
- if x.is_nan() {
- f64::NAN
- } else {
- x
- }
- #[cfg(not(feature = "canonicalize_nans"))]
- x
- }
-
- const fn saturate_i16_to_i8(x: i16) -> i8 {
- if x > i8::MAX as i16 {
- i8::MAX
- } else if x < i8::MIN as i16 {
- i8::MIN
- } else {
- x as i8
- }
- }
-
- const fn saturate_i16_to_u8(x: i16) -> u8 {
- if x <= 0 {
- 0
- } else if x > u8::MAX as i16 {
- u8::MAX
- } else {
- x as u8
- }
- }
-
- const fn saturate_i32_to_i16(x: i32) -> i16 {
- if x > i16::MAX as i32 {
- i16::MAX
- } else if x < i16::MIN as i32 {
- i16::MIN
- } else {
- x as i16
- }
- }
-
- const fn saturate_i32_to_u16(x: i32) -> u16 {
- if x <= 0 {
- 0
- } else if x > u16::MAX as i32 {
- u16::MAX
- } else {
- x as u16
- }
- }
-
- const fn replace_lane_bytes<const LANE_BYTES: usize>(
- self,
- lane: u8,
- value: [u8; LANE_BYTES],
- lane_count: u8,
- ) -> Self {
- debug_assert!(lane < lane_count);
- let mut bytes = self.to_le_bytes();
- let mut i = 0;
- let start = lane as usize * LANE_BYTES;
- while i < LANE_BYTES {
- bytes[start + i] = value[i];
- i += 1;
- }
- Self::from_le_bytes(bytes)
- }
-
pub const fn from_le_bytes(bytes: [u8; 16]) -> Self {
Self(i128::from_le_bytes(bytes))
}
@@ -228,6 +150,7 @@ impl Value128 {
Self::from_f64x2([op(a[0], b[0]), op(a[1], b[1])])
}
+ #[inline]
pub const fn reduce_or(self) -> u8 {
let mut result = 0u8;
let bytes = self.to_le_bytes();
@@ -1045,8 +968,8 @@ impl Value128 {
let mut out = [0i8; 16];
let mut i = 0;
while i < 8 {
- out[i] = Self::saturate_i16_to_i8(av[i]);
- out[i + 8] = Self::saturate_i16_to_i8(bv[i]);
+ out[i] = saturate_i16_to_i8(av[i]);
+ out[i + 8] = saturate_i16_to_i8(bv[i]);
i += 1;
}
Self::from_i8x16(out)
@@ -1059,8 +982,8 @@ impl Value128 {
let mut out = [0u8; 16];
let mut i = 0;
while i < 8 {
- out[i] = Self::saturate_i16_to_u8(av[i]);
- out[i + 8] = Self::saturate_i16_to_u8(bv[i]);
+ out[i] = saturate_i16_to_u8(av[i]);
+ out[i + 8] = saturate_i16_to_u8(bv[i]);
i += 1;
}
Self::from_u8x16(out)
@@ -1073,8 +996,8 @@ impl Value128 {
let mut out = [0i16; 8];
let mut i = 0;
while i < 4 {
- out[i] = Self::saturate_i32_to_i16(av[i]);
- out[i + 4] = Self::saturate_i32_to_i16(bv[i]);
+ out[i] = saturate_i32_to_i16(av[i]);
+ out[i + 4] = saturate_i32_to_i16(bv[i]);
i += 1;
}
Self::from_i16x8(out)
@@ -1087,8 +1010,8 @@ impl Value128 {
let mut out = [0u16; 8];
let mut i = 0;
while i < 4 {
- out[i] = Self::saturate_i32_to_u16(av[i]);
- out[i + 4] = Self::saturate_i32_to_u16(bv[i]);
+ out[i] = saturate_i32_to_u16(av[i]);
+ out[i + 4] = saturate_i32_to_u16(bv[i]);
i += 1;
}
Self::from_u16x8(out)
@@ -1417,7 +1340,7 @@ impl Value128 {
let mut out = [0i16; 8];
let mut i = 0;
while i < 8 {
- let r = ((a[i] as i32 * b[i] as i32) + 0x4000) >> 15;
+ let r = ((a[i] as i32 * b[i] as i32) + (1 << 14)) >> 15; // 2^14: Q15 rounding
out[i] = if r > i16::MAX as i32 {
i16::MAX
} else if r < i16::MIN as i32 {
@@ -2051,7 +1974,7 @@ impl Value128 {
}
#[doc(alias = "f32x4.eq")]
- pub fn f32x4_eq(self, rhs: Self) -> Self {
+ pub const fn f32x4_eq(self, rhs: Self) -> Self {
let a = self.as_f32x4();
let b = rhs.as_f32x4();
let mut out = [0i32; 4];
@@ -2064,7 +1987,7 @@ impl Value128 {
}
#[doc(alias = "f64x2.eq")]
- pub fn f64x2_eq(self, rhs: Self) -> Self {
+ pub const fn f64x2_eq(self, rhs: Self) -> Self {
let a = self.as_f64x2();
let b = rhs.as_f64x2();
let mut out = [0i64; 2];
@@ -2077,7 +2000,7 @@ impl Value128 {
}
#[doc(alias = "f32x4.ne")]
- pub fn f32x4_ne(self, rhs: Self) -> Self {
+ pub const fn f32x4_ne(self, rhs: Self) -> Self {
let a = self.as_f32x4();
let b = rhs.as_f32x4();
let mut out = [0i32; 4];
@@ -2090,7 +2013,7 @@ impl Value128 {
}
#[doc(alias = "f64x2.ne")]
- pub fn f64x2_ne(self, rhs: Self) -> Self {
+ pub const fn f64x2_ne(self, rhs: Self) -> Self {
let a = self.as_f64x2();
let b = rhs.as_f64x2();
let mut out = [0i64; 2];
@@ -2103,7 +2026,7 @@ impl Value128 {
}
#[doc(alias = "f32x4.lt")]
- pub fn f32x4_lt(self, rhs: Self) -> Self {
+ pub const fn f32x4_lt(self, rhs: Self) -> Self {
let a = self.as_f32x4();
let b = rhs.as_f32x4();
let mut out = [0i32; 4];
@@ -2116,7 +2039,7 @@ impl Value128 {
}
#[doc(alias = "f64x2.lt")]
- pub fn f64x2_lt(self, rhs: Self) -> Self {
+ pub const fn f64x2_lt(self, rhs: Self) -> Self {
let a = self.as_f64x2();
let b = rhs.as_f64x2();
let mut out = [0i64; 2];
@@ -2129,17 +2052,17 @@ impl Value128 {
}
#[doc(alias = "f32x4.gt")]
- pub fn f32x4_gt(self, rhs: Self) -> Self {
+ pub const fn f32x4_gt(self, rhs: Self) -> Self {
rhs.f32x4_lt(self)
}
#[doc(alias = "f64x2.gt")]
- pub fn f64x2_gt(self, rhs: Self) -> Self {
+ pub const fn f64x2_gt(self, rhs: Self) -> Self {
rhs.f64x2_lt(self)
}
#[doc(alias = "f32x4.le")]
- pub fn f32x4_le(self, rhs: Self) -> Self {
+ pub const fn f32x4_le(self, rhs: Self) -> Self {
let a = self.as_f32x4();
let b = rhs.as_f32x4();
let mut out = [0i32; 4];
@@ -2152,7 +2075,7 @@ impl Value128 {
}
#[doc(alias = "f64x2.le")]
- pub fn f64x2_le(self, rhs: Self) -> Self {
+ pub const fn f64x2_le(self, rhs: Self) -> Self {
let a = self.as_f64x2();
let b = rhs.as_f64x2();
let mut out = [0i64; 2];
@@ -2165,7 +2088,7 @@ impl Value128 {
}
#[doc(alias = "f32x4.ge")]
- pub fn f32x4_ge(self, rhs: Self) -> Self {
+ pub const fn f32x4_ge(self, rhs: Self) -> Self {
let a = self.as_f32x4();
let b = rhs.as_f32x4();
let mut out = [0i32; 4];
@@ -2178,7 +2101,7 @@ impl Value128 {
}
#[doc(alias = "f64x2.ge")]
- pub fn f64x2_ge(self, rhs: Self) -> Self {
+ pub const fn f64x2_ge(self, rhs: Self) -> Self {
let a = self.as_f64x2();
let b = rhs.as_f64x2();
let mut out = [0i64; 2];
@@ -2192,42 +2115,42 @@ impl Value128 {
#[doc(alias = "f32x4.ceil")]
pub fn f32x4_ceil(self) -> Self {
- self.map_f32x4(|x| Self::canonicalize_simd_f32_nan(x.ceil()))
+ self.map_f32x4(|x| canonicalize_simd_f32_nan(x.ceil()))
}
#[doc(alias = "f64x2.ceil")]
pub fn f64x2_ceil(self) -> Self {
- self.map_f64x2(|x| Self::canonicalize_simd_f64_nan(x.ceil()))
+ self.map_f64x2(|x| canonicalize_simd_f64_nan(x.ceil()))
}
#[doc(alias = "f32x4.floor")]
pub fn f32x4_floor(self) -> Self {
- self.map_f32x4(|x| Self::canonicalize_simd_f32_nan(x.floor()))
+ self.map_f32x4(|x| canonicalize_simd_f32_nan(x.floor()))
}
#[doc(alias = "f64x2.floor")]
pub fn f64x2_floor(self) -> Self {
- self.map_f64x2(|x| Self::canonicalize_simd_f64_nan(x.floor()))
+ self.map_f64x2(|x| canonicalize_simd_f64_nan(x.floor()))
}
#[doc(alias = "f32x4.trunc")]
pub fn f32x4_trunc(self) -> Self {
- self.map_f32x4(|x| Self::canonicalize_simd_f32_nan(x.trunc()))
+ self.map_f32x4(|x| canonicalize_simd_f32_nan(x.trunc()))
}
#[doc(alias = "f64x2.trunc")]
pub fn f64x2_trunc(self) -> Self {
- self.map_f64x2(|x| Self::canonicalize_simd_f64_nan(x.trunc()))
+ self.map_f64x2(|x| canonicalize_simd_f64_nan(x.trunc()))
}
#[doc(alias = "f32x4.nearest")]
pub fn f32x4_nearest(self) -> Self {
- self.map_f32x4(|x| Self::canonicalize_simd_f32_nan(TinywasmFloatExt::tw_nearest(x)))
+ self.map_f32x4(|x| canonicalize_simd_f32_nan(TinywasmFloatExt::tw_nearest(x)))
}
#[doc(alias = "f64x2.nearest")]
pub fn f64x2_nearest(self) -> Self {
- self.map_f64x2(|x| Self::canonicalize_simd_f64_nan(TinywasmFloatExt::tw_nearest(x)))
+ self.map_f64x2(|x| canonicalize_simd_f64_nan(TinywasmFloatExt::tw_nearest(x)))
}
#[doc(alias = "f32x4.abs")]
@@ -2252,52 +2175,52 @@ impl Value128 {
#[doc(alias = "f32x4.sqrt")]
pub fn f32x4_sqrt(self) -> Self {
- self.map_f32x4(|x| Self::canonicalize_simd_f32_nan(x.sqrt()))
+ self.map_f32x4(|x| canonicalize_simd_f32_nan(x.sqrt()))
}
#[doc(alias = "f64x2.sqrt")]
pub fn f64x2_sqrt(self) -> Self {
- self.map_f64x2(|x| Self::canonicalize_simd_f64_nan(x.sqrt()))
+ self.map_f64x2(|x| canonicalize_simd_f64_nan(x.sqrt()))
}
#[doc(alias = "f32x4.add")]
pub fn f32x4_add(self, rhs: Self) -> Self {
- self.zip_f32x4(rhs, |a, b| Self::canonicalize_simd_f32_nan(a + b))
+ self.zip_f32x4(rhs, |a, b| canonicalize_simd_f32_nan(a + b))
}
#[doc(alias = "f64x2.add")]
pub fn f64x2_add(self, rhs: Self) -> Self {
- self.zip_f64x2(rhs, |a, b| Self::canonicalize_simd_f64_nan(a + b))
+ self.zip_f64x2(rhs, |a, b| canonicalize_simd_f64_nan(a + b))
}
#[doc(alias = "f32x4.sub")]
pub fn f32x4_sub(self, rhs: Self) -> Self {
- self.zip_f32x4(rhs, |a, b| Self::canonicalize_simd_f32_nan(a - b))
+ self.zip_f32x4(rhs, |a, b| canonicalize_simd_f32_nan(a - b))
}
#[doc(alias = "f64x2.sub")]
pub fn f64x2_sub(self, rhs: Self) -> Self {
- self.zip_f64x2(rhs, |a, b| Self::canonicalize_simd_f64_nan(a - b))
+ self.zip_f64x2(rhs, |a, b| canonicalize_simd_f64_nan(a - b))
}
#[doc(alias = "f32x4.mul")]
pub fn f32x4_mul(self, rhs: Self) -> Self {
- self.zip_f32x4(rhs, |a, b| Self::canonicalize_simd_f32_nan(a * b))
+ self.zip_f32x4(rhs, |a, b| canonicalize_simd_f32_nan(a * b))
}
#[doc(alias = "f64x2.mul")]
pub fn f64x2_mul(self, rhs: Self) -> Self {
- self.zip_f64x2(rhs, |a, b| Self::canonicalize_simd_f64_nan(a * b))
+ self.zip_f64x2(rhs, |a, b| canonicalize_simd_f64_nan(a * b))
}
#[doc(alias = "f32x4.div")]
pub fn f32x4_div(self, rhs: Self) -> Self {
- self.zip_f32x4(rhs, |a, b| Self::canonicalize_simd_f32_nan(a / b))
+ self.zip_f32x4(rhs, |a, b| canonicalize_simd_f32_nan(a / b))
}
#[doc(alias = "f64x2.div")]
pub fn f64x2_div(self, rhs: Self) -> Self {
- self.zip_f64x2(rhs, |a, b| Self::canonicalize_simd_f64_nan(a / b))
+ self.zip_f64x2(rhs, |a, b| canonicalize_simd_f64_nan(a / b))
}
#[doc(alias = "f32x4.min")]
@@ -2524,6 +2447,23 @@ impl Value128 {
pub const fn extract_lane_f64(self, lane: u8) -> f64 {
f64::from_bits(self.extract_lane_i64(lane) as u64)
}
+
+ const fn replace_lane_bytes<const LANE_BYTES: usize>(
+ self,
+ lane: u8,
+ value: [u8; LANE_BYTES],
+ lane_count: u8,
+ ) -> Self {
+ debug_assert!(lane < lane_count);
+ let mut bytes = self.to_le_bytes();
+ let mut i = 0;
+ let start = lane as usize * LANE_BYTES;
+ while i < LANE_BYTES {
+ bytes[start + i] = value[i];
+ i += 1;
+ }
+ Self::from_le_bytes(bytes)
+ }
}
impl From<Value128> for i128 {
@@ -2567,12 +2507,80 @@ impl core::ops::BitXor for Value128 {
}
#[inline]
+const fn canonicalize_simd_f32_nan(x: f32) -> f32 {
+ #[cfg(feature = "canonicalize_nans")]
+ if x.is_nan() {
+ f32::NAN
+ } else {
+ x
+ }
+ #[cfg(not(feature = "canonicalize_nans"))]
+ x
+}
+
+#[inline]
+const fn canonicalize_simd_f64_nan(x: f64) -> f64 {
+ #[cfg(feature = "canonicalize_nans")]
+ if x.is_nan() {
+ f64::NAN
+ } else {
+ x
+ }
+ #[cfg(not(feature = "canonicalize_nans"))]
+ x
+}
+
+#[inline]
+const fn saturate_i16_to_i8(x: i16) -> i8 {
+ if x > i8::MAX as i16 {
+ i8::MAX
+ } else if x < i8::MIN as i16 {
+ i8::MIN
+ } else {
+ x as i8
+ }
+}
+
+#[inline]
+const fn saturate_i16_to_u8(x: i16) -> u8 {
+ if x <= 0 {
+ 0
+ } else if x > u8::MAX as i16 {
+ u8::MAX
+ } else {
+ x as u8
+ }
+}
+
+#[inline]
+const fn saturate_i32_to_i16(x: i32) -> i16 {
+ if x > i16::MAX as i32 {
+ i16::MAX
+ } else if x < i16::MIN as i32 {
+ i16::MIN
+ } else {
+ x as i16
+ }
+}
+
+#[inline]
+const fn saturate_i32_to_u16(x: i32) -> u16 {
+ if x <= 0 {
+ 0
+ } else if x > u16::MAX as i32 {
+ u16::MAX
+ } else {
+ x as u16
+ }
+}
+
+#[inline]
fn trunc_sat_f32_to_i32(v: f32) -> i32 {
if v.is_nan() {
0
- } else if v <= -2147483904.0_f32 {
+ } else if v <= i32::MIN as f32 - (1 << 8) as f32 {
i32::MIN
- } else if v >= 2147483648.0_f32 {
+ } else if v >= (i32::MAX as f32 + 1.0) {
i32::MAX
} else {
v.trunc() as i32
@@ -2583,7 +2591,7 @@ fn trunc_sat_f32_to_i32(v: f32) -> i32 {
fn trunc_sat_f32_to_u32(v: f32) -> u32 {
if v.is_nan() || v <= -1.0_f32 {
0
- } else if v >= 4294967296.0_f32 {
+ } else if v >= (u32::MAX as f32 + 1.0) {
u32::MAX
} else {
v.trunc() as u32
@@ -2594,9 +2602,9 @@ fn trunc_sat_f32_to_u32(v: f32) -> u32 {
fn trunc_sat_f64_to_i32(v: f64) -> i32 {
if v.is_nan() {
0
- } else if v <= -2147483649.0_f64 {
+ } else if v <= i32::MIN as f64 - 1.0_f64 {
i32::MIN
- } else if v >= 2147483648.0_f64 {
+ } else if v >= (i32::MAX as f64 + 1.0) {
i32::MAX
} else {
v.trunc() as i32
@@ -2607,7 +2615,7 @@ fn trunc_sat_f64_to_i32(v: f64) -> i32 {
fn trunc_sat_f64_to_u32(v: f64) -> u32 {
if v.is_nan() || v <= -1.0_f64 {
0
- } else if v >= 4294967296.0_f64 {
+ } else if v >= (u32::MAX as f64 + 1.0) {
u32::MAX
} else {
v.trunc() as u32
diff --git a/crates/tinywasm/tests/generated/wasm-annotations.csv b/crates/tinywasm/tests/generated/wasm-annotations.csv
index 1b99033..b1bfe45 100644
--- a/crates/tinywasm/tests/generated/wasm-annotations.csv
+++ b/crates/tinywasm/tests/generated/wasm-annotations.csv
@@ -1,2 +1,2 @@
0.8.0,142,0,[{"name":"annotations.wast","passed":74,"failed":0},{"name":"annotations/simd_lane.wast (skipped)","passed":0,"failed":0},{"name":"id.wast","passed":7,"failed":0},{"name":"token.wast","passed":61,"failed":0}]
-0.9.0-alpha.0,142,0,[{"name":"annotations.wast","passed":74,"failed":0},{"name":"id.wast","passed":7,"failed":0},{"name":"simd_lane.wast (skipped)","passed":0,"failed":0},{"name":"token.wast","passed":61,"failed":0}]
+0.9.0-alpha.0,617,0,[{"name":"annotations.wast","passed":74,"failed":0},{"name":"id.wast","passed":7,"failed":0},{"name":"simd_lane.wast","passed":475,"failed":0},{"name":"token.wast","passed":61,"failed":0}]
diff --git a/crates/tinywasm/tests/generated/wasm-memory64.csv b/crates/tinywasm/tests/generated/wasm-memory64.csv
index 039fe8c..20afc3b 100644
--- a/crates/tinywasm/tests/generated/wasm-memory64.csv
+++ b/crates/tinywasm/tests/generated/wasm-memory64.csv
@@ -1,2 +1,2 @@
0.8.0,15081,3214,[{"name":"address.wast","passed":260,"failed":0},{"name":"address0.wast","passed":92,"failed":0},{"name":"address1.wast","passed":127,"failed":0},{"name":"address64.wast","passed":0,"failed":242},{"name":"align.wast","passed":161,"failed":0},{"name":"align0.wast","passed":5,"failed":0},{"name":"align64.wast","passed":83,"failed":73},{"name":"annotations.wast","passed":74,"failed":0},{"name":"array_copy.wast","passed":4,"failed":31},{"name":"array_fill.wast","passed":3,"failed":14},{"name":"array_init_data.wast","passed":2,"failed":31},{"name":"array_init_elem.wast","passed":3,"failed":20},{"name":"binary-gc.wast","passed":1,"failed":0},{"name":"binary-leb128.wast","passed":92,"failed":1},{"name":"binary.wast","passed":124,"failed":0},{"name":"binary0.wast","passed":7,"failed":0},{"name":"br_if.wast","passed":119,"failed":0},{"name":"br_on_cast.wast","passed":6,"failed":31},{"name":"br_on_cast_fail.wast","passed":6,"failed":31},{"name":"br_on_non_null.wast","passed":1,"failed":9},{"name":"br_on_null.wast","passed":1,"failed":9},{"name":"br_table.wast","passed":24,"failed":162},{"name":"call_indirect.wast","passed":47,"failed":124},{"name":"call_ref.wast","passed":4,"failed":31},{"name":"data.wast","passed":59,"failed":6},{"name":"data0.wast","passed":7,"failed":0},{"name":"data1.wast","passed":14,"failed":0},{"name":"data_drop0.wast","passed":11,"failed":0},{"name":"elem.wast","passed":137,"failed":14},{"name":"endianness64.wast","passed":0,"failed":69},{"name":"exports.wast","passed":97,"failed":0},{"name":"exports0.wast","passed":8,"failed":0},{"name":"float_exprs0.wast","passed":14,"failed":0},{"name":"float_exprs1.wast","passed":3,"failed":0},{"name":"float_memory0.wast","passed":30,"failed":0},{"name":"float_memory64.wast","passed":0,"failed":90},{"name":"func.wast","passed":175,"failed":0},{"name":"id.wast","passed":7,"failed":0},{"name":"if.wast","passed":241,"failed":0},{"name":"imports.wast","passed":99,"failed":82},{"name":"imports0.wast","passed":8,"failed":0},{"name":"imports1.wast","passed":5,"failed":0},{"name":"imports2.wast","passed":20,"failed":0},{"name":"imports3.wast","passed":10,"failed":0},{"name":"imports4.wast","passed":16,"failed":0},{"name":"linking.wast","passed":122,"failed":41},{"name":"linking0.wast","passed":6,"failed":0},{"name":"linking1.wast","passed":14,"failed":0},{"name":"linking2.wast","passed":11,"failed":0},{"name":"linking3.wast","passed":14,"failed":0},{"name":"load.wast","passed":118,"failed":0},{"name":"load0.wast","passed":3,"failed":0},{"name":"load1.wast","passed":18,"failed":0},{"name":"load2.wast","passed":38,"failed":0},{"name":"load64.wast","passed":59,"failed":38},{"name":"local_get.wast","passed":36,"failed":0},{"name":"local_init.wast","passed":10,"failed":0},{"name":"local_tee.wast","passed":98,"failed":0},{"name":"memory-multi.wast","passed":6,"failed":0},{"name":"memory.wast","passed":86,"failed":0},{"name":"memory64.wast","passed":10,"failed":53},{"name":"memory64/array.wast (skipped)","passed":0,"failed":0},{"name":"memory64/extern.wast (skipped)","passed":0,"failed":0},{"name":"memory64/global.wast (skipped)","passed":0,"failed":0},{"name":"memory64/i31.wast (skipped)","passed":0,"failed":0},{"name":"memory64/ref_null.wast (skipped)","passed":0,"failed":0},{"name":"memory64/select.wast (skipped)","passed":0,"failed":0},{"name":"memory64/simd_address.wast (skipped)","passed":0,"failed":0},{"name":"memory64/simd_lane.wast (skipped)","passed":0,"failed":0},{"name":"memory64/struct.wast (skipped)","passed":0,"failed":0},{"name":"memory64/table.wast (skipped)","passed":0,"failed":0},{"name":"memory_copy.wast","passed":8385,"failed":515},{"name":"memory_copy0.wast","passed":29,"failed":0},{"name":"memory_copy1.wast","passed":14,"failed":0},{"name":"memory_fill.wast","passed":164,"failed":36},{"name":"memory_fill0.wast","passed":16,"failed":0},{"name":"memory_grow.wast","passed":157,"failed":0},{"name":"memory_grow64.wast","passed":0,"failed":49},{"name":"memory_init.wast","passed":307,"failed":173},{"name":"memory_init0.wast","passed":13,"failed":0},{"name":"memory_redundancy64.wast","passed":0,"failed":8},{"name":"memory_size.wast","passed":49,"failed":0},{"name":"memory_size0.wast","passed":8,"failed":0},{"name":"memory_size1.wast","passed":15,"failed":0},{"name":"memory_size2.wast","passed":21,"failed":0},{"name":"memory_size3.wast","passed":2,"failed":0},{"name":"memory_trap0.wast","passed":14,"failed":0},{"name":"memory_trap1.wast","passed":168,"failed":0},{"name":"memory_trap64.wast","passed":0,"failed":172},{"name":"ref.wast","passed":12,"failed":1},{"name":"ref_as_non_null.wast","passed":1,"failed":6},{"name":"ref_cast.wast","passed":0,"failed":45},{"name":"ref_eq.wast","passed":6,"failed":83},{"name":"ref_is_null.wast","passed":2,"failed":20},{"name":"ref_test.wast","passed":0,"failed":71},{"name":"return_call.wast","passed":18,"failed":27},{"name":"return_call_indirect.wast","passed":31,"failed":45},{"name":"return_call_ref.wast","passed":11,"failed":40},{"name":"simd_memory-multi.wast","passed":0,"failed":1},{"name":"start0.wast","passed":9,"failed":0},{"name":"store.wast","passed":111,"failed":0},{"name":"store0.wast","passed":5,"failed":0},{"name":"store1.wast","passed":13,"failed":0},{"name":"table-sub.wast","passed":2,"failed":1},{"name":"table_copy.wast","passed":1742,"failed":30},{"name":"table_copy_mixed.wast","passed":3,"failed":1},{"name":"table_fill.wast","passed":9,"failed":71},{"name":"table_get.wast","passed":5,"failed":12},{"name":"table_grow.wast","passed":36,"failed":43},{"name":"table_init.wast","passed":588,"failed":288},{"name":"table_set.wast","passed":7,"failed":21},{"name":"table_size.wast","passed":2,"failed":38},{"name":"tag.wast","passed":1,"failed":8},{"name":"throw.wast","passed":3,"failed":10},{"name":"throw_ref.wast","passed":2,"failed":13},{"name":"token.wast","passed":61,"failed":0},{"name":"traps0.wast","passed":15,"failed":0},{"name":"try_table.wast","passed":11,"failed":51},{"name":"type-canon.wast","passed":0,"failed":2},{"name":"type-equivalence.wast","passed":12,"failed":20},{"name":"type-rec.wast","passed":6,"failed":14},{"name":"type-subtyping.wast","passed":16,"failed":86},{"name":"unreached-invalid.wast","passed":121,"failed":0},{"name":"unreached-valid.wast","passed":2,"failed":11}]
-0.9.0-alpha.0,1556,42,[{"name":"address.wast","passed":260,"failed":0},{"name":"address64.wast","passed":242,"failed":0},{"name":"align64.wast","passed":156,"failed":0},{"name":"binary-leb128.wast","passed":93,"failed":0},{"name":"binary.wast","passed":169,"failed":0},{"name":"endianness64.wast","passed":69,"failed":0},{"name":"float_memory64.wast","passed":90,"failed":0},{"name":"load64.wast","passed":97,"failed":0},{"name":"memory.wast","passed":79,"failed":0},{"name":"memory64.wast","passed":65,"failed":0},{"name":"memory_grow64.wast","passed":49,"failed":0},{"name":"memory_redundancy64.wast","passed":8,"failed":0},{"name":"memory_trap64.wast","passed":172,"failed":0},{"name":"simd_address.wast","passed":7,"failed":42}]
+0.9.0-alpha.0,1598,0,[{"name":"address.wast","passed":260,"failed":0},{"name":"address64.wast","passed":242,"failed":0},{"name":"align64.wast","passed":156,"failed":0},{"name":"binary-leb128.wast","passed":93,"failed":0},{"name":"binary.wast","passed":169,"failed":0},{"name":"endianness64.wast","passed":69,"failed":0},{"name":"float_memory64.wast","passed":90,"failed":0},{"name":"load64.wast","passed":97,"failed":0},{"name":"memory.wast","passed":79,"failed":0},{"name":"memory64.wast","passed":65,"failed":0},{"name":"memory_grow64.wast","passed":49,"failed":0},{"name":"memory_redundancy64.wast","passed":8,"failed":0},{"name":"memory_trap64.wast","passed":172,"failed":0},{"name":"simd_address.wast","passed":49,"failed":0}]
diff --git a/crates/tinywasm/tests/generated/wasm-multi-memory.csv b/crates/tinywasm/tests/generated/wasm-multi-memory.csv
index 33debd6..c81e9e5 100644
--- a/crates/tinywasm/tests/generated/wasm-multi-memory.csv
+++ b/crates/tinywasm/tests/generated/wasm-multi-memory.csv
@@ -1,2 +1,2 @@
0.8.0,1872,0,[{"name":"address0.wast","passed":92,"failed":0},{"name":"address1.wast","passed":127,"failed":0},{"name":"align.wast","passed":160,"failed":0},{"name":"align0.wast","passed":5,"failed":0},{"name":"binary.wast","passed":126,"failed":0},{"name":"binary0.wast","passed":7,"failed":0},{"name":"data.wast","passed":61,"failed":0},{"name":"data0.wast","passed":7,"failed":0},{"name":"data1.wast","passed":14,"failed":0},{"name":"data_drop0.wast","passed":11,"failed":0},{"name":"exports0.wast","passed":8,"failed":0},{"name":"float_exprs0.wast","passed":14,"failed":0},{"name":"float_exprs1.wast","passed":3,"failed":0},{"name":"float_memory0.wast","passed":30,"failed":0},{"name":"imports.wast","passed":175,"failed":0},{"name":"imports0.wast","passed":8,"failed":0},{"name":"imports1.wast","passed":5,"failed":0},{"name":"imports2.wast","passed":20,"failed":0},{"name":"imports3.wast","passed":10,"failed":0},{"name":"imports4.wast","passed":16,"failed":0},{"name":"linking0.wast","passed":6,"failed":0},{"name":"linking1.wast","passed":14,"failed":0},{"name":"linking2.wast","passed":11,"failed":0},{"name":"linking3.wast","passed":14,"failed":0},{"name":"load.wast","passed":118,"failed":0},{"name":"load0.wast","passed":3,"failed":0},{"name":"load1.wast","passed":18,"failed":0},{"name":"load2.wast","passed":38,"failed":0},{"name":"memory-multi.wast","passed":6,"failed":0},{"name":"memory.wast","passed":86,"failed":0},{"name":"memory_copy0.wast","passed":29,"failed":0},{"name":"memory_copy1.wast","passed":14,"failed":0},{"name":"memory_fill0.wast","passed":16,"failed":0},{"name":"memory_grow.wast","passed":157,"failed":0},{"name":"memory_init0.wast","passed":13,"failed":0},{"name":"memory_size.wast","passed":49,"failed":0},{"name":"memory_size0.wast","passed":8,"failed":0},{"name":"memory_size1.wast","passed":15,"failed":0},{"name":"memory_size2.wast","passed":21,"failed":0},{"name":"memory_size3.wast","passed":2,"failed":0},{"name":"memory_trap0.wast","passed":14,"failed":0},{"name":"memory_trap1.wast","passed":168,"failed":0},{"name":"multi-memory/simd_memory-multi.wast (skipped)","passed":0,"failed":0},{"name":"start0.wast","passed":9,"failed":0},{"name":"store.wast","passed":111,"failed":0},{"name":"store0.wast","passed":5,"failed":0},{"name":"store1.wast","passed":13,"failed":0},{"name":"traps0.wast","passed":15,"failed":0}]
-0.9.0-alpha.0,1871,0,[{"name":"address0.wast","passed":92,"failed":0},{"name":"address1.wast","passed":127,"failed":0},{"name":"align.wast","passed":160,"failed":0},{"name":"align0.wast","passed":5,"failed":0},{"name":"binary.wast","passed":126,"failed":0},{"name":"binary0.wast","passed":6,"failed":0},{"name":"data.wast","passed":61,"failed":0},{"name":"data0.wast","passed":7,"failed":0},{"name":"data1.wast","passed":14,"failed":0},{"name":"data_drop0.wast","passed":11,"failed":0},{"name":"exports0.wast","passed":8,"failed":0},{"name":"float_exprs0.wast","passed":14,"failed":0},{"name":"float_exprs1.wast","passed":3,"failed":0},{"name":"float_memory0.wast","passed":30,"failed":0},{"name":"imports.wast","passed":175,"failed":0},{"name":"imports0.wast","passed":8,"failed":0},{"name":"imports1.wast","passed":5,"failed":0},{"name":"imports2.wast","passed":20,"failed":0},{"name":"imports3.wast","passed":10,"failed":0},{"name":"imports4.wast","passed":16,"failed":0},{"name":"linking0.wast","passed":6,"failed":0},{"name":"linking1.wast","passed":14,"failed":0},{"name":"linking2.wast","passed":11,"failed":0},{"name":"linking3.wast","passed":14,"failed":0},{"name":"load.wast","passed":118,"failed":0},{"name":"load0.wast","passed":3,"failed":0},{"name":"load1.wast","passed":18,"failed":0},{"name":"load2.wast","passed":38,"failed":0},{"name":"memory-multi.wast","passed":6,"failed":0},{"name":"memory.wast","passed":86,"failed":0},{"name":"memory_copy0.wast","passed":29,"failed":0},{"name":"memory_copy1.wast","passed":14,"failed":0},{"name":"memory_fill0.wast","passed":16,"failed":0},{"name":"memory_grow.wast","passed":157,"failed":0},{"name":"memory_init0.wast","passed":13,"failed":0},{"name":"memory_size.wast","passed":49,"failed":0},{"name":"memory_size0.wast","passed":8,"failed":0},{"name":"memory_size1.wast","passed":15,"failed":0},{"name":"memory_size2.wast","passed":21,"failed":0},{"name":"memory_size3.wast","passed":2,"failed":0},{"name":"memory_trap0.wast","passed":14,"failed":0},{"name":"memory_trap1.wast","passed":168,"failed":0},{"name":"simd_memory-multi.wast (skipped)","passed":0,"failed":0},{"name":"start0.wast","passed":9,"failed":0},{"name":"store.wast","passed":111,"failed":0},{"name":"store0.wast","passed":5,"failed":0},{"name":"store1.wast","passed":13,"failed":0},{"name":"traps0.wast","passed":15,"failed":0}]
+0.9.0-alpha.0,1872,0,[{"name":"address0.wast","passed":92,"failed":0},{"name":"address1.wast","passed":127,"failed":0},{"name":"align.wast","passed":160,"failed":0},{"name":"align0.wast","passed":5,"failed":0},{"name":"binary.wast","passed":126,"failed":0},{"name":"binary0.wast","passed":6,"failed":0},{"name":"data.wast","passed":61,"failed":0},{"name":"data0.wast","passed":7,"failed":0},{"name":"data1.wast","passed":14,"failed":0},{"name":"data_drop0.wast","passed":11,"failed":0},{"name":"exports0.wast","passed":8,"failed":0},{"name":"float_exprs0.wast","passed":14,"failed":0},{"name":"float_exprs1.wast","passed":3,"failed":0},{"name":"float_memory0.wast","passed":30,"failed":0},{"name":"imports.wast","passed":175,"failed":0},{"name":"imports0.wast","passed":8,"failed":0},{"name":"imports1.wast","passed":5,"failed":0},{"name":"imports2.wast","passed":20,"failed":0},{"name":"imports3.wast","passed":10,"failed":0},{"name":"imports4.wast","passed":16,"failed":0},{"name":"linking0.wast","passed":6,"failed":0},{"name":"linking1.wast","passed":14,"failed":0},{"name":"linking2.wast","passed":11,"failed":0},{"name":"linking3.wast","passed":14,"failed":0},{"name":"load.wast","passed":118,"failed":0},{"name":"load0.wast","passed":3,"failed":0},{"name":"load1.wast","passed":18,"failed":0},{"name":"load2.wast","passed":38,"failed":0},{"name":"memory-multi.wast","passed":6,"failed":0},{"name":"memory.wast","passed":86,"failed":0},{"name":"memory_copy0.wast","passed":29,"failed":0},{"name":"memory_copy1.wast","passed":14,"failed":0},{"name":"memory_fill0.wast","passed":16,"failed":0},{"name":"memory_grow.wast","passed":157,"failed":0},{"name":"memory_init0.wast","passed":13,"failed":0},{"name":"memory_size.wast","passed":49,"failed":0},{"name":"memory_size0.wast","passed":8,"failed":0},{"name":"memory_size1.wast","passed":15,"failed":0},{"name":"memory_size2.wast","passed":21,"failed":0},{"name":"memory_size3.wast","passed":2,"failed":0},{"name":"memory_trap0.wast","passed":14,"failed":0},{"name":"memory_trap1.wast","passed":168,"failed":0},{"name":"simd_memory-multi.wast","passed":1,"failed":0},{"name":"start0.wast","passed":9,"failed":0},{"name":"store.wast","passed":111,"failed":0},{"name":"store0.wast","passed":5,"failed":0},{"name":"store1.wast","passed":13,"failed":0},{"name":"traps0.wast","passed":15,"failed":0}]
diff --git a/crates/tinywasm/tests/test-wasm-annotations.rs b/crates/tinywasm/tests/test-wasm-annotations.rs
index beac9eb..8655d15 100644
--- a/crates/tinywasm/tests/test-wasm-annotations.rs
+++ b/crates/tinywasm/tests/test-wasm-annotations.rs
@@ -7,7 +7,6 @@ fn main() -> Result<()> {
TestSuite::set_log_level(log::LevelFilter::Off);
let mut test_suite = TestSuite::new();
- test_suite.skip("simd_lane.wast");
test_suite.run_files(proposal(&Proposal::Annotations))?;
test_suite.save_csv("./tests/generated/wasm-annotations.csv", env!("CARGO_PKG_VERSION"))?;
test_suite.report_status()
diff --git a/crates/tinywasm/tests/test-wasm-multi-memory.rs b/crates/tinywasm/tests/test-wasm-multi-memory.rs
index 30052b0..e4487f1 100644
--- a/crates/tinywasm/tests/test-wasm-multi-memory.rs
+++ b/crates/tinywasm/tests/test-wasm-multi-memory.rs
@@ -7,7 +7,6 @@ fn main() -> Result<()> {
TestSuite::set_log_level(log::LevelFilter::Off);
let mut test_suite = TestSuite::new();
- test_suite.skip("simd_memory-multi.wast");
test_suite.run_files(proposal(&Proposal::MultiMemory))?;
test_suite.save_csv("./tests/generated/wasm-multi-memory.csv", env!("CARGO_PKG_VERSION"))?;
test_suite.report_status()
diff --git a/examples/rust/src/tinywasm.rs b/examples/rust/src/tinywasm.rs
index d3b3f8c..11d7637 100644
--- a/examples/rust/src/tinywasm.rs
+++ b/examples/rust/src/tinywasm.rs
@@ -26,7 +26,7 @@ fn run() -> tinywasm::Result<()> {
)?;
let instance = module.instantiate(&mut store, Some(imports))?;
- let add_and_print = instance.exported_func::<(i32, i32), ()>(&mut store, "add_and_print")?;
+ let add_and_print = instance.exported_func::<(i32, i32), ()>(&store, "add_and_print")?;
add_and_print.call(&mut store, (1, 2))?;
Ok(())
}
diff --git a/examples/rust/src/tinywasm_no_std.rs b/examples/rust/src/tinywasm_no_std.rs
index 46f1785..6a31ff0 100644
--- a/examples/rust/src/tinywasm_no_std.rs
+++ b/examples/rust/src/tinywasm_no_std.rs
@@ -43,7 +43,7 @@ fn run() -> tinywasm::Result<()> {
)?;
let instance = module.instantiate(&mut store, Some(imports))?;
- let add_and_print = instance.exported_func::<(i32, i32), ()>(&mut store, "add_and_print")?;
+ let add_and_print = instance.exported_func::<(i32, i32), ()>(&store, "add_and_print")?;
add_and_print.call(&mut store, (1, 2))?;
Ok(())
}