From 0c1982442522aebad289fa6008604173f3be1e07 Mon Sep 17 00:00:00 2001 From: Lachlan Sneff Date: Fri, 22 Feb 2019 14:07:03 -0800 Subject: [PATCH] Fix after merge --- lib/clif-backend/src/module.rs | 2 +- lib/runtime-core/src/cache.rs | 1 - lib/runtime-core/src/module.rs | 2 +- lib/runtime/benches/nginx.rs | 11 ++++++++--- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/clif-backend/src/module.rs b/lib/clif-backend/src/module.rs index 38a657625..07efe9bd3 100644 --- a/lib/clif-backend/src/module.rs +++ b/lib/clif-backend/src/module.rs @@ -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, diff --git a/lib/runtime-core/src/cache.rs b/lib/runtime-core/src/cache.rs index 64fe3e182..4859bd390 100644 --- a/lib/runtime-core/src/cache.rs +++ b/lib/runtime-core/src/cache.rs @@ -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 { diff --git a/lib/runtime-core/src/module.rs b/lib/runtime-core/src/module.rs index cac375b66..43c9be9dc 100644 --- a/lib/runtime-core/src/module.rs +++ b/lib/runtime-core/src/module.rs @@ -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}, diff --git a/lib/runtime/benches/nginx.rs b/lib/runtime/benches/nginx.rs index 542a87d7d..1466addb1 100644 --- a/lib/runtime/benches/nginx.rs +++ b/lib/runtime/benches/nginx.rs @@ -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)) });