Skip to content

Commit

Permalink
Annotate compiled module consistenly
Browse files Browse the repository at this point in the history
  • Loading branch information
webmaster128 committed Oct 7, 2023
1 parent 7c7b93d commit b76c1e5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/vm/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ where
pub fn save_wasm_unchecked(&self, wasm: &[u8]) -> VmResult<Checksum> {
// We need a new engine for each Wasm -> module compilation due to the metering middleware.
let compiling_engine = make_compiling_engine(None);
// This module cannot be executed directly as it was not created with the runtime engine
let module = compile(&compiling_engine, wasm)?;

let mut cache = self.inner.lock().unwrap();
Expand Down Expand Up @@ -292,8 +293,9 @@ where
let wasm = self.load_wasm_with_path(&cache.wasm_path, checksum)?;
cache.stats.misses = cache.stats.misses.saturating_add(1);
// Module will run with a different engine, so we can set memory limit to None
let engine = make_compiling_engine(None);
let module = compile(&engine, &wasm)?;
let compiling_engine = make_compiling_engine(None);
// This module cannot be executed directly as it was not created with the runtime engine
let module = compile(&compiling_engine, &wasm)?;
// Store into the fs cache too
let module_size = cache.fs_cache.store(checksum, &module)?;
cache
Expand Down Expand Up @@ -380,8 +382,7 @@ where
{
// Module will run with a different engine, so we can set memory limit to None
let compiling_engine = make_compiling_engine(None);
// Note that module cannot be used directly as it was not created with the
// runtime engine.
// This module cannot be executed directly as it was not created with the runtime engine
let module = compile(&compiling_engine, &wasm)?;
cache.fs_cache.store(checksum, &module)?;
}
Expand Down

0 comments on commit b76c1e5

Please sign in to comment.