Skip to content

Commit

Permalink
Merge #1022
Browse files Browse the repository at this point in the history
1022: Add caching support for Singlepass backend. r=losfair a=losfair

This PR adds caching support for the Singlepass backend.

- [x] Implementation
- [x] AArch64 test

Co-authored-by: losfair <[email protected]>
Co-authored-by: Heyang Zhou <[email protected]>
  • Loading branch information
bors[bot] and losfair authored Dec 2, 2019
2 parents 19dfdec + 2eb11f5 commit d639748
Show file tree
Hide file tree
Showing 8 changed files with 146 additions and 60 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- [#1006](https://github.com/wasmerio/wasmer/pull/1006) Fix minor panic issue when `wasmer::compile_with` called with llvm backend
- [#1009](https://github.com/wasmerio/wasmer/pull/1009) Enable LLVM verifier for all tests, add new llvm-backend-tests crate.
- [#1022](https://github.com/wasmerio/wasmer/pull/1022) Add caching support for Singlepass backend.
- [#1004](https://github.com/wasmerio/wasmer/pull/1004) Add the Auto backend to enable to adapt backend usage depending on wasm file executed.

## 0.11.0 - 2019-11-22
Expand Down
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/feature_matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

| &nbsp; | Singlepass | Cranelift | LLVM |
| - | :-: | :-: | :-: |
| Caching | |||
| Caching | |||
| Emscripten ||||
| Metering ||||
| Multi-value return ||||
| OSR | 🔄 | | |
| OSR | 🔄 | | 🔄 |
| SIMD ||||
| WASI ||||
| WASMER_BACKTRACE ||||
Expand Down
18 changes: 9 additions & 9 deletions lib/runtime-core/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ use std::collections::BTreeMap;
use std::ops::Bound::{Included, Unbounded};

/// An index to a register
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)]
pub struct RegisterIndex(pub usize);

/// A kind of wasm or constant value
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)]
pub enum WasmAbstractValue {
/// A wasm runtime value
Runtime,
Expand All @@ -20,7 +20,7 @@ pub enum WasmAbstractValue {
}

/// A container for the state of a running wasm instance.
#[derive(Clone, Debug)]
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct MachineState {
/// Stack values.
pub stack_values: Vec<MachineValue>,
Expand All @@ -37,7 +37,7 @@ pub struct MachineState {
}

/// A diff of two `MachineState`s.
#[derive(Clone, Debug, Default)]
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
pub struct MachineStateDiff {
/// Last.
pub last: Option<usize>,
Expand All @@ -63,7 +63,7 @@ pub struct MachineStateDiff {
}

/// A kind of machine value.
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)]
pub enum MachineValue {
/// Undefined.
Undefined,
Expand All @@ -86,7 +86,7 @@ pub enum MachineValue {
}

/// A map of function states.
#[derive(Clone, Debug)]
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct FunctionStateMap {
/// Initial.
pub initial: MachineState,
Expand All @@ -111,7 +111,7 @@ pub struct FunctionStateMap {
}

/// A kind of suspend offset.
#[derive(Clone, Copy, Debug)]
#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
pub enum SuspendOffset {
/// A loop.
Loop(usize),
Expand All @@ -122,7 +122,7 @@ pub enum SuspendOffset {
}

/// Info for an offset.
#[derive(Clone, Debug)]
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct OffsetInfo {
/// End offset.
pub end_offset: usize, // excluded bound
Expand All @@ -133,7 +133,7 @@ pub struct OffsetInfo {
}

/// A map of module state.
#[derive(Clone, Debug)]
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct ModuleStateMap {
/// Local functions.
pub local_functions: BTreeMap<usize, FunctionStateMap>,
Expand Down
2 changes: 1 addition & 1 deletion lib/runtime/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ impl Cache for FileSystemCache {
}
}

#[cfg(all(test, not(feature = "singlepass")))]
#[cfg(test)]
mod tests {

use super::*;
Expand Down
3 changes: 3 additions & 0 deletions lib/singlepass-backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ byteorder = "1.3"
nix = "0.15"
libc = "0.2.60"
smallvec = "0.6"
serde = "1.0"
serde_derive = "1.0"
bincode = "1.2"
Loading

0 comments on commit d639748

Please sign in to comment.