Refactor Cache logic to include debug information (#2065)
* move caching to the CompilationArtifacts * mv cache_config from Compiler to CompiledModule * hash isa flags * no cache for wasm2obj * mv caching to wasmtime crate * account each Compiler field when hash
This commit is contained in:
@@ -11,7 +11,6 @@ use std::{
|
||||
};
|
||||
use structopt::{clap::AppSettings, StructOpt};
|
||||
use target_lexicon::Triple;
|
||||
use wasmtime_environ::CacheConfig;
|
||||
|
||||
/// The after help text for the `wasm2obj` command.
|
||||
pub const WASM2OBJ_AFTER_HELP: &str = "The translation is dependent on the environment chosen.\n\
|
||||
@@ -60,11 +59,6 @@ impl WasmToObjCommand {
|
||||
pretty_env_logger::init();
|
||||
}
|
||||
|
||||
let cache_config = if self.common.disable_cache {
|
||||
CacheConfig::new_cache_disabled()
|
||||
} else {
|
||||
CacheConfig::from_file(self.common.config.as_deref())?
|
||||
};
|
||||
let strategy = pick_compilation_strategy(self.common.cranelift, self.common.lightbeam)?;
|
||||
|
||||
let data = wat::parse_file(&self.module).context("failed to parse module")?;
|
||||
@@ -76,7 +70,6 @@ impl WasmToObjCommand {
|
||||
self.common.enable_simd,
|
||||
self.common.opt_level(),
|
||||
self.common.debug_info,
|
||||
&cache_config,
|
||||
)?;
|
||||
|
||||
let mut file =
|
||||
|
||||
11
src/obj.rs
11
src/obj.rs
@@ -7,8 +7,8 @@ use wasmtime_debug::{emit_dwarf, read_debuginfo};
|
||||
use wasmtime_environ::Lightbeam;
|
||||
use wasmtime_environ::{
|
||||
entity::EntityRef, settings, settings::Configurable, wasm::DefinedMemoryIndex,
|
||||
wasm::MemoryIndex, CacheConfig, Compiler, Cranelift, ModuleEnvironment, ModuleMemoryOffset,
|
||||
ModuleVmctxInfo, Tunables, VMOffsets,
|
||||
wasm::MemoryIndex, Compiler, Cranelift, ModuleEnvironment, ModuleMemoryOffset, ModuleVmctxInfo,
|
||||
Tunables, VMOffsets,
|
||||
};
|
||||
use wasmtime_jit::native;
|
||||
use wasmtime_obj::{emit_module, ObjectBuilderTarget};
|
||||
@@ -21,7 +21,6 @@ pub fn compile_to_obj(
|
||||
enable_simd: bool,
|
||||
opt_level: wasmtime::OptLevel,
|
||||
debug_info: bool,
|
||||
cache_config: &CacheConfig,
|
||||
) -> Result<Object> {
|
||||
let isa_builder = match target {
|
||||
Some(target) => native::lookup(target.clone())?,
|
||||
@@ -72,11 +71,9 @@ pub fn compile_to_obj(
|
||||
_traps,
|
||||
_stack_maps,
|
||||
) = match strategy {
|
||||
Strategy::Auto | Strategy::Cranelift => {
|
||||
Cranelift::compile_module(&translation, &*isa, cache_config)
|
||||
}
|
||||
Strategy::Auto | Strategy::Cranelift => Cranelift::compile_module(&translation, &*isa),
|
||||
#[cfg(feature = "lightbeam")]
|
||||
Strategy::Lightbeam => Lightbeam::compile_module(&translation, &*isa, cache_config),
|
||||
Strategy::Lightbeam => Lightbeam::compile_module(&translation, &*isa),
|
||||
#[cfg(not(feature = "lightbeam"))]
|
||||
Strategy::Lightbeam => bail!("lightbeam support not enabled"),
|
||||
other => bail!("unsupported compilation strategy {:?}", other),
|
||||
|
||||
Reference in New Issue
Block a user