From 53a8fca4d53262c0d19244c6c13736b4edbd07ca Mon Sep 17 00:00:00 2001 From: Syrus Date: Sat, 16 Mar 2019 11:52:11 -0700 Subject: [PATCH] Make wasmer executable work with dynasm --- Makefile | 2 +- lib/dynasm-backend/src/lib.rs | 6 ++++-- src/bin/wasmer.rs | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 0c9a0692d..a51d66789 100644 --- a/Makefile +++ b/Makefile @@ -48,7 +48,7 @@ test-emscripten: release: # If you are in OS-X, you will need mingw-w64 for cross compiling to windows # brew install mingw-w64 - cargo build --release + cargo +nightly build --release debug-release: cargo build --release --features debug diff --git a/lib/dynasm-backend/src/lib.rs b/lib/dynasm-backend/src/lib.rs index 00602782d..3695b98a4 100644 --- a/lib/dynasm-backend/src/lib.rs +++ b/lib/dynasm-backend/src/lib.rs @@ -38,7 +38,8 @@ impl CacheGen for Placeholder { &self, module: &ModuleInner, ) -> Result<(Box, Box<[u8]>, Memory), CacheError> { - unimplemented!() + // unimplemented!() + Err(CacheError::Unknown("the dynasm backend doesn't support caching yet".to_string())) } } @@ -73,7 +74,8 @@ impl Compiler for SinglePassCompiler { } unsafe fn from_cache(&self, _artifact: Artifact, _: Token) -> Result { - unimplemented!("the dynasm backend doesn't support caching yet") + Err(CacheError::Unknown("the dynasm backend doesn't support caching yet".to_string())) + // unimplemented!("the dynasm backend doesn't support caching yet") } } diff --git a/src/bin/wasmer.rs b/src/bin/wasmer.rs index e36e99cb6..ec051105e 100644 --- a/src/bin/wasmer.rs +++ b/src/bin/wasmer.rs @@ -128,8 +128,9 @@ fn execute_wasm(options: &Run) -> Result<(), String> { let module = webassembly::compile(&wasm_binary[..]) .map_err(|e| format!("Can't compile module: {:?}", e))?; - // We save the module into a cache file - cache.store(hash, module.clone()).unwrap(); + // We try to save the module into a cache file + cache.store(hash, module.clone()).unwrap_or_default(); + module } };