Skip to content

Commit

Permalink
Try #822:
Browse files Browse the repository at this point in the history
  • Loading branch information
bors[bot] authored Sep 24, 2019
2 parents 42e4871 + 588a77d commit 8215067
Show file tree
Hide file tree
Showing 14 changed files with 96 additions and 63 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Blocks of changes will separated by version increments.

## **[Unreleased]**

- [#822](https://github.com/wasmerio/wasmer/pull/822) Update Cranelift fork version to `0.43.1`
- [#829](https://github.com/wasmerio/wasmer/pull/829) Fix deps on `make bench-*` commands; benchmarks don't compile other backends now
- [#807](https://github.com/wasmerio/wasmer/pull/807) Implement Send for `Instance`, breaking change on `ImportObject`, remove method `get_namespace` replaced with `with_namespace` and `maybe_with_namespace`
- [#817](https://github.com/wasmerio/wasmer/pull/817) Add document for tracking features across backends and language integrations, [docs/feature_matrix.md]
Expand Down
86 changes: 44 additions & 42 deletions Cargo.lock

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

18 changes: 9 additions & 9 deletions lib/clif-backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ readme = "README.md"

[dependencies]
wasmer-runtime-core = { path = "../runtime-core", version = "0.7.0" }
cranelift-native = { version = "0.31" }
cranelift-codegen = { version = "0.31" }
cranelift-entity = { version = "0.31" }
cranelift-frontend = { package = "wasmer-clif-fork-frontend", version = "0.33" }
cranelift-wasm = { package = "wasmer-clif-fork-wasm", version = "0.33" }
target-lexicon = "0.4"
wasmparser = "0.35.1"
byteorder = "1.3"
nix = "0.15"
cranelift-native = "0.43.1"
cranelift-codegen = "0.43.1"
cranelift-entity = "0.43.1"
cranelift-frontend = { package = "wasmer-clif-fork-frontend", version = "0.43.1" }
cranelift-wasm = { package = "wasmer-clif-fork-wasm", version = "0.43.1" }
target-lexicon = "0.8.1"
wasmparser = "0.37.0"
byteorder = "1.3.2"
nix = "0.15.0"
libc = "0.2.60"
rayon = "1.1"

Expand Down
13 changes: 12 additions & 1 deletion lib/clif-backend/src/code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,18 @@ impl FunctionCodeGenerator<CodegenError> for CraneliftFunctionCodeGenerator {

fn feed_local(&mut self, ty: WpType, n: usize) -> Result<(), CodegenError> {
let mut next_local = self.next_local;
cranelift_wasm::declare_locals(&mut self.builder(), n as u32, ty, &mut next_local)?;
let mut builder = FunctionBuilder::new(
&mut self.func,
&mut self.func_translator.func_ctx,
&mut self.position,
);
cranelift_wasm::declare_locals(
&mut builder,
n as u32,
ty,
&mut next_local,
&mut self.func_env,
)?;
self.next_local = next_local;
Ok(())
}
Expand Down
4 changes: 2 additions & 2 deletions lib/clif-backend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ extern crate serde;
fn get_isa() -> Box<dyn isa::TargetIsa> {
let flags = {
let mut builder = settings::builder();
builder.set("opt_level", "best").unwrap();
builder.set("opt_level", "speed_and_size").unwrap();
builder.set("jump_tables_enabled", "false").unwrap();

if cfg!(not(test)) {
builder.set("enable_verifier", "false").unwrap();
}

let flags = settings::Flags::new(builder);
debug_assert_eq!(flags.opt_level(), settings::OptLevel::Best);
debug_assert_eq!(flags.opt_level(), settings::OptLevel::SpeedAndSize);
flags
};
isa::lookup(Triple::host()).unwrap().finish(flags)
Expand Down
5 changes: 5 additions & 0 deletions lib/clif-backend/src/relocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ impl binemit::RelocSink for RelocSink {
}
}
}

fn reloc_constant(&mut self, _: u32, _: cranelift_codegen::binemit::Reloc, _: u32) {
unimplemented!()
}

fn reloc_jt(
&mut self,
_offset: binemit::CodeOffset,
Expand Down
13 changes: 11 additions & 2 deletions lib/clif-backend/src/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ use crate::{
use rayon::prelude::*;

use byteorder::{ByteOrder, LittleEndian};
use cranelift_codegen::{ir, isa, Context};
use cranelift_codegen::{
binemit::{Stackmap, StackmapSink},
ir, isa, Context,
};
use std::{
mem,
ptr::{write_unaligned, NonNull},
Expand Down Expand Up @@ -58,6 +61,11 @@ pub struct FuncResolverBuilder {
import_len: usize,
}

pub struct NoopStackmapSink {}
impl StackmapSink for NoopStackmapSink {
fn add_stackmap(&mut self, _: u32, _: Stackmap) {}
}

impl FuncResolverBuilder {
pub fn new_from_backend_cache(
backend_cache: BackendCache,
Expand Down Expand Up @@ -109,12 +117,13 @@ impl FuncResolverBuilder {
ctx.func = func.to_owned();
let mut reloc_sink = RelocSink::new();
let mut local_trap_sink = LocalTrapSink::new();

let mut stackmap_sink = NoopStackmapSink {};
ctx.compile_and_emit(
isa,
&mut code_buf,
&mut reloc_sink,
&mut local_trap_sink,
&mut stackmap_sink,
)
.map_err(|e| CompileError::InternalError { msg: e.to_string() })?;
ctx.clear();
Expand Down
9 changes: 8 additions & 1 deletion lib/clif-backend/src/trampoline.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::cache::TrampolineCache;
use crate::resolver::NoopStackmapSink;
use cranelift_codegen::{
binemit::{NullTrapSink, Reloc, RelocSink},
cursor::{Cursor, FuncCursor},
Expand All @@ -19,6 +20,11 @@ struct NullRelocSink {}
impl RelocSink for NullRelocSink {
fn reloc_ebb(&mut self, _: u32, _: Reloc, _: u32) {}
fn reloc_external(&mut self, _: u32, _: Reloc, _: &ir::ExternalName, _: i64) {}

fn reloc_constant(&mut self, _: u32, _: Reloc, _: u32) {
unimplemented!()
}

fn reloc_jt(&mut self, _: u32, _: Reloc, _: ir::JumpTable) {}
}

Expand Down Expand Up @@ -89,12 +95,13 @@ impl Trampolines {
ctx.func = trampoline_func;

let mut code_buf = Vec::new();

let mut stackmap_sink = NoopStackmapSink {};
ctx.compile_and_emit(
isa,
&mut code_buf,
&mut NullRelocSink {},
&mut NullTrapSink {},
&mut stackmap_sink,
)
.expect("unable to compile trampolines");
ctx.clear();
Expand Down
2 changes: 1 addition & 1 deletion lib/llvm-backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ readme = "README.md"

[dependencies]
wasmer-runtime-core = { path = "../runtime-core", version = "0.7.0" }
wasmparser = "0.35.1"
wasmparser = "0.37.0"
smallvec = "0.6"
goblin = "0.0.24"
libc = "0.2.60"
Expand Down
2 changes: 1 addition & 1 deletion lib/runtime-abi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ libc = "0.2.60"
wasmer-runtime-core = { path = "../runtime-core" }
failure = "0.1"
tar = "0.4"
wasmparser = "0.35.1"
wasmparser = "0.37.0"
zstd = "0.4"

# [target.'cfg(unix)'.dependencies.zbox]
Expand Down
Loading

0 comments on commit 8215067

Please sign in to comment.