Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to newer cranelift and wasmparser 0.32.1. #518

Merged
merged 7 commits into from
Jul 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/clif-backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ edition = "2018"

[dependencies]
wasmer-runtime-core = { path = "../runtime-core", version = "0.5.1" }
cranelift-native = { git = "https://github.com/wasmerio/cranelift.git", rev = "84ec31b0fdfc10db491ef950815ee2961db057cb" }
cranelift-codegen = { git = "https://github.com/wasmerio/cranelift.git", rev = "84ec31b0fdfc10db491ef950815ee2961db057cb" }
cranelift-entity = { git = "https://github.com/wasmerio/cranelift.git", rev = "84ec31b0fdfc10db491ef950815ee2961db057cb" }
cranelift-frontend = { git = "https://github.com/wasmerio/cranelift.git", rev = "84ec31b0fdfc10db491ef950815ee2961db057cb" }
cranelift-wasm = { git = "https://github.com/wasmerio/cranelift.git", rev = "84ec31b0fdfc10db491ef950815ee2961db057cb" }
cranelift-native = { git = "https://github.com/wasmerio/cranelift.git", rev = "2ada531d79b34a9e6c94c81f2615677e22d68780" }
cranelift-codegen = { git = "https://github.com/wasmerio/cranelift.git", rev = "2ada531d79b34a9e6c94c81f2615677e22d68780" }
cranelift-entity = { git = "https://github.com/wasmerio/cranelift.git", rev = "2ada531d79b34a9e6c94c81f2615677e22d68780" }
cranelift-frontend = { git = "https://github.com/wasmerio/cranelift.git", rev = "2ada531d79b34a9e6c94c81f2615677e22d68780" }
cranelift-wasm = { git = "https://github.com/wasmerio/cranelift.git", rev = "2ada531d79b34a9e6c94c81f2615677e22d68780" }
hashbrown = "0.1"
target-lexicon = "0.4.0"
wasmparser = "0.29.2"
wasmparser = "0.32.1"
byteorder = "1"
nix = "0.13.0"
libc = "0.2.49"
Expand Down
1 change: 1 addition & 0 deletions lib/clif-backend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ fn get_isa() -> Box<isa::TargetIsa> {
let flags = {
let mut builder = settings::builder();
builder.set("opt_level", "best").unwrap();
builder.set("jump_tables_enabled", "false").unwrap();

if cfg!(not(test)) {
builder.set("enable_verifier", "false").unwrap();
Expand Down
2 changes: 1 addition & 1 deletion lib/llvm-backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2018"
[dependencies]
wasmer-runtime-core = { path = "../runtime-core", version = "0.5.1" }
inkwell = { git = "https://github.com/wasmerio/inkwell", branch = "llvm7-0" }
wasmparser = "0.29.2"
wasmparser = "0.32.1"
hashbrown = "0.1.8"
smallvec = "0.6.8"
goblin = "0.0.20"
Expand Down
8 changes: 4 additions & 4 deletions lib/llvm-backend/src/code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use wasmparser::{BinaryReaderError, MemoryImmediate, Operator, Type as WpType};

use crate::backend::LLVMBackend;
use crate::intrinsics::{CtxType, GlobalCache, Intrinsics, MemoryCache};
use crate::read_info::type_to_type;
use crate::read_info::{blocktype_to_type, type_to_type};
use crate::state::{ControlFrame, IfElseState, State};
use crate::trampolines::generate_trampolines;

Expand Down Expand Up @@ -525,7 +525,7 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
let end_block = context.append_basic_block(&function, "end");
builder.position_at_end(&end_block);

let phis = if let Ok(wasmer_ty) = type_to_type(ty) {
let phis = if let Ok(wasmer_ty) = blocktype_to_type(ty) {
let llvm_ty = type_to_llvm(intrinsics, wasmer_ty);
[llvm_ty]
.iter()
Expand All @@ -545,7 +545,7 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
builder.build_unconditional_branch(&loop_body);

builder.position_at_end(&loop_next);
let phis = if let Ok(wasmer_ty) = type_to_type(ty) {
let phis = if let Ok(wasmer_ty) = blocktype_to_type(ty) {
let llvm_ty = type_to_llvm(intrinsics, wasmer_ty);
[llvm_ty]
.iter()
Expand Down Expand Up @@ -680,7 +680,7 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
let end_phis = {
builder.position_at_end(&end_block);

let phis = if let Ok(wasmer_ty) = type_to_type(ty) {
let phis = if let Ok(wasmer_ty) = blocktype_to_type(ty) {
let llvm_ty = type_to_llvm(intrinsics, wasmer_ty);
[llvm_ty]
.iter()
Expand Down
15 changes: 14 additions & 1 deletion lib/llvm-backend/src/read_info.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use wasmer_runtime_core::types::Type;
use wasmparser::{BinaryReaderError, Type as WpType};
use wasmparser::{BinaryReaderError, Type as WpType, TypeOrFuncType as WpTypeOrFuncType};

pub fn type_to_type(ty: WpType) -> Result<Type, BinaryReaderError> {
Ok(match ty {
Expand All @@ -21,3 +21,16 @@ pub fn type_to_type(ty: WpType) -> Result<Type, BinaryReaderError> {
}
})
}

pub fn blocktype_to_type(ty: WpTypeOrFuncType) -> Result<Type, BinaryReaderError> {
match ty {
WpTypeOrFuncType::Type(inner_ty) => type_to_type(inner_ty),
_ => {
return Err(BinaryReaderError {
message:
"the wasmer llvm backend does not yet support the multi-value return extension",
offset: -1isize as usize,
});
}
}
}
4 changes: 2 additions & 2 deletions lib/middleware-common/src/metering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use wasmer_runtime_core::{
codegen::{Event, EventSink, FunctionMiddleware, InternalEvent},
module::ModuleInfo,
vm::{Ctx, InternalField},
wasmparser::{Operator, Type as WpType},
wasmparser::{Operator, Type as WpType, TypeOrFuncType as WpTypeOrFuncType},
Instance,
};

Expand Down Expand Up @@ -92,7 +92,7 @@ impl FunctionMiddleware for Metering {
}));
sink.push(Event::WasmOwned(Operator::I64GeU));
sink.push(Event::WasmOwned(Operator::If {
ty: WpType::EmptyBlockType,
ty: WpTypeOrFuncType::Type(WpType::EmptyBlockType),
}));
sink.push(Event::Internal(InternalEvent::Breakpoint(Box::new(
move |ctx| unsafe {
Expand Down
2 changes: 1 addition & 1 deletion lib/runtime-abi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ wasmer-runtime-core = { path = "../runtime-core" }
hashbrown = "0.1"
failure = "0.1"
tar = "0.4"
wasmparser = "0.29.2"
wasmparser = "0.32.1"
zstd = "0.4"

# [target.'cfg(unix)'.dependencies.zbox]
Expand Down
2 changes: 1 addition & 1 deletion lib/runtime-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ edition = "2018"
[dependencies]
nix = "0.12.0"
page_size = "0.4.1"
wasmparser = "0.29.2"
wasmparser = "0.32.1"
parking_lot = "0.7.1"
lazy_static = "1.2.0"
indexmap = "1.0.2"
Expand Down
1 change: 1 addition & 0 deletions lib/runtime-core/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ pub fn read_module<
enable_reference_types: false,
enable_simd: false,
enable_bulk_memory: false,
enable_multi_value: false,
},
mutable_global_imports: false,
}),
Expand Down
2 changes: 1 addition & 1 deletion lib/singlepass-backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ edition = "2018"

[dependencies]
wasmer-runtime-core = { path = "../runtime-core", version = "0.5.1" }
wasmparser = "0.29.2"
wasmparser = "0.32.1"
dynasm = "0.3.2"
dynasmrt = "0.3.1"
lazy_static = "1.2.0"
Expand Down
17 changes: 10 additions & 7 deletions lib/singlepass-backend/src/codegen_x64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use wasmer_runtime_core::{
},
vm::{self, LocalGlobal, LocalTable, INTERNALS_SIZE},
};
use wasmparser::{Operator, Type as WpType};
use wasmparser::{Operator, Type as WpType, TypeOrFuncType as WpTypeOrFuncType};

lazy_static! {
/// Performs a System V call to `target` with [stack_top..stack_base] as the argument list, from right to left.
Expand Down Expand Up @@ -3335,8 +3335,9 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
loop_like: false,
if_else: IfElseState::If(label_else),
returns: match ty {
WpType::EmptyBlockType => smallvec![],
_ => smallvec![ty],
WpTypeOrFuncType::Type(WpType::EmptyBlockType) => smallvec![],
WpTypeOrFuncType::Type(inner_ty) => smallvec![inner_ty],
_ => panic!("multi-value returns not yet implemented"),
},
value_stack_depth: self.value_stack.len(),
});
Expand Down Expand Up @@ -3434,8 +3435,9 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
loop_like: false,
if_else: IfElseState::None,
returns: match ty {
WpType::EmptyBlockType => smallvec![],
_ => smallvec![ty],
WpTypeOrFuncType::Type(WpType::EmptyBlockType) => smallvec![],
WpTypeOrFuncType::Type(inner_ty) => smallvec![inner_ty],
_ => panic!("multi-value returns not yet implemented"),
},
value_stack_depth: self.value_stack.len(),
});
Expand All @@ -3447,8 +3449,9 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
loop_like: true,
if_else: IfElseState::None,
returns: match ty {
WpType::EmptyBlockType => smallvec![],
_ => smallvec![ty],
WpTypeOrFuncType::Type(WpType::EmptyBlockType) => smallvec![],
WpTypeOrFuncType::Type(inner_ty) => smallvec![inner_ty],
_ => panic!("multi-value returns not yet implemented"),
},
value_stack_depth: self.value_stack.len(),
});
Expand Down