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:
Artur Jamro
2019-07-25 16:16:10 -07:00
committed by Dan Gohman
parent 17e4528648
commit 165dc4944d
20 changed files with 502 additions and 110 deletions

View File

@@ -7,6 +7,7 @@ use crate::module_environ::FunctionBodyData;
use cranelift_codegen::{binemit, ir, isa, CodegenError};
use cranelift_entity::PrimaryMap;
use cranelift_wasm::{DefinedFuncIndex, FuncIndex, WasmError};
use serde::{Deserialize, Serialize};
use std::ops::Range;
use std::vec::Vec;
@@ -23,7 +24,7 @@ pub struct CodeAndJTOffsets {
type Functions = PrimaryMap<DefinedFuncIndex, CodeAndJTOffsets>;
/// The result of compiling a WebAssembly module's functions.
#[derive(Debug)]
#[derive(Deserialize, Serialize, Debug)]
pub struct Compilation {
/// Compiled machine code for the function bodies.
functions: Functions,
@@ -94,7 +95,7 @@ impl<'a> Iterator for Iter<'a> {
}
/// A record of a relocation to perform.
#[derive(Debug, Clone)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Relocation {
/// The relocation code.
pub reloc: binemit::Reloc,
@@ -107,7 +108,7 @@ pub struct Relocation {
}
/// Destination function. Can be either user function or some special one, like `memory.grow`.
#[derive(Debug, Copy, Clone)]
#[derive(Serialize, Deserialize, Debug, Copy, Clone)]
pub enum RelocationTarget {
/// The user function index.
UserFunc(FuncIndex),