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

@@ -8,15 +8,16 @@ use cranelift_codegen::ir::InstBuilder;
use cranelift_codegen::isa::{TargetFrontendConfig, TargetIsa};
use cranelift_codegen::Context;
use cranelift_codegen::{binemit, ir};
use cranelift_entity::PrimaryMap;
use cranelift_entity::{EntityRef, PrimaryMap};
use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext};
use cranelift_wasm::DefinedFuncIndex;
use cranelift_wasm::{DefinedFuncIndex, DefinedMemoryIndex};
use std::boxed::Box;
use std::string::String;
use std::vec::Vec;
use wasmtime_debug::{emit_debugsections_image, DebugInfoData};
use wasmtime_environ::{
Compilation, CompileError, Compiler as _C, FunctionBodyData, Module, Relocations, Tunables,
Compilation, CompileError, Compiler as _C, FunctionBodyData, Module, ModuleVmctxInfo,
Relocations, Tunables, VMOffsets,
};
use wasmtime_runtime::{InstantiationError, SignatureRegistry, VMFunctionBody};
@@ -83,13 +84,14 @@ impl Compiler {
),
SetupError,
> {
let (compilation, relocations, address_transform) = DefaultCompiler::compile_module(
module,
function_body_inputs,
&*self.isa,
debug_data.is_some(),
)
.map_err(SetupError::Compile)?;
let (compilation, relocations, address_transform, value_ranges, stack_slots) =
DefaultCompiler::compile_module(
module,
function_body_inputs,
&*self.isa,
debug_data.is_some(),
)
.map_err(SetupError::Compile)?;
let allocated_functions =
allocate_functions(&mut self.code_memory, &compilation).map_err(|message| {
@@ -108,11 +110,22 @@ impl Compiler {
let body_len = compilation.get(i).body.len();
funcs.push((ptr, body_len));
}
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,
}
};
let bytes = emit_debugsections_image(
triple,
&target_config,
&debug_data,
&module_vmctx_info,
&address_transform,
&value_ranges,
&funcs,
)
.map_err(|e| SetupError::DebugInfo(e))?;