truntime: Switch to singlepass compiler. - wasm-runtime - A wasm runtime
git clone https://git.parazyd.org/wasm-runtime
Log
Files
Refs
README
---
commit 48ba506e1bc994ce7c1f4bd216c876b3f82c4843
parent 5125a8bcdd2141fac1eb4cbd0666d29d12d3bdbf
Author: parazyd 
Date:   Wed,  9 Mar 2022 00:15:43 +0100

runtime: Switch to singlepass compiler.

Diffstat:
  M Cargo.toml                          |       1 +
  M src/runtime.rs                      |       5 +++--

2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/Cargo.toml b/Cargo.toml
t@@ -17,6 +17,7 @@ anyhow = "1.0.55"
 drk-sdk = { path = "./drk-sdk" }
 thiserror = "1.0.30"
 wasmer = "2.2.0"
+wasmer-compiler-singlepass = "2.2.0"
 
 [dev-dependencies]
 borsh = "0.9.3"
diff --git a/src/runtime.rs b/src/runtime.rs
t@@ -1,6 +1,7 @@
 use anyhow::{anyhow, Result};
 use drk_sdk::entrypoint;
-use wasmer::{imports, Cranelift, Instance, Memory, Module, Store, Universal, Value};
+use wasmer::{imports, Instance, Memory, Module, Store, Universal, Value};
+use wasmer_compiler_singlepass::Singlepass;
 
 use crate::memory::MemoryManipulation;
 
t@@ -19,7 +20,7 @@ impl Runtime {
     /// Create a new wasm runtime instance that contains the given wasm module.
     pub fn new(wasm_bytes: &[u8]) -> Result {
         // Define the compiler, engine, and store
-        let compiler = Cranelift::default();
+        let compiler = Singlepass::new();
         let store = Store::new(&Universal::new(compiler).engine());
 
         println!("Compiling module...");