Simple module compilation cache (#203)
* Simple module compilation cache * Fix base64 encoding bug * Use warn! everywhere in cache system * Remove unused import * Temporary workaround for long path on Windows * Remove unused import for non-windows builds * Add command line argument to enable cache system + apply minor review feedback
This commit is contained in:
@@ -10,6 +10,7 @@ use cranelift_wasm::{
|
||||
self, translate_module, DefinedFuncIndex, FuncIndex, Global, GlobalIndex, Memory, MemoryIndex,
|
||||
SignatureIndex, Table, TableIndex, WasmResult,
|
||||
};
|
||||
use sha2::{Digest, Sha256};
|
||||
use std::boxed::Box;
|
||||
use std::string::String;
|
||||
use std::vec::Vec;
|
||||
@@ -79,6 +80,11 @@ impl<'data> ModuleEnvironment<'data> {
|
||||
pub fn translate(mut self, data: &'data [u8]) -> WasmResult<ModuleTranslation<'data>> {
|
||||
translate_module(data, &mut self)?;
|
||||
|
||||
// TODO: this is temporary workaround and will be replaced with derive macro.
|
||||
let mut hasher = Sha256::new();
|
||||
hasher.input(data);
|
||||
self.result.module.hash = Some(hasher.result().into());
|
||||
|
||||
Ok(self.result)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user