Upgrade wasmparser to 0.63

This commit is contained in:
Syrus
2020-10-29 16:43:02 -07:00
parent ba60630407
commit 68a0ae9615
5 changed files with 69 additions and 54 deletions

4
Cargo.lock generated
View File

@@ -2527,9 +2527,9 @@ dependencies = [
[[package]]
name = "wasmparser"
version = "0.62.0"
version = "0.63.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e36b5b8441a5d83ea606c9eb904a3ee3889ebfeda1df1a5c48b84725239d93ce"
checksum = "89e4bce139034f66d49ad6071f6eda10f7188b0ad3cbfe080d673535ee30c23e"
[[package]]
name = "wast"

View File

@@ -3,7 +3,7 @@
use crate::translator::{irlibcall_to_libcall, irreloc_to_relocationkind};
use cranelift_codegen::binemit;
use cranelift_codegen::ir::{self, ExternalName};
use wasmer_compiler::{JumpTable, Relocation, RelocationTarget, SourceLoc, TrapInformation};
use wasmer_compiler::{JumpTable, Relocation, RelocationTarget, TrapInformation};
use wasmer_types::entity::EntityRef;
use wasmer_types::{FunctionIndex, LocalFunctionIndex};
use wasmer_vm::{ModuleInfo, TrapCode};

View File

@@ -665,42 +665,42 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
} => {
translate_load(*offset, ir::Opcode::Load, I8X16, builder, state, environ)?;
}
Operator::I16x8Load8x8S {
Operator::V128Load8x8S {
memarg: MemoryImmediate { offset, .. },
} => {
let (flags, base, offset) = prepare_load(*offset, 8, builder, state, environ)?;
let loaded = builder.ins().sload8x8(flags, base, offset);
state.push1(loaded);
}
Operator::I16x8Load8x8U {
Operator::V128Load8x8U {
memarg: MemoryImmediate { offset, .. },
} => {
let (flags, base, offset) = prepare_load(*offset, 8, builder, state, environ)?;
let loaded = builder.ins().uload8x8(flags, base, offset);
state.push1(loaded);
}
Operator::I32x4Load16x4S {
Operator::V128Load16x4S {
memarg: MemoryImmediate { offset, .. },
} => {
let (flags, base, offset) = prepare_load(*offset, 8, builder, state, environ)?;
let loaded = builder.ins().sload16x4(flags, base, offset);
state.push1(loaded);
}
Operator::I32x4Load16x4U {
Operator::V128Load16x4U {
memarg: MemoryImmediate { offset, .. },
} => {
let (flags, base, offset) = prepare_load(*offset, 8, builder, state, environ)?;
let loaded = builder.ins().uload16x4(flags, base, offset);
state.push1(loaded);
}
Operator::I64x2Load32x2S {
Operator::V128Load32x2S {
memarg: MemoryImmediate { offset, .. },
} => {
let (flags, base, offset) = prepare_load(*offset, 8, builder, state, environ)?;
let loaded = builder.ins().sload32x2(flags, base, offset);
state.push1(loaded);
}
Operator::I64x2Load32x2U {
Operator::V128Load32x2U {
memarg: MemoryImmediate { offset, .. },
} => {
let (flags, base, offset) = prepare_load(*offset, 8, builder, state, environ)?;
@@ -1266,16 +1266,16 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
let splatted = builder.ins().splat(type_of(op), state.pop1());
state.push1(splatted)
}
Operator::V8x16LoadSplat {
Operator::V128Load8Splat {
memarg: MemoryImmediate { offset, .. },
}
| Operator::V16x8LoadSplat {
| Operator::V128Load16Splat {
memarg: MemoryImmediate { offset, .. },
}
| Operator::V32x4LoadSplat {
| Operator::V128Load32Splat {
memarg: MemoryImmediate { offset, .. },
}
| Operator::V64x2LoadSplat {
| Operator::V128Load64Splat {
memarg: MemoryImmediate { offset, .. },
} => {
// TODO: For spec compliance, this is initially implemented as a combination of `load +
@@ -1327,7 +1327,7 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
let vector = optionally_bitcast_vector(vector, type_of(op), builder);
state.push1(builder.ins().insertlane(vector, replacement, *lane))
}
Operator::V8x16Shuffle { lanes, .. } => {
Operator::I8x16Shuffle { lanes, .. } => {
let (a, b) = pop2_with_bitcast(state, I8X16, builder);
let lanes = ConstantData::from(lanes.as_ref());
let mask = builder.func.dfg.immediates.push(lanes);
@@ -1338,7 +1338,7 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
// to WASM using the less specific v128 type for certain operations and more specific
// types (e.g. i8x16) for others.
}
Operator::V8x16Swizzle => {
Operator::I8x16Swizzle => {
let (a, b) = pop2_with_bitcast(state, I8X16, builder);
state.push1(builder.ins().swizzle(I8X16, a, b))
}
@@ -1346,11 +1346,11 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
let (a, b) = pop2_with_bitcast(state, type_of(op), builder);
state.push1(builder.ins().iadd(a, b))
}
Operator::I8x16AddSaturateS | Operator::I16x8AddSaturateS => {
Operator::I8x16AddSatS | Operator::I16x8AddSatS => {
let (a, b) = pop2_with_bitcast(state, type_of(op), builder);
state.push1(builder.ins().sadd_sat(a, b))
}
Operator::I8x16AddSaturateU | Operator::I16x8AddSaturateU => {
Operator::I8x16AddSatU | Operator::I16x8AddSatU => {
let (a, b) = pop2_with_bitcast(state, type_of(op), builder);
state.push1(builder.ins().uadd_sat(a, b))
}
@@ -1358,11 +1358,11 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
let (a, b) = pop2_with_bitcast(state, type_of(op), builder);
state.push1(builder.ins().isub(a, b))
}
Operator::I8x16SubSaturateS | Operator::I16x8SubSaturateS => {
Operator::I8x16SubSatS | Operator::I16x8SubSatS => {
let (a, b) = pop2_with_bitcast(state, type_of(op), builder);
state.push1(builder.ins().ssub_sat(a, b))
}
Operator::I8x16SubSaturateU | Operator::I16x8SubSaturateU => {
Operator::I8x16SubSatU | Operator::I16x8SubSatU => {
let (a, b) = pop2_with_bitcast(state, type_of(op), builder);
state.push1(builder.ins().usub_sat(a, b))
}
@@ -1574,7 +1574,22 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
| Operator::I32x4WidenHighI16x8U { .. }
| Operator::I8x16Bitmask
| Operator::I16x8Bitmask
| Operator::I32x4Bitmask => {
| Operator::I32x4Bitmask
| Operator::F32x4Ceil
| Operator::F32x4Floor
| Operator::F32x4Trunc
| Operator::F32x4Nearest
| Operator::F32x4Ceil
| Operator::F32x4Floor
| Operator::F64x2Ceil
| Operator::F64x2Floor
| Operator::F64x2Trunc
| Operator::F64x2Nearest
| Operator::F32x4PMin
| Operator::F32x4PMax
| Operator::F64x2PMin
| Operator::F64x2PMax
=> {
return Err(wasm_unsupported!("proposed SIMD operator {:?}", op));
}
@@ -1974,9 +1989,9 @@ fn type_of(operator: &Operator) -> Type {
| Operator::V128Xor
| Operator::V128Bitselect => I8X16, // default type representing V128
Operator::V8x16Shuffle { .. }
Operator::I8x16Shuffle { .. }
| Operator::I8x16Splat
| Operator::V8x16LoadSplat { .. }
| Operator::V128Load8Splat { .. }
| Operator::I8x16ExtractLaneS { .. }
| Operator::I8x16ExtractLaneU { .. }
| Operator::I8x16ReplaceLane { .. }
@@ -1997,11 +2012,11 @@ fn type_of(operator: &Operator) -> Type {
| Operator::I8x16ShrS
| Operator::I8x16ShrU
| Operator::I8x16Add
| Operator::I8x16AddSaturateS
| Operator::I8x16AddSaturateU
| Operator::I8x16AddSatS
| Operator::I8x16AddSatU
| Operator::I8x16Sub
| Operator::I8x16SubSaturateS
| Operator::I8x16SubSaturateU
| Operator::I8x16SubSatS
| Operator::I8x16SubSatU
| Operator::I8x16MinS
| Operator::I8x16MinU
| Operator::I8x16MaxS
@@ -2009,7 +2024,7 @@ fn type_of(operator: &Operator) -> Type {
| Operator::I8x16RoundingAverageU => I8X16,
Operator::I16x8Splat
| Operator::V16x8LoadSplat { .. }
| Operator::V128Load16Splat { .. }
| Operator::I16x8ExtractLaneS { .. }
| Operator::I16x8ExtractLaneU { .. }
| Operator::I16x8ReplaceLane { .. }
@@ -2030,11 +2045,11 @@ fn type_of(operator: &Operator) -> Type {
| Operator::I16x8ShrS
| Operator::I16x8ShrU
| Operator::I16x8Add
| Operator::I16x8AddSaturateS
| Operator::I16x8AddSaturateU
| Operator::I16x8AddSatS
| Operator::I16x8AddSatU
| Operator::I16x8Sub
| Operator::I16x8SubSaturateS
| Operator::I16x8SubSaturateU
| Operator::I16x8SubSatS
| Operator::I16x8SubSatU
| Operator::I16x8MinS
| Operator::I16x8MinU
| Operator::I16x8MaxS
@@ -2043,7 +2058,7 @@ fn type_of(operator: &Operator) -> Type {
| Operator::I16x8Mul => I16X8,
Operator::I32x4Splat
| Operator::V32x4LoadSplat { .. }
| Operator::V128Load32Splat { .. }
| Operator::I32x4ExtractLane { .. }
| Operator::I32x4ReplaceLane { .. }
| Operator::I32x4Eq
@@ -2073,7 +2088,7 @@ fn type_of(operator: &Operator) -> Type {
| Operator::F32x4ConvertI32x4U => I32X4,
Operator::I64x2Splat
| Operator::V64x2LoadSplat { .. }
| Operator::V128Load64Splat { .. }
| Operator::I64x2ExtractLane { .. }
| Operator::I64x2ReplaceLane { .. }
| Operator::I64x2Neg

View File

@@ -2491,7 +2491,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
let res = self.builder.build_bitcast(res, self.intrinsics.i128_ty, "");
self.state.push1(res);
}
Operator::I8x16AddSaturateS => {
Operator::I8x16AddSatS => {
let ((v1, i1), (v2, i2)) = self.state.pop2_extra()?;
let (v1, _) = self.v128_into_i8x16(v1, i1);
let (v2, _) = self.v128_into_i8x16(v2, i2);
@@ -2508,7 +2508,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
let res = self.builder.build_bitcast(res, self.intrinsics.i128_ty, "");
self.state.push1(res);
}
Operator::I16x8AddSaturateS => {
Operator::I16x8AddSatS => {
let ((v1, i1), (v2, i2)) = self.state.pop2_extra()?;
let (v1, _) = self.v128_into_i16x8(v1, i1);
let (v2, _) = self.v128_into_i16x8(v2, i2);
@@ -2525,7 +2525,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
let res = self.builder.build_bitcast(res, self.intrinsics.i128_ty, "");
self.state.push1(res);
}
Operator::I8x16AddSaturateU => {
Operator::I8x16AddSatU => {
let ((v1, i1), (v2, i2)) = self.state.pop2_extra()?;
let (v1, _) = self.v128_into_i8x16(v1, i1);
let (v2, _) = self.v128_into_i8x16(v2, i2);
@@ -2542,7 +2542,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
let res = self.builder.build_bitcast(res, self.intrinsics.i128_ty, "");
self.state.push1(res);
}
Operator::I16x8AddSaturateU => {
Operator::I16x8AddSatU => {
let ((v1, i1), (v2, i2)) = self.state.pop2_extra()?;
let (v1, _) = self.v128_into_i16x8(v1, i1);
let (v2, _) = self.v128_into_i16x8(v2, i2);
@@ -2599,7 +2599,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
let res = self.builder.build_bitcast(res, self.intrinsics.i128_ty, "");
self.state.push1(res);
}
Operator::I8x16SubSaturateS => {
Operator::I8x16SubSatS => {
let ((v1, i1), (v2, i2)) = self.state.pop2_extra()?;
let (v1, _) = self.v128_into_i8x16(v1, i1);
let (v2, _) = self.v128_into_i8x16(v2, i2);
@@ -2616,7 +2616,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
let res = self.builder.build_bitcast(res, self.intrinsics.i128_ty, "");
self.state.push1(res);
}
Operator::I16x8SubSaturateS => {
Operator::I16x8SubSatS => {
let ((v1, i1), (v2, i2)) = self.state.pop2_extra()?;
let (v1, _) = self.v128_into_i16x8(v1, i1);
let (v2, _) = self.v128_into_i16x8(v2, i2);
@@ -2633,7 +2633,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
let res = self.builder.build_bitcast(res, self.intrinsics.i128_ty, "");
self.state.push1(res);
}
Operator::I8x16SubSaturateU => {
Operator::I8x16SubSatU => {
let ((v1, i1), (v2, i2)) = self.state.pop2_extra()?;
let (v1, _) = self.v128_into_i8x16(v1, i1);
let (v2, _) = self.v128_into_i8x16(v2, i2);
@@ -2650,7 +2650,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
let res = self.builder.build_bitcast(res, self.intrinsics.i128_ty, "");
self.state.push1(res);
}
Operator::I16x8SubSaturateU => {
Operator::I16x8SubSatU => {
let ((v1, i1), (v2, i2)) = self.state.pop2_extra()?;
let (v1, _) = self.v128_into_i16x8(v1, i1);
let (v2, _) = self.v128_into_i16x8(v2, i2);
@@ -6971,7 +6971,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
};
self.state.push1_extra(res, info);
}
Operator::V8x16Swizzle => {
Operator::I8x16Swizzle => {
let ((v1, i1), (v2, i2)) = self.state.pop2_extra()?;
let v1 = self.apply_pending_canonicalization(v1, i1);
let v1 = self
@@ -7039,7 +7039,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
let res = self.builder.build_bitcast(res, self.intrinsics.i128_ty, "");
self.state.push1(res);
}
Operator::V8x16Shuffle { lanes } => {
Operator::I8x16Shuffle { lanes } => {
let ((v1, i1), (v2, i2)) = self.state.pop2_extra()?;
let v1 = self.apply_pending_canonicalization(v1, i1);
let v1 = self
@@ -7062,7 +7062,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
let res = self.builder.build_bitcast(res, self.intrinsics.i128_ty, "");
self.state.push1(res);
}
Operator::I16x8Load8x8S { ref memarg } => {
Operator::V128Load8x8S { ref memarg } => {
let offset = self.state.pop1()?.into_int_value();
let memory_index = MemoryIndex::from_u32(0);
let effective_address = self.resolve_memory_ptr(
@@ -7083,7 +7083,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
let res = self.builder.build_bitcast(res, self.intrinsics.i128_ty, "");
self.state.push1(res);
}
Operator::I16x8Load8x8U { ref memarg } => {
Operator::V128Load8x8U { ref memarg } => {
let offset = self.state.pop1()?.into_int_value();
let memory_index = MemoryIndex::from_u32(0);
let effective_address = self.resolve_memory_ptr(
@@ -7104,7 +7104,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
let res = self.builder.build_bitcast(res, self.intrinsics.i128_ty, "");
self.state.push1(res);
}
Operator::I32x4Load16x4S { ref memarg } => {
Operator::V128Load16x4S { ref memarg } => {
let offset = self.state.pop1()?.into_int_value();
let memory_index = MemoryIndex::from_u32(0);
let effective_address = self.resolve_memory_ptr(
@@ -7125,7 +7125,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
let res = self.builder.build_bitcast(res, self.intrinsics.i128_ty, "");
self.state.push1(res);
}
Operator::I32x4Load16x4U { ref memarg } => {
Operator::V128Load16x4U { ref memarg } => {
let offset = self.state.pop1()?.into_int_value();
let memory_index = MemoryIndex::from_u32(0);
let effective_address = self.resolve_memory_ptr(
@@ -7146,7 +7146,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
let res = self.builder.build_bitcast(res, self.intrinsics.i128_ty, "");
self.state.push1(res);
}
Operator::I64x2Load32x2S { ref memarg } => {
Operator::V128Load32x2S { ref memarg } => {
let offset = self.state.pop1()?.into_int_value();
let memory_index = MemoryIndex::from_u32(0);
let effective_address = self.resolve_memory_ptr(
@@ -7167,7 +7167,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
let res = self.builder.build_bitcast(res, self.intrinsics.i128_ty, "");
self.state.push1(res);
}
Operator::I64x2Load32x2U { ref memarg } => {
Operator::V128Load32x2U { ref memarg } => {
let offset = self.state.pop1()?.into_int_value();
let memory_index = MemoryIndex::from_u32(0);
let effective_address = self.resolve_memory_ptr(
@@ -7188,7 +7188,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
let res = self.builder.build_bitcast(res, self.intrinsics.i128_ty, "");
self.state.push1(res);
}
Operator::V8x16LoadSplat { ref memarg } => {
Operator::V128Load8Splat { ref memarg } => {
let offset = self.state.pop1()?.into_int_value();
let memory_index = MemoryIndex::from_u32(0);
let effective_address = self.resolve_memory_ptr(
@@ -7209,7 +7209,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
let res = self.builder.build_bitcast(res, self.intrinsics.i128_ty, "");
self.state.push1(res);
}
Operator::V16x8LoadSplat { ref memarg } => {
Operator::V128Load16Splat { ref memarg } => {
let offset = self.state.pop1()?.into_int_value();
let memory_index = MemoryIndex::from_u32(0);
let effective_address = self.resolve_memory_ptr(
@@ -7230,7 +7230,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
let res = self.builder.build_bitcast(res, self.intrinsics.i128_ty, "");
self.state.push1(res);
}
Operator::V32x4LoadSplat { ref memarg } => {
Operator::V128Load32Splat { ref memarg } => {
let offset = self.state.pop1()?.into_int_value();
let memory_index = MemoryIndex::from_u32(0);
let effective_address = self.resolve_memory_ptr(
@@ -7251,7 +7251,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
let res = self.builder.build_bitcast(res, self.intrinsics.i128_ty, "");
self.state.push1(res);
}
Operator::V64x2LoadSplat { ref memarg } => {
Operator::V128Load64Splat { ref memarg } => {
let offset = self.state.pop1()?.into_int_value();
let memory_index = MemoryIndex::from_u32(0);
let effective_address = self.resolve_memory_ptr(

View File

@@ -13,7 +13,7 @@ edition = "2018"
[dependencies]
wasmer-vm = { path = "../vm", version = "1.0.0-alpha4" }
wasmer-types = { path = "../wasmer-types", version = "1.0.0-alpha4", default-features = false }
wasmparser = { version = "0.62", optional = true, default-features = false }
wasmparser = { version = "0.63", optional = true, default-features = false }
target-lexicon = { version = "0.10", default-features = false }
enumset = "1.0"
hashbrown = { version = "0.8", optional = true }