Update cranelift dependencies to 0.29.0 (#59)
This commit is contained in:
committed by
Dan Gohman
parent
ddbc00752e
commit
7b9761f4a2
@@ -23,10 +23,8 @@ name = "wasm2obj"
|
||||
path = "src/wasm2obj.rs"
|
||||
|
||||
[dependencies]
|
||||
cranelift-codegen = "0.28.0"
|
||||
cranelift-native = "0.28.0"
|
||||
cranelift-entity = "0.28.0"
|
||||
cranelift-wasm = "0.28.0"
|
||||
cranelift-codegen = "0.29.0"
|
||||
cranelift-native = "0.29.0"
|
||||
wasmtime-debug = { path = "lib/debug" }
|
||||
wasmtime-environ = { path = "lib/environ" }
|
||||
wasmtime-runtime = { path = "lib/runtime" }
|
||||
|
||||
@@ -11,9 +11,9 @@ cargo-fuzz = true
|
||||
[dependencies]
|
||||
wasmtime-environ = { path = "../lib/environ" }
|
||||
wasmtime-jit = { path = "../lib/jit" }
|
||||
cranelift-codegen = "0.28.0"
|
||||
cranelift-wasm = "0.28.0"
|
||||
cranelift-native = "0.28.0"
|
||||
cranelift-codegen = "0.29.0"
|
||||
cranelift-wasm = "0.29.0"
|
||||
cranelift-native = "0.29.0"
|
||||
libfuzzer-sys = { git = "https://github.com/rust-fuzz/libfuzzer-sys.git" }
|
||||
wasmparser = { version = "0.29.2", default-features = false }
|
||||
binaryen = "0.5.0"
|
||||
|
||||
@@ -14,9 +14,9 @@ edition = "2018"
|
||||
[dependencies]
|
||||
gimli = "0.17.0"
|
||||
wasmparser = { version = "0.28.0" }
|
||||
cranelift-codegen = "0.28.0"
|
||||
cranelift-entity = "0.28.0"
|
||||
cranelift-wasm = "0.28.0"
|
||||
cranelift-codegen = "0.29.0"
|
||||
cranelift-entity = "0.29.0"
|
||||
cranelift-wasm = "0.29.0"
|
||||
faerie = "0.7.0"
|
||||
wasmtime-environ = { path = "../environ", default-features = false }
|
||||
target-lexicon = { version = "0.2.0", default-features = false }
|
||||
|
||||
@@ -56,7 +56,7 @@ impl AddressTransform {
|
||||
continue;
|
||||
}
|
||||
// src_offset is a wasm bytecode offset in the code section
|
||||
let src_offset = t.srcloc.bits() as WasmAddress + fn_offset;
|
||||
let src_offset = t.srcloc.bits() as WasmAddress - code_section_offset;
|
||||
assert!(fn_offset <= src_offset && src_offset <= fn_offset + fn_size);
|
||||
lookup.insert(
|
||||
src_offset,
|
||||
|
||||
@@ -12,9 +12,9 @@ readme = "README.md"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
cranelift-codegen = "0.28.0"
|
||||
cranelift-entity = "0.28.0"
|
||||
cranelift-wasm = "0.28.0"
|
||||
cranelift-codegen = "0.29.0"
|
||||
cranelift-entity = "0.29.0"
|
||||
cranelift-wasm = "0.29.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 }
|
||||
|
||||
@@ -9,6 +9,7 @@ use crate::func_environ::{
|
||||
get_memory32_grow_name, get_memory32_size_name, FuncEnvironment,
|
||||
};
|
||||
use crate::module::Module;
|
||||
use crate::module_environ::FunctionBodyData;
|
||||
use cranelift_codegen::binemit;
|
||||
use cranelift_codegen::ir;
|
||||
use cranelift_codegen::ir::ExternalName;
|
||||
@@ -112,7 +113,7 @@ fn get_address_transform(
|
||||
/// associated relocations.
|
||||
pub fn compile_module<'data, 'module>(
|
||||
module: &'module Module,
|
||||
function_body_inputs: PrimaryMap<DefinedFuncIndex, &'data [u8]>,
|
||||
function_body_inputs: PrimaryMap<DefinedFuncIndex, FunctionBodyData<'data>>,
|
||||
isa: &dyn isa::TargetIsa,
|
||||
generate_debug_info: bool,
|
||||
) -> Result<(Compilation, Relocations, AddressTransforms), CompileError> {
|
||||
@@ -122,7 +123,7 @@ pub fn compile_module<'data, 'module>(
|
||||
|
||||
function_body_inputs
|
||||
.into_iter()
|
||||
.collect::<Vec<(DefinedFuncIndex, &&'data [u8])>>()
|
||||
.collect::<Vec<(DefinedFuncIndex, &FunctionBodyData<'data>)>>()
|
||||
.par_iter()
|
||||
.map(|(i, input)| {
|
||||
let func_index = module.func_index(*i);
|
||||
@@ -133,7 +134,8 @@ pub fn compile_module<'data, 'module>(
|
||||
let mut trans = FuncTranslator::new();
|
||||
trans
|
||||
.translate(
|
||||
input,
|
||||
input.data,
|
||||
input.module_offset,
|
||||
&mut context.func,
|
||||
&mut FuncEnvironment::new(isa.frontend_config(), module),
|
||||
)
|
||||
|
||||
@@ -54,8 +54,8 @@ pub use crate::module::{
|
||||
Export, MemoryPlan, MemoryStyle, Module, TableElements, TablePlan, TableStyle,
|
||||
};
|
||||
pub use crate::module_environ::{
|
||||
translate_signature, DataInitializer, DataInitializerLocation, ModuleEnvironment,
|
||||
ModuleTranslation,
|
||||
translate_signature, DataInitializer, DataInitializerLocation, FunctionBodyData,
|
||||
ModuleEnvironment, ModuleTranslation,
|
||||
};
|
||||
pub use crate::tunables::Tunables;
|
||||
pub use crate::vmoffsets::{TargetSharedSignatureIndex, VMOffsets};
|
||||
|
||||
@@ -13,6 +13,15 @@ use std::boxed::Box;
|
||||
use std::string::String;
|
||||
use std::vec::Vec;
|
||||
|
||||
/// Contains function data: byte code and its offset in the module.
|
||||
pub struct FunctionBodyData<'a> {
|
||||
/// Body byte code.
|
||||
pub data: &'a [u8],
|
||||
|
||||
/// Body offset in the module file.
|
||||
pub module_offset: usize,
|
||||
}
|
||||
|
||||
/// The result of translating via `ModuleEnvironment`. Function bodies are not
|
||||
/// yet translated, and data initializers have not yet been copied out of the
|
||||
/// original buffer.
|
||||
@@ -24,7 +33,7 @@ pub struct ModuleTranslation<'data> {
|
||||
pub module: Module,
|
||||
|
||||
/// References to the function bodies.
|
||||
pub function_body_inputs: PrimaryMap<DefinedFuncIndex, &'data [u8]>,
|
||||
pub function_body_inputs: PrimaryMap<DefinedFuncIndex, FunctionBodyData<'data>>,
|
||||
|
||||
/// References to the data initializers.
|
||||
pub data_initializers: Vec<DataInitializer<'data>>,
|
||||
@@ -260,8 +269,15 @@ impl<'data> cranelift_wasm::ModuleEnvironment<'data> for ModuleEnvironment<'data
|
||||
});
|
||||
}
|
||||
|
||||
fn define_function_body(&mut self, body_bytes: &'data [u8]) -> WasmResult<()> {
|
||||
self.result.function_body_inputs.push(body_bytes);
|
||||
fn define_function_body(
|
||||
&mut self,
|
||||
body_bytes: &'data [u8],
|
||||
body_offset: usize,
|
||||
) -> WasmResult<()> {
|
||||
self.result.function_body_inputs.push(FunctionBodyData {
|
||||
data: body_bytes,
|
||||
module_offset: body_offset,
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -12,10 +12,10 @@ readme = "README.md"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
cranelift-codegen = "0.28.0"
|
||||
cranelift-entity = "0.28.0"
|
||||
cranelift-wasm = "0.28.0"
|
||||
cranelift-frontend = "0.28.0"
|
||||
cranelift-codegen = "0.29.0"
|
||||
cranelift-entity = "0.29.0"
|
||||
cranelift-wasm = "0.29.0"
|
||||
cranelift-frontend = "0.29.0"
|
||||
wasmtime-environ = { path = "../environ", default-features = false }
|
||||
wasmtime-runtime = { path = "../runtime", default-features = false }
|
||||
wasmtime-debug = { path = "../debug", default-features = false }
|
||||
|
||||
@@ -16,7 +16,9 @@ use std::string::String;
|
||||
use std::vec::Vec;
|
||||
use wasmtime_debug::{emit_debugsections_image, DebugInfoData};
|
||||
use wasmtime_environ::cranelift;
|
||||
use wasmtime_environ::{Compilation, CompileError, Module, Relocations, Tunables};
|
||||
use wasmtime_environ::{
|
||||
Compilation, CompileError, FunctionBodyData, Module, Relocations, Tunables,
|
||||
};
|
||||
use wasmtime_runtime::{InstantiationError, SignatureRegistry, VMFunctionBody};
|
||||
|
||||
/// A WebAssembly code JIT compiler.
|
||||
@@ -66,7 +68,7 @@ impl Compiler {
|
||||
pub(crate) fn compile<'data>(
|
||||
&mut self,
|
||||
module: &Module,
|
||||
function_body_inputs: PrimaryMap<DefinedFuncIndex, &'data [u8]>,
|
||||
function_body_inputs: PrimaryMap<DefinedFuncIndex, FunctionBodyData<'data>>,
|
||||
debug_data: Option<DebugInfoData>,
|
||||
) -> Result<
|
||||
(
|
||||
|
||||
@@ -12,8 +12,8 @@ readme = "README.md"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
cranelift-codegen = "0.28.0"
|
||||
cranelift-entity = "0.28.0"
|
||||
cranelift-wasm = "0.28.0"
|
||||
cranelift-codegen = "0.29.0"
|
||||
cranelift-entity = "0.29.0"
|
||||
cranelift-wasm = "0.29.0"
|
||||
wasmtime-environ = { path = "../environ" }
|
||||
faerie = "0.7.1"
|
||||
|
||||
@@ -12,9 +12,9 @@ readme = "README.md"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
cranelift-codegen = "0.28.0"
|
||||
cranelift-entity = "0.28.0"
|
||||
cranelift-wasm = "0.28.0"
|
||||
cranelift-codegen = "0.29.0"
|
||||
cranelift-entity = "0.29.0"
|
||||
cranelift-wasm = "0.29.0"
|
||||
wasmtime-environ = { path = "../environ", default-features = false }
|
||||
region = "2.0.0"
|
||||
lazy_static = "1.2.0"
|
||||
|
||||
@@ -12,10 +12,10 @@ readme = "README.md"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
cranelift-codegen = "0.28.0"
|
||||
cranelift-native = "0.28.0"
|
||||
cranelift-wasm = "0.28.0"
|
||||
cranelift-entity = "0.28.0"
|
||||
cranelift-codegen = "0.29.0"
|
||||
cranelift-native = "0.29.0"
|
||||
cranelift-wasm = "0.29.0"
|
||||
cranelift-entity = "0.29.0"
|
||||
wasmtime-jit = { path = "../jit" }
|
||||
wasmtime-runtime = { path = "../runtime" }
|
||||
wasmtime-environ = { path = "../environ" }
|
||||
|
||||
Reference in New Issue
Block a user