Fix after merge

This commit is contained in:
Lachlan Sneff 2019-02-22 14:07:03 -08:00
parent d9506ca5d5
commit 0c19824425
4 changed files with 10 additions and 6 deletions

View File

@ -7,7 +7,7 @@ use cranelift_wasm;
use hashbrown::HashMap;
use std::sync::Arc;
use wasmer_runtime_core::cache::{Artifact, Error as CacheError, WasmHash};
use wasmer_runtime_core::cache::{Artifact, Error as CacheError};
use wasmer_runtime_core::{
backend::Backend,

View File

@ -75,7 +75,6 @@ struct ArtifactHeader {
magic: [u8; 8], // [W, A, S, M, E, R, \0, \0]
version: u64,
data_len: u64,
wasm_hash: [u8; 64], // Sha256 of the wasm in binary format.
}
impl ArtifactHeader {

View File

@ -1,6 +1,6 @@
use crate::{
backend::{Backend, FuncResolver, ProtectedCaller},
cache::{Artifact, Error as CacheError, WasmHash},
cache::{Artifact, Error as CacheError},
error,
import::ImportObject,
structures::{Map, TypedIndex},

View File

@ -14,7 +14,7 @@ fn compile_module() {
}
fn load_module(hash: WasmHash, cache: &impl Cache) {
cache.load(hash).unwrap();
cache.load(hash).expect("could not load module");
}
fn hashing_benchmark(c: &mut Criterion) {
@ -31,10 +31,15 @@ fn compile_benchmark(c: &mut Criterion) {
fn load_benchmark(c: &mut Criterion) {
c.bench_function("nginx load", |b| {
let mut cache = unsafe { FileSystemCache::new(tempdir().unwrap().path()).unwrap() };
let tempdir = tempdir().unwrap();
let mut cache = unsafe {
FileSystemCache::new(tempdir.path()).expect("unable to create file system cache")
};
let module = compile(NGINX_WASM).unwrap();
cache.store(module).unwrap();
let wasm_hash = WasmHash::generate(NGINX_WASM);
cache
.store(wasm_hash, module)
.expect("unable to store into cache");
b.iter(|| load_module(wasm_hash, &cache))
});