Trace log access to cache system

This commit is contained in:
Artur Jamro
2019-08-22 13:07:41 -07:00
committed by Dan Gohman
parent f65d8f2372
commit ade5c0dd2f
2 changed files with 11 additions and 1 deletions

View File

@@ -353,6 +353,14 @@ impl binemit::RelocSink for RelocSink {
) {
panic!("trampoline compilation should not produce external symbol relocs");
}
fn reloc_constant(
&mut self,
_code_offset: binemit::CodeOffset,
_reloc: binemit::Reloc,
_constant_offset: ir::ConstantOffset,
) {
panic!("trampoline compilation should not produce constant relocs");
}
fn reloc_jt(
&mut self,
_offset: binemit::CodeOffset,

View File

@@ -7,7 +7,7 @@ use cranelift_codegen::{ir, isa};
use cranelift_entity::PrimaryMap;
use cranelift_wasm::DefinedFuncIndex;
use lazy_static::lazy_static;
use log::{debug, warn};
use log::{debug, trace, warn};
use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256};
use std::fs;
@@ -241,6 +241,7 @@ impl ModuleCacheEntry {
pub fn get_data(&self) -> Option<ModuleCacheData> {
let path = self.mod_cache_path.as_ref()?;
trace!("get_data() for path: {}", path.display());
let compressed_cache_bytes = fs::read(path).ok()?;
let cache_bytes = zstd::decode_all(&compressed_cache_bytes[..])
.map_err(|err| warn!("Failed to decompress cached code: {}", err))
@@ -256,6 +257,7 @@ impl ModuleCacheEntry {
fn update_data_impl(&self, data: &ModuleCacheData) -> Option<()> {
let path = self.mod_cache_path.as_ref()?;
trace!("update_data() for path: {}", path.display());
let serialized_data = bincode::serialize(&data)
.map_err(|err| warn!("Failed to serialize cached code: {}", err))
.ok()?;