Browse Source

Update Lightbeam for various API changes.

pull/397/head
Dan Gohman 5 years ago
parent
commit
8d52e389f8
  1. 2
      lightbeam/Cargo.toml
  2. 4
      wasmtime-environ/src/compilation.rs
  3. 28
      wasmtime-environ/src/lightbeam.rs

2
lightbeam/Cargo.toml

@ -22,7 +22,7 @@ failure_derive = "0.1.3"
cranelift-codegen = "0.44"
multi_mut = "0.1"
either = "1.5"
wabt = "0.7"
wabt = "0.9.2"
lazy_static = "1.2"
quickcheck = "0.7"
typemap = "0.3"

4
wasmtime-environ/src/compilation.rs

@ -153,6 +153,10 @@ pub enum CompileError {
/// A compilation error occured.
#[fail(display = "Compilation error: {}", _0)]
Codegen(CodegenError),
/// A compilation error occured.
#[fail(display = "Debug info is not supported with this configuration")]
DebugInfoNotSupported,
}
/// An implementation of a compiler from parsed WebAssembly module to native code.

28
wasmtime-environ/src/lightbeam.rs

@ -1,12 +1,13 @@
//! Support for compiling with Lightbeam.
use crate::compilation::{AddressTransforms, Compilation, CompileError, Relocations};
use crate::compilation::{Compilation, CompileError, Relocations, Traps};
use crate::func_environ::FuncEnvironment;
use crate::module::Module;
use crate::module_environ::FunctionBodyData;
// TODO: Put this in `compilation`
use crate::address_map::{ModuleAddressMap, ValueLabelsRanges};
use crate::cranelift::RelocSink;
use cranelift_codegen::isa;
use cranelift_codegen::{ir, isa};
use cranelift_entity::{PrimaryMap, SecondaryMap};
use cranelift_wasm::DefinedFuncIndex;
use lightbeam;
@ -22,8 +23,22 @@ impl crate::compilation::Compiler for Lightbeam {
function_body_inputs: PrimaryMap<DefinedFuncIndex, FunctionBodyData<'data>>,
isa: &dyn isa::TargetIsa,
// TODO
_generate_debug_info: bool,
) -> Result<(Compilation, Relocations, AddressTransforms), CompileError> {
generate_debug_info: bool,
) -> Result<
(
Compilation,
Relocations,
ModuleAddressMap,
ValueLabelsRanges,
PrimaryMap<DefinedFuncIndex, ir::StackSlots>,
Traps,
),
CompileError,
> {
if generate_debug_info {
return Err(CompileError::DebugInfoNotSupported);
}
let env = FuncEnvironment::new(isa.frontend_config(), module);
let mut relocations = PrimaryMap::new();
let mut codegen_session: lightbeam::CodeGenSession<_> =
@ -57,7 +72,10 @@ impl crate::compilation::Compiler for Lightbeam {
Ok((
Compilation::from_buffer(code_section.buffer().to_vec(), code_section_ranges_and_jt),
relocations,
AddressTransforms::new(),
ModuleAddressMap::new(),
ValueLabelsRanges::new(),
PrimaryMap::new(),
Traps::new(),
))
}
}

Loading…
Cancel
Save