From 18477bbe9e9bd6a3a936dcce8707318a02fc7e94 Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Thu, 8 Sep 2022 15:28:51 +0300 Subject: [PATCH] wasmparser: self-contain for_each_operator! MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adjusts the `for_each_operator!` macro to avoid it requiring ambient context (imports) with specific names. Instead it’ll use correctly-scoped fully qualified names, making it somewhat easier to use. --- crates/wasmparser/src/lib.rs | 246 ++++++++++++------------ crates/wasmparser/src/validator/core.rs | 7 +- crates/wasmparser/src/validator/func.rs | 4 +- 3 files changed, 125 insertions(+), 132 deletions(-) diff --git a/crates/wasmparser/src/lib.rs b/crates/wasmparser/src/lib.rs index b299ccd2dc..10a1411fe9 100644 --- a/crates/wasmparser/src/lib.rs +++ b/crates/wasmparser/src/lib.rs @@ -78,10 +78,6 @@ /// https://github.com/WebAssembly/relaxed-simd /// /// ``` -/// // These names are referred to by the types of each payload and must -/// // be imported into the module using the `for_each_operator!` macro. -/// use wasmparser::{V128, MemArg, BlockType, ValType, BrTable, Ieee32, Ieee64}; -/// /// macro_rules! define_visit_operator { /// // The outer layer of repetition represents how all operators are /// // provided to the macro at the same time. @@ -122,18 +118,18 @@ macro_rules! for_each_operator { $mac! { @mvp Unreachable => visit_unreachable @mvp Nop => visit_nop - @mvp Block { ty: BlockType } => visit_block - @mvp Loop { ty: BlockType } => visit_loop - @mvp If { ty: BlockType } => visit_if + @mvp Block { ty: $crate::BlockType } => visit_block + @mvp Loop { ty: $crate::BlockType } => visit_loop + @mvp If { ty: $crate::BlockType } => visit_if @mvp Else => visit_else - @expections Try { ty: BlockType } => visit_try + @expections Try { ty: $crate::BlockType } => visit_try @expections Catch { index: u32 } => visit_catch @expections Throw { index: u32 } => visit_throw @expections Rethrow { relative_depth: u32 } => visit_rethrow @mvp End => visit_end @mvp Br { relative_depth: u32 } => visit_br @mvp BrIf { relative_depth: u32 } => visit_br_if - @mvp BrTable { table: BrTable<'a> } => visit_br_table + @mvp BrTable { table: $crate::BrTable<'a> } => visit_br_table @mvp Return => visit_return @mvp Call { function_index: u32 } => visit_call @mvp CallIndirect { index: u32, table_index: u32, table_byte: u8 } => visit_call_indirect @@ -143,42 +139,42 @@ macro_rules! for_each_operator { @expections CatchAll => visit_catch_all @mvp Drop => visit_drop @mvp Select => visit_select - @reference_types TypedSelect { ty: ValType } => visit_typed_select + @reference_types TypedSelect { ty: $crate::ValType } => visit_typed_select @mvp LocalGet { local_index: u32 } => visit_local_get @mvp LocalSet { local_index: u32 } => visit_local_set @mvp LocalTee { local_index: u32 } => visit_local_tee @mvp GlobalGet { global_index: u32 } => visit_global_get @mvp GlobalSet { global_index: u32 } => visit_global_set - @mvp I32Load { memarg: MemArg } => visit_i32_load - @mvp I64Load { memarg: MemArg } => visit_i64_load - @mvp F32Load { memarg: MemArg } => visit_f32_load - @mvp F64Load { memarg: MemArg } => visit_f64_load - @mvp I32Load8S { memarg: MemArg } => visit_i32_load8_s - @mvp I32Load8U { memarg: MemArg } => visit_i32_load8_u - @mvp I32Load16S { memarg: MemArg } => visit_i32_load16_s - @mvp I32Load16U { memarg: MemArg } => visit_i32_load16_u - @mvp I64Load8S { memarg: MemArg } => visit_i64_load8_s - @mvp I64Load8U { memarg: MemArg } => visit_i64_load8_u - @mvp I64Load16S { memarg: MemArg } => visit_i64_load16_s - @mvp I64Load16U { memarg: MemArg } => visit_i64_load16_u - @mvp I64Load32S { memarg: MemArg } => visit_i64_load32_s - @mvp I64Load32U { memarg: MemArg } => visit_i64_load32_u - @mvp I32Store { memarg: MemArg } => visit_i32_store - @mvp I64Store { memarg: MemArg } => visit_i64_store - @mvp F32Store { memarg: MemArg } => visit_f32_store - @mvp F64Store { memarg: MemArg } => visit_f64_store - @mvp I32Store8 { memarg: MemArg } => visit_i32_store8 - @mvp I32Store16 { memarg: MemArg } => visit_i32_store16 - @mvp I64Store8 { memarg: MemArg } => visit_i64_store8 - @mvp I64Store16 { memarg: MemArg } => visit_i64_store16 - @mvp I64Store32 { memarg: MemArg } => visit_i64_store32 + @mvp I32Load { memarg: $crate::MemArg } => visit_i32_load + @mvp I64Load { memarg: $crate::MemArg } => visit_i64_load + @mvp F32Load { memarg: $crate::MemArg } => visit_f32_load + @mvp F64Load { memarg: $crate::MemArg } => visit_f64_load + @mvp I32Load8S { memarg: $crate::MemArg } => visit_i32_load8_s + @mvp I32Load8U { memarg: $crate::MemArg } => visit_i32_load8_u + @mvp I32Load16S { memarg: $crate::MemArg } => visit_i32_load16_s + @mvp I32Load16U { memarg: $crate::MemArg } => visit_i32_load16_u + @mvp I64Load8S { memarg: $crate::MemArg } => visit_i64_load8_s + @mvp I64Load8U { memarg: $crate::MemArg } => visit_i64_load8_u + @mvp I64Load16S { memarg: $crate::MemArg } => visit_i64_load16_s + @mvp I64Load16U { memarg: $crate::MemArg } => visit_i64_load16_u + @mvp I64Load32S { memarg: $crate::MemArg } => visit_i64_load32_s + @mvp I64Load32U { memarg: $crate::MemArg } => visit_i64_load32_u + @mvp I32Store { memarg: $crate::MemArg } => visit_i32_store + @mvp I64Store { memarg: $crate::MemArg } => visit_i64_store + @mvp F32Store { memarg: $crate::MemArg } => visit_f32_store + @mvp F64Store { memarg: $crate::MemArg } => visit_f64_store + @mvp I32Store8 { memarg: $crate::MemArg } => visit_i32_store8 + @mvp I32Store16 { memarg: $crate::MemArg } => visit_i32_store16 + @mvp I64Store8 { memarg: $crate::MemArg } => visit_i64_store8 + @mvp I64Store16 { memarg: $crate::MemArg } => visit_i64_store16 + @mvp I64Store32 { memarg: $crate::MemArg } => visit_i64_store32 @mvp MemorySize { mem: u32, mem_byte: u8 } => visit_memory_size @mvp MemoryGrow { mem: u32, mem_byte: u8 } => visit_memory_grow @mvp I32Const { value: i32 } => visit_i32_const @mvp I64Const { value: i64 } => visit_i64_const - @mvp F32Const { value: Ieee32 } => visit_f32_const - @mvp F64Const { value: Ieee64 } => visit_f64_const - @reference_types RefNull { ty: ValType } => visit_ref_null + @mvp F32Const { value: $crate::Ieee32 } => visit_f32_const + @mvp F64Const { value: $crate::Ieee64 } => visit_f64_const + @reference_types RefNull { ty: $crate::ValType } => visit_ref_null @reference_types RefIsNull => visit_ref_is_null @reference_types RefFunc { function_index: u32 } => visit_ref_func @mvp I32Eqz => visit_i32_eqz @@ -338,99 +334,99 @@ macro_rules! for_each_operator { // 0xFE operators // https://github.com/WebAssembly/threads/blob/master/proposals/threads/Overview.md - @threads MemoryAtomicNotify { memarg: MemArg } => visit_memory_atomic_notify - @threads MemoryAtomicWait32 { memarg: MemArg } => visit_memory_atomic_wait32 - @threads MemoryAtomicWait64 { memarg: MemArg } => visit_memory_atomic_wait64 + @threads MemoryAtomicNotify { memarg: $crate::MemArg } => visit_memory_atomic_notify + @threads MemoryAtomicWait32 { memarg: $crate::MemArg } => visit_memory_atomic_wait32 + @threads MemoryAtomicWait64 { memarg: $crate::MemArg } => visit_memory_atomic_wait64 @threads AtomicFence { flags: u8 } => visit_atomic_fence - @threads I32AtomicLoad { memarg: MemArg } => visit_i32_atomic_load - @threads I64AtomicLoad { memarg: MemArg } => visit_i64_atomic_load - @threads I32AtomicLoad8U { memarg: MemArg } => visit_i32_atomic_load8_u - @threads I32AtomicLoad16U { memarg: MemArg } => visit_i32_atomic_load16_u - @threads I64AtomicLoad8U { memarg: MemArg } => visit_i64_atomic_load8_u - @threads I64AtomicLoad16U { memarg: MemArg } => visit_i64_atomic_load16_u - @threads I64AtomicLoad32U { memarg: MemArg } => visit_i64_atomic_load32_u - @threads I32AtomicStore { memarg: MemArg } => visit_i32_atomic_store - @threads I64AtomicStore { memarg: MemArg } => visit_i64_atomic_store - @threads I32AtomicStore8 { memarg: MemArg } => visit_i32_atomic_store8 - @threads I32AtomicStore16 { memarg: MemArg } => visit_i32_atomic_store16 - @threads I64AtomicStore8 { memarg: MemArg } => visit_i64_atomic_store8 - @threads I64AtomicStore16 { memarg: MemArg } => visit_i64_atomic_store16 - @threads I64AtomicStore32 { memarg: MemArg } => visit_i64_atomic_store32 - @threads I32AtomicRmwAdd { memarg: MemArg } => visit_i32_atomic_rmw_add - @threads I64AtomicRmwAdd { memarg: MemArg } => visit_i64_atomic_rmw_add - @threads I32AtomicRmw8AddU { memarg: MemArg } => visit_i32_atomic_rmw8_add_u - @threads I32AtomicRmw16AddU { memarg: MemArg } => visit_i32_atomic_rmw16_add_u - @threads I64AtomicRmw8AddU { memarg: MemArg } => visit_i64_atomic_rmw8_add_u - @threads I64AtomicRmw16AddU { memarg: MemArg } => visit_i64_atomic_rmw16_add_u - @threads I64AtomicRmw32AddU { memarg: MemArg } => visit_i64_atomic_rmw32_add_u - @threads I32AtomicRmwSub { memarg: MemArg } => visit_i32_atomic_rmw_sub - @threads I64AtomicRmwSub { memarg: MemArg } => visit_i64_atomic_rmw_sub - @threads I32AtomicRmw8SubU { memarg: MemArg } => visit_i32_atomic_rmw8_sub_u - @threads I32AtomicRmw16SubU { memarg: MemArg } => visit_i32_atomic_rmw16_sub_u - @threads I64AtomicRmw8SubU { memarg: MemArg } => visit_i64_atomic_rmw8_sub_u - @threads I64AtomicRmw16SubU { memarg: MemArg } => visit_i64_atomic_rmw16_sub_u - @threads I64AtomicRmw32SubU { memarg: MemArg } => visit_i64_atomic_rmw32_sub_u - @threads I32AtomicRmwAnd { memarg: MemArg } => visit_i32_atomic_rmw_and - @threads I64AtomicRmwAnd { memarg: MemArg } => visit_i64_atomic_rmw_and - @threads I32AtomicRmw8AndU { memarg: MemArg } => visit_i32_atomic_rmw8_and_u - @threads I32AtomicRmw16AndU { memarg: MemArg } => visit_i32_atomic_rmw16_and_u - @threads I64AtomicRmw8AndU { memarg: MemArg } => visit_i64_atomic_rmw8_and_u - @threads I64AtomicRmw16AndU { memarg: MemArg } => visit_i64_atomic_rmw16_and_u - @threads I64AtomicRmw32AndU { memarg: MemArg } => visit_i64_atomic_rmw32_and_u - @threads I32AtomicRmwOr { memarg: MemArg } => visit_i32_atomic_rmw_or - @threads I64AtomicRmwOr { memarg: MemArg } => visit_i64_atomic_rmw_or - @threads I32AtomicRmw8OrU { memarg: MemArg } => visit_i32_atomic_rmw8_or_u - @threads I32AtomicRmw16OrU { memarg: MemArg } => visit_i32_atomic_rmw16_or_u - @threads I64AtomicRmw8OrU { memarg: MemArg } => visit_i64_atomic_rmw8_or_u - @threads I64AtomicRmw16OrU { memarg: MemArg } => visit_i64_atomic_rmw16_or_u - @threads I64AtomicRmw32OrU { memarg: MemArg } => visit_i64_atomic_rmw32_or_u - @threads I32AtomicRmwXor { memarg: MemArg } => visit_i32_atomic_rmw_xor - @threads I64AtomicRmwXor { memarg: MemArg } => visit_i64_atomic_rmw_xor - @threads I32AtomicRmw8XorU { memarg: MemArg } => visit_i32_atomic_rmw8_xor_u - @threads I32AtomicRmw16XorU { memarg: MemArg } => visit_i32_atomic_rmw16_xor_u - @threads I64AtomicRmw8XorU { memarg: MemArg } => visit_i64_atomic_rmw8_xor_u - @threads I64AtomicRmw16XorU { memarg: MemArg } => visit_i64_atomic_rmw16_xor_u - @threads I64AtomicRmw32XorU { memarg: MemArg } => visit_i64_atomic_rmw32_xor_u - @threads I32AtomicRmwXchg { memarg: MemArg } => visit_i32_atomic_rmw_xchg - @threads I64AtomicRmwXchg { memarg: MemArg } => visit_i64_atomic_rmw_xchg - @threads I32AtomicRmw8XchgU { memarg: MemArg } => visit_i32_atomic_rmw8_xchg_u - @threads I32AtomicRmw16XchgU { memarg: MemArg } => visit_i32_atomic_rmw16_xchg_u - @threads I64AtomicRmw8XchgU { memarg: MemArg } => visit_i64_atomic_rmw8_xchg_u - @threads I64AtomicRmw16XchgU { memarg: MemArg } => visit_i64_atomic_rmw16_xchg_u - @threads I64AtomicRmw32XchgU { memarg: MemArg } => visit_i64_atomic_rmw32_xchg_u - @threads I32AtomicRmwCmpxchg { memarg: MemArg } => visit_i32_atomic_rmw_cmpxchg - @threads I64AtomicRmwCmpxchg { memarg: MemArg } => visit_i64_atomic_rmw_cmpxchg - @threads I32AtomicRmw8CmpxchgU { memarg: MemArg } => visit_i32_atomic_rmw8_cmpxchg_u - @threads I32AtomicRmw16CmpxchgU { memarg: MemArg } => visit_i32_atomic_rmw16_cmpxchg_u - @threads I64AtomicRmw8CmpxchgU { memarg: MemArg } => visit_i64_atomic_rmw8_cmpxchg_u - @threads I64AtomicRmw16CmpxchgU { memarg: MemArg } => visit_i64_atomic_rmw16_cmpxchg_u - @threads I64AtomicRmw32CmpxchgU { memarg: MemArg } => visit_i64_atomic_rmw32_cmpxchg_u + @threads I32AtomicLoad { memarg: $crate::MemArg } => visit_i32_atomic_load + @threads I64AtomicLoad { memarg: $crate::MemArg } => visit_i64_atomic_load + @threads I32AtomicLoad8U { memarg: $crate::MemArg } => visit_i32_atomic_load8_u + @threads I32AtomicLoad16U { memarg: $crate::MemArg } => visit_i32_atomic_load16_u + @threads I64AtomicLoad8U { memarg: $crate::MemArg } => visit_i64_atomic_load8_u + @threads I64AtomicLoad16U { memarg: $crate::MemArg } => visit_i64_atomic_load16_u + @threads I64AtomicLoad32U { memarg: $crate::MemArg } => visit_i64_atomic_load32_u + @threads I32AtomicStore { memarg: $crate::MemArg } => visit_i32_atomic_store + @threads I64AtomicStore { memarg: $crate::MemArg } => visit_i64_atomic_store + @threads I32AtomicStore8 { memarg: $crate::MemArg } => visit_i32_atomic_store8 + @threads I32AtomicStore16 { memarg: $crate::MemArg } => visit_i32_atomic_store16 + @threads I64AtomicStore8 { memarg: $crate::MemArg } => visit_i64_atomic_store8 + @threads I64AtomicStore16 { memarg: $crate::MemArg } => visit_i64_atomic_store16 + @threads I64AtomicStore32 { memarg: $crate::MemArg } => visit_i64_atomic_store32 + @threads I32AtomicRmwAdd { memarg: $crate::MemArg } => visit_i32_atomic_rmw_add + @threads I64AtomicRmwAdd { memarg: $crate::MemArg } => visit_i64_atomic_rmw_add + @threads I32AtomicRmw8AddU { memarg: $crate::MemArg } => visit_i32_atomic_rmw8_add_u + @threads I32AtomicRmw16AddU { memarg: $crate::MemArg } => visit_i32_atomic_rmw16_add_u + @threads I64AtomicRmw8AddU { memarg: $crate::MemArg } => visit_i64_atomic_rmw8_add_u + @threads I64AtomicRmw16AddU { memarg: $crate::MemArg } => visit_i64_atomic_rmw16_add_u + @threads I64AtomicRmw32AddU { memarg: $crate::MemArg } => visit_i64_atomic_rmw32_add_u + @threads I32AtomicRmwSub { memarg: $crate::MemArg } => visit_i32_atomic_rmw_sub + @threads I64AtomicRmwSub { memarg: $crate::MemArg } => visit_i64_atomic_rmw_sub + @threads I32AtomicRmw8SubU { memarg: $crate::MemArg } => visit_i32_atomic_rmw8_sub_u + @threads I32AtomicRmw16SubU { memarg: $crate::MemArg } => visit_i32_atomic_rmw16_sub_u + @threads I64AtomicRmw8SubU { memarg: $crate::MemArg } => visit_i64_atomic_rmw8_sub_u + @threads I64AtomicRmw16SubU { memarg: $crate::MemArg } => visit_i64_atomic_rmw16_sub_u + @threads I64AtomicRmw32SubU { memarg: $crate::MemArg } => visit_i64_atomic_rmw32_sub_u + @threads I32AtomicRmwAnd { memarg: $crate::MemArg } => visit_i32_atomic_rmw_and + @threads I64AtomicRmwAnd { memarg: $crate::MemArg } => visit_i64_atomic_rmw_and + @threads I32AtomicRmw8AndU { memarg: $crate::MemArg } => visit_i32_atomic_rmw8_and_u + @threads I32AtomicRmw16AndU { memarg: $crate::MemArg } => visit_i32_atomic_rmw16_and_u + @threads I64AtomicRmw8AndU { memarg: $crate::MemArg } => visit_i64_atomic_rmw8_and_u + @threads I64AtomicRmw16AndU { memarg: $crate::MemArg } => visit_i64_atomic_rmw16_and_u + @threads I64AtomicRmw32AndU { memarg: $crate::MemArg } => visit_i64_atomic_rmw32_and_u + @threads I32AtomicRmwOr { memarg: $crate::MemArg } => visit_i32_atomic_rmw_or + @threads I64AtomicRmwOr { memarg: $crate::MemArg } => visit_i64_atomic_rmw_or + @threads I32AtomicRmw8OrU { memarg: $crate::MemArg } => visit_i32_atomic_rmw8_or_u + @threads I32AtomicRmw16OrU { memarg: $crate::MemArg } => visit_i32_atomic_rmw16_or_u + @threads I64AtomicRmw8OrU { memarg: $crate::MemArg } => visit_i64_atomic_rmw8_or_u + @threads I64AtomicRmw16OrU { memarg: $crate::MemArg } => visit_i64_atomic_rmw16_or_u + @threads I64AtomicRmw32OrU { memarg: $crate::MemArg } => visit_i64_atomic_rmw32_or_u + @threads I32AtomicRmwXor { memarg: $crate::MemArg } => visit_i32_atomic_rmw_xor + @threads I64AtomicRmwXor { memarg: $crate::MemArg } => visit_i64_atomic_rmw_xor + @threads I32AtomicRmw8XorU { memarg: $crate::MemArg } => visit_i32_atomic_rmw8_xor_u + @threads I32AtomicRmw16XorU { memarg: $crate::MemArg } => visit_i32_atomic_rmw16_xor_u + @threads I64AtomicRmw8XorU { memarg: $crate::MemArg } => visit_i64_atomic_rmw8_xor_u + @threads I64AtomicRmw16XorU { memarg: $crate::MemArg } => visit_i64_atomic_rmw16_xor_u + @threads I64AtomicRmw32XorU { memarg: $crate::MemArg } => visit_i64_atomic_rmw32_xor_u + @threads I32AtomicRmwXchg { memarg: $crate::MemArg } => visit_i32_atomic_rmw_xchg + @threads I64AtomicRmwXchg { memarg: $crate::MemArg } => visit_i64_atomic_rmw_xchg + @threads I32AtomicRmw8XchgU { memarg: $crate::MemArg } => visit_i32_atomic_rmw8_xchg_u + @threads I32AtomicRmw16XchgU { memarg: $crate::MemArg } => visit_i32_atomic_rmw16_xchg_u + @threads I64AtomicRmw8XchgU { memarg: $crate::MemArg } => visit_i64_atomic_rmw8_xchg_u + @threads I64AtomicRmw16XchgU { memarg: $crate::MemArg } => visit_i64_atomic_rmw16_xchg_u + @threads I64AtomicRmw32XchgU { memarg: $crate::MemArg } => visit_i64_atomic_rmw32_xchg_u + @threads I32AtomicRmwCmpxchg { memarg: $crate::MemArg } => visit_i32_atomic_rmw_cmpxchg + @threads I64AtomicRmwCmpxchg { memarg: $crate::MemArg } => visit_i64_atomic_rmw_cmpxchg + @threads I32AtomicRmw8CmpxchgU { memarg: $crate::MemArg } => visit_i32_atomic_rmw8_cmpxchg_u + @threads I32AtomicRmw16CmpxchgU { memarg: $crate::MemArg } => visit_i32_atomic_rmw16_cmpxchg_u + @threads I64AtomicRmw8CmpxchgU { memarg: $crate::MemArg } => visit_i64_atomic_rmw8_cmpxchg_u + @threads I64AtomicRmw16CmpxchgU { memarg: $crate::MemArg } => visit_i64_atomic_rmw16_cmpxchg_u + @threads I64AtomicRmw32CmpxchgU { memarg: $crate::MemArg } => visit_i64_atomic_rmw32_cmpxchg_u // 0xFD operators // SIMD https://webassembly.github.io/simd/core/binary/instructions.html - @simd V128Load { memarg: MemArg } => visit_v128_load - @simd V128Load8x8S { memarg: MemArg } => visit_v128_load8x8_s - @simd V128Load8x8U { memarg: MemArg } => visit_v128_load8x8_u - @simd V128Load16x4S { memarg: MemArg } => visit_v128_load16x4_s - @simd V128Load16x4U { memarg: MemArg } => visit_v128_load16x4_u - @simd V128Load32x2S { memarg: MemArg } => visit_v128_load32x2_s - @simd V128Load32x2U { memarg: MemArg } => visit_v128_load32x2_u - @simd V128Load8Splat { memarg: MemArg } => visit_v128_load8_splat - @simd V128Load16Splat { memarg: MemArg } => visit_v128_load16_splat - @simd V128Load32Splat { memarg: MemArg } => visit_v128_load32_splat - @simd V128Load64Splat { memarg: MemArg } => visit_v128_load64_splat - @simd V128Load32Zero { memarg: MemArg } => visit_v128_load32_zero - @simd V128Load64Zero { memarg: MemArg } => visit_v128_load64_zero - @simd V128Store { memarg: MemArg } => visit_v128_store - @simd V128Load8Lane { memarg: MemArg, lane: u8 } => visit_v128_load8_lane - @simd V128Load16Lane { memarg: MemArg, lane: u8 } => visit_v128_load16_lane - @simd V128Load32Lane { memarg: MemArg, lane: u8 } => visit_v128_load32_lane - @simd V128Load64Lane { memarg: MemArg, lane: u8 } => visit_v128_load64_lane - @simd V128Store8Lane { memarg: MemArg, lane: u8 } => visit_v128_store8_lane - @simd V128Store16Lane { memarg: MemArg, lane: u8 } => visit_v128_store16_lane - @simd V128Store32Lane { memarg: MemArg, lane: u8 } => visit_v128_store32_lane - @simd V128Store64Lane { memarg: MemArg, lane: u8 } => visit_v128_store64_lane - @simd V128Const { value: V128 } => visit_v128_const + @simd V128Load { memarg: $crate::MemArg } => visit_v128_load + @simd V128Load8x8S { memarg: $crate::MemArg } => visit_v128_load8x8_s + @simd V128Load8x8U { memarg: $crate::MemArg } => visit_v128_load8x8_u + @simd V128Load16x4S { memarg: $crate::MemArg } => visit_v128_load16x4_s + @simd V128Load16x4U { memarg: $crate::MemArg } => visit_v128_load16x4_u + @simd V128Load32x2S { memarg: $crate::MemArg } => visit_v128_load32x2_s + @simd V128Load32x2U { memarg: $crate::MemArg } => visit_v128_load32x2_u + @simd V128Load8Splat { memarg: $crate::MemArg } => visit_v128_load8_splat + @simd V128Load16Splat { memarg: $crate::MemArg } => visit_v128_load16_splat + @simd V128Load32Splat { memarg: $crate::MemArg } => visit_v128_load32_splat + @simd V128Load64Splat { memarg: $crate::MemArg } => visit_v128_load64_splat + @simd V128Load32Zero { memarg: $crate::MemArg } => visit_v128_load32_zero + @simd V128Load64Zero { memarg: $crate::MemArg } => visit_v128_load64_zero + @simd V128Store { memarg: $crate::MemArg } => visit_v128_store + @simd V128Load8Lane { memarg: $crate::MemArg, lane: u8 } => visit_v128_load8_lane + @simd V128Load16Lane { memarg: $crate::MemArg, lane: u8 } => visit_v128_load16_lane + @simd V128Load32Lane { memarg: $crate::MemArg, lane: u8 } => visit_v128_load32_lane + @simd V128Load64Lane { memarg: $crate::MemArg, lane: u8 } => visit_v128_load64_lane + @simd V128Store8Lane { memarg: $crate::MemArg, lane: u8 } => visit_v128_store8_lane + @simd V128Store16Lane { memarg: $crate::MemArg, lane: u8 } => visit_v128_store16_lane + @simd V128Store32Lane { memarg: $crate::MemArg, lane: u8 } => visit_v128_store32_lane + @simd V128Store64Lane { memarg: $crate::MemArg, lane: u8 } => visit_v128_store64_lane + @simd V128Const { value: $crate::V128 } => visit_v128_const @simd I8x16Shuffle { lanes: [u8; 16] } => visit_i8x16_shuffle @simd I8x16ExtractLaneS { lane: u8 } => visit_i8x16_extract_lane_s @simd I8x16ExtractLaneU { lane: u8 } => visit_i8x16_extract_lane_u diff --git a/crates/wasmparser/src/validator/core.rs b/crates/wasmparser/src/validator/core.rs index a35b6454fb..933ea49555 100644 --- a/crates/wasmparser/src/validator/core.rs +++ b/crates/wasmparser/src/validator/core.rs @@ -7,10 +7,9 @@ use super::{ }; use crate::validator::core::arc::MaybeOwned; use crate::{ - limits::*, BinaryReaderError, BlockType, BrTable, ConstExpr, Data, DataKind, Element, - ElementItem, ElementKind, ExternalKind, FuncType, Global, GlobalType, Ieee32, Ieee64, MemArg, - MemoryType, Result, TableType, TagType, TypeRef, ValType, VisitOperator, WasmFeatures, - WasmModuleResources, V128, + limits::*, BinaryReaderError, ConstExpr, Data, DataKind, Element, ElementItem, ElementKind, + ExternalKind, FuncType, Global, GlobalType, MemoryType, Result, TableType, TagType, TypeRef, + ValType, VisitOperator, WasmFeatures, WasmModuleResources, }; use indexmap::IndexMap; use std::mem; diff --git a/crates/wasmparser/src/validator/func.rs b/crates/wasmparser/src/validator/func.rs index 1948af0b1a..6284758f17 100644 --- a/crates/wasmparser/src/validator/func.rs +++ b/crates/wasmparser/src/validator/func.rs @@ -1,5 +1,5 @@ use super::operators::{Frame, OperatorValidator, OperatorValidatorAllocations}; -use crate::{BinaryReader, Result, ValType}; +use crate::{BinaryReader, Result, ValType, VisitOperator}; use crate::{FunctionBody, Operator, WasmFeatures, WasmModuleResources}; /// Resources necessary to perform validation of a function. @@ -308,8 +308,6 @@ mod tests { } } -use crate::{BlockType, BrTable, Ieee32, Ieee64, MemArg, VisitOperator, V128}; - macro_rules! define_visit_operator { ($(@$proposal:ident $op:ident $({ $($arg:ident: $argty:ty),* })? => $visit:ident)*) => { $(