Skip to content

Commit

Permalink
Merge branch 'master' into feature/wasi-in-c-api
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkMcCaskey authored Oct 25, 2019
2 parents 2a532b8 + 8653216 commit c2d3f29
Show file tree
Hide file tree
Showing 65 changed files with 3,319 additions and 2,962 deletions.
13 changes: 10 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
# Changelog

All PRs to the Wasmer repository must add to this file.
## **[Unreleased]**

Blocks of changes will separated by version increments.
- [#883](https://github.com/wasmerio/wasmer/pull/883) Allow floating point operations to have arbitrary inputs, even including SNaNs.

## **[Unreleased]**
## 0.9.0 - 2019-10-23

Special thanks to @alocquet for their contributions!

- [#898](https://github.com/wasmerio/wasmer/pull/898) State tracking is now disabled by default in the LLVM backend. It can be enabled with `--track-state`.
- [#861](https://github.com/wasmerio/wasmer/pull/861) Add descriptions to `unimplemented!` macro in various places
- [#897](https://github.com/wasmerio/wasmer/pull/897) Removes special casing of stdin, stdout, and stderr in WASI. Closing these files now works. Removes `stdin`, `stdout`, and `stderr` from `WasiFS`, replaced by the methods `stdout`, `stdout_mut`, and so on.
- [#863](https://github.com/wasmerio/wasmer/pull/863) Fix min and max for cases involving NaN and negative zero when using the LLVM backend.

## 0.8.0 - 2019-10-02

Expand Down
596 changes: 214 additions & 382 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wasmer"
version = "0.8.0"
version = "0.9.0"
authors = ["The Wasmer Engineering Team <[email protected]>"]
edition = "2018"
repository = "https://github.com/wasmerio/wasmer"
Expand Down
53 changes: 49 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -142,20 +142,65 @@ install:

# Checks
check-bench-singlepass:
cargo bench --all --no-run --no-default-features --features "backend-singlepass" \
cargo check --benches --all --no-default-features --features "backend-singlepass" \
--exclude wasmer-clif-backend --exclude wasmer-llvm-backend --exclude wasmer-kernel-loader
check-bench-clif:
cargo bench --all --no-run --no-default-features --features "backend-cranelift" \
cargo check --benches --all --no-default-features --features "backend-cranelift" \
--exclude wasmer-singlepass-backend --exclude wasmer-llvm-backend --exclude wasmer-kernel-loader \
--exclude wasmer-middleware-common-tests
check-bench-llvm:
cargo bench --all --no-run --no-default-features --features "backend-llvm" \
cargo check --benches --all --no-default-features --features "backend-llvm" \
--exclude wasmer-singlepass-backend --exclude wasmer-clif-backend --exclude wasmer-kernel-loader

check-bench: check-bench-singlepass check-bench-llvm

# TODO: We wanted `--workspace --exclude wasmer-runtime`, but can't due
# to https://github.com/rust-lang/cargo/issues/6745 .
NOT_RUNTIME_CRATES = -p wasmer-clif-backend -p wasmer-singlepass-backend -p wasmer-middleware-common -p wasmer-runtime-core -p wasmer-emscripten -p wasmer-llvm-backend -p wasmer-wasi -p wasmer-kernel-loader -p wasmer-dev-utils -p wasmer-wasi-tests -p wasmer-middleware-common-tests -p wasmer-emscripten-tests
RUNTIME_CHECK = cargo check --manifest-path lib/runtime/Cargo.toml --no-default-features
check: check-bench
cargo check --release --features backend-singlepass,backend-llvm,loader-kernel,debug
cargo check $(NOT_RUNTIME_CRATES)
cargo check --release $(NOT_RUNTIME_CRATES)
cargo check --all-features $(NOT_RUNTIME_CRATES)
cargo check --release --all-features $(NOT_RUNTIME_CRATES)
# wasmer-runtime doesn't work with all backends enabled at once.
#
# We test using manifest-path directly so as to disable the default.
# `--no-default-features` only disables the default features in the
# current package, not the package specified by `-p`. This is
# intentional.
#
# Test default features, test 'debug' feature only in non-release
# builds, test as many combined features as possible with each backend
# as default, and test a minimal set of features with only one backend
# at a time.
cargo check --manifest-path lib/runtime/Cargo.toml
cargo check --release --manifest-path lib/runtime/Cargo.toml

$(RUNTIME_CHECK) \
--features=cranelift,cache,debug,llvm,singlepass,default-backend-singlepass
$(RUNTIME_CHECK) --release \
--features=cranelift,cache,llvm,singlepass,default-backend-singlepass
$(RUNTIME_CHECK) \
--features=cranelift,cache,debug,llvm,singlepass,default-backend-cranelift
$(RUNTIME_CHECK) --release \
--features=cranelift,cache,llvm,singlepass,default-backend-cranelift
$(RUNTIME_CHECK) \
--features=cranelift,cache,debug,llvm,singlepass,default-backend-llvm
$(RUNTIME_CHECK) --release \
--features=cranelift,cache,llvm,singlepass,default-backend-llvm
$(RUNTIME_CHECK) \
--features=singlepass,default-backend-singlepass,debug
$(RUNTIME_CHECK) --release \
--features=singlepass,default-backend-singlepass
$(RUNTIME_CHECK) \
--features=cranelift,default-backend-cranelift,debug
$(RUNTIME_CHECK) --release \
--features=cranelift,default-backend-cranelift
$(RUNTIME_CHECK) \
--features=llvm,default-backend-llvm,debug
$(RUNTIME_CHECK) --release \
--features=llvm,default-backend-llvm

# Release
release:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Wasmer runtime can be used as a library embedded in different languages, so you
| ![PHP logo](./docs/assets/languages/php.svg) | [**PHP**](https://github.com/wasmerio/php-ext-wasm) | Wasmer | actively developed | <a href="https://pecl.php.net/package/wasm" target="_blank">![last release](https://img.shields.io/github/v/release/wasmerio/php-ext-wasm?style=flat-square)</a> | ![number of Github stars](https://img.shields.io/github/stars/wasmerio/php-ext-wasm?style=flat-square) |
| ![Ruby logo](./docs/assets/languages/ruby.svg) | [**Ruby**](https://github.com/wasmerio/ruby-ext-wasm) | Wasmer | actively developed | <a href="https://rubygems.org/gems/wasmer" target="_blank">![last release](https://img.shields.io/gem/v/wasmer?style=flat-square)</a> | ![number of Github stars](https://img.shields.io/github/stars/wasmerio/ruby-ext-wasm?style=flat-square) |
| ![Postgres logo](./docs/assets/languages/postgres.svg) | [**Postgres**](https://github.com/wasmerio/postgres-ext-wasm) | Wasmer | actively developed | <a href="https://github.com/wasmerio/postgres-ext-wasm" target="_blank">![last release](https://img.shields.io/github/v/release/wasmerio/postgres-ext-wasm?style=flat-square)</a> | ![number of Github stars](https://img.shields.io/github/stars/wasmerio/postgres-ext-wasm?style=flat-square) |
| ![JS Logo](./docs/assets/languages/js.svg) | [**JavaScript**](https://github.com/wasmerio/wasmer-js) | Wasmer | actively developed | <a href="https://www.npmjs.com/package/@wasmer/wasi" target="_blank">![last release](https://img.shields.io/npm/v/@wasmer/wasi?style=flat-square)</a> | ![number of Github stars](https://img.shields.io/github/stars/wasmerio/wasmer-js?style=flat-square) |
| ![C# logo](./docs/assets/languages/csharp.svg) | [**C#/.Net**](https://github.com/migueldeicaza/WasmerSharp) | [Miguel de Icaza](https://github.com/migueldeicaza) | actively developed | <a href="https://www.nuget.org/packages/WasmerSharp/" target="_blank">![last release](https://img.shields.io/nuget/v/WasmerSharp?style=flat-square)</a> | ![number of Github stars](https://img.shields.io/github/stars/migueldeicaza/WasmerSharp?style=flat-square) |
| ![R logo](./docs/assets/languages/r.svg) | [**R**](https://github.com/dirkschumacher/wasmr) | [Dirk Schumacher](https://github.com/dirkschumacher) | actively developed | | ![number of Github stars](https://img.shields.io/github/stars/dirkschumacher/wasmr?style=flat-square) |
| ![Swift logo](./docs/assets/languages/swift.svg) | [**Swift**](https://github.com/markmals/swift-ext-wasm) | [Mark Malström](https://github.com/markmals/) | passively maintained | | ![number of Github stars](https://img.shields.io/github/stars/markmals/swift-ext-wasm?style=flat-square) |
Expand Down
4 changes: 4 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ jobs:
cat /proc/meminfo
displayName: System info - Extended (Linux)
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
- bash: |
sysctl -a | grep machdep.cpu
displayName: System info - Extended (Mac)
condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))
- bash: make test
displayName: Tests (*nix)
condition: and(succeeded(), not(eq(variables['Agent.OS'], 'Windows_NT')))
Expand Down
8 changes: 8 additions & 0 deletions docs/assets/languages/js.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions lib/clif-backend/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wasmer-clif-backend"
version = "0.8.0"
version = "0.9.0"
description = "Wasmer runtime Cranelift compiler backend"
license = "MIT"
authors = ["The Wasmer Engineering Team <[email protected]>"]
Expand All @@ -9,7 +9,7 @@ edition = "2018"
readme = "README.md"

[dependencies]
wasmer-runtime-core = { path = "../runtime-core", version = "0.8.0" }
wasmer-runtime-core = { path = "../runtime-core", version = "0.9.0" }
cranelift-native = "0.44.0"
cranelift-codegen = "0.44.0"
cranelift-entity = "0.44.0"
Expand All @@ -35,7 +35,7 @@ version = "0.0.7"

[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3", features = ["errhandlingapi", "minwindef", "minwinbase", "winnt"] }
wasmer-win-exception-handler = { path = "../win-exception-handler", version = "0.8.0" }
wasmer-win-exception-handler = { path = "../win-exception-handler", version = "0.9.0" }

[features]
debug = ["wasmer-runtime-core/debug"]
160 changes: 0 additions & 160 deletions lib/clif-backend/src/code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,166 +128,6 @@ impl ModuleCodeGenerator<CraneliftFunctionCodeGenerator, Caller, CodegenError>
.state
.initialize(&builder.func.signature, exit_block);

#[cfg(feature = "debug")]
{
use cranelift_codegen::cursor::{Cursor, FuncCursor};
use cranelift_codegen::ir::InstBuilder;
let entry_ebb = func.layout.entry_block().unwrap();
let ebb = func.dfg.make_ebb();
func.layout.insert_ebb(ebb, entry_ebb);
let mut pos = FuncCursor::new(&mut func).at_first_insertion_point(ebb);
let params = pos.func.dfg.ebb_params(entry_ebb).to_vec();

let new_ebb_params: Vec<_> = params
.iter()
.map(|&param| {
pos.func
.dfg
.append_ebb_param(ebb, pos.func.dfg.value_type(param))
})
.collect();

let start_debug = {
let signature = pos.func.import_signature(ir::Signature {
call_conv: self.target_config().default_call_conv,
params: vec![
ir::AbiParam::special(ir::types::I64, ir::ArgumentPurpose::VMContext),
ir::AbiParam::new(ir::types::I32),
],
returns: vec![],
});

let name = ir::ExternalName::testcase("strtdbug");

pos.func.import_function(ir::ExtFuncData {
name,
signature,
colocated: false,
})
};

let end_debug = {
let signature = pos.func.import_signature(ir::Signature {
call_conv: self.target_config().default_call_conv,
params: vec![ir::AbiParam::special(
ir::types::I64,
ir::ArgumentPurpose::VMContext,
)],
returns: vec![],
});

let name = ir::ExternalName::testcase("enddbug");

pos.func.import_function(ir::ExtFuncData {
name,
signature,
colocated: false,
})
};

let i32_print = {
let signature = pos.func.import_signature(ir::Signature {
call_conv: self.target_config().default_call_conv,
params: vec![
ir::AbiParam::special(ir::types::I64, ir::ArgumentPurpose::VMContext),
ir::AbiParam::new(ir::types::I32),
],
returns: vec![],
});

let name = ir::ExternalName::testcase("i32print");

pos.func.import_function(ir::ExtFuncData {
name,
signature,
colocated: false,
})
};

let i64_print = {
let signature = pos.func.import_signature(ir::Signature {
call_conv: self.target_config().default_call_conv,
params: vec![
ir::AbiParam::special(ir::types::I64, ir::ArgumentPurpose::VMContext),
ir::AbiParam::new(ir::types::I64),
],
returns: vec![],
});

let name = ir::ExternalName::testcase("i64print");

pos.func.import_function(ir::ExtFuncData {
name,
signature,
colocated: false,
})
};

let f32_print = {
let signature = pos.func.import_signature(ir::Signature {
call_conv: self.target_config().default_call_conv,
params: vec![
ir::AbiParam::special(ir::types::I64, ir::ArgumentPurpose::VMContext),
ir::AbiParam::new(ir::types::F32),
],
returns: vec![],
});

let name = ir::ExternalName::testcase("f32print");

pos.func.import_function(ir::ExtFuncData {
name,
signature,
colocated: false,
})
};

let f64_print = {
let signature = pos.func.import_signature(ir::Signature {
call_conv: self.target_config().default_call_conv,
params: vec![
ir::AbiParam::special(ir::types::I64, ir::ArgumentPurpose::VMContext),
ir::AbiParam::new(ir::types::F64),
],
returns: vec![],
});

let name = ir::ExternalName::testcase("f64print");

pos.func.import_function(ir::ExtFuncData {
name,
signature,
colocated: false,
})
};

let vmctx = pos
.func
.special_param(ir::ArgumentPurpose::VMContext)
.expect("missing vmctx parameter");

let func_index = pos.ins().iconst(
ir::types::I32,
func_index.index() as i64 + self.module.info.imported_functions.len() as i64,
);

pos.ins().call(start_debug, &[vmctx, func_index]);

for param in new_ebb_params.iter().cloned() {
match pos.func.dfg.value_type(param) {
ir::types::I32 => pos.ins().call(i32_print, &[vmctx, param]),
ir::types::I64 => pos.ins().call(i64_print, &[vmctx, param]),
ir::types::F32 => pos.ins().call(f32_print, &[vmctx, param]),
ir::types::F64 => pos.ins().call(f64_print, &[vmctx, param]),
_ => unimplemented!(),
};
}

pos.ins().call(end_debug, &[vmctx]);

pos.ins().jump(entry_ebb, new_ebb_params.as_slice());
}

self.functions.push(func_env);
Ok(self.functions.last_mut().unwrap())
}
Expand Down
12 changes: 6 additions & 6 deletions lib/clif-backend/src/relocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl binemit::RelocSink for RelocSink {
_ebb_offset: binemit::CodeOffset,
) {
// This should use the `offsets` field of `ir::Function`.
unimplemented!();
unimplemented!("RelocSink::reloc_ebb");
}
fn reloc_external(
&mut self,
Expand Down Expand Up @@ -146,7 +146,7 @@ impl binemit::RelocSink for RelocSink {

DYNAMIC_MEM_GROW => VmCallKind::DynamicMemoryGrow,
DYNAMIC_MEM_SIZE => VmCallKind::DynamicMemorySize,
_ => unimplemented!(),
_ => unimplemented!("reloc_external VmCall::Local {}", index),
})),
IMPORT_NAMESPACE => RelocationType::VmCall(VmCall::Import(match index {
STATIC_MEM_GROW => VmCallKind::StaticMemoryGrow,
Expand All @@ -157,10 +157,10 @@ impl binemit::RelocSink for RelocSink {

DYNAMIC_MEM_GROW => VmCallKind::DynamicMemoryGrow,
DYNAMIC_MEM_SIZE => VmCallKind::DynamicMemorySize,
_ => unimplemented!(),
_ => unimplemented!("reloc_external VmCall::Import {}", index),
})),
SIG_NAMESPACE => RelocationType::Signature(SigIndex::new(index as usize)),
_ => unimplemented!(),
_ => unimplemented!("reloc_external SigIndex {}", index),
};
self.external_relocs.push(ExternalRelocation {
reloc,
Expand Down Expand Up @@ -204,7 +204,7 @@ impl binemit::RelocSink for RelocSink {
}

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

fn reloc_jt(
Expand All @@ -213,7 +213,7 @@ impl binemit::RelocSink for RelocSink {
_reloc: binemit::Reloc,
_jt: ir::JumpTable,
) {
unimplemented!();
unimplemented!("RelocSink::reloc_jt");
}
}

Expand Down
Loading

0 comments on commit c2d3f29

Please sign in to comment.