From e66f01b923165e44befa86dce5104134ad9a922c Mon Sep 17 00:00:00 2001 From: Yury Delendik Date: Tue, 29 Jan 2019 18:27:44 -0600 Subject: [PATCH] Update cranelift libraries to 0.28.0 --- Cargo.toml | 8 ++++---- fuzz/Cargo.toml | 6 +++--- lib/environ/Cargo.toml | 6 +++--- lib/environ/src/module_environ.rs | 26 +++++--------------------- lib/jit/Cargo.toml | 8 ++++---- lib/obj/Cargo.toml | 4 ++-- lib/runtime/Cargo.toml | 6 +++--- lib/wast/Cargo.toml | 8 ++++---- 8 files changed, 28 insertions(+), 44 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1fb28435e7..4803654a84 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,10 +23,10 @@ name = "wasm2obj" path = "src/wasm2obj.rs" [dependencies] -cranelift-codegen = "0.26.0" -cranelift-native = "0.26.0" -cranelift-entity = "0.26.0" -cranelift-wasm = "0.26.0" +cranelift-codegen = "0.28.0" +cranelift-native = "0.28.0" +cranelift-entity = "0.28.0" +cranelift-wasm = "0.28.0" wasmtime-environ = { path = "lib/environ" } wasmtime-runtime = { path = "lib/runtime" } wasmtime-jit = { path = "lib/jit" } diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index 93cc8a4c1e..7289ffa84b 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -11,9 +11,9 @@ cargo-fuzz = true [dependencies] wasmtime-environ = { path = "../lib/environ" } wasmtime-jit = { path = "../lib/jit" } -cranelift-codegen = "0.26.0" -cranelift-wasm = "0.26.0" -cranelift-native = "0.26.0" +cranelift-codegen = "0.28.0" +cranelift-wasm = "0.28.0" +cranelift-native = "0.28.0" libfuzzer-sys = { git = "https://github.com/rust-fuzz/libfuzzer-sys.git" } wasmparser = { version = "0.23.0", default-features = false } binaryen = "0.5.0" diff --git a/lib/environ/Cargo.toml b/lib/environ/Cargo.toml index 8cf7451b32..8c2842bcce 100644 --- a/lib/environ/Cargo.toml +++ b/lib/environ/Cargo.toml @@ -12,9 +12,9 @@ readme = "README.md" edition = "2018" [dependencies] -cranelift-codegen = "0.26.0" -cranelift-entity = "0.26.0" -cranelift-wasm = "0.26.0" +cranelift-codegen = "0.28.0" +cranelift-entity = "0.28.0" +cranelift-wasm = "0.28.0" cast = { version = "0.2.2", default-features = false } failure = { version = "0.1.3", default-features = false } failure_derive = { version = "0.1.3", default-features = false } diff --git a/lib/environ/src/module_environ.rs b/lib/environ/src/module_environ.rs index f3e92b7f25..a8578b200b 100644 --- a/lib/environ/src/module_environ.rs +++ b/lib/environ/src/module_environ.rs @@ -1,7 +1,6 @@ use crate::func_environ::FuncEnvironment; use crate::module::{Export, MemoryPlan, Module, TableElements, TablePlan}; use crate::tunables::Tunables; -use core::clone::Clone; use cranelift_codegen::ir; use cranelift_codegen::ir::{AbiParam, ArgumentPurpose}; use cranelift_codegen::isa::TargetFrontendConfig; @@ -10,6 +9,7 @@ use cranelift_wasm::{ self, translate_module, DefinedFuncIndex, FuncIndex, Global, GlobalIndex, Memory, MemoryIndex, SignatureIndex, Table, TableIndex, WasmResult, }; +use std::boxed::Box; use std::string::String; use std::vec::Vec; @@ -80,16 +80,12 @@ impl<'data> cranelift_wasm::ModuleEnvironment<'data> for ModuleEnvironment<'data self.result.target_config } - fn declare_signature(&mut self, sig: &ir::Signature) { - let sig = translate_signature(sig.clone(), self.pointer_type()); + fn declare_signature(&mut self, sig: ir::Signature) { + let sig = translate_signature(sig, self.pointer_type()); // TODO: Deduplicate signatures. self.result.module.signatures.push(sig); } - fn get_signature(&self, sig_index: SignatureIndex) -> &ir::Signature { - &self.result.module.signatures[sig_index] - } - fn declare_func_import(&mut self, sig_index: SignatureIndex, module: &str, field: &str) { debug_assert_eq!( self.result.module.functions.len(), @@ -104,18 +100,10 @@ impl<'data> cranelift_wasm::ModuleEnvironment<'data> for ModuleEnvironment<'data .push((String::from(module), String::from(field))); } - fn get_num_func_imports(&self) -> usize { - self.result.module.imported_funcs.len() - } - fn declare_func_type(&mut self, sig_index: SignatureIndex) { self.result.module.functions.push(sig_index); } - fn get_func_type(&self, func_index: FuncIndex) -> SignatureIndex { - self.result.module.functions[func_index] - } - fn declare_global_import(&mut self, global: Global, module: &str, field: &str) { debug_assert_eq!( self.result.module.globals.len(), @@ -134,10 +122,6 @@ impl<'data> cranelift_wasm::ModuleEnvironment<'data> for ModuleEnvironment<'data self.result.module.globals.push(global); } - fn get_global(&self, global_index: GlobalIndex) -> &Global { - &self.result.module.globals[global_index] - } - fn declare_table_import(&mut self, table: Table, module: &str, field: &str) { debug_assert_eq!( self.result.module.table_plans.len(), @@ -163,13 +147,13 @@ impl<'data> cranelift_wasm::ModuleEnvironment<'data> for ModuleEnvironment<'data table_index: TableIndex, base: Option, offset: usize, - elements: Vec, + elements: Box<[FuncIndex]>, ) { self.result.module.table_elements.push(TableElements { table_index, base, offset, - elements, + elements: elements.to_vec(), }); } diff --git a/lib/jit/Cargo.toml b/lib/jit/Cargo.toml index 9c49a902a5..97b179bafc 100644 --- a/lib/jit/Cargo.toml +++ b/lib/jit/Cargo.toml @@ -12,10 +12,10 @@ readme = "README.md" edition = "2018" [dependencies] -cranelift-codegen = "0.26.0" -cranelift-entity = "0.26.0" -cranelift-wasm = "0.26.0" -cranelift-frontend = "0.26.0" +cranelift-codegen = "0.28.0" +cranelift-entity = "0.28.0" +cranelift-wasm = "0.28.0" +cranelift-frontend = "0.28.0" wasmtime-environ = { path = "../environ", default-features = false } wasmtime-runtime = { path = "../runtime", default-features = false } region = "1.0.0" diff --git a/lib/obj/Cargo.toml b/lib/obj/Cargo.toml index 43c8b180f0..6cba2e9c68 100644 --- a/lib/obj/Cargo.toml +++ b/lib/obj/Cargo.toml @@ -12,7 +12,7 @@ readme = "README.md" edition = "2018" [dependencies] -cranelift-codegen = "0.26.0" -cranelift-entity = "0.26.0" +cranelift-codegen = "0.28.0" +cranelift-entity = "0.28.0" wasmtime-environ = { path = "../environ" } faerie = "0.6.0" diff --git a/lib/runtime/Cargo.toml b/lib/runtime/Cargo.toml index 2284c58e90..e7820501d6 100644 --- a/lib/runtime/Cargo.toml +++ b/lib/runtime/Cargo.toml @@ -12,9 +12,9 @@ readme = "README.md" edition = "2018" [dependencies] -cranelift-codegen = "0.26.0" -cranelift-entity = "0.26.0" -cranelift-wasm = "0.26.0" +cranelift-codegen = "0.28.0" +cranelift-entity = "0.28.0" +cranelift-wasm = "0.28.0" wasmtime-environ = { path = "../environ", default-features = false } region = "1.0.0" lazy_static = "1.2.0" diff --git a/lib/wast/Cargo.toml b/lib/wast/Cargo.toml index 8f0036da94..67ed2d386d 100644 --- a/lib/wast/Cargo.toml +++ b/lib/wast/Cargo.toml @@ -12,10 +12,10 @@ readme = "README.md" edition = "2018" [dependencies] -cranelift-codegen = "0.26.0" -cranelift-native = "0.26.0" -cranelift-wasm = "0.26.0" -cranelift-entity = "0.26.0" +cranelift-codegen = "0.28.0" +cranelift-native = "0.28.0" +cranelift-wasm = "0.28.0" +cranelift-entity = "0.28.0" wasmtime-jit = { path = "../jit" } wasmtime-runtime = { path = "../runtime" } wasmtime-environ = { path = "../environ" }