Merge branch 'pr/changes1' into pr/changes2
This commit is contained in:
commit
bf54c4ed1b
16
Cargo.toml
16
Cargo.toml
|
@ -1,30 +1,30 @@
|
||||||
[package]
|
[package]
|
||||||
name = "waffle"
|
name = "waffle"
|
||||||
version = "0.0.22"
|
version = "0.0.25"
|
||||||
description = "Wasm Analysis Framework For Lightweight Experiments"
|
description = "Wasm Analysis Framework For Lightweight Experiments"
|
||||||
authors = ["Chris Fallin <chris@cfallin.org>"]
|
authors = ["Chris Fallin <chris@cfallin.org>"]
|
||||||
license = "Apache-2.0 WITH LLVM-exception"
|
license = "Apache-2.0 WITH LLVM-exception"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
wasmparser = "0.95"
|
wasmparser = "0.202"
|
||||||
wasm-encoder = "0.20"
|
wasm-encoder = "0.202"
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
structopt = "0.3"
|
structopt = "0.3"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
env_logger = "0.9"
|
env_logger = "0.11"
|
||||||
fxhash = "0.2"
|
fxhash = "0.2"
|
||||||
smallvec = "1.7"
|
smallvec = "1.13"
|
||||||
rayon = "1.5"
|
rayon = "1.10"
|
||||||
lazy_static = "1.4"
|
lazy_static = "1.4"
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
addr2line = "0.19"
|
addr2line = "0.21"
|
||||||
|
|
||||||
# For fuzzing only. Versions must match those in fuzz/Cargo.toml.
|
# For fuzzing only. Versions must match those in fuzz/Cargo.toml.
|
||||||
libfuzzer-sys = { version = "0.4", optional = true }
|
libfuzzer-sys = { version = "0.4", optional = true }
|
||||||
wasm-smith = { version = "0.8", optional = true }
|
|
||||||
indexmap = "2.2.2"
|
indexmap = "2.2.2"
|
||||||
stacker = "0.1.15"
|
stacker = "0.1.15"
|
||||||
|
wasm-smith = { version = "0.202", optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
|
|
|
@ -542,6 +542,408 @@ impl<'a> WasmFuncBackend<'a> {
|
||||||
Operator::MemoryFill { mem } => {
|
Operator::MemoryFill { mem } => {
|
||||||
Some(wasm_encoder::Instruction::MemoryFill(mem.index() as u32))
|
Some(wasm_encoder::Instruction::MemoryFill(mem.index() as u32))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Operator::V128Load { memory } => Some(wasm_encoder::Instruction::V128Load(
|
||||||
|
wasm_encoder::MemArg::from(*memory),
|
||||||
|
)),
|
||||||
|
Operator::V128Load8x8S { memory } => Some(wasm_encoder::Instruction::V128Load8x8S(
|
||||||
|
wasm_encoder::MemArg::from(*memory),
|
||||||
|
)),
|
||||||
|
Operator::V128Load8x8U { memory } => Some(wasm_encoder::Instruction::V128Load8x8U(
|
||||||
|
wasm_encoder::MemArg::from(*memory),
|
||||||
|
)),
|
||||||
|
Operator::V128Load16x4S { memory } => Some(wasm_encoder::Instruction::V128Load16x4S(
|
||||||
|
wasm_encoder::MemArg::from(*memory),
|
||||||
|
)),
|
||||||
|
Operator::V128Load16x4U { memory } => Some(wasm_encoder::Instruction::V128Load16x4U(
|
||||||
|
wasm_encoder::MemArg::from(*memory),
|
||||||
|
)),
|
||||||
|
Operator::V128Load32x2S { memory } => Some(wasm_encoder::Instruction::V128Load32x2S(
|
||||||
|
wasm_encoder::MemArg::from(*memory),
|
||||||
|
)),
|
||||||
|
Operator::V128Load32x2U { memory } => Some(wasm_encoder::Instruction::V128Load32x2U(
|
||||||
|
wasm_encoder::MemArg::from(*memory),
|
||||||
|
)),
|
||||||
|
Operator::V128Load8Splat { memory } => Some(wasm_encoder::Instruction::V128Load8Splat(
|
||||||
|
wasm_encoder::MemArg::from(*memory),
|
||||||
|
)),
|
||||||
|
Operator::V128Load16Splat { memory } => Some(
|
||||||
|
wasm_encoder::Instruction::V128Load16Splat(wasm_encoder::MemArg::from(*memory)),
|
||||||
|
),
|
||||||
|
Operator::V128Load32Splat { memory } => Some(
|
||||||
|
wasm_encoder::Instruction::V128Load32Splat(wasm_encoder::MemArg::from(*memory)),
|
||||||
|
),
|
||||||
|
Operator::V128Load64Splat { memory } => Some(
|
||||||
|
wasm_encoder::Instruction::V128Load64Splat(wasm_encoder::MemArg::from(*memory)),
|
||||||
|
),
|
||||||
|
Operator::V128Load32Zero { memory } => Some(wasm_encoder::Instruction::V128Load32Zero(
|
||||||
|
wasm_encoder::MemArg::from(*memory),
|
||||||
|
)),
|
||||||
|
Operator::V128Load64Zero { memory } => Some(wasm_encoder::Instruction::V128Load64Zero(
|
||||||
|
wasm_encoder::MemArg::from(*memory),
|
||||||
|
)),
|
||||||
|
Operator::V128Store { memory } => Some(wasm_encoder::Instruction::V128Store(
|
||||||
|
wasm_encoder::MemArg::from(*memory),
|
||||||
|
)),
|
||||||
|
Operator::V128Load8Lane { memory, lane } => {
|
||||||
|
Some(wasm_encoder::Instruction::V128Load8Lane {
|
||||||
|
memarg: wasm_encoder::MemArg::from(*memory),
|
||||||
|
lane: *lane,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
Operator::V128Load16Lane { memory, lane } => {
|
||||||
|
Some(wasm_encoder::Instruction::V128Load16Lane {
|
||||||
|
memarg: wasm_encoder::MemArg::from(*memory),
|
||||||
|
lane: *lane,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
Operator::V128Load32Lane { memory, lane } => {
|
||||||
|
Some(wasm_encoder::Instruction::V128Load32Lane {
|
||||||
|
memarg: wasm_encoder::MemArg::from(*memory),
|
||||||
|
lane: *lane,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
Operator::V128Load64Lane { memory, lane } => {
|
||||||
|
Some(wasm_encoder::Instruction::V128Load64Lane {
|
||||||
|
memarg: wasm_encoder::MemArg::from(*memory),
|
||||||
|
lane: *lane,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
Operator::V128Store8Lane { memory, lane } => {
|
||||||
|
Some(wasm_encoder::Instruction::V128Store8Lane {
|
||||||
|
memarg: wasm_encoder::MemArg::from(*memory),
|
||||||
|
lane: *lane,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
Operator::V128Store16Lane { memory, lane } => {
|
||||||
|
Some(wasm_encoder::Instruction::V128Store16Lane {
|
||||||
|
memarg: wasm_encoder::MemArg::from(*memory),
|
||||||
|
lane: *lane,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
Operator::V128Store32Lane { memory, lane } => {
|
||||||
|
Some(wasm_encoder::Instruction::V128Store32Lane {
|
||||||
|
memarg: wasm_encoder::MemArg::from(*memory),
|
||||||
|
lane: *lane,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
Operator::V128Store64Lane { memory, lane } => {
|
||||||
|
Some(wasm_encoder::Instruction::V128Store64Lane {
|
||||||
|
memarg: wasm_encoder::MemArg::from(*memory),
|
||||||
|
lane: *lane,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
Operator::V128Const { value } => {
|
||||||
|
Some(wasm_encoder::Instruction::V128Const(*value as i128))
|
||||||
|
}
|
||||||
|
|
||||||
|
Operator::I8x16Shuffle { lanes } => {
|
||||||
|
Some(wasm_encoder::Instruction::I8x16Shuffle(lanes.clone()))
|
||||||
|
}
|
||||||
|
|
||||||
|
Operator::I8x16ExtractLaneS { lane } => {
|
||||||
|
Some(wasm_encoder::Instruction::I8x16ExtractLaneS(*lane))
|
||||||
|
}
|
||||||
|
Operator::I8x16ExtractLaneU { lane } => {
|
||||||
|
Some(wasm_encoder::Instruction::I8x16ExtractLaneU(*lane))
|
||||||
|
}
|
||||||
|
Operator::I8x16ReplaceLane { lane } => {
|
||||||
|
Some(wasm_encoder::Instruction::I8x16ReplaceLane(*lane))
|
||||||
|
}
|
||||||
|
Operator::I16x8ExtractLaneS { lane } => {
|
||||||
|
Some(wasm_encoder::Instruction::I16x8ExtractLaneS(*lane))
|
||||||
|
}
|
||||||
|
Operator::I16x8ExtractLaneU { lane } => {
|
||||||
|
Some(wasm_encoder::Instruction::I16x8ExtractLaneU(*lane))
|
||||||
|
}
|
||||||
|
Operator::I16x8ReplaceLane { lane } => {
|
||||||
|
Some(wasm_encoder::Instruction::I16x8ReplaceLane(*lane))
|
||||||
|
}
|
||||||
|
Operator::I32x4ExtractLane { lane } => {
|
||||||
|
Some(wasm_encoder::Instruction::I32x4ExtractLane(*lane))
|
||||||
|
}
|
||||||
|
Operator::I32x4ReplaceLane { lane } => {
|
||||||
|
Some(wasm_encoder::Instruction::I32x4ReplaceLane(*lane))
|
||||||
|
}
|
||||||
|
Operator::I64x2ExtractLane { lane } => {
|
||||||
|
Some(wasm_encoder::Instruction::I64x2ExtractLane(*lane))
|
||||||
|
}
|
||||||
|
Operator::I64x2ReplaceLane { lane } => {
|
||||||
|
Some(wasm_encoder::Instruction::I64x2ReplaceLane(*lane))
|
||||||
|
}
|
||||||
|
Operator::F32x4ExtractLane { lane } => {
|
||||||
|
Some(wasm_encoder::Instruction::F32x4ExtractLane(*lane))
|
||||||
|
}
|
||||||
|
Operator::F32x4ReplaceLane { lane } => {
|
||||||
|
Some(wasm_encoder::Instruction::F32x4ReplaceLane(*lane))
|
||||||
|
}
|
||||||
|
Operator::F64x2ExtractLane { lane } => {
|
||||||
|
Some(wasm_encoder::Instruction::F64x2ExtractLane(*lane))
|
||||||
|
}
|
||||||
|
Operator::F64x2ReplaceLane { lane } => {
|
||||||
|
Some(wasm_encoder::Instruction::F64x2ReplaceLane(*lane))
|
||||||
|
}
|
||||||
|
|
||||||
|
Operator::I8x16Swizzle => Some(wasm_encoder::Instruction::I8x16Swizzle),
|
||||||
|
Operator::I8x16Splat => Some(wasm_encoder::Instruction::I8x16Splat),
|
||||||
|
Operator::I16x8Splat => Some(wasm_encoder::Instruction::I16x8Splat),
|
||||||
|
Operator::I32x4Splat => Some(wasm_encoder::Instruction::I32x4Splat),
|
||||||
|
Operator::I64x2Splat => Some(wasm_encoder::Instruction::I64x2Splat),
|
||||||
|
Operator::F32x4Splat => Some(wasm_encoder::Instruction::F32x4Splat),
|
||||||
|
Operator::F64x2Splat => Some(wasm_encoder::Instruction::F64x2Splat),
|
||||||
|
|
||||||
|
Operator::I8x16Eq => Some(wasm_encoder::Instruction::I8x16Eq),
|
||||||
|
Operator::I8x16Ne => Some(wasm_encoder::Instruction::I8x16Ne),
|
||||||
|
Operator::I8x16LtS => Some(wasm_encoder::Instruction::I8x16LtS),
|
||||||
|
Operator::I8x16LtU => Some(wasm_encoder::Instruction::I8x16LtU),
|
||||||
|
Operator::I8x16GtS => Some(wasm_encoder::Instruction::I8x16GtS),
|
||||||
|
Operator::I8x16GtU => Some(wasm_encoder::Instruction::I8x16GtU),
|
||||||
|
Operator::I8x16LeS => Some(wasm_encoder::Instruction::I8x16LeS),
|
||||||
|
Operator::I8x16LeU => Some(wasm_encoder::Instruction::I8x16LeU),
|
||||||
|
Operator::I8x16GeS => Some(wasm_encoder::Instruction::I8x16GeS),
|
||||||
|
Operator::I8x16GeU => Some(wasm_encoder::Instruction::I8x16GeU),
|
||||||
|
|
||||||
|
Operator::I16x8Eq => Some(wasm_encoder::Instruction::I16x8Eq),
|
||||||
|
Operator::I16x8Ne => Some(wasm_encoder::Instruction::I16x8Ne),
|
||||||
|
Operator::I16x8LtS => Some(wasm_encoder::Instruction::I16x8LtS),
|
||||||
|
Operator::I16x8LtU => Some(wasm_encoder::Instruction::I16x8LtU),
|
||||||
|
Operator::I16x8GtS => Some(wasm_encoder::Instruction::I16x8GtS),
|
||||||
|
Operator::I16x8GtU => Some(wasm_encoder::Instruction::I16x8GtU),
|
||||||
|
Operator::I16x8LeS => Some(wasm_encoder::Instruction::I16x8LeS),
|
||||||
|
Operator::I16x8LeU => Some(wasm_encoder::Instruction::I16x8LeU),
|
||||||
|
Operator::I16x8GeS => Some(wasm_encoder::Instruction::I16x8GeS),
|
||||||
|
Operator::I16x8GeU => Some(wasm_encoder::Instruction::I16x8GeU),
|
||||||
|
|
||||||
|
Operator::I32x4Eq => Some(wasm_encoder::Instruction::I32x4Eq),
|
||||||
|
Operator::I32x4Ne => Some(wasm_encoder::Instruction::I32x4Ne),
|
||||||
|
Operator::I32x4LtS => Some(wasm_encoder::Instruction::I32x4LtS),
|
||||||
|
Operator::I32x4LtU => Some(wasm_encoder::Instruction::I32x4LtU),
|
||||||
|
Operator::I32x4GtS => Some(wasm_encoder::Instruction::I32x4GtS),
|
||||||
|
Operator::I32x4GtU => Some(wasm_encoder::Instruction::I32x4GtU),
|
||||||
|
Operator::I32x4LeS => Some(wasm_encoder::Instruction::I32x4LeS),
|
||||||
|
Operator::I32x4LeU => Some(wasm_encoder::Instruction::I32x4LeU),
|
||||||
|
Operator::I32x4GeS => Some(wasm_encoder::Instruction::I32x4GeS),
|
||||||
|
Operator::I32x4GeU => Some(wasm_encoder::Instruction::I32x4GeU),
|
||||||
|
|
||||||
|
Operator::I64x2Eq => Some(wasm_encoder::Instruction::I64x2Eq),
|
||||||
|
Operator::I64x2Ne => Some(wasm_encoder::Instruction::I64x2Ne),
|
||||||
|
Operator::I64x2LtS => Some(wasm_encoder::Instruction::I64x2LtS),
|
||||||
|
Operator::I64x2GtS => Some(wasm_encoder::Instruction::I64x2GtS),
|
||||||
|
Operator::I64x2LeS => Some(wasm_encoder::Instruction::I64x2LeS),
|
||||||
|
Operator::I64x2GeS => Some(wasm_encoder::Instruction::I64x2GeS),
|
||||||
|
|
||||||
|
Operator::F32x4Eq => Some(wasm_encoder::Instruction::F32x4Eq),
|
||||||
|
Operator::F32x4Ne => Some(wasm_encoder::Instruction::F32x4Ne),
|
||||||
|
Operator::F32x4Lt => Some(wasm_encoder::Instruction::F32x4Lt),
|
||||||
|
Operator::F32x4Gt => Some(wasm_encoder::Instruction::F32x4Gt),
|
||||||
|
Operator::F32x4Le => Some(wasm_encoder::Instruction::F32x4Le),
|
||||||
|
Operator::F32x4Ge => Some(wasm_encoder::Instruction::F32x4Ge),
|
||||||
|
|
||||||
|
Operator::F64x2Eq => Some(wasm_encoder::Instruction::F64x2Eq),
|
||||||
|
Operator::F64x2Ne => Some(wasm_encoder::Instruction::F64x2Ne),
|
||||||
|
Operator::F64x2Lt => Some(wasm_encoder::Instruction::F64x2Lt),
|
||||||
|
Operator::F64x2Gt => Some(wasm_encoder::Instruction::F64x2Gt),
|
||||||
|
Operator::F64x2Le => Some(wasm_encoder::Instruction::F64x2Le),
|
||||||
|
Operator::F64x2Ge => Some(wasm_encoder::Instruction::F64x2Ge),
|
||||||
|
|
||||||
|
Operator::V128Not => Some(wasm_encoder::Instruction::V128Not),
|
||||||
|
Operator::V128And => Some(wasm_encoder::Instruction::V128And),
|
||||||
|
Operator::V128AndNot => Some(wasm_encoder::Instruction::V128AndNot),
|
||||||
|
Operator::V128Or => Some(wasm_encoder::Instruction::V128Or),
|
||||||
|
Operator::V128Xor => Some(wasm_encoder::Instruction::V128Xor),
|
||||||
|
Operator::V128Bitselect => Some(wasm_encoder::Instruction::V128Bitselect),
|
||||||
|
Operator::V128AnyTrue => Some(wasm_encoder::Instruction::V128AnyTrue),
|
||||||
|
|
||||||
|
Operator::I8x16Abs => Some(wasm_encoder::Instruction::I8x16Abs),
|
||||||
|
Operator::I8x16Neg => Some(wasm_encoder::Instruction::I8x16Neg),
|
||||||
|
Operator::I8x16Popcnt => Some(wasm_encoder::Instruction::I8x16Popcnt),
|
||||||
|
Operator::I8x16AllTrue => Some(wasm_encoder::Instruction::I8x16AllTrue),
|
||||||
|
Operator::I8x16Bitmask => Some(wasm_encoder::Instruction::I8x16Bitmask),
|
||||||
|
Operator::I8x16NarrowI16x8S => Some(wasm_encoder::Instruction::I8x16NarrowI16x8S),
|
||||||
|
Operator::I8x16NarrowI16x8U => Some(wasm_encoder::Instruction::I8x16NarrowI16x8U),
|
||||||
|
Operator::I8x16Shl => Some(wasm_encoder::Instruction::I8x16Shl),
|
||||||
|
Operator::I8x16ShrS => Some(wasm_encoder::Instruction::I8x16ShrS),
|
||||||
|
Operator::I8x16ShrU => Some(wasm_encoder::Instruction::I8x16ShrU),
|
||||||
|
Operator::I8x16Add => Some(wasm_encoder::Instruction::I8x16Add),
|
||||||
|
Operator::I8x16AddSatS => Some(wasm_encoder::Instruction::I8x16AddSatS),
|
||||||
|
Operator::I8x16AddSatU => Some(wasm_encoder::Instruction::I8x16AddSatU),
|
||||||
|
Operator::I8x16Sub => Some(wasm_encoder::Instruction::I8x16Sub),
|
||||||
|
Operator::I8x16SubSatS => Some(wasm_encoder::Instruction::I8x16SubSatS),
|
||||||
|
Operator::I8x16SubSatU => Some(wasm_encoder::Instruction::I8x16SubSatU),
|
||||||
|
Operator::I8x16MinS => Some(wasm_encoder::Instruction::I8x16MinS),
|
||||||
|
Operator::I8x16MinU => Some(wasm_encoder::Instruction::I8x16MinU),
|
||||||
|
Operator::I8x16MaxS => Some(wasm_encoder::Instruction::I8x16MaxS),
|
||||||
|
Operator::I8x16MaxU => Some(wasm_encoder::Instruction::I8x16MaxU),
|
||||||
|
Operator::I8x16AvgrU => Some(wasm_encoder::Instruction::I8x16AvgrU),
|
||||||
|
|
||||||
|
Operator::I16x8ExtAddPairwiseI8x16S => {
|
||||||
|
Some(wasm_encoder::Instruction::I16x8ExtAddPairwiseI8x16S)
|
||||||
|
}
|
||||||
|
Operator::I16x8ExtAddPairwiseI8x16U => {
|
||||||
|
Some(wasm_encoder::Instruction::I16x8ExtAddPairwiseI8x16U)
|
||||||
|
}
|
||||||
|
Operator::I16x8Abs => Some(wasm_encoder::Instruction::I16x8Abs),
|
||||||
|
Operator::I16x8Neg => Some(wasm_encoder::Instruction::I16x8Neg),
|
||||||
|
Operator::I16x8Q15MulrSatS => Some(wasm_encoder::Instruction::I16x8Q15MulrSatS),
|
||||||
|
Operator::I16x8AllTrue => Some(wasm_encoder::Instruction::I16x8AllTrue),
|
||||||
|
Operator::I16x8Bitmask => Some(wasm_encoder::Instruction::I16x8Bitmask),
|
||||||
|
Operator::I16x8NarrowI32x4S => Some(wasm_encoder::Instruction::I16x8NarrowI32x4S),
|
||||||
|
Operator::I16x8NarrowI32x4U => Some(wasm_encoder::Instruction::I16x8NarrowI32x4U),
|
||||||
|
Operator::I16x8ExtendLowI8x16S => Some(wasm_encoder::Instruction::I16x8ExtendLowI8x16S),
|
||||||
|
Operator::I16x8ExtendHighI8x16S => {
|
||||||
|
Some(wasm_encoder::Instruction::I16x8ExtendHighI8x16S)
|
||||||
|
}
|
||||||
|
Operator::I16x8ExtendLowI8x16U => Some(wasm_encoder::Instruction::I16x8ExtendLowI8x16U),
|
||||||
|
Operator::I16x8ExtendHighI8x16U => {
|
||||||
|
Some(wasm_encoder::Instruction::I16x8ExtendHighI8x16U)
|
||||||
|
}
|
||||||
|
Operator::I16x8Shl => Some(wasm_encoder::Instruction::I16x8Shl),
|
||||||
|
Operator::I16x8ShrS => Some(wasm_encoder::Instruction::I16x8ShrS),
|
||||||
|
Operator::I16x8ShrU => Some(wasm_encoder::Instruction::I16x8ShrU),
|
||||||
|
Operator::I16x8Add => Some(wasm_encoder::Instruction::I16x8Add),
|
||||||
|
Operator::I16x8AddSatS => Some(wasm_encoder::Instruction::I16x8AddSatS),
|
||||||
|
Operator::I16x8AddSatU => Some(wasm_encoder::Instruction::I16x8AddSatU),
|
||||||
|
Operator::I16x8Sub => Some(wasm_encoder::Instruction::I16x8Sub),
|
||||||
|
Operator::I16x8SubSatS => Some(wasm_encoder::Instruction::I16x8SubSatS),
|
||||||
|
Operator::I16x8SubSatU => Some(wasm_encoder::Instruction::I16x8SubSatU),
|
||||||
|
Operator::I16x8Mul => Some(wasm_encoder::Instruction::I16x8Mul),
|
||||||
|
Operator::I16x8MinS => Some(wasm_encoder::Instruction::I16x8MinS),
|
||||||
|
Operator::I16x8MinU => Some(wasm_encoder::Instruction::I16x8MinU),
|
||||||
|
Operator::I16x8MaxS => Some(wasm_encoder::Instruction::I16x8MaxS),
|
||||||
|
Operator::I16x8MaxU => Some(wasm_encoder::Instruction::I16x8MaxU),
|
||||||
|
Operator::I16x8AvgrU => Some(wasm_encoder::Instruction::I16x8AvgrU),
|
||||||
|
Operator::I16x8ExtMulLowI8x16S => Some(wasm_encoder::Instruction::I16x8ExtMulLowI8x16S),
|
||||||
|
Operator::I16x8ExtMulHighI8x16S => {
|
||||||
|
Some(wasm_encoder::Instruction::I16x8ExtMulHighI8x16S)
|
||||||
|
}
|
||||||
|
Operator::I16x8ExtMulLowI8x16U => Some(wasm_encoder::Instruction::I16x8ExtMulLowI8x16U),
|
||||||
|
Operator::I16x8ExtMulHighI8x16U => {
|
||||||
|
Some(wasm_encoder::Instruction::I16x8ExtMulHighI8x16U)
|
||||||
|
}
|
||||||
|
|
||||||
|
Operator::I32x4ExtAddPairwiseI16x8S => {
|
||||||
|
Some(wasm_encoder::Instruction::I32x4ExtAddPairwiseI16x8S)
|
||||||
|
}
|
||||||
|
Operator::I32x4ExtAddPairwiseI16x8U => {
|
||||||
|
Some(wasm_encoder::Instruction::I32x4ExtAddPairwiseI16x8U)
|
||||||
|
}
|
||||||
|
Operator::I32x4Abs => Some(wasm_encoder::Instruction::I32x4Abs),
|
||||||
|
Operator::I32x4Neg => Some(wasm_encoder::Instruction::I32x4Neg),
|
||||||
|
Operator::I32x4AllTrue => Some(wasm_encoder::Instruction::I32x4AllTrue),
|
||||||
|
Operator::I32x4Bitmask => Some(wasm_encoder::Instruction::I32x4Bitmask),
|
||||||
|
Operator::I32x4ExtendLowI16x8S => Some(wasm_encoder::Instruction::I32x4ExtendLowI16x8S),
|
||||||
|
Operator::I32x4ExtendHighI16x8S => {
|
||||||
|
Some(wasm_encoder::Instruction::I32x4ExtendHighI16x8S)
|
||||||
|
}
|
||||||
|
Operator::I32x4ExtendLowI16x8U => Some(wasm_encoder::Instruction::I32x4ExtendLowI16x8U),
|
||||||
|
Operator::I32x4ExtendHighI16x8U => {
|
||||||
|
Some(wasm_encoder::Instruction::I32x4ExtendHighI16x8U)
|
||||||
|
}
|
||||||
|
Operator::I32x4Shl => Some(wasm_encoder::Instruction::I32x4Shl),
|
||||||
|
Operator::I32x4ShrS => Some(wasm_encoder::Instruction::I32x4ShrS),
|
||||||
|
Operator::I32x4ShrU => Some(wasm_encoder::Instruction::I32x4ShrU),
|
||||||
|
Operator::I32x4Add => Some(wasm_encoder::Instruction::I32x4Add),
|
||||||
|
Operator::I32x4Sub => Some(wasm_encoder::Instruction::I32x4Sub),
|
||||||
|
Operator::I32x4Mul => Some(wasm_encoder::Instruction::I32x4Mul),
|
||||||
|
Operator::I32x4MinS => Some(wasm_encoder::Instruction::I32x4MinS),
|
||||||
|
Operator::I32x4MinU => Some(wasm_encoder::Instruction::I32x4MinU),
|
||||||
|
Operator::I32x4MaxS => Some(wasm_encoder::Instruction::I32x4MaxS),
|
||||||
|
Operator::I32x4MaxU => Some(wasm_encoder::Instruction::I32x4MaxU),
|
||||||
|
Operator::I32x4DotI16x8S => Some(wasm_encoder::Instruction::I32x4DotI16x8S),
|
||||||
|
Operator::I32x4ExtMulLowI16x8S => Some(wasm_encoder::Instruction::I32x4ExtMulLowI16x8S),
|
||||||
|
Operator::I32x4ExtMulHighI16x8S => {
|
||||||
|
Some(wasm_encoder::Instruction::I32x4ExtMulHighI16x8S)
|
||||||
|
}
|
||||||
|
Operator::I32x4ExtMulLowI16x8U => Some(wasm_encoder::Instruction::I32x4ExtMulLowI16x8U),
|
||||||
|
Operator::I32x4ExtMulHighI16x8U => {
|
||||||
|
Some(wasm_encoder::Instruction::I32x4ExtMulHighI16x8U)
|
||||||
|
}
|
||||||
|
|
||||||
|
Operator::I64x2Abs => Some(wasm_encoder::Instruction::I64x2Abs),
|
||||||
|
Operator::I64x2Neg => Some(wasm_encoder::Instruction::I64x2Neg),
|
||||||
|
Operator::I64x2AllTrue => Some(wasm_encoder::Instruction::I64x2AllTrue),
|
||||||
|
Operator::I64x2Bitmask => Some(wasm_encoder::Instruction::I64x2Bitmask),
|
||||||
|
Operator::I64x2ExtendLowI32x4S => Some(wasm_encoder::Instruction::I64x2ExtendLowI32x4S),
|
||||||
|
Operator::I64x2ExtendHighI32x4S => {
|
||||||
|
Some(wasm_encoder::Instruction::I64x2ExtendHighI32x4S)
|
||||||
|
}
|
||||||
|
Operator::I64x2ExtendLowI32x4U => Some(wasm_encoder::Instruction::I64x2ExtendLowI32x4U),
|
||||||
|
Operator::I64x2ExtendHighI32x4U => {
|
||||||
|
Some(wasm_encoder::Instruction::I64x2ExtendHighI32x4U)
|
||||||
|
}
|
||||||
|
Operator::I64x2Shl => Some(wasm_encoder::Instruction::I64x2Shl),
|
||||||
|
Operator::I64x2ShrS => Some(wasm_encoder::Instruction::I64x2ShrS),
|
||||||
|
Operator::I64x2ShrU => Some(wasm_encoder::Instruction::I64x2ShrU),
|
||||||
|
Operator::I64x2Add => Some(wasm_encoder::Instruction::I64x2Add),
|
||||||
|
Operator::I64x2Sub => Some(wasm_encoder::Instruction::I64x2Sub),
|
||||||
|
Operator::I64x2Mul => Some(wasm_encoder::Instruction::I64x2Mul),
|
||||||
|
Operator::I64x2ExtMulLowI32x4S => Some(wasm_encoder::Instruction::I64x2ExtMulLowI32x4S),
|
||||||
|
Operator::I64x2ExtMulHighI32x4S => {
|
||||||
|
Some(wasm_encoder::Instruction::I64x2ExtMulHighI32x4S)
|
||||||
|
}
|
||||||
|
Operator::I64x2ExtMulLowI32x4U => Some(wasm_encoder::Instruction::I64x2ExtMulLowI32x4U),
|
||||||
|
Operator::I64x2ExtMulHighI32x4U => {
|
||||||
|
Some(wasm_encoder::Instruction::I64x2ExtMulHighI32x4U)
|
||||||
|
}
|
||||||
|
|
||||||
|
Operator::F32x4Ceil => Some(wasm_encoder::Instruction::F32x4Ceil),
|
||||||
|
Operator::F32x4Floor => Some(wasm_encoder::Instruction::F32x4Floor),
|
||||||
|
Operator::F32x4Trunc => Some(wasm_encoder::Instruction::F32x4Trunc),
|
||||||
|
Operator::F32x4Nearest => Some(wasm_encoder::Instruction::F32x4Nearest),
|
||||||
|
Operator::F32x4Abs => Some(wasm_encoder::Instruction::F32x4Abs),
|
||||||
|
Operator::F32x4Neg => Some(wasm_encoder::Instruction::F32x4Neg),
|
||||||
|
Operator::F32x4Sqrt => Some(wasm_encoder::Instruction::F32x4Sqrt),
|
||||||
|
Operator::F32x4Add => Some(wasm_encoder::Instruction::F32x4Add),
|
||||||
|
Operator::F32x4Sub => Some(wasm_encoder::Instruction::F32x4Sub),
|
||||||
|
Operator::F32x4Mul => Some(wasm_encoder::Instruction::F32x4Mul),
|
||||||
|
Operator::F32x4Div => Some(wasm_encoder::Instruction::F32x4Div),
|
||||||
|
Operator::F32x4Min => Some(wasm_encoder::Instruction::F32x4Min),
|
||||||
|
Operator::F32x4Max => Some(wasm_encoder::Instruction::F32x4Max),
|
||||||
|
Operator::F32x4PMin => Some(wasm_encoder::Instruction::F32x4PMin),
|
||||||
|
Operator::F32x4PMax => Some(wasm_encoder::Instruction::F32x4PMax),
|
||||||
|
|
||||||
|
Operator::F64x2Ceil => Some(wasm_encoder::Instruction::F64x2Ceil),
|
||||||
|
Operator::F64x2Floor => Some(wasm_encoder::Instruction::F64x2Floor),
|
||||||
|
Operator::F64x2Trunc => Some(wasm_encoder::Instruction::F64x2Trunc),
|
||||||
|
Operator::F64x2Nearest => Some(wasm_encoder::Instruction::F64x2Nearest),
|
||||||
|
Operator::F64x2Abs => Some(wasm_encoder::Instruction::F64x2Abs),
|
||||||
|
Operator::F64x2Neg => Some(wasm_encoder::Instruction::F64x2Neg),
|
||||||
|
Operator::F64x2Sqrt => Some(wasm_encoder::Instruction::F64x2Sqrt),
|
||||||
|
Operator::F64x2Add => Some(wasm_encoder::Instruction::F64x2Add),
|
||||||
|
Operator::F64x2Sub => Some(wasm_encoder::Instruction::F64x2Sub),
|
||||||
|
Operator::F64x2Mul => Some(wasm_encoder::Instruction::F64x2Mul),
|
||||||
|
Operator::F64x2Div => Some(wasm_encoder::Instruction::F64x2Div),
|
||||||
|
Operator::F64x2Min => Some(wasm_encoder::Instruction::F64x2Min),
|
||||||
|
Operator::F64x2Max => Some(wasm_encoder::Instruction::F64x2Max),
|
||||||
|
Operator::F64x2PMin => Some(wasm_encoder::Instruction::F64x2PMin),
|
||||||
|
Operator::F64x2PMax => Some(wasm_encoder::Instruction::F64x2PMax),
|
||||||
|
|
||||||
|
Operator::I32x4TruncSatF32x4S => Some(wasm_encoder::Instruction::I32x4TruncSatF32x4S),
|
||||||
|
Operator::I32x4TruncSatF32x4U => Some(wasm_encoder::Instruction::I32x4TruncSatF32x4U),
|
||||||
|
|
||||||
|
Operator::F32x4ConvertI32x4S => Some(wasm_encoder::Instruction::F32x4ConvertI32x4S),
|
||||||
|
Operator::F32x4ConvertI32x4U => Some(wasm_encoder::Instruction::F32x4ConvertI32x4U),
|
||||||
|
Operator::I32x4TruncSatF64x2SZero => {
|
||||||
|
Some(wasm_encoder::Instruction::I32x4TruncSatF64x2SZero)
|
||||||
|
}
|
||||||
|
Operator::I32x4TruncSatF64x2UZero => {
|
||||||
|
Some(wasm_encoder::Instruction::I32x4TruncSatF64x2UZero)
|
||||||
|
}
|
||||||
|
Operator::F64x2ConvertLowI32x4S => {
|
||||||
|
Some(wasm_encoder::Instruction::F64x2ConvertLowI32x4S)
|
||||||
|
}
|
||||||
|
Operator::F64x2ConvertLowI32x4U => {
|
||||||
|
Some(wasm_encoder::Instruction::F64x2ConvertLowI32x4U)
|
||||||
|
}
|
||||||
|
Operator::F32x4DemoteF64x2Zero => Some(wasm_encoder::Instruction::F32x4DemoteF64x2Zero),
|
||||||
|
Operator::F64x2PromoteLowF32x4 => Some(wasm_encoder::Instruction::F64x2PromoteLowF32x4),
|
||||||
|
|
||||||
|
Operator::CallRef { sig_index } => {
|
||||||
|
Some(wasm_encoder::Instruction::CallRef(sig_index.index() as u32))
|
||||||
|
}
|
||||||
|
Operator::RefFunc { func_index } => {
|
||||||
|
Some(wasm_encoder::Instruction::RefFunc(func_index.index() as u32))
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(inst) = inst {
|
if let Some(inst) = inst {
|
||||||
|
@ -583,12 +985,12 @@ pub fn compile(module: &Module<'_>) -> anyhow::Result<wasm_encoder::Module> {
|
||||||
num_table_imports += 1;
|
num_table_imports += 1;
|
||||||
let table = &module.tables[table];
|
let table = &module.tables[table];
|
||||||
wasm_encoder::EntityType::Table(wasm_encoder::TableType {
|
wasm_encoder::EntityType::Table(wasm_encoder::TableType {
|
||||||
element_type: wasm_encoder::ValType::from(table.ty),
|
element_type: wasm_encoder::RefType::from(table.ty),
|
||||||
minimum: table
|
minimum: table
|
||||||
.func_elements
|
.func_elements
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|elts| elts.len() as u32)
|
.map(|elts| elts.len() as u32)
|
||||||
.unwrap_or(0),
|
.unwrap_or(table.initial),
|
||||||
maximum: table.max,
|
maximum: table.max,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -633,7 +1035,7 @@ pub fn compile(module: &Module<'_>) -> anyhow::Result<wasm_encoder::Module> {
|
||||||
let mut tables = wasm_encoder::TableSection::new();
|
let mut tables = wasm_encoder::TableSection::new();
|
||||||
for table_data in module.tables.values().skip(num_table_imports) {
|
for table_data in module.tables.values().skip(num_table_imports) {
|
||||||
tables.table(wasm_encoder::TableType {
|
tables.table(wasm_encoder::TableType {
|
||||||
element_type: wasm_encoder::ValType::from(table_data.ty),
|
element_type: wasm_encoder::RefType::from(table_data.ty),
|
||||||
minimum: table_data
|
minimum: table_data
|
||||||
.func_elements
|
.func_elements
|
||||||
.as_ref()
|
.as_ref()
|
||||||
|
@ -714,12 +1116,26 @@ pub fn compile(module: &Module<'_>) -> anyhow::Result<wasm_encoder::Module> {
|
||||||
if let Some(elts) = &table_data.func_elements {
|
if let Some(elts) = &table_data.func_elements {
|
||||||
for (i, &elt) in elts.iter().enumerate() {
|
for (i, &elt) in elts.iter().enumerate() {
|
||||||
if elt.is_valid() {
|
if elt.is_valid() {
|
||||||
elem.active(
|
match table_data.ty {
|
||||||
Some(table.index() as u32),
|
Type::FuncRef => {
|
||||||
&wasm_encoder::ConstExpr::i32_const(i as i32),
|
elem.active(
|
||||||
wasm_encoder::ValType::FuncRef,
|
Some(table.index() as u32),
|
||||||
wasm_encoder::Elements::Functions(&[elt.index() as u32]),
|
&wasm_encoder::ConstExpr::i32_const(i as i32),
|
||||||
);
|
wasm_encoder::Elements::Functions(&[elt.index() as u32]),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Type::TypedFuncRef(..) => {
|
||||||
|
elem.active(
|
||||||
|
Some(table.index() as u32),
|
||||||
|
&wasm_encoder::ConstExpr::i32_const(i as i32),
|
||||||
|
wasm_encoder::Elements::Expressions(
|
||||||
|
table_data.ty.into(),
|
||||||
|
&[wasm_encoder::ConstExpr::ref_func(elt.index() as u32)],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
_ => unreachable!(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
331
src/frontend.rs
331
src/frontend.rs
|
@ -96,10 +96,17 @@ fn handle_payload<'a>(
|
||||||
trace!("Wasm parser item: {:?}", payload);
|
trace!("Wasm parser item: {:?}", payload);
|
||||||
match payload {
|
match payload {
|
||||||
Payload::TypeSection(reader) => {
|
Payload::TypeSection(reader) => {
|
||||||
for ty in reader {
|
for rec_group in reader {
|
||||||
let ty = ty?;
|
for ty in rec_group?.into_types() {
|
||||||
let wasmparser::Type::Func(fty) = ty;
|
match &ty.composite_type {
|
||||||
module.signatures.push(fty.into());
|
wasmparser::CompositeType::Func(fty) => {
|
||||||
|
module.signatures.push(fty.into());
|
||||||
|
}
|
||||||
|
_ => bail!(FrontendError::UnsupportedFeature(
|
||||||
|
"non-function type in type section".into()
|
||||||
|
)),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Payload::ImportSection(reader) => {
|
Payload::ImportSection(reader) => {
|
||||||
|
@ -126,7 +133,11 @@ fn handle_payload<'a>(
|
||||||
ImportKind::Global(global)
|
ImportKind::Global(global)
|
||||||
}
|
}
|
||||||
TypeRef::Table(ty) => {
|
TypeRef::Table(ty) => {
|
||||||
let table = module.frontend_add_table(ty.element_type.into(), None);
|
let table = module.frontend_add_table(
|
||||||
|
ty.element_type.into(),
|
||||||
|
ty.initial,
|
||||||
|
ty.maximum,
|
||||||
|
);
|
||||||
ImportKind::Table(table)
|
ImportKind::Table(table)
|
||||||
}
|
}
|
||||||
TypeRef::Memory(mem) => {
|
TypeRef::Memory(mem) => {
|
||||||
|
@ -167,7 +178,11 @@ fn handle_payload<'a>(
|
||||||
Payload::TableSection(reader) => {
|
Payload::TableSection(reader) => {
|
||||||
for table in reader {
|
for table in reader {
|
||||||
let table = table?;
|
let table = table?;
|
||||||
module.frontend_add_table(table.element_type.into(), table.maximum);
|
module.frontend_add_table(
|
||||||
|
table.ty.element_type.into(),
|
||||||
|
table.ty.initial,
|
||||||
|
table.ty.maximum,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Payload::FunctionSection(reader) => {
|
Payload::FunctionSection(reader) => {
|
||||||
|
@ -237,7 +252,7 @@ fn handle_payload<'a>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Payload::CustomSection(reader) if reader.name() == "name" => {
|
Payload::CustomSection(reader) if reader.name() == "name" => {
|
||||||
let name_reader = NameSectionReader::new(reader.data(), reader.data_offset())?;
|
let name_reader = NameSectionReader::new(reader.data(), reader.data_offset());
|
||||||
for subsection in name_reader {
|
for subsection in name_reader {
|
||||||
let subsection = subsection?;
|
let subsection = subsection?;
|
||||||
match subsection {
|
match subsection {
|
||||||
|
@ -306,12 +321,6 @@ fn handle_payload<'a>(
|
||||||
Payload::ElementSection(reader) => {
|
Payload::ElementSection(reader) => {
|
||||||
for element in reader {
|
for element in reader {
|
||||||
let element = element?;
|
let element = element?;
|
||||||
if element.ty != wasmparser::ValType::FuncRef {
|
|
||||||
bail!(FrontendError::UnsupportedFeature(format!(
|
|
||||||
"Unsupported table type: {:?}",
|
|
||||||
element.ty
|
|
||||||
)));
|
|
||||||
}
|
|
||||||
match &element.kind {
|
match &element.kind {
|
||||||
wasmparser::ElementKind::Passive => {}
|
wasmparser::ElementKind::Passive => {}
|
||||||
wasmparser::ElementKind::Declared => {}
|
wasmparser::ElementKind::Declared => {}
|
||||||
|
@ -319,24 +328,41 @@ fn handle_payload<'a>(
|
||||||
table_index,
|
table_index,
|
||||||
offset_expr,
|
offset_expr,
|
||||||
} => {
|
} => {
|
||||||
let table = Table::from(*table_index);
|
let table = Table::from(table_index.unwrap_or(0));
|
||||||
let offset = parse_init_expr(&offset_expr)?.unwrap_or(0) as usize;
|
let offset = parse_init_expr(&offset_expr)?.unwrap_or(0) as usize;
|
||||||
let items = element
|
let funcs = match element.items {
|
||||||
.items
|
wasmparser::ElementItems::Functions(items) => {
|
||||||
.get_items_reader()?
|
let mut funcs = vec![];
|
||||||
.into_iter()
|
for item in items {
|
||||||
.collect::<Result<Vec<_>, _>>()?;
|
let item = item?;
|
||||||
let mut funcs = vec![];
|
let func = Func::from(item);
|
||||||
for item in items {
|
funcs.push(func);
|
||||||
let func = match item {
|
}
|
||||||
wasmparser::ElementItem::Func(func_idx) => Func::from(func_idx),
|
funcs
|
||||||
_ => bail!(FrontendError::UnsupportedFeature(format!(
|
}
|
||||||
"Unsupported element item: {:?}",
|
wasmparser::ElementItems::Expressions(_, const_exprs) => {
|
||||||
item
|
let mut funcs = vec![];
|
||||||
))),
|
for const_expr in const_exprs {
|
||||||
};
|
let const_expr = const_expr?;
|
||||||
funcs.push(func);
|
let mut func = None;
|
||||||
}
|
for op in const_expr.get_operators_reader() {
|
||||||
|
let op = op?;
|
||||||
|
match op {
|
||||||
|
wasmparser::Operator::End => {}
|
||||||
|
wasmparser::Operator::RefFunc { function_index } => {
|
||||||
|
func = Some(Func::from(function_index));
|
||||||
|
}
|
||||||
|
wasmparser::Operator::RefNull { .. } => {
|
||||||
|
func = Some(Func::invalid());
|
||||||
|
}
|
||||||
|
_ => panic!("Unsupported table-init op: {:?}", op),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
funcs.push(func.unwrap_or(Func::invalid()));
|
||||||
|
}
|
||||||
|
funcs
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
let table_items = module.tables[table].func_elements.as_mut().unwrap();
|
let table_items = module.tables[table].func_elements.as_mut().unwrap();
|
||||||
let new_size = offset.checked_add(funcs.len()).ok_or_else(|| {
|
let new_size = offset.checked_add(funcs.len()).ok_or_else(|| {
|
||||||
|
@ -683,6 +709,11 @@ impl LocalTracker {
|
||||||
ListRef::default(),
|
ListRef::default(),
|
||||||
types,
|
types,
|
||||||
)),
|
)),
|
||||||
|
Type::V128 => body.add_value(ValueDef::Operator(
|
||||||
|
Operator::V128Const { value: 0 },
|
||||||
|
ListRef::default(),
|
||||||
|
types,
|
||||||
|
)),
|
||||||
_ => todo!("unsupported type: {:?}", ty),
|
_ => todo!("unsupported type: {:?}", ty),
|
||||||
};
|
};
|
||||||
body.append_to_block(at_block, val);
|
body.append_to_block(at_block, val);
|
||||||
|
@ -1157,7 +1188,245 @@ impl<'a, 'b> FunctionBodyBuilder<'a, 'b> {
|
||||||
| wasmparser::Operator::TableGrow { .. }
|
| wasmparser::Operator::TableGrow { .. }
|
||||||
| wasmparser::Operator::TableSize { .. }
|
| wasmparser::Operator::TableSize { .. }
|
||||||
| wasmparser::Operator::MemoryCopy { .. }
|
| wasmparser::Operator::MemoryCopy { .. }
|
||||||
| wasmparser::Operator::MemoryFill { .. } => {
|
| wasmparser::Operator::MemoryFill { .. }
|
||||||
|
| wasmparser::Operator::V128Load { .. }
|
||||||
|
| wasmparser::Operator::V128Load8x8S { .. }
|
||||||
|
| wasmparser::Operator::V128Load8x8U { .. }
|
||||||
|
| wasmparser::Operator::V128Load16x4S { .. }
|
||||||
|
| wasmparser::Operator::V128Load16x4U { .. }
|
||||||
|
| wasmparser::Operator::V128Load32x2S { .. }
|
||||||
|
| wasmparser::Operator::V128Load32x2U { .. }
|
||||||
|
| wasmparser::Operator::V128Load8Splat { .. }
|
||||||
|
| wasmparser::Operator::V128Load16Splat { .. }
|
||||||
|
| wasmparser::Operator::V128Load32Splat { .. }
|
||||||
|
| wasmparser::Operator::V128Load64Splat { .. }
|
||||||
|
| wasmparser::Operator::V128Load32Zero { .. }
|
||||||
|
| wasmparser::Operator::V128Load64Zero { .. }
|
||||||
|
| wasmparser::Operator::V128Store { .. }
|
||||||
|
| wasmparser::Operator::V128Load8Lane { .. }
|
||||||
|
| wasmparser::Operator::V128Load16Lane { .. }
|
||||||
|
| wasmparser::Operator::V128Load32Lane { .. }
|
||||||
|
| wasmparser::Operator::V128Load64Lane { .. }
|
||||||
|
| wasmparser::Operator::V128Store8Lane { .. }
|
||||||
|
| wasmparser::Operator::V128Store16Lane { .. }
|
||||||
|
| wasmparser::Operator::V128Store32Lane { .. }
|
||||||
|
| wasmparser::Operator::V128Store64Lane { .. }
|
||||||
|
| wasmparser::Operator::V128Const { .. }
|
||||||
|
| wasmparser::Operator::I8x16Shuffle { .. }
|
||||||
|
| wasmparser::Operator::I8x16ExtractLaneS { .. }
|
||||||
|
| wasmparser::Operator::I8x16ExtractLaneU { .. }
|
||||||
|
| wasmparser::Operator::I8x16ReplaceLane { .. }
|
||||||
|
| wasmparser::Operator::I16x8ExtractLaneS { .. }
|
||||||
|
| wasmparser::Operator::I16x8ExtractLaneU { .. }
|
||||||
|
| wasmparser::Operator::I16x8ReplaceLane { .. }
|
||||||
|
| wasmparser::Operator::I32x4ExtractLane { .. }
|
||||||
|
| wasmparser::Operator::I32x4ReplaceLane { .. }
|
||||||
|
| wasmparser::Operator::I64x2ExtractLane { .. }
|
||||||
|
| wasmparser::Operator::I64x2ReplaceLane { .. }
|
||||||
|
| wasmparser::Operator::F32x4ExtractLane { .. }
|
||||||
|
| wasmparser::Operator::F32x4ReplaceLane { .. }
|
||||||
|
| wasmparser::Operator::F64x2ExtractLane { .. }
|
||||||
|
| wasmparser::Operator::F64x2ReplaceLane { .. }
|
||||||
|
| wasmparser::Operator::I8x16Swizzle
|
||||||
|
| wasmparser::Operator::I8x16Splat
|
||||||
|
| wasmparser::Operator::I16x8Splat
|
||||||
|
| wasmparser::Operator::I32x4Splat
|
||||||
|
| wasmparser::Operator::I64x2Splat
|
||||||
|
| wasmparser::Operator::F32x4Splat
|
||||||
|
| wasmparser::Operator::F64x2Splat
|
||||||
|
| wasmparser::Operator::I8x16Eq
|
||||||
|
| wasmparser::Operator::I8x16Ne
|
||||||
|
| wasmparser::Operator::I8x16LtS
|
||||||
|
| wasmparser::Operator::I8x16LtU
|
||||||
|
| wasmparser::Operator::I8x16GtS
|
||||||
|
| wasmparser::Operator::I8x16GtU
|
||||||
|
| wasmparser::Operator::I8x16LeS
|
||||||
|
| wasmparser::Operator::I8x16LeU
|
||||||
|
| wasmparser::Operator::I8x16GeS
|
||||||
|
| wasmparser::Operator::I8x16GeU
|
||||||
|
| wasmparser::Operator::I16x8Eq
|
||||||
|
| wasmparser::Operator::I16x8Ne
|
||||||
|
| wasmparser::Operator::I16x8LtS
|
||||||
|
| wasmparser::Operator::I16x8LtU
|
||||||
|
| wasmparser::Operator::I16x8GtS
|
||||||
|
| wasmparser::Operator::I16x8GtU
|
||||||
|
| wasmparser::Operator::I16x8LeS
|
||||||
|
| wasmparser::Operator::I16x8LeU
|
||||||
|
| wasmparser::Operator::I16x8GeS
|
||||||
|
| wasmparser::Operator::I16x8GeU
|
||||||
|
| wasmparser::Operator::I32x4Eq
|
||||||
|
| wasmparser::Operator::I32x4Ne
|
||||||
|
| wasmparser::Operator::I32x4LtS
|
||||||
|
| wasmparser::Operator::I32x4LtU
|
||||||
|
| wasmparser::Operator::I32x4GtS
|
||||||
|
| wasmparser::Operator::I32x4GtU
|
||||||
|
| wasmparser::Operator::I32x4LeS
|
||||||
|
| wasmparser::Operator::I32x4LeU
|
||||||
|
| wasmparser::Operator::I32x4GeS
|
||||||
|
| wasmparser::Operator::I32x4GeU
|
||||||
|
| wasmparser::Operator::I64x2Eq
|
||||||
|
| wasmparser::Operator::I64x2Ne
|
||||||
|
| wasmparser::Operator::I64x2LtS
|
||||||
|
| wasmparser::Operator::I64x2GtS
|
||||||
|
| wasmparser::Operator::I64x2LeS
|
||||||
|
| wasmparser::Operator::I64x2GeS
|
||||||
|
| wasmparser::Operator::F32x4Eq
|
||||||
|
| wasmparser::Operator::F32x4Ne
|
||||||
|
| wasmparser::Operator::F32x4Lt
|
||||||
|
| wasmparser::Operator::F32x4Gt
|
||||||
|
| wasmparser::Operator::F32x4Le
|
||||||
|
| wasmparser::Operator::F32x4Ge
|
||||||
|
| wasmparser::Operator::F64x2Eq
|
||||||
|
| wasmparser::Operator::F64x2Ne
|
||||||
|
| wasmparser::Operator::F64x2Lt
|
||||||
|
| wasmparser::Operator::F64x2Gt
|
||||||
|
| wasmparser::Operator::F64x2Le
|
||||||
|
| wasmparser::Operator::F64x2Ge
|
||||||
|
| wasmparser::Operator::V128Not
|
||||||
|
| wasmparser::Operator::V128And
|
||||||
|
| wasmparser::Operator::V128AndNot
|
||||||
|
| wasmparser::Operator::V128Or
|
||||||
|
| wasmparser::Operator::V128Xor
|
||||||
|
| wasmparser::Operator::V128Bitselect
|
||||||
|
| wasmparser::Operator::V128AnyTrue
|
||||||
|
| wasmparser::Operator::I8x16Abs
|
||||||
|
| wasmparser::Operator::I8x16Neg
|
||||||
|
| wasmparser::Operator::I8x16Popcnt
|
||||||
|
| wasmparser::Operator::I8x16AllTrue
|
||||||
|
| wasmparser::Operator::I8x16Bitmask
|
||||||
|
| wasmparser::Operator::I8x16NarrowI16x8S
|
||||||
|
| wasmparser::Operator::I8x16NarrowI16x8U
|
||||||
|
| wasmparser::Operator::I8x16Shl
|
||||||
|
| wasmparser::Operator::I8x16ShrS
|
||||||
|
| wasmparser::Operator::I8x16ShrU
|
||||||
|
| wasmparser::Operator::I8x16Add
|
||||||
|
| wasmparser::Operator::I8x16AddSatS
|
||||||
|
| wasmparser::Operator::I8x16AddSatU
|
||||||
|
| wasmparser::Operator::I8x16Sub
|
||||||
|
| wasmparser::Operator::I8x16SubSatS
|
||||||
|
| wasmparser::Operator::I8x16SubSatU
|
||||||
|
| wasmparser::Operator::I8x16MinS
|
||||||
|
| wasmparser::Operator::I8x16MinU
|
||||||
|
| wasmparser::Operator::I8x16MaxS
|
||||||
|
| wasmparser::Operator::I8x16MaxU
|
||||||
|
| wasmparser::Operator::I8x16AvgrU
|
||||||
|
| wasmparser::Operator::I16x8ExtAddPairwiseI8x16S
|
||||||
|
| wasmparser::Operator::I16x8ExtAddPairwiseI8x16U
|
||||||
|
| wasmparser::Operator::I16x8Abs
|
||||||
|
| wasmparser::Operator::I16x8Neg
|
||||||
|
| wasmparser::Operator::I16x8Q15MulrSatS
|
||||||
|
| wasmparser::Operator::I16x8AllTrue
|
||||||
|
| wasmparser::Operator::I16x8Bitmask
|
||||||
|
| wasmparser::Operator::I16x8NarrowI32x4S
|
||||||
|
| wasmparser::Operator::I16x8NarrowI32x4U
|
||||||
|
| wasmparser::Operator::I16x8ExtendLowI8x16S
|
||||||
|
| wasmparser::Operator::I16x8ExtendHighI8x16S
|
||||||
|
| wasmparser::Operator::I16x8ExtendLowI8x16U
|
||||||
|
| wasmparser::Operator::I16x8ExtendHighI8x16U
|
||||||
|
| wasmparser::Operator::I16x8Shl
|
||||||
|
| wasmparser::Operator::I16x8ShrS
|
||||||
|
| wasmparser::Operator::I16x8ShrU
|
||||||
|
| wasmparser::Operator::I16x8Add
|
||||||
|
| wasmparser::Operator::I16x8AddSatS
|
||||||
|
| wasmparser::Operator::I16x8AddSatU
|
||||||
|
| wasmparser::Operator::I16x8Sub
|
||||||
|
| wasmparser::Operator::I16x8SubSatS
|
||||||
|
| wasmparser::Operator::I16x8SubSatU
|
||||||
|
| wasmparser::Operator::I16x8Mul
|
||||||
|
| wasmparser::Operator::I16x8MinS
|
||||||
|
| wasmparser::Operator::I16x8MinU
|
||||||
|
| wasmparser::Operator::I16x8MaxS
|
||||||
|
| wasmparser::Operator::I16x8MaxU
|
||||||
|
| wasmparser::Operator::I16x8AvgrU
|
||||||
|
| wasmparser::Operator::I16x8ExtMulLowI8x16S
|
||||||
|
| wasmparser::Operator::I16x8ExtMulHighI8x16S
|
||||||
|
| wasmparser::Operator::I16x8ExtMulLowI8x16U
|
||||||
|
| wasmparser::Operator::I16x8ExtMulHighI8x16U
|
||||||
|
| wasmparser::Operator::I32x4ExtAddPairwiseI16x8S
|
||||||
|
| wasmparser::Operator::I32x4ExtAddPairwiseI16x8U
|
||||||
|
| wasmparser::Operator::I32x4Abs
|
||||||
|
| wasmparser::Operator::I32x4Neg
|
||||||
|
| wasmparser::Operator::I32x4AllTrue
|
||||||
|
| wasmparser::Operator::I32x4Bitmask
|
||||||
|
| wasmparser::Operator::I32x4ExtendLowI16x8S
|
||||||
|
| wasmparser::Operator::I32x4ExtendHighI16x8S
|
||||||
|
| wasmparser::Operator::I32x4ExtendLowI16x8U
|
||||||
|
| wasmparser::Operator::I32x4ExtendHighI16x8U
|
||||||
|
| wasmparser::Operator::I32x4Shl
|
||||||
|
| wasmparser::Operator::I32x4ShrS
|
||||||
|
| wasmparser::Operator::I32x4ShrU
|
||||||
|
| wasmparser::Operator::I32x4Add
|
||||||
|
| wasmparser::Operator::I32x4Sub
|
||||||
|
| wasmparser::Operator::I32x4Mul
|
||||||
|
| wasmparser::Operator::I32x4MinS
|
||||||
|
| wasmparser::Operator::I32x4MinU
|
||||||
|
| wasmparser::Operator::I32x4MaxS
|
||||||
|
| wasmparser::Operator::I32x4MaxU
|
||||||
|
| wasmparser::Operator::I32x4DotI16x8S
|
||||||
|
| wasmparser::Operator::I32x4ExtMulLowI16x8S
|
||||||
|
| wasmparser::Operator::I32x4ExtMulHighI16x8S
|
||||||
|
| wasmparser::Operator::I32x4ExtMulLowI16x8U
|
||||||
|
| wasmparser::Operator::I32x4ExtMulHighI16x8U
|
||||||
|
| wasmparser::Operator::I64x2Abs
|
||||||
|
| wasmparser::Operator::I64x2Neg
|
||||||
|
| wasmparser::Operator::I64x2AllTrue
|
||||||
|
| wasmparser::Operator::I64x2Bitmask
|
||||||
|
| wasmparser::Operator::I64x2ExtendLowI32x4S
|
||||||
|
| wasmparser::Operator::I64x2ExtendHighI32x4S
|
||||||
|
| wasmparser::Operator::I64x2ExtendLowI32x4U
|
||||||
|
| wasmparser::Operator::I64x2ExtendHighI32x4U
|
||||||
|
| wasmparser::Operator::I64x2Shl
|
||||||
|
| wasmparser::Operator::I64x2ShrS
|
||||||
|
| wasmparser::Operator::I64x2ShrU
|
||||||
|
| wasmparser::Operator::I64x2Add
|
||||||
|
| wasmparser::Operator::I64x2Sub
|
||||||
|
| wasmparser::Operator::I64x2Mul
|
||||||
|
| wasmparser::Operator::I64x2ExtMulLowI32x4S
|
||||||
|
| wasmparser::Operator::I64x2ExtMulHighI32x4S
|
||||||
|
| wasmparser::Operator::I64x2ExtMulLowI32x4U
|
||||||
|
| wasmparser::Operator::I64x2ExtMulHighI32x4U
|
||||||
|
| wasmparser::Operator::F32x4Ceil
|
||||||
|
| wasmparser::Operator::F32x4Floor
|
||||||
|
| wasmparser::Operator::F32x4Trunc
|
||||||
|
| wasmparser::Operator::F32x4Nearest
|
||||||
|
| wasmparser::Operator::F32x4Abs
|
||||||
|
| wasmparser::Operator::F32x4Neg
|
||||||
|
| wasmparser::Operator::F32x4Sqrt
|
||||||
|
| wasmparser::Operator::F32x4Add
|
||||||
|
| wasmparser::Operator::F32x4Sub
|
||||||
|
| wasmparser::Operator::F32x4Mul
|
||||||
|
| wasmparser::Operator::F32x4Div
|
||||||
|
| wasmparser::Operator::F32x4Min
|
||||||
|
| wasmparser::Operator::F32x4Max
|
||||||
|
| wasmparser::Operator::F32x4PMin
|
||||||
|
| wasmparser::Operator::F32x4PMax
|
||||||
|
| wasmparser::Operator::F64x2Ceil
|
||||||
|
| wasmparser::Operator::F64x2Floor
|
||||||
|
| wasmparser::Operator::F64x2Trunc
|
||||||
|
| wasmparser::Operator::F64x2Nearest
|
||||||
|
| wasmparser::Operator::F64x2Abs
|
||||||
|
| wasmparser::Operator::F64x2Neg
|
||||||
|
| wasmparser::Operator::F64x2Sqrt
|
||||||
|
| wasmparser::Operator::F64x2Add
|
||||||
|
| wasmparser::Operator::F64x2Sub
|
||||||
|
| wasmparser::Operator::F64x2Mul
|
||||||
|
| wasmparser::Operator::F64x2Div
|
||||||
|
| wasmparser::Operator::F64x2Min
|
||||||
|
| wasmparser::Operator::F64x2Max
|
||||||
|
| wasmparser::Operator::F64x2PMin
|
||||||
|
| wasmparser::Operator::F64x2PMax
|
||||||
|
| wasmparser::Operator::I32x4TruncSatF32x4S
|
||||||
|
| wasmparser::Operator::I32x4TruncSatF32x4U
|
||||||
|
| wasmparser::Operator::F32x4ConvertI32x4S
|
||||||
|
| wasmparser::Operator::F32x4ConvertI32x4U
|
||||||
|
| wasmparser::Operator::I32x4TruncSatF64x2SZero
|
||||||
|
| wasmparser::Operator::I32x4TruncSatF64x2UZero
|
||||||
|
| wasmparser::Operator::F64x2ConvertLowI32x4S
|
||||||
|
| wasmparser::Operator::F64x2ConvertLowI32x4U
|
||||||
|
| wasmparser::Operator::F32x4DemoteF64x2Zero
|
||||||
|
| wasmparser::Operator::F64x2PromoteLowF32x4
|
||||||
|
| wasmparser::Operator::CallRef { .. }
|
||||||
|
| wasmparser::Operator::RefFunc { .. } => {
|
||||||
self.emit(Operator::try_from(&op).unwrap(), loc)?
|
self.emit(Operator::try_from(&op).unwrap(), loc)?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
206
src/fuzzing.rs
206
src/fuzzing.rs
|
@ -1,111 +1,111 @@
|
||||||
//! Fuzzing-specific utilities.
|
//! Fuzzing-specific utilities.
|
||||||
|
|
||||||
use libfuzzer_sys::arbitrary;
|
// use libfuzzer_sys::arbitrary;
|
||||||
|
|
||||||
pub fn reject(bytes: &[u8]) -> bool {
|
// pub fn reject(bytes: &[u8]) -> bool {
|
||||||
let parser = wasmparser::Parser::new(0);
|
// let parser = wasmparser::Parser::new(0);
|
||||||
let mut has_start = false;
|
// let mut has_start = false;
|
||||||
let mut has_global_set = false;
|
// let mut has_global_set = false;
|
||||||
let mut num_globals = 0;
|
// let mut num_globals = 0;
|
||||||
for payload in parser.parse_all(bytes) {
|
// for payload in parser.parse_all(bytes) {
|
||||||
match payload.unwrap() {
|
// match payload.unwrap() {
|
||||||
wasmparser::Payload::CodeSectionEntry(body) => {
|
// wasmparser::Payload::CodeSectionEntry(body) => {
|
||||||
for op in body.get_operators_reader().unwrap() {
|
// for op in body.get_operators_reader().unwrap() {
|
||||||
let op = op.unwrap();
|
// let op = op.unwrap();
|
||||||
match op {
|
// match op {
|
||||||
wasmparser::Operator::GlobalSet { .. } => {
|
// wasmparser::Operator::GlobalSet { .. } => {
|
||||||
has_global_set = true;
|
// has_global_set = true;
|
||||||
}
|
// }
|
||||||
_ => {}
|
// _ => {}
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
wasmparser::Payload::StartSection { .. } => {
|
// wasmparser::Payload::StartSection { .. } => {
|
||||||
has_start = true;
|
// has_start = true;
|
||||||
}
|
// }
|
||||||
wasmparser::Payload::ExportSection(mut reader) => {
|
// wasmparser::Payload::ExportSection(mut reader) => {
|
||||||
for _ in 0..reader.get_count() {
|
// for _ in 0..reader.get_count() {
|
||||||
let e = reader.read().unwrap();
|
// let e = reader.read().unwrap();
|
||||||
match &e.kind {
|
// match &e.kind {
|
||||||
&wasmparser::ExternalKind::Global => {
|
// &wasmparser::ExternalKind::Global => {
|
||||||
num_globals += 1;
|
// num_globals += 1;
|
||||||
}
|
// }
|
||||||
_ => {}
|
// _ => {}
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
wasmparser::Payload::MemorySection(mut reader) => {
|
// wasmparser::Payload::MemorySection(mut reader) => {
|
||||||
for _ in 0..reader.get_count() {
|
// for _ in 0..reader.get_count() {
|
||||||
let m = reader.read().unwrap();
|
// let m = reader.read().unwrap();
|
||||||
if m.maximum.is_none() || m.maximum.unwrap() > 100 {
|
// if m.maximum.is_none() || m.maximum.unwrap() > 100 {
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
_ => {}
|
// _ => {}
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
if !has_start || !has_global_set || num_globals < 1 {
|
// if !has_start || !has_global_set || num_globals < 1 {
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
false
|
// false
|
||||||
}
|
// }
|
||||||
|
|
||||||
#[derive(Debug)]
|
// #[derive(Debug)]
|
||||||
pub struct Config;
|
// pub struct Config;
|
||||||
|
|
||||||
impl<'a> arbitrary::Arbitrary<'a> for Config {
|
// impl<'a> arbitrary::Arbitrary<'a> for Config {
|
||||||
fn arbitrary(_u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result<Self> {
|
// fn arbitrary(_u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result<Self> {
|
||||||
Ok(Config)
|
// Ok(Config)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
impl wasm_smith::Config for Config {
|
// impl wasm_smith::Config for Config {
|
||||||
fn min_funcs(&self) -> usize {
|
// fn min_funcs(&self) -> usize {
|
||||||
1
|
// 1
|
||||||
}
|
// }
|
||||||
fn max_funcs(&self) -> usize {
|
// fn max_funcs(&self) -> usize {
|
||||||
1
|
// 1
|
||||||
}
|
// }
|
||||||
fn min_memories(&self) -> u32 {
|
// fn min_memories(&self) -> u32 {
|
||||||
1
|
// 1
|
||||||
}
|
// }
|
||||||
fn max_memories(&self) -> usize {
|
// fn max_memories(&self) -> usize {
|
||||||
1
|
// 1
|
||||||
}
|
// }
|
||||||
fn min_globals(&self) -> usize {
|
// fn min_globals(&self) -> usize {
|
||||||
10
|
// 10
|
||||||
}
|
// }
|
||||||
fn max_globals(&self) -> usize {
|
// fn max_globals(&self) -> usize {
|
||||||
10
|
// 10
|
||||||
}
|
// }
|
||||||
fn min_tables(&self) -> u32 {
|
// fn min_tables(&self) -> u32 {
|
||||||
0
|
// 0
|
||||||
}
|
// }
|
||||||
fn max_tables(&self) -> usize {
|
// fn max_tables(&self) -> usize {
|
||||||
0
|
// 0
|
||||||
}
|
// }
|
||||||
fn min_imports(&self) -> usize {
|
// fn min_imports(&self) -> usize {
|
||||||
0
|
// 0
|
||||||
}
|
// }
|
||||||
fn max_imports(&self) -> usize {
|
// fn max_imports(&self) -> usize {
|
||||||
0
|
// 0
|
||||||
}
|
// }
|
||||||
fn min_exports(&self) -> usize {
|
// fn min_exports(&self) -> usize {
|
||||||
12
|
// 12
|
||||||
}
|
// }
|
||||||
fn max_exports(&self) -> usize {
|
// fn max_exports(&self) -> usize {
|
||||||
12
|
// 12
|
||||||
}
|
// }
|
||||||
fn allow_start_export(&self) -> bool {
|
// fn allow_start_export(&self) -> bool {
|
||||||
true
|
// true
|
||||||
}
|
// }
|
||||||
fn canonicalize_nans(&self) -> bool {
|
// fn canonicalize_nans(&self) -> bool {
|
||||||
true
|
// true
|
||||||
}
|
// }
|
||||||
fn max_memory_pages(&self, _is_64: bool) -> u64 {
|
// fn max_memory_pages(&self, _is_64: bool) -> u64 {
|
||||||
1
|
// 1
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
|
@ -1213,11 +1213,7 @@ pub fn const_eval(
|
||||||
Some(ConstVal::None)
|
Some(ConstVal::None)
|
||||||
}),
|
}),
|
||||||
(_, args) if args.iter().any(|&arg| arg == ConstVal::None) => None,
|
(_, args) if args.iter().any(|&arg| arg == ConstVal::None) => None,
|
||||||
(op, args) => unimplemented!(
|
_ => None,
|
||||||
"Undefined operator or arg combination: {:?}, {:?}",
|
|
||||||
op,
|
|
||||||
args
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
53
src/ir.rs
53
src/ir.rs
|
@ -10,6 +10,7 @@ pub enum Type {
|
||||||
F64,
|
F64,
|
||||||
V128,
|
V128,
|
||||||
FuncRef,
|
FuncRef,
|
||||||
|
TypedFuncRef(bool, u32),
|
||||||
}
|
}
|
||||||
impl From<wasmparser::ValType> for Type {
|
impl From<wasmparser::ValType> for Type {
|
||||||
fn from(ty: wasmparser::ValType) -> Self {
|
fn from(ty: wasmparser::ValType) -> Self {
|
||||||
|
@ -19,23 +20,38 @@ impl From<wasmparser::ValType> for Type {
|
||||||
wasmparser::ValType::F32 => Type::F32,
|
wasmparser::ValType::F32 => Type::F32,
|
||||||
wasmparser::ValType::F64 => Type::F64,
|
wasmparser::ValType::F64 => Type::F64,
|
||||||
wasmparser::ValType::V128 => Type::V128,
|
wasmparser::ValType::V128 => Type::V128,
|
||||||
wasmparser::ValType::FuncRef => Type::FuncRef,
|
wasmparser::ValType::Ref(r) => r.into(),
|
||||||
_ => panic!("Unsupported type: {:?}", ty),
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl From<wasmparser::RefType> for Type {
|
||||||
|
fn from(ty: wasmparser::RefType) -> Self {
|
||||||
|
match ty.type_index() {
|
||||||
|
Some(idx) => {
|
||||||
|
let nullable = ty.is_nullable();
|
||||||
|
Type::TypedFuncRef(nullable, idx.as_module_index().unwrap())
|
||||||
|
}
|
||||||
|
None => Type::FuncRef,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::fmt::Display for Type {
|
impl std::fmt::Display for Type {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||||
let s = match self {
|
match self {
|
||||||
Type::I32 => "i32",
|
Type::I32 => write!(f, "i32"),
|
||||||
Type::I64 => "i64",
|
Type::I64 => write!(f, "i64"),
|
||||||
Type::F32 => "f32",
|
Type::F32 => write!(f, "f32"),
|
||||||
Type::F64 => "f64",
|
Type::F64 => write!(f, "f64"),
|
||||||
Type::V128 => "v128",
|
Type::V128 => write!(f, "v128"),
|
||||||
Type::FuncRef => "funcref",
|
Type::FuncRef => write!(f, "funcref"),
|
||||||
};
|
Type::TypedFuncRef(nullable, idx) => write!(
|
||||||
write!(f, "{}", s)
|
f,
|
||||||
|
"funcref({}, {})",
|
||||||
|
if *nullable { "null" } else { "not_null" },
|
||||||
|
idx
|
||||||
|
),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +63,20 @@ impl From<Type> for wasm_encoder::ValType {
|
||||||
Type::F32 => wasm_encoder::ValType::F32,
|
Type::F32 => wasm_encoder::ValType::F32,
|
||||||
Type::F64 => wasm_encoder::ValType::F64,
|
Type::F64 => wasm_encoder::ValType::F64,
|
||||||
Type::V128 => wasm_encoder::ValType::V128,
|
Type::V128 => wasm_encoder::ValType::V128,
|
||||||
Type::FuncRef => wasm_encoder::ValType::FuncRef,
|
Type::FuncRef | Type::TypedFuncRef(..) => wasm_encoder::ValType::Ref(ty.into()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<Type> for wasm_encoder::RefType {
|
||||||
|
fn from(ty: Type) -> wasm_encoder::RefType {
|
||||||
|
match ty {
|
||||||
|
Type::FuncRef => wasm_encoder::RefType::FUNCREF,
|
||||||
|
Type::TypedFuncRef(nullable, idx) => wasm_encoder::RefType {
|
||||||
|
nullable,
|
||||||
|
heap_type: wasm_encoder::HeapType::Concrete(idx),
|
||||||
|
},
|
||||||
|
_ => panic!("Cannot convert {:?} into reftype", ty),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ pub struct MemorySegment {
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
pub struct TableData {
|
pub struct TableData {
|
||||||
pub ty: Type,
|
pub ty: Type,
|
||||||
|
pub initial: u32,
|
||||||
pub max: Option<u32>,
|
pub max: Option<u32>,
|
||||||
pub func_elements: Option<Vec<Func>>,
|
pub func_elements: Option<Vec<Func>>,
|
||||||
}
|
}
|
||||||
|
@ -174,15 +175,12 @@ impl<'a> Module<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Module<'a> {
|
impl<'a> Module<'a> {
|
||||||
pub(crate) fn frontend_add_table(&mut self, ty: Type, max: Option<u32>) -> Table {
|
pub(crate) fn frontend_add_table(&mut self, ty: Type, initial: u32, max: Option<u32>) -> Table {
|
||||||
let func_elements = if ty == Type::FuncRef {
|
let func_elements = Some(vec![]);
|
||||||
Some(vec![])
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
};
|
|
||||||
self.tables.push(TableData {
|
self.tables.push(TableData {
|
||||||
ty,
|
ty,
|
||||||
func_elements,
|
func_elements,
|
||||||
|
initial,
|
||||||
max,
|
max,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
1054
src/op_traits.rs
1054
src/op_traits.rs
File diff suppressed because it is too large
Load diff
707
src/ops.rs
707
src/ops.rs
|
@ -295,6 +295,348 @@ pub enum Operator {
|
||||||
MemoryGrow {
|
MemoryGrow {
|
||||||
mem: Memory,
|
mem: Memory,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
V128Load {
|
||||||
|
memory: MemoryArg,
|
||||||
|
},
|
||||||
|
V128Load8x8S {
|
||||||
|
memory: MemoryArg,
|
||||||
|
},
|
||||||
|
V128Load8x8U {
|
||||||
|
memory: MemoryArg,
|
||||||
|
},
|
||||||
|
V128Load16x4S {
|
||||||
|
memory: MemoryArg,
|
||||||
|
},
|
||||||
|
V128Load16x4U {
|
||||||
|
memory: MemoryArg,
|
||||||
|
},
|
||||||
|
V128Load32x2S {
|
||||||
|
memory: MemoryArg,
|
||||||
|
},
|
||||||
|
V128Load32x2U {
|
||||||
|
memory: MemoryArg,
|
||||||
|
},
|
||||||
|
V128Load8Splat {
|
||||||
|
memory: MemoryArg,
|
||||||
|
},
|
||||||
|
V128Load16Splat {
|
||||||
|
memory: MemoryArg,
|
||||||
|
},
|
||||||
|
V128Load32Splat {
|
||||||
|
memory: MemoryArg,
|
||||||
|
},
|
||||||
|
V128Load64Splat {
|
||||||
|
memory: MemoryArg,
|
||||||
|
},
|
||||||
|
V128Load32Zero {
|
||||||
|
memory: MemoryArg,
|
||||||
|
},
|
||||||
|
V128Load64Zero {
|
||||||
|
memory: MemoryArg,
|
||||||
|
},
|
||||||
|
V128Store {
|
||||||
|
memory: MemoryArg,
|
||||||
|
},
|
||||||
|
V128Load8Lane {
|
||||||
|
memory: MemoryArg,
|
||||||
|
lane: u8,
|
||||||
|
},
|
||||||
|
V128Load16Lane {
|
||||||
|
memory: MemoryArg,
|
||||||
|
lane: u8,
|
||||||
|
},
|
||||||
|
V128Load32Lane {
|
||||||
|
memory: MemoryArg,
|
||||||
|
lane: u8,
|
||||||
|
},
|
||||||
|
V128Load64Lane {
|
||||||
|
memory: MemoryArg,
|
||||||
|
lane: u8,
|
||||||
|
},
|
||||||
|
V128Store8Lane {
|
||||||
|
memory: MemoryArg,
|
||||||
|
lane: u8,
|
||||||
|
},
|
||||||
|
V128Store16Lane {
|
||||||
|
memory: MemoryArg,
|
||||||
|
lane: u8,
|
||||||
|
},
|
||||||
|
V128Store32Lane {
|
||||||
|
memory: MemoryArg,
|
||||||
|
lane: u8,
|
||||||
|
},
|
||||||
|
V128Store64Lane {
|
||||||
|
memory: MemoryArg,
|
||||||
|
lane: u8,
|
||||||
|
},
|
||||||
|
|
||||||
|
V128Const {
|
||||||
|
value: u128,
|
||||||
|
},
|
||||||
|
|
||||||
|
I8x16Shuffle {
|
||||||
|
lanes: [u8; 16],
|
||||||
|
},
|
||||||
|
|
||||||
|
I8x16ExtractLaneS {
|
||||||
|
lane: u8,
|
||||||
|
},
|
||||||
|
I8x16ExtractLaneU {
|
||||||
|
lane: u8,
|
||||||
|
},
|
||||||
|
I8x16ReplaceLane {
|
||||||
|
lane: u8,
|
||||||
|
},
|
||||||
|
I16x8ExtractLaneS {
|
||||||
|
lane: u8,
|
||||||
|
},
|
||||||
|
I16x8ExtractLaneU {
|
||||||
|
lane: u8,
|
||||||
|
},
|
||||||
|
I16x8ReplaceLane {
|
||||||
|
lane: u8,
|
||||||
|
},
|
||||||
|
I32x4ExtractLane {
|
||||||
|
lane: u8,
|
||||||
|
},
|
||||||
|
I32x4ReplaceLane {
|
||||||
|
lane: u8,
|
||||||
|
},
|
||||||
|
I64x2ExtractLane {
|
||||||
|
lane: u8,
|
||||||
|
},
|
||||||
|
I64x2ReplaceLane {
|
||||||
|
lane: u8,
|
||||||
|
},
|
||||||
|
F32x4ExtractLane {
|
||||||
|
lane: u8,
|
||||||
|
},
|
||||||
|
F32x4ReplaceLane {
|
||||||
|
lane: u8,
|
||||||
|
},
|
||||||
|
F64x2ExtractLane {
|
||||||
|
lane: u8,
|
||||||
|
},
|
||||||
|
F64x2ReplaceLane {
|
||||||
|
lane: u8,
|
||||||
|
},
|
||||||
|
|
||||||
|
I8x16Swizzle,
|
||||||
|
I8x16Splat,
|
||||||
|
I16x8Splat,
|
||||||
|
I32x4Splat,
|
||||||
|
I64x2Splat,
|
||||||
|
F32x4Splat,
|
||||||
|
F64x2Splat,
|
||||||
|
|
||||||
|
I8x16Eq,
|
||||||
|
I8x16Ne,
|
||||||
|
I8x16LtS,
|
||||||
|
I8x16LtU,
|
||||||
|
I8x16GtS,
|
||||||
|
I8x16GtU,
|
||||||
|
I8x16LeS,
|
||||||
|
I8x16LeU,
|
||||||
|
I8x16GeS,
|
||||||
|
I8x16GeU,
|
||||||
|
|
||||||
|
I16x8Eq,
|
||||||
|
I16x8Ne,
|
||||||
|
I16x8LtS,
|
||||||
|
I16x8LtU,
|
||||||
|
I16x8GtS,
|
||||||
|
I16x8GtU,
|
||||||
|
I16x8LeS,
|
||||||
|
I16x8LeU,
|
||||||
|
I16x8GeS,
|
||||||
|
I16x8GeU,
|
||||||
|
|
||||||
|
I32x4Eq,
|
||||||
|
I32x4Ne,
|
||||||
|
I32x4LtS,
|
||||||
|
I32x4LtU,
|
||||||
|
I32x4GtS,
|
||||||
|
I32x4GtU,
|
||||||
|
I32x4LeS,
|
||||||
|
I32x4LeU,
|
||||||
|
I32x4GeS,
|
||||||
|
I32x4GeU,
|
||||||
|
|
||||||
|
I64x2Eq,
|
||||||
|
I64x2Ne,
|
||||||
|
I64x2LtS,
|
||||||
|
I64x2GtS,
|
||||||
|
I64x2LeS,
|
||||||
|
I64x2GeS,
|
||||||
|
|
||||||
|
F32x4Eq,
|
||||||
|
F32x4Ne,
|
||||||
|
F32x4Lt,
|
||||||
|
F32x4Gt,
|
||||||
|
F32x4Le,
|
||||||
|
F32x4Ge,
|
||||||
|
|
||||||
|
F64x2Eq,
|
||||||
|
F64x2Ne,
|
||||||
|
F64x2Lt,
|
||||||
|
F64x2Gt,
|
||||||
|
F64x2Le,
|
||||||
|
F64x2Ge,
|
||||||
|
|
||||||
|
V128Not,
|
||||||
|
V128And,
|
||||||
|
V128AndNot,
|
||||||
|
V128Or,
|
||||||
|
V128Xor,
|
||||||
|
V128Bitselect,
|
||||||
|
V128AnyTrue,
|
||||||
|
|
||||||
|
I8x16Abs,
|
||||||
|
I8x16Neg,
|
||||||
|
I8x16Popcnt,
|
||||||
|
I8x16AllTrue,
|
||||||
|
I8x16Bitmask,
|
||||||
|
I8x16NarrowI16x8S,
|
||||||
|
I8x16NarrowI16x8U,
|
||||||
|
I8x16Shl,
|
||||||
|
I8x16ShrS,
|
||||||
|
I8x16ShrU,
|
||||||
|
I8x16Add,
|
||||||
|
I8x16AddSatS,
|
||||||
|
I8x16AddSatU,
|
||||||
|
I8x16Sub,
|
||||||
|
I8x16SubSatS,
|
||||||
|
I8x16SubSatU,
|
||||||
|
I8x16MinS,
|
||||||
|
I8x16MinU,
|
||||||
|
I8x16MaxS,
|
||||||
|
I8x16MaxU,
|
||||||
|
I8x16AvgrU,
|
||||||
|
|
||||||
|
I16x8ExtAddPairwiseI8x16S,
|
||||||
|
I16x8ExtAddPairwiseI8x16U,
|
||||||
|
I16x8Abs,
|
||||||
|
I16x8Neg,
|
||||||
|
I16x8Q15MulrSatS,
|
||||||
|
I16x8AllTrue,
|
||||||
|
I16x8Bitmask,
|
||||||
|
I16x8NarrowI32x4S,
|
||||||
|
I16x8NarrowI32x4U,
|
||||||
|
I16x8ExtendLowI8x16S,
|
||||||
|
I16x8ExtendHighI8x16S,
|
||||||
|
I16x8ExtendLowI8x16U,
|
||||||
|
I16x8ExtendHighI8x16U,
|
||||||
|
I16x8Shl,
|
||||||
|
I16x8ShrS,
|
||||||
|
I16x8ShrU,
|
||||||
|
I16x8Add,
|
||||||
|
I16x8AddSatS,
|
||||||
|
I16x8AddSatU,
|
||||||
|
I16x8Sub,
|
||||||
|
I16x8SubSatS,
|
||||||
|
I16x8SubSatU,
|
||||||
|
I16x8Mul,
|
||||||
|
I16x8MinS,
|
||||||
|
I16x8MinU,
|
||||||
|
I16x8MaxS,
|
||||||
|
I16x8MaxU,
|
||||||
|
I16x8AvgrU,
|
||||||
|
I16x8ExtMulLowI8x16S,
|
||||||
|
I16x8ExtMulHighI8x16S,
|
||||||
|
I16x8ExtMulLowI8x16U,
|
||||||
|
I16x8ExtMulHighI8x16U,
|
||||||
|
I32x4ExtAddPairwiseI16x8S,
|
||||||
|
I32x4ExtAddPairwiseI16x8U,
|
||||||
|
|
||||||
|
I32x4Abs,
|
||||||
|
I32x4Neg,
|
||||||
|
I32x4AllTrue,
|
||||||
|
I32x4Bitmask,
|
||||||
|
I32x4ExtendLowI16x8S,
|
||||||
|
I32x4ExtendHighI16x8S,
|
||||||
|
I32x4ExtendLowI16x8U,
|
||||||
|
I32x4ExtendHighI16x8U,
|
||||||
|
I32x4Shl,
|
||||||
|
I32x4ShrS,
|
||||||
|
I32x4ShrU,
|
||||||
|
I32x4Add,
|
||||||
|
I32x4Sub,
|
||||||
|
I32x4Mul,
|
||||||
|
I32x4MinS,
|
||||||
|
I32x4MinU,
|
||||||
|
I32x4MaxS,
|
||||||
|
I32x4MaxU,
|
||||||
|
I32x4DotI16x8S,
|
||||||
|
I32x4ExtMulLowI16x8S,
|
||||||
|
I32x4ExtMulHighI16x8S,
|
||||||
|
I32x4ExtMulLowI16x8U,
|
||||||
|
I32x4ExtMulHighI16x8U,
|
||||||
|
I64x2Abs,
|
||||||
|
I64x2Neg,
|
||||||
|
I64x2AllTrue,
|
||||||
|
I64x2Bitmask,
|
||||||
|
I64x2ExtendLowI32x4S,
|
||||||
|
I64x2ExtendHighI32x4S,
|
||||||
|
I64x2ExtendLowI32x4U,
|
||||||
|
I64x2ExtendHighI32x4U,
|
||||||
|
I64x2Shl,
|
||||||
|
I64x2ShrS,
|
||||||
|
I64x2ShrU,
|
||||||
|
I64x2Add,
|
||||||
|
I64x2Sub,
|
||||||
|
I64x2Mul,
|
||||||
|
I64x2ExtMulLowI32x4S,
|
||||||
|
I64x2ExtMulHighI32x4S,
|
||||||
|
I64x2ExtMulLowI32x4U,
|
||||||
|
I64x2ExtMulHighI32x4U,
|
||||||
|
F32x4Ceil,
|
||||||
|
F32x4Floor,
|
||||||
|
F32x4Trunc,
|
||||||
|
F32x4Nearest,
|
||||||
|
F32x4Abs,
|
||||||
|
F32x4Neg,
|
||||||
|
F32x4Sqrt,
|
||||||
|
F32x4Add,
|
||||||
|
F32x4Sub,
|
||||||
|
F32x4Mul,
|
||||||
|
F32x4Div,
|
||||||
|
F32x4Min,
|
||||||
|
F32x4Max,
|
||||||
|
F32x4PMin,
|
||||||
|
F32x4PMax,
|
||||||
|
F64x2Ceil,
|
||||||
|
F64x2Floor,
|
||||||
|
F64x2Trunc,
|
||||||
|
F64x2Nearest,
|
||||||
|
F64x2Abs,
|
||||||
|
F64x2Neg,
|
||||||
|
F64x2Sqrt,
|
||||||
|
F64x2Add,
|
||||||
|
F64x2Sub,
|
||||||
|
F64x2Mul,
|
||||||
|
F64x2Div,
|
||||||
|
F64x2Min,
|
||||||
|
F64x2Max,
|
||||||
|
F64x2PMin,
|
||||||
|
F64x2PMax,
|
||||||
|
I32x4TruncSatF32x4S,
|
||||||
|
I32x4TruncSatF32x4U,
|
||||||
|
F32x4ConvertI32x4S,
|
||||||
|
F32x4ConvertI32x4U,
|
||||||
|
I32x4TruncSatF64x2SZero,
|
||||||
|
I32x4TruncSatF64x2UZero,
|
||||||
|
F64x2ConvertLowI32x4S,
|
||||||
|
F64x2ConvertLowI32x4U,
|
||||||
|
F32x4DemoteF64x2Zero,
|
||||||
|
F64x2PromoteLowF32x4,
|
||||||
|
|
||||||
|
CallRef {
|
||||||
|
sig_index: Signature,
|
||||||
|
},
|
||||||
|
RefFunc {
|
||||||
|
func_index: Func,
|
||||||
|
},
|
||||||
MemoryCopy {
|
MemoryCopy {
|
||||||
dst_mem: Memory,
|
dst_mem: Memory,
|
||||||
src_mem: Memory,
|
src_mem: Memory,
|
||||||
|
@ -306,7 +648,7 @@ pub enum Operator {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn op_size() {
|
fn op_size() {
|
||||||
assert_eq!(std::mem::size_of::<Operator>(), 16);
|
assert_eq!(std::mem::size_of::<Operator>(), 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> std::convert::TryFrom<&'b wasmparser::Operator<'a>> for Operator {
|
impl<'a, 'b> std::convert::TryFrom<&'b wasmparser::Operator<'a>> for Operator {
|
||||||
|
@ -575,6 +917,369 @@ impl<'a, 'b> std::convert::TryFrom<&'b wasmparser::Operator<'a>> for Operator {
|
||||||
&wasmparser::Operator::MemoryGrow { mem, .. } => Ok(Operator::MemoryGrow {
|
&wasmparser::Operator::MemoryGrow { mem, .. } => Ok(Operator::MemoryGrow {
|
||||||
mem: Memory::from(mem),
|
mem: Memory::from(mem),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
&wasmparser::Operator::V128Load { memarg } => Ok(Operator::V128Load {
|
||||||
|
memory: memarg.into(),
|
||||||
|
}),
|
||||||
|
&wasmparser::Operator::V128Load8x8S { memarg } => Ok(Operator::V128Load8x8S {
|
||||||
|
memory: memarg.into(),
|
||||||
|
}),
|
||||||
|
&wasmparser::Operator::V128Load8x8U { memarg } => Ok(Operator::V128Load8x8U {
|
||||||
|
memory: memarg.into(),
|
||||||
|
}),
|
||||||
|
&wasmparser::Operator::V128Load16x4S { memarg } => Ok(Operator::V128Load16x4S {
|
||||||
|
memory: memarg.into(),
|
||||||
|
}),
|
||||||
|
&wasmparser::Operator::V128Load16x4U { memarg } => Ok(Operator::V128Load16x4U {
|
||||||
|
memory: memarg.into(),
|
||||||
|
}),
|
||||||
|
&wasmparser::Operator::V128Load32x2S { memarg } => Ok(Operator::V128Load32x2S {
|
||||||
|
memory: memarg.into(),
|
||||||
|
}),
|
||||||
|
&wasmparser::Operator::V128Load32x2U { memarg } => Ok(Operator::V128Load32x2U {
|
||||||
|
memory: memarg.into(),
|
||||||
|
}),
|
||||||
|
&wasmparser::Operator::V128Load8Splat { memarg } => Ok(Operator::V128Load8Splat {
|
||||||
|
memory: memarg.into(),
|
||||||
|
}),
|
||||||
|
&wasmparser::Operator::V128Load16Splat { memarg } => Ok(Operator::V128Load16Splat {
|
||||||
|
memory: memarg.into(),
|
||||||
|
}),
|
||||||
|
&wasmparser::Operator::V128Load32Splat { memarg } => Ok(Operator::V128Load32Splat {
|
||||||
|
memory: memarg.into(),
|
||||||
|
}),
|
||||||
|
&wasmparser::Operator::V128Load64Splat { memarg } => Ok(Operator::V128Load64Splat {
|
||||||
|
memory: memarg.into(),
|
||||||
|
}),
|
||||||
|
&wasmparser::Operator::V128Load32Zero { memarg } => Ok(Operator::V128Load32Zero {
|
||||||
|
memory: memarg.into(),
|
||||||
|
}),
|
||||||
|
&wasmparser::Operator::V128Load64Zero { memarg } => Ok(Operator::V128Load64Zero {
|
||||||
|
memory: memarg.into(),
|
||||||
|
}),
|
||||||
|
&wasmparser::Operator::V128Store { memarg } => Ok(Operator::V128Store {
|
||||||
|
memory: memarg.into(),
|
||||||
|
}),
|
||||||
|
&wasmparser::Operator::V128Load8Lane { memarg, lane } => Ok(Operator::V128Load8Lane {
|
||||||
|
memory: memarg.into(),
|
||||||
|
lane,
|
||||||
|
}),
|
||||||
|
&wasmparser::Operator::V128Load16Lane { memarg, lane } => {
|
||||||
|
Ok(Operator::V128Load16Lane {
|
||||||
|
memory: memarg.into(),
|
||||||
|
lane,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
&wasmparser::Operator::V128Load32Lane { memarg, lane } => {
|
||||||
|
Ok(Operator::V128Load32Lane {
|
||||||
|
memory: memarg.into(),
|
||||||
|
lane,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
&wasmparser::Operator::V128Load64Lane { memarg, lane } => {
|
||||||
|
Ok(Operator::V128Load64Lane {
|
||||||
|
memory: memarg.into(),
|
||||||
|
lane,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
&wasmparser::Operator::V128Store8Lane { memarg, lane } => {
|
||||||
|
Ok(Operator::V128Store8Lane {
|
||||||
|
memory: memarg.into(),
|
||||||
|
lane,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
&wasmparser::Operator::V128Store16Lane { memarg, lane } => {
|
||||||
|
Ok(Operator::V128Store16Lane {
|
||||||
|
memory: memarg.into(),
|
||||||
|
lane,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
&wasmparser::Operator::V128Store32Lane { memarg, lane } => {
|
||||||
|
Ok(Operator::V128Store32Lane {
|
||||||
|
memory: memarg.into(),
|
||||||
|
lane,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
&wasmparser::Operator::V128Store64Lane { memarg, lane } => {
|
||||||
|
Ok(Operator::V128Store64Lane {
|
||||||
|
memory: memarg.into(),
|
||||||
|
lane,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
&wasmparser::Operator::V128Const { value } => Ok(Operator::V128Const {
|
||||||
|
value: value.i128() as u128,
|
||||||
|
}),
|
||||||
|
|
||||||
|
&wasmparser::Operator::I8x16Shuffle { lanes } => Ok(Operator::I8x16Shuffle { lanes }),
|
||||||
|
|
||||||
|
&wasmparser::Operator::I8x16ExtractLaneS { lane } => {
|
||||||
|
Ok(Operator::I8x16ExtractLaneS { lane })
|
||||||
|
}
|
||||||
|
&wasmparser::Operator::I8x16ExtractLaneU { lane } => {
|
||||||
|
Ok(Operator::I8x16ExtractLaneU { lane })
|
||||||
|
}
|
||||||
|
&wasmparser::Operator::I8x16ReplaceLane { lane } => {
|
||||||
|
Ok(Operator::I8x16ReplaceLane { lane })
|
||||||
|
}
|
||||||
|
&wasmparser::Operator::I16x8ExtractLaneS { lane } => {
|
||||||
|
Ok(Operator::I16x8ExtractLaneS { lane })
|
||||||
|
}
|
||||||
|
&wasmparser::Operator::I16x8ExtractLaneU { lane } => {
|
||||||
|
Ok(Operator::I16x8ExtractLaneU { lane })
|
||||||
|
}
|
||||||
|
&wasmparser::Operator::I16x8ReplaceLane { lane } => {
|
||||||
|
Ok(Operator::I16x8ReplaceLane { lane })
|
||||||
|
}
|
||||||
|
&wasmparser::Operator::I32x4ExtractLane { lane } => {
|
||||||
|
Ok(Operator::I32x4ExtractLane { lane })
|
||||||
|
}
|
||||||
|
&wasmparser::Operator::I32x4ReplaceLane { lane } => {
|
||||||
|
Ok(Operator::I32x4ReplaceLane { lane })
|
||||||
|
}
|
||||||
|
&wasmparser::Operator::I64x2ExtractLane { lane } => {
|
||||||
|
Ok(Operator::I64x2ExtractLane { lane })
|
||||||
|
}
|
||||||
|
&wasmparser::Operator::I64x2ReplaceLane { lane } => {
|
||||||
|
Ok(Operator::I64x2ReplaceLane { lane })
|
||||||
|
}
|
||||||
|
&wasmparser::Operator::F32x4ExtractLane { lane } => {
|
||||||
|
Ok(Operator::F32x4ExtractLane { lane })
|
||||||
|
}
|
||||||
|
&wasmparser::Operator::F32x4ReplaceLane { lane } => {
|
||||||
|
Ok(Operator::F32x4ReplaceLane { lane })
|
||||||
|
}
|
||||||
|
&wasmparser::Operator::F64x2ExtractLane { lane } => {
|
||||||
|
Ok(Operator::F64x2ExtractLane { lane })
|
||||||
|
}
|
||||||
|
&wasmparser::Operator::F64x2ReplaceLane { lane } => {
|
||||||
|
Ok(Operator::F64x2ReplaceLane { lane })
|
||||||
|
}
|
||||||
|
|
||||||
|
&wasmparser::Operator::I8x16Swizzle => Ok(Operator::I8x16Swizzle),
|
||||||
|
&wasmparser::Operator::I8x16Splat => Ok(Operator::I8x16Splat),
|
||||||
|
&wasmparser::Operator::I16x8Splat => Ok(Operator::I16x8Splat),
|
||||||
|
&wasmparser::Operator::I32x4Splat => Ok(Operator::I32x4Splat),
|
||||||
|
&wasmparser::Operator::I64x2Splat => Ok(Operator::I64x2Splat),
|
||||||
|
&wasmparser::Operator::F32x4Splat => Ok(Operator::F32x4Splat),
|
||||||
|
&wasmparser::Operator::F64x2Splat => Ok(Operator::F64x2Splat),
|
||||||
|
|
||||||
|
&wasmparser::Operator::I8x16Eq => Ok(Operator::I8x16Eq),
|
||||||
|
&wasmparser::Operator::I8x16Ne => Ok(Operator::I8x16Ne),
|
||||||
|
&wasmparser::Operator::I8x16LtS => Ok(Operator::I8x16LtS),
|
||||||
|
&wasmparser::Operator::I8x16LtU => Ok(Operator::I8x16LtU),
|
||||||
|
&wasmparser::Operator::I8x16GtS => Ok(Operator::I8x16GtS),
|
||||||
|
&wasmparser::Operator::I8x16GtU => Ok(Operator::I8x16GtU),
|
||||||
|
&wasmparser::Operator::I8x16LeS => Ok(Operator::I8x16LeS),
|
||||||
|
&wasmparser::Operator::I8x16LeU => Ok(Operator::I8x16LeU),
|
||||||
|
&wasmparser::Operator::I8x16GeS => Ok(Operator::I8x16GeS),
|
||||||
|
&wasmparser::Operator::I8x16GeU => Ok(Operator::I8x16GeU),
|
||||||
|
|
||||||
|
&wasmparser::Operator::I16x8Eq => Ok(Operator::I16x8Eq),
|
||||||
|
&wasmparser::Operator::I16x8Ne => Ok(Operator::I16x8Ne),
|
||||||
|
&wasmparser::Operator::I16x8LtS => Ok(Operator::I16x8LtS),
|
||||||
|
&wasmparser::Operator::I16x8LtU => Ok(Operator::I16x8LtU),
|
||||||
|
&wasmparser::Operator::I16x8GtS => Ok(Operator::I16x8GtS),
|
||||||
|
&wasmparser::Operator::I16x8GtU => Ok(Operator::I16x8GtU),
|
||||||
|
&wasmparser::Operator::I16x8LeS => Ok(Operator::I16x8LeS),
|
||||||
|
&wasmparser::Operator::I16x8LeU => Ok(Operator::I16x8LeU),
|
||||||
|
&wasmparser::Operator::I16x8GeS => Ok(Operator::I16x8GeS),
|
||||||
|
&wasmparser::Operator::I16x8GeU => Ok(Operator::I16x8GeU),
|
||||||
|
|
||||||
|
&wasmparser::Operator::I32x4Eq => Ok(Operator::I32x4Eq),
|
||||||
|
&wasmparser::Operator::I32x4Ne => Ok(Operator::I32x4Ne),
|
||||||
|
&wasmparser::Operator::I32x4LtS => Ok(Operator::I32x4LtS),
|
||||||
|
&wasmparser::Operator::I32x4LtU => Ok(Operator::I32x4LtU),
|
||||||
|
&wasmparser::Operator::I32x4GtS => Ok(Operator::I32x4GtS),
|
||||||
|
&wasmparser::Operator::I32x4GtU => Ok(Operator::I32x4GtU),
|
||||||
|
&wasmparser::Operator::I32x4LeS => Ok(Operator::I32x4LeS),
|
||||||
|
&wasmparser::Operator::I32x4LeU => Ok(Operator::I32x4LeU),
|
||||||
|
&wasmparser::Operator::I32x4GeS => Ok(Operator::I32x4GeS),
|
||||||
|
&wasmparser::Operator::I32x4GeU => Ok(Operator::I32x4GeU),
|
||||||
|
|
||||||
|
&wasmparser::Operator::I64x2Eq => Ok(Operator::I64x2Eq),
|
||||||
|
&wasmparser::Operator::I64x2Ne => Ok(Operator::I64x2Ne),
|
||||||
|
&wasmparser::Operator::I64x2LtS => Ok(Operator::I64x2LtS),
|
||||||
|
&wasmparser::Operator::I64x2GtS => Ok(Operator::I64x2GtS),
|
||||||
|
&wasmparser::Operator::I64x2LeS => Ok(Operator::I64x2LeS),
|
||||||
|
&wasmparser::Operator::I64x2GeS => Ok(Operator::I64x2GeS),
|
||||||
|
|
||||||
|
&wasmparser::Operator::F32x4Eq => Ok(Operator::F32x4Eq),
|
||||||
|
&wasmparser::Operator::F32x4Ne => Ok(Operator::F32x4Ne),
|
||||||
|
&wasmparser::Operator::F32x4Lt => Ok(Operator::F32x4Lt),
|
||||||
|
&wasmparser::Operator::F32x4Gt => Ok(Operator::F32x4Gt),
|
||||||
|
&wasmparser::Operator::F32x4Le => Ok(Operator::F32x4Le),
|
||||||
|
&wasmparser::Operator::F32x4Ge => Ok(Operator::F32x4Ge),
|
||||||
|
|
||||||
|
&wasmparser::Operator::F64x2Eq => Ok(Operator::F64x2Eq),
|
||||||
|
&wasmparser::Operator::F64x2Ne => Ok(Operator::F64x2Ne),
|
||||||
|
&wasmparser::Operator::F64x2Lt => Ok(Operator::F64x2Lt),
|
||||||
|
&wasmparser::Operator::F64x2Gt => Ok(Operator::F64x2Gt),
|
||||||
|
&wasmparser::Operator::F64x2Le => Ok(Operator::F64x2Le),
|
||||||
|
&wasmparser::Operator::F64x2Ge => Ok(Operator::F64x2Ge),
|
||||||
|
|
||||||
|
&wasmparser::Operator::V128Not => Ok(Operator::V128Not),
|
||||||
|
&wasmparser::Operator::V128And => Ok(Operator::V128And),
|
||||||
|
&wasmparser::Operator::V128AndNot => Ok(Operator::V128AndNot),
|
||||||
|
&wasmparser::Operator::V128Or => Ok(Operator::V128Or),
|
||||||
|
&wasmparser::Operator::V128Xor => Ok(Operator::V128Xor),
|
||||||
|
&wasmparser::Operator::V128Bitselect => Ok(Operator::V128Bitselect),
|
||||||
|
&wasmparser::Operator::V128AnyTrue => Ok(Operator::V128AnyTrue),
|
||||||
|
|
||||||
|
&wasmparser::Operator::I8x16Abs => Ok(Operator::I8x16Abs),
|
||||||
|
&wasmparser::Operator::I8x16Neg => Ok(Operator::I8x16Neg),
|
||||||
|
&wasmparser::Operator::I8x16Popcnt => Ok(Operator::I8x16Popcnt),
|
||||||
|
&wasmparser::Operator::I8x16AllTrue => Ok(Operator::I8x16AllTrue),
|
||||||
|
&wasmparser::Operator::I8x16Bitmask => Ok(Operator::I8x16Bitmask),
|
||||||
|
&wasmparser::Operator::I8x16NarrowI16x8S => Ok(Operator::I8x16NarrowI16x8S),
|
||||||
|
&wasmparser::Operator::I8x16NarrowI16x8U => Ok(Operator::I8x16NarrowI16x8U),
|
||||||
|
&wasmparser::Operator::I8x16Shl => Ok(Operator::I8x16Shl),
|
||||||
|
&wasmparser::Operator::I8x16ShrS => Ok(Operator::I8x16ShrS),
|
||||||
|
&wasmparser::Operator::I8x16ShrU => Ok(Operator::I8x16ShrU),
|
||||||
|
&wasmparser::Operator::I8x16Add => Ok(Operator::I8x16Add),
|
||||||
|
&wasmparser::Operator::I8x16AddSatS => Ok(Operator::I8x16AddSatS),
|
||||||
|
&wasmparser::Operator::I8x16AddSatU => Ok(Operator::I8x16AddSatU),
|
||||||
|
&wasmparser::Operator::I8x16Sub => Ok(Operator::I8x16Sub),
|
||||||
|
&wasmparser::Operator::I8x16SubSatS => Ok(Operator::I8x16SubSatS),
|
||||||
|
&wasmparser::Operator::I8x16SubSatU => Ok(Operator::I8x16SubSatU),
|
||||||
|
&wasmparser::Operator::I8x16MinS => Ok(Operator::I8x16MinS),
|
||||||
|
&wasmparser::Operator::I8x16MinU => Ok(Operator::I8x16MinU),
|
||||||
|
&wasmparser::Operator::I8x16MaxS => Ok(Operator::I8x16MaxS),
|
||||||
|
&wasmparser::Operator::I8x16MaxU => Ok(Operator::I8x16MaxU),
|
||||||
|
&wasmparser::Operator::I8x16AvgrU => Ok(Operator::I8x16AvgrU),
|
||||||
|
|
||||||
|
&wasmparser::Operator::I16x8ExtAddPairwiseI8x16S => {
|
||||||
|
Ok(Operator::I16x8ExtAddPairwiseI8x16S)
|
||||||
|
}
|
||||||
|
&wasmparser::Operator::I16x8ExtAddPairwiseI8x16U => {
|
||||||
|
Ok(Operator::I16x8ExtAddPairwiseI8x16U)
|
||||||
|
}
|
||||||
|
&wasmparser::Operator::I16x8Abs => Ok(Operator::I16x8Abs),
|
||||||
|
&wasmparser::Operator::I16x8Neg => Ok(Operator::I16x8Neg),
|
||||||
|
&wasmparser::Operator::I16x8Q15MulrSatS => Ok(Operator::I16x8Q15MulrSatS),
|
||||||
|
&wasmparser::Operator::I16x8AllTrue => Ok(Operator::I16x8AllTrue),
|
||||||
|
&wasmparser::Operator::I16x8Bitmask => Ok(Operator::I16x8Bitmask),
|
||||||
|
&wasmparser::Operator::I16x8NarrowI32x4S => Ok(Operator::I16x8NarrowI32x4S),
|
||||||
|
&wasmparser::Operator::I16x8NarrowI32x4U => Ok(Operator::I16x8NarrowI32x4U),
|
||||||
|
&wasmparser::Operator::I16x8ExtendLowI8x16S => Ok(Operator::I16x8ExtendLowI8x16S),
|
||||||
|
&wasmparser::Operator::I16x8ExtendHighI8x16S => Ok(Operator::I16x8ExtendHighI8x16S),
|
||||||
|
&wasmparser::Operator::I16x8ExtendLowI8x16U => Ok(Operator::I16x8ExtendLowI8x16U),
|
||||||
|
&wasmparser::Operator::I16x8ExtendHighI8x16U => Ok(Operator::I16x8ExtendHighI8x16U),
|
||||||
|
&wasmparser::Operator::I16x8Shl => Ok(Operator::I16x8Shl),
|
||||||
|
&wasmparser::Operator::I16x8ShrS => Ok(Operator::I16x8ShrS),
|
||||||
|
&wasmparser::Operator::I16x8ShrU => Ok(Operator::I16x8ShrU),
|
||||||
|
&wasmparser::Operator::I16x8Add => Ok(Operator::I16x8Add),
|
||||||
|
&wasmparser::Operator::I16x8AddSatS => Ok(Operator::I16x8AddSatS),
|
||||||
|
&wasmparser::Operator::I16x8AddSatU => Ok(Operator::I16x8AddSatU),
|
||||||
|
&wasmparser::Operator::I16x8Sub => Ok(Operator::I16x8Sub),
|
||||||
|
&wasmparser::Operator::I16x8SubSatS => Ok(Operator::I16x8SubSatS),
|
||||||
|
&wasmparser::Operator::I16x8SubSatU => Ok(Operator::I16x8SubSatU),
|
||||||
|
&wasmparser::Operator::I16x8Mul => Ok(Operator::I16x8Mul),
|
||||||
|
&wasmparser::Operator::I16x8MinS => Ok(Operator::I16x8MinS),
|
||||||
|
&wasmparser::Operator::I16x8MinU => Ok(Operator::I16x8MinU),
|
||||||
|
&wasmparser::Operator::I16x8MaxS => Ok(Operator::I16x8MaxS),
|
||||||
|
&wasmparser::Operator::I16x8MaxU => Ok(Operator::I16x8MaxU),
|
||||||
|
&wasmparser::Operator::I16x8AvgrU => Ok(Operator::I16x8AvgrU),
|
||||||
|
&wasmparser::Operator::I16x8ExtMulLowI8x16S => Ok(Operator::I16x8ExtMulLowI8x16S),
|
||||||
|
&wasmparser::Operator::I16x8ExtMulHighI8x16S => Ok(Operator::I16x8ExtMulHighI8x16S),
|
||||||
|
&wasmparser::Operator::I16x8ExtMulLowI8x16U => Ok(Operator::I16x8ExtMulLowI8x16U),
|
||||||
|
&wasmparser::Operator::I16x8ExtMulHighI8x16U => Ok(Operator::I16x8ExtMulHighI8x16U),
|
||||||
|
&wasmparser::Operator::I32x4ExtAddPairwiseI16x8S => {
|
||||||
|
Ok(Operator::I32x4ExtAddPairwiseI16x8S)
|
||||||
|
}
|
||||||
|
&wasmparser::Operator::I32x4ExtAddPairwiseI16x8U => {
|
||||||
|
Ok(Operator::I32x4ExtAddPairwiseI16x8U)
|
||||||
|
}
|
||||||
|
|
||||||
|
&wasmparser::Operator::I32x4Abs => Ok(Operator::I32x4Abs),
|
||||||
|
&wasmparser::Operator::I32x4Neg => Ok(Operator::I32x4Neg),
|
||||||
|
&wasmparser::Operator::I32x4AllTrue => Ok(Operator::I32x4AllTrue),
|
||||||
|
&wasmparser::Operator::I32x4Bitmask => Ok(Operator::I32x4Bitmask),
|
||||||
|
&wasmparser::Operator::I32x4ExtendLowI16x8S => Ok(Operator::I32x4ExtendLowI16x8S),
|
||||||
|
&wasmparser::Operator::I32x4ExtendHighI16x8S => Ok(Operator::I32x4ExtendHighI16x8S),
|
||||||
|
&wasmparser::Operator::I32x4ExtendLowI16x8U => Ok(Operator::I32x4ExtendLowI16x8U),
|
||||||
|
&wasmparser::Operator::I32x4ExtendHighI16x8U => Ok(Operator::I32x4ExtendHighI16x8U),
|
||||||
|
&wasmparser::Operator::I32x4Shl => Ok(Operator::I32x4Shl),
|
||||||
|
&wasmparser::Operator::I32x4ShrS => Ok(Operator::I32x4ShrS),
|
||||||
|
&wasmparser::Operator::I32x4ShrU => Ok(Operator::I32x4ShrU),
|
||||||
|
&wasmparser::Operator::I32x4Add => Ok(Operator::I32x4Add),
|
||||||
|
&wasmparser::Operator::I32x4Sub => Ok(Operator::I32x4Sub),
|
||||||
|
&wasmparser::Operator::I32x4Mul => Ok(Operator::I32x4Mul),
|
||||||
|
&wasmparser::Operator::I32x4MinS => Ok(Operator::I32x4MinS),
|
||||||
|
&wasmparser::Operator::I32x4MinU => Ok(Operator::I32x4MinU),
|
||||||
|
&wasmparser::Operator::I32x4MaxS => Ok(Operator::I32x4MaxS),
|
||||||
|
&wasmparser::Operator::I32x4MaxU => Ok(Operator::I32x4MaxU),
|
||||||
|
&wasmparser::Operator::I32x4DotI16x8S => Ok(Operator::I32x4DotI16x8S),
|
||||||
|
&wasmparser::Operator::I32x4ExtMulLowI16x8S => Ok(Operator::I32x4ExtMulLowI16x8S),
|
||||||
|
&wasmparser::Operator::I32x4ExtMulHighI16x8S => Ok(Operator::I32x4ExtMulHighI16x8S),
|
||||||
|
&wasmparser::Operator::I32x4ExtMulLowI16x8U => Ok(Operator::I32x4ExtMulLowI16x8U),
|
||||||
|
&wasmparser::Operator::I32x4ExtMulHighI16x8U => Ok(Operator::I32x4ExtMulHighI16x8U),
|
||||||
|
&wasmparser::Operator::I64x2Abs => Ok(Operator::I64x2Abs),
|
||||||
|
&wasmparser::Operator::I64x2Neg => Ok(Operator::I64x2Neg),
|
||||||
|
&wasmparser::Operator::I64x2AllTrue => Ok(Operator::I64x2AllTrue),
|
||||||
|
&wasmparser::Operator::I64x2Bitmask => Ok(Operator::I64x2Bitmask),
|
||||||
|
&wasmparser::Operator::I64x2ExtendLowI32x4S => Ok(Operator::I64x2ExtendLowI32x4S),
|
||||||
|
&wasmparser::Operator::I64x2ExtendHighI32x4S => Ok(Operator::I64x2ExtendHighI32x4S),
|
||||||
|
&wasmparser::Operator::I64x2ExtendLowI32x4U => Ok(Operator::I64x2ExtendLowI32x4U),
|
||||||
|
&wasmparser::Operator::I64x2ExtendHighI32x4U => Ok(Operator::I64x2ExtendHighI32x4U),
|
||||||
|
&wasmparser::Operator::I64x2Shl => Ok(Operator::I64x2Shl),
|
||||||
|
&wasmparser::Operator::I64x2ShrS => Ok(Operator::I64x2ShrS),
|
||||||
|
&wasmparser::Operator::I64x2ShrU => Ok(Operator::I64x2ShrU),
|
||||||
|
&wasmparser::Operator::I64x2Add => Ok(Operator::I64x2Add),
|
||||||
|
&wasmparser::Operator::I64x2Sub => Ok(Operator::I64x2Sub),
|
||||||
|
&wasmparser::Operator::I64x2Mul => Ok(Operator::I64x2Mul),
|
||||||
|
&wasmparser::Operator::I64x2ExtMulLowI32x4S => Ok(Operator::I64x2ExtMulLowI32x4S),
|
||||||
|
&wasmparser::Operator::I64x2ExtMulHighI32x4S => Ok(Operator::I64x2ExtMulHighI32x4S),
|
||||||
|
&wasmparser::Operator::I64x2ExtMulLowI32x4U => Ok(Operator::I64x2ExtMulLowI32x4U),
|
||||||
|
&wasmparser::Operator::I64x2ExtMulHighI32x4U => Ok(Operator::I64x2ExtMulHighI32x4U),
|
||||||
|
&wasmparser::Operator::F32x4Ceil => Ok(Operator::F32x4Ceil),
|
||||||
|
&wasmparser::Operator::F32x4Floor => Ok(Operator::F32x4Floor),
|
||||||
|
&wasmparser::Operator::F32x4Trunc => Ok(Operator::F32x4Trunc),
|
||||||
|
&wasmparser::Operator::F32x4Nearest => Ok(Operator::F32x4Nearest),
|
||||||
|
&wasmparser::Operator::F32x4Abs => Ok(Operator::F32x4Abs),
|
||||||
|
&wasmparser::Operator::F32x4Neg => Ok(Operator::F32x4Neg),
|
||||||
|
&wasmparser::Operator::F32x4Sqrt => Ok(Operator::F32x4Sqrt),
|
||||||
|
&wasmparser::Operator::F32x4Add => Ok(Operator::F32x4Add),
|
||||||
|
&wasmparser::Operator::F32x4Sub => Ok(Operator::F32x4Sub),
|
||||||
|
&wasmparser::Operator::F32x4Mul => Ok(Operator::F32x4Mul),
|
||||||
|
&wasmparser::Operator::F32x4Div => Ok(Operator::F32x4Div),
|
||||||
|
&wasmparser::Operator::F32x4Min => Ok(Operator::F32x4Min),
|
||||||
|
&wasmparser::Operator::F32x4Max => Ok(Operator::F32x4Max),
|
||||||
|
&wasmparser::Operator::F32x4PMin => Ok(Operator::F32x4PMin),
|
||||||
|
&wasmparser::Operator::F32x4PMax => Ok(Operator::F32x4PMax),
|
||||||
|
&wasmparser::Operator::F64x2Ceil => Ok(Operator::F64x2Ceil),
|
||||||
|
&wasmparser::Operator::F64x2Floor => Ok(Operator::F64x2Floor),
|
||||||
|
&wasmparser::Operator::F64x2Trunc => Ok(Operator::F64x2Trunc),
|
||||||
|
&wasmparser::Operator::F64x2Nearest => Ok(Operator::F64x2Nearest),
|
||||||
|
&wasmparser::Operator::F64x2Abs => Ok(Operator::F64x2Abs),
|
||||||
|
&wasmparser::Operator::F64x2Neg => Ok(Operator::F64x2Neg),
|
||||||
|
&wasmparser::Operator::F64x2Sqrt => Ok(Operator::F64x2Sqrt),
|
||||||
|
&wasmparser::Operator::F64x2Add => Ok(Operator::F64x2Add),
|
||||||
|
&wasmparser::Operator::F64x2Sub => Ok(Operator::F64x2Sub),
|
||||||
|
&wasmparser::Operator::F64x2Mul => Ok(Operator::F64x2Mul),
|
||||||
|
&wasmparser::Operator::F64x2Div => Ok(Operator::F64x2Div),
|
||||||
|
&wasmparser::Operator::F64x2Min => Ok(Operator::F64x2Min),
|
||||||
|
&wasmparser::Operator::F64x2Max => Ok(Operator::F64x2Max),
|
||||||
|
&wasmparser::Operator::F64x2PMin => Ok(Operator::F64x2PMin),
|
||||||
|
&wasmparser::Operator::F64x2PMax => Ok(Operator::F64x2PMax),
|
||||||
|
&wasmparser::Operator::I32x4TruncSatF32x4S => Ok(Operator::I32x4TruncSatF32x4S),
|
||||||
|
&wasmparser::Operator::I32x4TruncSatF32x4U => Ok(Operator::I32x4TruncSatF32x4U),
|
||||||
|
&wasmparser::Operator::F32x4ConvertI32x4S => Ok(Operator::F32x4ConvertI32x4S),
|
||||||
|
&wasmparser::Operator::F32x4ConvertI32x4U => Ok(Operator::F32x4ConvertI32x4U),
|
||||||
|
&wasmparser::Operator::I32x4TruncSatF64x2SZero => Ok(Operator::I32x4TruncSatF64x2SZero),
|
||||||
|
&wasmparser::Operator::I32x4TruncSatF64x2UZero => Ok(Operator::I32x4TruncSatF64x2UZero),
|
||||||
|
&wasmparser::Operator::F64x2ConvertLowI32x4S => Ok(Operator::F64x2ConvertLowI32x4S),
|
||||||
|
&wasmparser::Operator::F64x2ConvertLowI32x4U => Ok(Operator::F64x2ConvertLowI32x4U),
|
||||||
|
&wasmparser::Operator::F32x4DemoteF64x2Zero => Ok(Operator::F32x4DemoteF64x2Zero),
|
||||||
|
&wasmparser::Operator::F64x2PromoteLowF32x4 => Ok(Operator::F64x2PromoteLowF32x4),
|
||||||
|
|
||||||
|
&wasmparser::Operator::CallRef { type_index } => Ok(Operator::CallRef {
|
||||||
|
sig_index: Signature::from(type_index),
|
||||||
|
}),
|
||||||
|
&wasmparser::Operator::RefFunc { function_index } => Ok(Operator::RefFunc {
|
||||||
|
func_index: Func::from(function_index),
|
||||||
|
}),
|
||||||
|
|
||||||
&wasmparser::Operator::MemoryCopy { dst_mem, src_mem } => Ok(Operator::MemoryCopy {
|
&wasmparser::Operator::MemoryCopy { dst_mem, src_mem } => Ok(Operator::MemoryCopy {
|
||||||
dst_mem: Memory::from(dst_mem),
|
dst_mem: Memory::from(dst_mem),
|
||||||
src_mem: Memory::from(src_mem),
|
src_mem: Memory::from(src_mem),
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
//! Pooled list data structure.
|
//! Pooled list data structure.
|
||||||
|
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
use std::default::Default;
|
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::ops::{Index, IndexMut};
|
use std::ops::{Index, IndexMut};
|
||||||
|
|
22
wasm_tests/test-simd.wat
Normal file
22
wasm_tests/test-simd.wat
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
(module
|
||||||
|
(memory 1 1)
|
||||||
|
(func (export "pack") (param i64 i64) (result v128)
|
||||||
|
v128.const i64x2 0 0
|
||||||
|
local.get 0
|
||||||
|
i64x2.replace_lane 0
|
||||||
|
local.get 1
|
||||||
|
i64x2.replace_lane 1
|
||||||
|
return)
|
||||||
|
(func (export "unpack") (param v128) (result i64 i64)
|
||||||
|
local.get 0
|
||||||
|
i64x2.extract_lane 0
|
||||||
|
local.get 0
|
||||||
|
i64x2.extract_lane 1
|
||||||
|
return)
|
||||||
|
(func (export "load") (param i32) (result v128)
|
||||||
|
local.get 0
|
||||||
|
v128.load)
|
||||||
|
(func (export "store") (param i32 v128)
|
||||||
|
local.get 0
|
||||||
|
local.get 1
|
||||||
|
v128.store))
|
21
wasm_tests/typed-funcref.wat
Normal file
21
wasm_tests/typed-funcref.wat
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
(module
|
||||||
|
(type $t (func (param i32 i32) (result i32)))
|
||||||
|
|
||||||
|
(table $tab 10 10 (ref null $t))
|
||||||
|
(table $tab2 10 10 (ref null $t))
|
||||||
|
|
||||||
|
(elem (table $tab2) (i32.const 0) (ref null $t) (ref.func $f))
|
||||||
|
|
||||||
|
(func $callit (param i32 i32 i32) (result i32)
|
||||||
|
(call_ref $t (local.get 1)
|
||||||
|
(local.get 2)
|
||||||
|
(table.get $tab (local.get 0))))
|
||||||
|
|
||||||
|
(func $setit (param i32 (ref null $t))
|
||||||
|
(table.set $tab (local.get 0) (local.get 1)))
|
||||||
|
|
||||||
|
(func $getf (result (ref null $t))
|
||||||
|
(ref.func $f))
|
||||||
|
|
||||||
|
(func $f (param i32 i32) (result i32)
|
||||||
|
local.get 0))
|
Loading…
Reference in a new issue