Files
wasmer/lib/compiler-singlepass
Ivan Enderlin ef2a55fb60 fix(compiler-singlepass) Fix future rustc error.
When compiling `wasmer-compiler-singlepass`, one can read an warning as:

```
warning: cannot borrow `*self` as mutable because it is also borrowed as immutable
    --> lib/compiler-singlepass/src/codegen_x64.rs:5132:29
     |
5125 |                 while let Some(fp) = self.fp_stack.last() {
     |                                      ------------- immutable borrow occurs here
...
5132 |                             self.canonicalize_nan(
     |                             ^^^^ mutable borrow occurs here
5133 |                                 fp.canonicalization.unwrap().to_size(),
     |                                 ------------------- immutable borrow later used here
     |
     = note: `#[warn(mutable_borrow_reservation_conflict)]` on by default
     = warning: this borrowing pattern was not meant to be accepted, and may become a hard error in the future
     = note: for more information, see issue #59159 <https://github.com/rust-lang/rust/issues/59159>
```

This patch fixes that now a warning, future error.
2020-11-27 11:18:22 +01:00
..
2020-11-06 11:50:07 -08:00
2020-09-15 14:32:16 +03:00

wasmer-compiler-singlepass Build Status Join Wasmer Slack MIT License

This crate contains a compiler implementation based on the Singlepass linear compiler.

Usage

Add this crate into your Cargo.toml dependencies:

wasmer-compiler-singlepass = "1.0.0-alpha"

And then:

use wasmer::{Store, JIT};
use wasmer_compiler_singlepass::Singlepass;

let compiler = Singlepass::new();
// Put it into an engine and add it to the store
let store = Store::new(&JIT::new(&compiler).engine());

Note: you can find a full working example using Singlepass compiler here.

When to use Singlepass

Singlepass is designed to emit compiled code at linear time, as such is not prone to JIT bombs and also offers great compilation performance orders of magnitude faster than wasmer-compiler-cranelift and wasmer-compiler-llvm, however with a bit slower runtime speed.

The fact that singlepass is not prone to JIT bombs and offers a very predictable compilation speed makes it ideal for blockchains and other systems where fast and consistent compilation times are very critical.