Transform ranges and simple expressions (#63)

This commit is contained in:
Yury Delendik
2019-08-08 22:44:45 -05:00
committed by Dan Gohman
parent 36b4ff8031
commit 4f04d7d873
20 changed files with 2701 additions and 867 deletions

View File

@@ -32,7 +32,9 @@
use cranelift_codegen::isa;
use cranelift_codegen::settings;
use cranelift_codegen::settings::Configurable;
use cranelift_entity::EntityRef;
use cranelift_native;
use cranelift_wasm::DefinedMemoryIndex;
use docopt::Docopt;
use faerie::Artifact;
use serde::Deserialize;
@@ -49,7 +51,9 @@ use std::str::FromStr;
use target_lexicon::Triple;
use wasmtime_debug::{emit_debugsections, read_debuginfo};
use wasmtime_environ::cache_conf;
use wasmtime_environ::{Compiler, Cranelift, ModuleEnvironment, Tunables};
use wasmtime_environ::{
Compiler, Cranelift, ModuleEnvironment, ModuleVmctxInfo, Tunables, VMOffsets,
};
use wasmtime_obj::emit_module;
mod utils;
@@ -183,13 +187,23 @@ fn handle_module(
)
};
let (compilation, relocations, address_transform) = Cranelift::compile_module(
&module,
lazy_function_body_inputs,
&*isa,
generate_debug_info,
)
.map_err(|e| e.to_string())?;
let (compilation, relocations, address_transform, value_ranges, stack_slots) =
Cranelift::compile_module(
&module,
lazy_function_body_inputs,
&*isa,
generate_debug_info,
)
.map_err(|e| e.to_string())?;
let module_vmctx_info = {
let ofs = VMOffsets::new(target_config.pointer_bytes(), &module);
let memory_offset = ofs.vmctx_vmmemory_definition_base(DefinedMemoryIndex::new(0)) as i64;
ModuleVmctxInfo {
memory_offset,
stack_slots,
}
};
emit_module(
&mut obj,
@@ -202,8 +216,15 @@ fn handle_module(
if generate_debug_info {
let debug_data = read_debuginfo(&data);
emit_debugsections(&mut obj, &target_config, &debug_data, &address_transform)
.map_err(|e| e.to_string())?;
emit_debugsections(
&mut obj,
&module_vmctx_info,
&target_config,
&debug_data,
&address_transform,
&value_ranges,
)
.map_err(|e| e.to_string())?;
}
// FIXME: Make the format a parameter.