889: fix(singlepass-backend) Use wasmparser from `runtime-core` r=Hywan a=Hywan
The `wasmer-runtime-core` crate re-exports the `wasmparser`
crate. This patch updates the `singlepass-backend` crate to use
`wasmparser` through the `wasmer-runtime-core` crate, which removes a
direct dependency for this crate.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
The `wasmer-runtime-core` crate re-exports the `wasmparser`
crate. This patch updates the `singlepass-backend` crate to use
`wasmparser` through the `wasmer-runtime-core` crate, which removes a
direct dependency for this crate.
Fixes the one issue uncovered. The capstone disassembling support in the LLVM backend was broken. Fixed by removing it. Instead, use the `--llvm-object-file` flag to get a finished object file to disassemble with any disassembler.
885: fix(cranelift-backend) Remove broken (and useless?) debug code r=nlewycky a=Hywan
This debug code is broken (it doesn't compile). It can be assumed
nobody uses it, and can be considered as dead code. As such, this PR
removes it.
The `debug` feature is kept in `Cargo.toml` to activate `wasmer-runtime-core/debug`.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
Instead of ensuring outputs are arithmetic NaNs on every function, we tag them as pending such a check, so that a sequence of computation can have a single canonicalization step at the end.
There's an extra wriggle for SIMD. The Wasm type system only indicates them as V128, so it's possible that we might do computations as F32x4Add, I8x16Add, F64x2Add in a row with no other computations in between. Thus, most SIMD functions apply pending canonicalizations to their inputs, even integer SIMD operations.
After a long time, the macros are easy to read, but not at first
glance. I hope this PR will improve the situation: Same syntax used
everywhere, more spaces…
863: Rewrite Min/Max to handle all cases correctly. Fixes 545 spectest failures. r=nlewycky a=nlewycky
# Description
The llvm backend was not quite following the Wasm spec for {F32,F64,F32x4xF64x2}{Min,Max}. We used the `@llvm.minnum` and `@llvm.maxnum` intrinsics which don't handle the corner cases the same. When we tried to use `@llvm.minimum` and `@llvm.maximum` which do, we get an internal error from the x86 backend. I was hoping that crash would go away with the upgrade to LLVM 9, but it does not.
Reimplement these operations using plain LLVM instructions.
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Nick Lewycky <nick@wasmer.io>
870: Fix unused value warning due to inkwell API change. NFC. r=nlewycky a=nlewycky
# Description
Fix unused value warning due to inkwell API change. No functionality change.
Co-authored-by: Nick Lewycky <nick@wasmer.io>
869: Remove exclusions for tests that appear to be passing right now. r=nlewycky a=nlewycky
# Description
Remove exclusions for tests that appear to be passing right now.
Co-authored-by: Nick Lewycky <nick@wasmer.io>
Sizes are now ordered, to facilitate an assertion that one size is less (smaller) than another.
panic! error messages are provided for remaining emitter functions.
850: Add builder API for WasiState r=MarkMcCaskey a=MarkMcCaskey
Nicer to use and it checks for errors!
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
Co-authored-by: Mark McCaskey <markmccaskey@users.noreply.github.com>
807: Implement Send for Instance r=MarkMcCaskey a=MarkMcCaskey
# Review
- [x] Create a short description of the the change in the CHANGELOG.md file
Resolves#748
WIP
## List of changes
### Commit 1
- `Global`s use Arc instead of RC
- Export `Context` and `FuncPointer` manually implement Send
- `ImportObject` uses `Arc<Mutex<HashMap<...>>>` Instead of `Rc<RefCell<HashMap<...>>>`; removed `get_namespace` method in favor of continuation style to deal with locking the Mutex
- `Func` manually implements `Send` (TODO: this change needs to be checked in depth)
### Commit 2
- `unsafe impl Send for Export {}` (temporary to allow Memory to be not Send)
- RefCell -> Mutex in Global and Table
- Rc -> Arc in Table
- Namespace's `IsExport`s must be `Send` (Done to avoid touching much more of the code (i.e. `trait IsExport: Send` requires a lot -- maybe this is what we should do though)
- Make `Host` and `Wasm` `Func`s Send (manual implementation)
- Manual implementation for `LocalTable` and `AnyFunc`
### Commit 3
- rm placeholder `unsafe impl Send for Export {}`
- Manual implementation for `LocalBacking` and `ImportBacking` (both seemed to be not Send due to direct ownership of mutable pointers in their containers)
- ImportObject's state creator Fn trait object is now ` + Send + Sync + 'static` (required because it's in an Arc)
- Manually implement Send for `InstanceInner` because it holds a raw pointer, `LocalBacking` and `ImportBacking` are marked Send separately
- Memory: All Rc -> Arc (including unshared memory); All RefCell -> Mutex (including unshared memory)
- Manual implementation of Send and Sync on `UnsharedMemoryInternal`
- Manual implementation of Send and Sync on `SharedMemoryInternal`
- Change `runtime-core::unix::memory::Memory.fd` from `Option<Rc<Rawfd>>` to `Option<Arc<Rawfd>>` (not strictly required for this change because Memory has manual implementations of Send and Sync, but Arc seems more correct here and there's no comment justifying the use of Rc)
- Manual implementation of Send for `ImportedFunc`
Co-authored-by: Mark McCaskey <mark@wasmer.io>
Co-authored-by: Mark McCaskey <markmccaskey@users.noreply.github.com>
821: Remove patch version in deps when not necessary r=MarkMcCaskey a=MarkMcCaskey
This allows wasmer library users to have more control over the exact versions of deps that Wasmer uses.
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
803: Add method to call function at index on Ctx r=MarkMcCaskey a=MarkMcCaskey
For #638 and #670
```Rust
fn call_guest_fn(ctx: &mut Ctx, guest_fn: u32) -> u32 {
println!("{}", guest_fn);
let guest_fn_typed = unsafe { std::mem::transmute(guest_fn) };
let result = ctx.call_with_table_index(guest_fn_typed, &[]).unwrap();
println!(" -> {:?}", result);
0
}
```
is what this looks like from the Host side
See `examples/callback.rs` for an example that doesn't require `transmute`
# Review
- [x] Create a short description of the the change in the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
Co-authored-by: Mark McCaskey <markmccaskey@users.noreply.github.com>
805: Replace panic! & unimplemented! in runtime-code and llvm-backend r=nlewycky a=pventuzelo
# Description
Replace `unimplemented!` by already used `CodegenError` in `lib/llvm-backend/src/code.rs`
Replace `unimplemented!` by `Err` in `lib/llvm-backend/src/trampolines.rs`
Replace `panic!` by already used `BinaryReaderError` in `lib/runtime-core/src/parse.rs`
# Review
- [ ] Create a short description of the the change in the CHANGELOG.md file
Co-authored-by: Patrick Ventuzelo <ventuzelo.patrick@gmail.com>
When the colored output was originally added in https://github.com/wasmerio/wasmer/pull/489 and there was a discussion then about that it should ideally be in a higher-level crate rather than in the runtime-core library crate.
I agree with that, users of the library shouldn't be required to bring in the colored crate dependency and ideally also not have stdout/stderr output either, that should be controlled by the application that uses wasmer-runtime-core, not the library.
Disabling stdout/stderr output would be more intrusive but I wanted to at least not have colored output and another crate dependency so this change removes the colored output and the "colored" crate.
720: Bump lazy_static from 1.3.0 to 1.4.0 r=Hywan a=dependabot-preview[bot]
Bumps [lazy_static](https://github.com/rust-lang-nursery/lazy-static.rs) from 1.3.0 to 1.4.0.
<details>
<summary>Release notes</summary>
*Sourced from [lazy_static's releases](https://github.com/rust-lang-nursery/lazy-static.rs/releases).*
> ## 1.4.0
> **Bumps the minimum supported version of `rustc` to `1.27.2`**
>
> - [Fix typo in lib.rs](https://github-redirect.dependabot.com/rust-lang-nursery/lazy-static.rs/pull/144) (thanks [@​fbruetting](https://github.com/fbruetting))
> - [Automatically check if README.md examples are working when running "cargo test"](https://github-redirect.dependabot.com/rust-lang-nursery/lazy-static.rs/pull/145) (thanks [@​GuillaumeGomez](https://github.com/GuillaumeGomez))
> - [Allow deprecated to remove warnings in nightly](https://github-redirect.dependabot.com/rust-lang-nursery/lazy-static.rs/pull/152) (thanks [@​Schaeff](https://github.com/Schaeff))
> - [bump MSRV to 1.27.2](https://github-redirect.dependabot.com/rust-lang-nursery/lazy-static.rs/pull/155) (thanks [@​matklad](https://github.com/matklad))
</details>
<details>
<summary>Commits</summary>
- [`4216696`](421669662b) Merge pull request [#156](https://github-redirect.dependabot.com/rust-lang-nursery/lazy-static.rs/issues/156) from rust-lang-nursery/cargo/1.4.0
- [`1651fde`](1651fdeee8) prepare for 1.4.0 release
- [`d9c9689`](d9c96890da) Merge pull request [#155](https://github-redirect.dependabot.com/rust-lang-nursery/lazy-static.rs/issues/155) from matklad/hints
- [`d59c784`](d59c7848d4) adjust FIXME comment
- [`90baadd`](90baaddd61) comment typo
- [`42fa58e`](42fa58ea68) bump MSRV to 1.27.2
- [`8a5f404`](8a5f404fc8) Merge pull request [#152](https://github-redirect.dependabot.com/rust-lang-nursery/lazy-static.rs/issues/152) from Schaeff/allow-deprecated
- [`1dbd5ae`](1dbd5ae6cc) allow deprecated to remove warning in nightly
- [`65d58f1`](65d58f1a60) Merge pull request [#145](https://github-redirect.dependabot.com/rust-lang-nursery/lazy-static.rs/issues/145) from GuillaumeGomez/doc-tests
- [`e519fd4`](e519fd42c3) Automatically check if README.md examples are working when running "cargo test"
- Additional commits viewable in [compare view](https://github.com/rust-lang-nursery/lazy-static.rs/compare/1.3.0...1.4.0)
</details>
<br />
[![Dependabot compatibility score](https://api.dependabot.com/badges/compatibility_score?dependency-name=lazy_static&package-manager=cargo&previous-version=1.3.0&new-version=1.4.0)](https://dependabot.com/compatibility-score.html?dependency-name=lazy_static&package-manager=cargo&previous-version=1.3.0&new-version=1.4.0)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
**Note:** This repo was added to Dependabot recently, so you'll receive a maximum of 5 PRs for your first few update runs. Once an update run creates fewer than 5 PRs we'll remove that limit.
You can always request more updates by clicking `Bump now` in your [Dependabot dashboard](https://app.dependabot.com).
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
- `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme
Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com):
- Update frequency (including time of day and day of week)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Pull request limits (per update run and/or open at any time)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)
Finally, you can contact us by mentioning @dependabot.
</details>
765: Bump blake2b_simd from 0.5.7 to 0.5.8 r=Hywan a=dependabot-preview[bot]
Bumps [blake2b_simd](https://github.com/oconnor663/blake2_simd) from 0.5.7 to 0.5.8.
<details>
<summary>Commits</summary>
- [`296d75e`](296d75e502) version 0.5.8
- [`3706393`](3706393fd9) Merge pull request [#12](https://github-redirect.dependabot.com/oconnor663/blake2_simd/issues/12) from kobigurk/master
- [`1ee274d`](1ee274d775) Addresses Jack's comments
- [`ec7c0fc`](ec7c0fc1d3) Adds test vectors for blake2x
- [`2bcd7bf`](2bcd7bfa12) Adds support for max depth 0 for blake2b and fixes tests
- [`0ce1995`](0ce1995ff0) adds support for max depth 0
- See full diff in [compare view](https://github.com/oconnor663/blake2_simd/compare/0.5.7...0.5.8)
</details>
<br />
[![Dependabot compatibility score](https://api.dependabot.com/badges/compatibility_score?dependency-name=blake2b_simd&package-manager=cargo&previous-version=0.5.7&new-version=0.5.8)](https://dependabot.com/compatibility-score.html?dependency-name=blake2b_simd&package-manager=cargo&previous-version=0.5.7&new-version=0.5.8)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
- `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme
Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com):
- Update frequency (including time of day and day of week)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Pull request limits (per update run and/or open at any time)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)
Finally, you can contact us by mentioning @dependabot.
</details>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>