1438: Post release fixup r=MarkMcCaskey a=MarkMcCaskey
Had to do `--allow-dirty` to ship these changes in 0.17.0
Co-authored-by: Mark McCaskey <mark@wasmer.io>
Co-authored-by: Mark McCaskey <5770194+MarkMcCaskey@users.noreply.github.com>
1437: Prepare for 0.17.0 release r=MarkMcCaskey a=MarkMcCaskey
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1414: Update doc comment for `RuntimeError` r=Hywan a=MarkMcCaskey
# Review
- [ ] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
Co-authored-by: Ivan Enderlin <ivan@mnt.io>
1413: some minor improvements r=MarkMcCaskey a=michaelvoronov
<!--
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests
-->
# Description
Some minor improvements.
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: vms <michail.vms@gmail.com>
1401: Make runtime and trap errors well defined r=syrusakbary a=MarkMcCaskey
Resolves#1328
This PR goes through and gives explicit types for all the errors instead of using `Box<dyn Any + Send>` where possible. This gives users better insight into what the specific errors are and should help with debugging in the case of mistakes in our code.
The remaining uses of `Box<dyn Any>` are due to the structure of our dependency graph -- this is probably solvable but it seems fine as is as all error types are now explicit and the remaining `Box<dyn Any>`s are either fully user controlled or not for end-user consumption.
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1410: feat(runtime-core) Implement `ImportObjectIterator::size_hint`. r=MarkMcCaskey a=Hywan
Because it is helpful in some circumstances.
Co-authored-by: Ivan Enderlin <ivan@mnt.io>
1358: Update C API to use new API r=MarkMcCaskey a=MarkMcCaskey
# Review
- [ ] 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 <5770194+MarkMcCaskey@users.noreply.github.com>
1375: chore(deps): bump smallvec from 1.2.0 to 1.3.0 r=MarkMcCaskey a=dependabot-preview[bot]
Bumps [smallvec](https://github.com/servo/rust-smallvec) from 1.2.0 to 1.3.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/servo/rust-smallvec/releases">smallvec's releases</a>.</em></p>
<blockquote>
<h2>v1.3.0</h2>
<ul>
<li>Add a new unstable <code>const_generics</code> feature (<a href="https://github-redirect.dependabot.com/servo/rust-smallvec/issues/204">#204</a>).</li>
<li>Improve inlining of constructor functions (<a href="https://github-redirect.dependabot.com/servo/rust-smallvec/issues/206">#206</a>).</li>
<li>Add a <code>slice.to_smallvec()</code> convenience method (<a href="https://github-redirect.dependabot.com/servo/rust-smallvec/issues/203">#203</a>).</li>
<li>Documentation and testing improvements.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="3957cd8b36"><code>3957cd8</code></a> Auto merge of <a href="https://github-redirect.dependabot.com/servo/rust-smallvec/issues/207">#207</a> - mbrubeck:bump, r=mbrubeck</li>
<li><a href="851d222629"><code>851d222</code></a> Version 1.3.0</li>
<li><a href="6a14df03e5"><code>6a14df0</code></a> Document Cargo features</li>
<li><a href="c48902fb78"><code>c48902f</code></a> Make ToSmallVec trait public</li>
<li><a href="faca460f0c"><code>faca460</code></a> Auto merge of <a href="https://github-redirect.dependabot.com/servo/rust-smallvec/issues/206">#206</a> - hiddenhare:inline-constructors, r=mbrubeck</li>
<li><a href="f5f6d89e7e"><code>f5f6d89</code></a> Add #[inline] attribute to all fns which return SmallVec</li>
<li><a href="9cdf8fb424"><code>9cdf8fb</code></a> Auto merge of <a href="https://github-redirect.dependabot.com/servo/rust-smallvec/issues/204">#204</a> - c410-f3r:const__generics, r=mbrubeck</li>
<li><a href="02cdf2492e"><code>02cdf24</code></a> Auto merge of <a href="https://github-redirect.dependabot.com/servo/rust-smallvec/issues/205">#205</a> - c410-f3r:fix-ci, r=mbrubeck</li>
<li><a href="9f2f610d52"><code>9f2f610</code></a> Fix CI</li>
<li><a href="70e967edaa"><code>70e967e</code></a> Add support for constant generics</li>
<li>Additional commits viewable in <a href="https://github.com/servo/rust-smallvec/compare/v1.2.0...v1.3.0">compare view</a></li>
</ul>
</details>
<br />
[](https://dependabot.com/compatibility-score/?dependency-name=smallvec&package-manager=cargo&previous-version=1.2.0&new-version=1.3.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)
---
<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)
- Pull request limits (per update run and/or open at any time)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)
</details>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
1394: Bump libc from 0.2.68 to 0.2.69 r=MarkMcCaskey a=dependabot-preview[bot]
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.68 to 0.2.69.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/rust-lang/libc/releases">libc's releases</a>.</em></p>
<blockquote>
<h2>0.2.69</h2>
<p>Bump patch version to 0.2.69</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="d833b6b2d6"><code>d833b6b</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/rust-lang/libc/issues/1732">#1732</a> from Minoru/feature/release-0.2.69</li>
<li><a href="9604f461dc"><code>9604f46</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/rust-lang/libc/issues/1697">#1697</a> from JohnTitor/emscripten</li>
<li><a href="542eef19b9"><code>542eef1</code></a> Fix <code>max_align_t</code> size and align</li>
<li><a href="c1a4d6271d"><code>c1a4d62</code></a> Use wasi values for <code>errno</code>s</li>
<li><a href="622e6f5d25"><code>622e6f5</code></a> Update node to v12.16.2</li>
<li><a href="991678ce0b"><code>991678c</code></a> Skip test for <code>SYS_gettid</code></li>
<li><a href="3d8197ec2b"><code>3d8197e</code></a> Update links</li>
<li><a href="80a2f9cbb2"><code>80a2f9c</code></a> Update emsdk to 1.39.12</li>
<li><a href="4eb6331c4f"><code>4eb6331</code></a> Remove <code>TCP_FASTOPEN_CONNECT</code> from emscripten</li>
<li><a href="be0347bbec"><code>be0347b</code></a> Remove <code>IPV6_FLOWINFO</code> from emscripten</li>
<li>Additional commits viewable in <a href="https://github.com/rust-lang/libc/compare/0.2.68...0.2.69">compare view</a></li>
</ul>
</details>
<br />
[](https://dependabot.com/compatibility-score/?dependency-name=libc&package-manager=cargo&previous-version=0.2.68&new-version=0.2.69)
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)
- Pull request limits (per update run and/or open at any time)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)
</details>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
1374: chore(deps): bump parking_lot from 0.10.0 to 0.10.2 r=MarkMcCaskey a=dependabot-preview[bot]
Bumps [parking_lot](https://github.com/Amanieu/parking_lot) from 0.10.0 to 0.10.2.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/Amanieu/parking_lot/blob/master/CHANGELOG.md">parking_lot's changelog</a>.</em></p>
<blockquote>
<h2>parking_lot 0.10.2 (2020-04-10)</h2>
<ul>
<li>Update minimum version of <code>lock_api</code>.</li>
</ul>
<h2>parking_lot 0.10.1, parking_lot_core 0.7.1, lock_api 0.3.4 (2020-04-10)</h2>
<ul>
<li>Add methods to construct <code>Mutex</code>, <code>RwLock</code>, etc in a <code>const</code> context. (<a href="https://github-redirect.dependabot.com/Amanieu/parking_lot/issues/217">#217</a>)</li>
<li>Add <code>FairMutex</code> which always uses fair unlocking. (<a href="https://github-redirect.dependabot.com/Amanieu/parking_lot/issues/204">#204</a>)</li>
<li>Fixed panic with deadlock detection on macOS. (<a href="https://github-redirect.dependabot.com/Amanieu/parking_lot/issues/203">#203</a>)</li>
<li>Fixed incorrect synchronization in <code>create_hashtable</code>. (<a href="https://github-redirect.dependabot.com/Amanieu/parking_lot/issues/210">#210</a>)</li>
<li>Use <code>llvm_asm!</code> instead of the deprecated <code>asm!</code>. (<a href="https://github-redirect.dependabot.com/Amanieu/parking_lot/issues/223">#223</a>)</li>
</ul>
<h2>lock_api 0.3.3 (2020-01-04)</h2>
<ul>
<li>Deprecate unsound <code>MappedRwLockWriteGuard::downgrade</code> (<a href="https://github-redirect.dependabot.com/Amanieu/parking_lot/issues/198">#198</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="4cb93a3268"><code>4cb93a3</code></a> Bump parking_lot to version 0.10.2</li>
<li><a href="d070a26900"><code>d070a26</code></a> Merge <a href="https://github-redirect.dependabot.com/Amanieu/parking_lot/issues/224">#224</a></li>
<li><a href="8030870c0f"><code>8030870</code></a> Update required parking_lot_core version</li>
<li><a href="413432c43e"><code>413432c</code></a> Fix required lock_api version</li>
<li><a href="699325c9a7"><code>699325c</code></a> Add test for <a href="https://github-redirect.dependabot.com/Amanieu/parking_lot/issues/203">#203</a></li>
<li><a href="761a4d567f"><code>761a4d5</code></a> Bump versions of all crates</li>
<li><a href="87a574488c"><code>87a5744</code></a> Merge <a href="https://github-redirect.dependabot.com/Amanieu/parking_lot/issues/223">#223</a></li>
<li><a href="806e5c1c1e"><code>806e5c1</code></a> Attempt to fix CI</li>
<li><a href="9bed8e3dd1"><code>9bed8e3</code></a> Fix documentation link</li>
<li><a href="dce000d302"><code>dce000d</code></a> Use llvm_asm! instead of asm!</li>
<li>Additional commits viewable in <a href="https://github.com/Amanieu/parking_lot/compare/0.10.0...0.10.2">compare view</a></li>
</ul>
</details>
<br />
[](https://dependabot.com/compatibility-score/?dependency-name=parking_lot&package-manager=cargo&previous-version=0.10.0&new-version=0.10.2)
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)
- Pull request limits (per update run and/or open at any time)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)
</details>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
1376: chore(deps): bump structopt from 0.3.12 to 0.3.13 r=MarkMcCaskey a=dependabot-preview[bot]
Bumps [structopt](https://github.com/TeXitoi/structopt) from 0.3.12 to 0.3.13.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/TeXitoi/structopt/blob/master/CHANGELOG.md">structopt's changelog</a>.</em></p>
<blockquote>
<h1>v0.3.13 (2020-04-9)</h1>
<ul>
<li>Bump <code>proc-macro-error</code> to <code>1.0</code>.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a href="https://github.com/TeXitoi/structopt/commits">compare view</a></li>
</ul>
</details>
<br />
[](https://dependabot.com/compatibility-score/?dependency-name=structopt&package-manager=cargo&previous-version=0.3.12&new-version=0.3.13)
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)
- Pull request limits (per update run and/or open at any time)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)
</details>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
1392: Bump blake3 from 0.3.1 to 0.3.2 r=MarkMcCaskey a=dependabot-preview[bot]
Bumps [blake3](https://github.com/BLAKE3-team/BLAKE3) from 0.3.1 to 0.3.2.
<details>
<summary>Commits</summary>
<ul>
<li><a href="fcb4b83419"><code>fcb4b83</code></a> version 0.3.2</li>
<li><a href="d5e26538fc"><code>d5e2653</code></a> refactor build.rs</li>
<li><a href="7ef795d62e"><code>7ef795d</code></a> Do not require AVX512DQ</li>
<li><a href="370ba3644a"><code>370ba36</code></a> print the compiler version in CI, for help with debugging</li>
<li><a href="86c3174d5b"><code>86c3174</code></a> unbreak neon benchmarks</li>
<li><a href="e3069da68e"><code>e3069da</code></a> only run CI on branches and PRs, not tags</li>
<li>See full diff in <a href="https://github.com/BLAKE3-team/BLAKE3/compare/0.3.1...0.3.2">compare view</a></li>
</ul>
</details>
<br />
[](https://dependabot.com/compatibility-score/?dependency-name=blake3&package-manager=cargo&previous-version=0.3.1&new-version=0.3.2)
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)
- Pull request limits (per update run and/or open at any time)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)
</details>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
1390: Bump serde_json from 1.0.48 to 1.0.51 r=MarkMcCaskey a=dependabot-preview[bot]
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.48 to 1.0.51.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/serde-rs/json/releases">serde_json's releases</a>.</em></p>
<blockquote>
<h2>v1.0.51</h2>
<ul>
<li>Terminate StreamDeserializer after errors instead of repeatedly reparsing the same failed input (<a href="https://github-redirect.dependabot.com/serde-rs/json/issues/647">#647</a>)</li>
<li>Add FusedIterator impls for StreamDeserializer and for Map's various iterators</li>
</ul>
<h2>v1.0.50</h2>
<ul>
<li>Implement Eq for Value, Map, Number (<a href="https://github-redirect.dependabot.com/serde-rs/json/issues/640">#640</a>, thanks <a href="https://github.com/smarnach">@smarnach</a>)</li>
</ul>
<h2>v1.0.49</h2>
<ul>
<li>Improve error message when neither "std" nor "alloc" feature is enabled (<a href="https://github-redirect.dependabot.com/serde-rs/json/issues/643">#643</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="f77c84dd3d"><code>f77c84d</code></a> Release 1.0.51</li>
<li><a href="8e76584c20"><code>8e76584</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/serde-rs/json/issues/649">#649</a> from serde-rs/fused</li>
<li><a href="d133748122"><code>d133748</code></a> Implement FusedIterator for StreamDeserializer where possible</li>
<li><a href="858b01d852"><code>858b01d</code></a> Implement FusedIterator for Map iterators</li>
<li><a href="4c81923102"><code>4c81923</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/serde-rs/json/issues/648">#648</a> from serde-rs/streamerror</li>
<li><a href="e99e9d3713"><code>e99e9d3</code></a> Return None after stream deserializer has failed</li>
<li><a href="a1b1199e72"><code>a1b1199</code></a> Test stream behavior after error</li>
<li><a href="fd6741f4b0"><code>fd6741f</code></a> Release 1.0.50</li>
<li><a href="4ac9f6c7bf"><code>4ac9f6c</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/serde-rs/json/issues/640">#640</a> from smarnach/smarnach/eq-impls</li>
<li><a href="99eb4eab76"><code>99eb4ea</code></a> Implement Eq for Map, Number and Value.</li>
<li>Additional commits viewable in <a href="https://github.com/serde-rs/json/compare/v1.0.48...v1.0.51">compare view</a></li>
</ul>
</details>
<br />
[](https://dependabot.com/compatibility-score/?dependency-name=serde_json&package-manager=cargo&previous-version=1.0.48&new-version=1.0.51)
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)
- Pull request limits (per update run and/or open at any time)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)
</details>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
1395: Bump regex from 1.3.6 to 1.3.7 r=MarkMcCaskey a=dependabot-preview[bot]
Bumps [regex](https://github.com/rust-lang/regex) from 1.3.6 to 1.3.7.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/rust-lang/regex/blob/master/CHANGELOG.md">regex's changelog</a>.</em></p>
<blockquote>
<h1>1.3.7 (2020-04-17)</h1>
<p>This release contains a small bug fix that fixes how <code>regex</code> forwards crate
features to <code>regex-syntax</code>. In particular, this will reduce recompilations in
some cases.</p>
<p>Bug fixes:</p>
<ul>
<li>[BUG <a href="https://github-redirect.dependabot.com/rust-lang/regex/issues/665">#665</a>](<a href="https://github-redirect.dependabot.com/rust-lang/regex/pull/665">rust-lang/regex#665</a>):
Fix feature forwarding to <code>regex-syntax</code>.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="adb4aa3ce4"><code>adb4aa3</code></a> regex-1.3.7</li>
<li><a href="761284d2ee"><code>761284d</code></a> changelog: 1.3.7</li>
<li><a href="672d877019"><code>672d877</code></a> sparse: add better Debug impl</li>
<li><a href="b490e0b2e5"><code>b490e0b</code></a> cargo: tweak features for regex-syntax</li>
<li>See full diff in <a href="https://github.com/rust-lang/regex/compare/1.3.6...regex-1.3.7">compare view</a></li>
</ul>
</details>
<br />
[](https://dependabot.com/compatibility-score/?dependency-name=regex&package-manager=cargo&previous-version=1.3.6&new-version=1.3.7)
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)
- Pull request limits (per update run and/or open at any time)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)
</details>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
1391: Bump anyhow from 1.0.26 to 1.0.28 r=MarkMcCaskey a=dependabot-preview[bot]
Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.26 to 1.0.28.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/dtolnay/anyhow/releases">anyhow's releases</a>.</em></p>
<blockquote>
<h2>1.0.28</h2>
<ul>
<li>Documentation improvements (<a href="https://github-redirect.dependabot.com/dtolnay/anyhow/issues/73">#73</a>, <a href="https://github-redirect.dependabot.com/dtolnay/anyhow/issues/78">#78</a>)</li>
</ul>
<h2>1.0.27</h2>
<ul>
<li>
<p>Improve documentation of backtrace environment variable combinations (<a href="https://github-redirect.dependabot.com/dtolnay/anyhow/issues/69">#69</a>)</p>
<blockquote>
<ul>
<li>If you want panics and errors to both have backtraces, set <code>RUST_BACKTRACE=1</code>;</li>
<li>If you want only errors to have backtraces, set <code>RUST_LIB_BACKTRACE=1</code>;</li>
<li>If you want only panics to have backtraces, set <code>RUST_BACKTRACE=1</code> and <code>RUST_LIB_BACKTRACE=0</code>.</li>
</ul>
</blockquote>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="022f700a1c"><code>022f700</code></a> Release 1.0.28</li>
<li><a href="e2eb1f5263"><code>e2eb1f5</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/dtolnay/anyhow/issues/78">#78</a> from dtolnay/cfg</li>
<li><a href="d65ec5ed2f"><code>d65ec5e</code></a> Use doc_cfg to mark Error::new</li>
<li><a href="e46df9f4a5"><code>e46df9f</code></a> Rephrase nightly backtrace note</li>
<li><a href="946bff8a54"><code>946bff8</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/dtolnay/anyhow/issues/73">#73</a> from lzybkr/nightly_in_docs</li>
<li><a href="a07b84b641"><code>a07b84b</code></a> Mention nightly in module docs</li>
<li><a href="ffc45d2d42"><code>ffc45d2</code></a> Select a single docs.rs build target</li>
<li><a href="e7702aa4fc"><code>e7702aa</code></a> Release 1.0.27</li>
<li><a href="19be9654a0"><code>19be965</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/dtolnay/anyhow/issues/71">#71</a> from dtolnay/dev</li>
<li><a href="4426253333"><code>4426253</code></a> Disable dev dependency on futures executor</li>
<li>Additional commits viewable in <a href="https://github.com/dtolnay/anyhow/compare/1.0.26...1.0.28">compare view</a></li>
</ul>
</details>
<br />
[](https://dependabot.com/compatibility-score/?dependency-name=anyhow&package-manager=cargo&previous-version=1.0.26&new-version=1.0.28)
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)
- Pull request limits (per update run and/or open at any time)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)
</details>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
1396: Correct the backend name in README r=nlewycky a=satrobit
The README mistakenly said LLVM when it was referring to the singlepass backend. It's just a simple doc fix.
Co-authored-by: Amir Keshavarz <satrobit@users.noreply.github.com>
1388: Remove --test-threads=1 added to singlepass in 4d8eb7 now that the underlying bug is fixed. r=syrusakbary a=nlewycky
Co-authored-by: Nick Lewycky <nicholas@mxc.ca>
1385: Fix underflow in subtraction on global.get with float-type global. r=nlewycky a=nlewycky
# Description
Fix spectests-singlepass failures that appear when in debug builds (checked subtraction). The global.get opcode pushes to the fp_stack first and the value_stack second, so it shouldn't be subtracting 1 from the size of the value_stack.
Co-authored-by: Nick Lewycky <nicholas@mxc.ca>
Co-authored-by: nlewycky <nick@wasmer.io>
1382: Test Refactor r=syrusakbary a=syrusakbary
# Description
This PR is the continuation of #1380.
It refactors our testing infrastructure based on various points:
* There is no longer a "default compiler" on tests
* Tests are automatically generated for: emscripten and wasi
* It accelerates testing into multiple threads when possible (with the exception of the llvm backend)
* It automatically detects the backends available in the host
Summary of changes:
* [x] Removed all extra logic for test creation in emscripten test generator
* [x] Removed all extra logic for test creation in the wasi test generator
* [x] Divided wasmer wast test in different files (under `tests/custom/`)
* [x] Refactored trap asserts using the wast format
* [x] Improved the build script by adding emscripten and wasi test generators (separated from build)
* [x] Improved WASI errors to be Rust error types (by deriving from `thiserror::Error`)
* [x] Fixed toolchain error creation
* [x] Removed leaking of testing logic from generators into build
* [x] Refactored import tests to be compatible with multiple backends
* [x] Improved wasmer binary to work even when no backends are set (useful for testing without any backend available).
* [x] Removed assumption that Cranelift will be the default in the `wasmer` binary
* [x] Migrated middleware
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Syrus <me@syrusakbary.com>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
1380: Test refactor r=syrusakbary a=syrusakbary
<!--
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests
-->
# Description
This PR refactors the way we do testing in our infrastructure, simplifying test generation specially for spectests for each of the backends.
<!--
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->
# Review
- [ ] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Syrus <me@syrusakbary.com>
1370: feat(interface-types) Crate reorganization r=Hywan a=Hywan
This PR re-organizes the crate:
* `interpreter/wasm/values.rs` moves to `values.rs`,
* `interpreter/wasm/serde/*` moves to `serde/*`,
* `types.rs` is new, and includes `InterfaceType` and `RecordType`,
* Update the documentation.
Bonus: `InterfaceValue::Record` now takes a `Vec1` rather than a `Vec` to match `InterfaceType::Record`.
Co-authored-by: Ivan Enderlin <ivan@mnt.io>
1371: Update tests to use new API where easily possible r=MarkMcCaskey a=MarkMcCaskey
The primary thing that wasn't updated yet is the compile and compile_with... functions.
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1362: feat(interface-types) Remove allocator index from `string.lower_memory` r=Hywan a=Hywan
This PR updates `string.lower_memory` to remove the allocator index. Indeed, the string pointer is assumed to be present on the stack.
Also, this PR updates `string.size` to pop, and not to peek, the string to compute the length from.
That way, it matches the WIT proposal.
Co-authored-by: Ivan Enderlin <ivan@mnt.io>
1369: Fix broken makefile commands and improve test consistency r=MarkMcCaskey a=MarkMcCaskey
# Review
- [ ] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1367: Move `dev-utils` crate into `tests` r=MarkMcCaskey a=MarkMcCaskey
<!--
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests
-->
# Description
<!--
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->
# Review
- [ ] 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 <5770194+MarkMcCaskey@users.noreply.github.com>
1363: fix(interface-types) Don't duplicate code in the binary encoder. r=MarkMcCaskey a=Hywan
Use the `ToBytes` implementation of `RecordType` to encode the inner
record type of a type, so that it avoids code duplication.
Co-authored-by: Ivan Enderlin <ivan@mnt.io>
1361: doc(interface-types) Add `record` instructions in the `README.md` r=MarkMcCaskey a=Hywan
This PR keeps the documentation up-to-date.
Co-authored-by: Ivan Enderlin <ivan@mnt.io>
1357: Refactored bin commands into separate files r=syrusakbary a=syrusakbary
<!--
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests
-->
# Description
Refactored bin commands into separate files.
This PR does not do any sustancial changes other than refactoring into different files for better readability.
<!--
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Syrus <me@syrusakbary.com>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
1354: test(middleware-common) Remove an unused import r=MarkMcCaskey a=Hywan
This PR removes an unused import.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
1331: feat(interface-types) Implement the `record` instructions r=Hywan a=Hywan
### Description
This PR implements the `record` WIT type, along with the `record.lift` and `record.lower` instructions.
With my current understanding of the draft/specification, here is how it works. Let's say we want to represent a Rust struct like the following:
```rust
struct S {
x: String,
y: i32
}
```
First declare a WIT type, such as:
```wat
(@interface type (record (field string) (field i32)))
```
The `record` type is supported by the binary encoder, the WAT encoder, the binary decoder, and the WAT decoder. A new `TypeKind` node has been introduced in the AST to differentiate a function type (`(@interface type (func (param …) (result …)))`) of a record type (see above).
Second, the `record.lower` transforms a host value (here Rust value, `S`) into a WIT value. In our implementation, a record value is defined as:
```rust
InterfaceValue::Record(Vec<InterfaceValue>)
```
Multiple mechanisms are used to type check a record value based on a record type. The code of the `record.lower` is pretty straightforward.
Because transforming a host value into a WIT value isn't obvious, a `Serializer` has been implemented, based on [`serde`](https://serde.rs/). This feature is behind the `serde` flag, which is turned on by default.
Serde is only used to cross the host/Wasm boundary, but it's not used to represent the value in memory or anything. It's only a shortcut to transform a host value into a WIT value, and vice versa.
Use the following code to transform `S` into a WIT value:
```rust
#[derive(Serialize, Deserialize, Debug, PartialEq)]
struct S {
x: String,
y: i32,
}
let host_value = S { x: "hello".to_string(), y: 42 };
let wit_value = to_interface_value(&host_value).unwrap();
assert_eq!(
wit_value,
InterfaceValue::Record(vec![
InterfaceValue::String("hello".to_string()),
InterfaceValue::I32(42),
])
);
```
Third, the `record.lift` instruction does the opposite of `record.lower`: It transforms WIT values into a host value. To also facilitate the user experience, this PR contains a `Deserializer` implementation, still based on `serde`, with the `from_interface_values` function. It looks like this:
```rust
let wit_values = vec![
InterfaceValue::Record(vec![
InterfaceValue::String("hello".to_string()),
InterfaceValue::I32(42),
])
];
let host_value = from_interface_values::<S>(&wit_values).unwrap();
assert_eq!(
host_value,
S { x: "hello".to_string(), y: 42 },
);
```
With the `Serializer` and `Deserializer`, it's super easy for the user to send or receive values from WIT.
The `record.lift` and `record.lower` instructions are kind of basic. The `record.lift` instruction has a little trick to reduce vector allocations, but there is a documentation for that.
#### Opened questions
Records of dimension 1 do not raise any issue. With `record.lift`, all values on the stack (the WIT interpreter stack) are popped, and are used as record field values. Something like:
```
[stack]
i32(1)
i64(2),
string("hello")
record.lift <record_type>
```
generates
```
[stack]
record { i32(1), i64(2), string("hello") }
```
But it's not clear what happens with record of dimension > 1, for instance for a type like `record (field i32) (record (field i32) (field i32)) (field string)`, it is assumed (in this PR) that the stack must be like this:
```
[stack]
i32(1)
i32(2)
i32(3)
string("hello")
record.lift <record_type>
```
to generate:
```
[stack]
record { i32(1), record { i32(2), i32(3) }, string("hello") }
```
If we want the stack to contain an intermediate record, we should have something like this:
```
[stack]
i32(1)
i32(2)
i32(3)
record.lift <record_type_2>
string("hello")
record.lift <record_type_1>
```
But it would imply that `record_type_1` is defined as `record (field i32) (record (type record_type_2)) (field i32)`.
A sub-record defined by another record type isn't support, as it is not specified in the draft. I believe my assumption is fine enough for a first implementation of records in WIT.
### To do
- [x] Encode and decode record type (`(@interface type (record string i32))`):
- [x] Binary encoder/decoder
- [x] WAT encoder/decoder
- [x] Implement the `record.lift` instruction
- [x] Implement the `record.lower` instruction
- [x] Test
- [x] Documentation
- [x] Surprise!
- [x] Serialize a Rust value to WIT values (useful for `record`s)
- [x] Deserialize WIT values to a Rust value (useful for `record`s)
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
`Vec1` is used by `RecordType` to ensure that a record have at least 1
field. Then an `InterfaceValue::Record` is ensured to get at least one
value with the type-checking pass.
1350: update blake3 to 0.3.1 r=syrusakbary a=oconnor663
Version 0.3.0 caused problems because it required a C compiler with
AVX-512 support, which broke Android x86 cross-compilation. Version
0.3.1 automatically falls back to a pure Rust build when the C compiler
either doesn't exist or doesn't support the flags we need.
Co-authored-by: Jack O'Connor <oconnor663@gmail.com>
Version 0.3.0 caused problems because it required a C compiler with
AVX-512 support, which broke Android x86 cross-compilation. Version
0.3.1 automatically falls back to a pure Rust build when the C compiler
either doesn't exist or doesn't support the flags we need.
`seq`, `map` and `tuple` for instance are not supported officially. It
was fun to play with it at the beginning, but it is time to remove it
to match the `Serializer` implementation.
1313: Add types and methods to provide updated API r=MarkMcCaskey a=MarkMcCaskey
Improving the API in a number of ways.
<details><summary>Current status </summary>
- [x] Get exports from Instance
- [x] Func
- [x] Documented
- [x] Tested
- [x] DynFunc
- [x] Documented
- [x] Tested
- [x] Memory
- [x] Documented
- [x] Tested
- [x] Table
- [x] Documented
- [ ] Tested ; fully testing this now will be difficult, blocked on Table API being completed
- [x] Global
- [x] Documented
- [x] Tested
- [x] Field syntax (fairly non-trivial)
- [x] Get imports from Module
- [ ] Maybe update this to be an iterator instead of a Vec (side note, we may want to have a way to access specific types of imports too)
- [x] Documented
- [x] Tested
- [x] Get exports from Module
- [x] Documented
- [x] Tested
- [x] Get custom section from Module
- [x] Figure out correct solution
- [x] Ship separate PR that updates custom section code
- [x] Documented
- [x] Tested
- [ ] Updated Memory API
- [x] Added conversion methods to bytes/pages with From
- [ ] Documented
- [ ] Tested
- [ ] Table APIs ; blocked on `wrap` being not linear time update (this update should also make it possible to retrieve a `Func` from `vm::Anyfunc`)
- [ ] Table set (implemented needs to be checked)
- [ ] Documented with examples
- [x] Implemented
- [ ] Table grow (implemented needs to be checked)
- [ ] Documented with examples
- [x] Implemented
- [ ] Table get
- [x] Structure implemented
- [ ] Documented
- [ ] Tested
- [ ] Module APIs (probably separate)
- [x] Update import object macro to handle a lack of trailing commas as well
- [x] Add line in changelog about it
- [x] Tested
</details>
# Review
- [ ] 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 <5770194+MarkMcCaskey@users.noreply.github.com>
1339: Create a valid target triple in the LLVM Module. r=MarkMcCaskey a=nlewycky
Co-authored-by: Nick Lewycky <nick@wasmer.io>
Co-authored-by: nlewycky <nick@wasmer.io>
Co-authored-by: Mark McCaskey <5770194+MarkMcCaskey@users.noreply.github.com>
1345: Adding Azure pipelines to handle ARM r=syrusakbary a=syrusakbary
<!--
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests
-->
# Description
Adding Azure pipelines to handle ARM
<!--
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Syrus <me@syrusakbary.com>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
Version 0.3 switched to using assembly implementations by default, which
both perform better and build more quickly. This invokes the C compiler
from build.rs. If Wasmer would prefer to avoid that build dependency, we
could enable the new `pure` feature.
WIT values are native Rust values. But records are represented as a
vector of WIT values. In order to provide a super neat API to the
user, Serde is used to deserialize this vector of WIT values to a
large variety of Rust values.
The `Type::Record` variant now is defined by `RecordType`. In
addition, `InterfaceType` has a new variant: `Record`, that is also
defined by `RecordType`. Encoders and decoders are updated to consider
`RecordType`, which removes code duplication and simplify code.
This patch updates the `Type` type to be an enum with 2 variants:
`Function` and `Record`, resp. to represent:
1. `(@interface type (func (param i32 i32) (result string)))`
2. `(@interface type (record string i32))`
This patch updates the binary encoder and decoder, along with the WAT
encoder and decoder.
The index is bound to `u32::max_value()`. The invocation inputs'
length is bound to `usize::max_value()`, which can be
`u64::max_value`. Consequently, casting the invocation inputs' length
to `u32` can lead to an integer overflow. It is better to cast `index`
to `usize` when comparing with the invocation inputs' length.
1332: Add `CompilerConfig` opt to disable IR verification in debug mode r=MarkMcCaskey a=MarkMcCaskey
Resolves#1330
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
Basically the `x-to-y` instructions have been renamed `y.from_x`. This
patch updates the instruction. The binary representation isn't
specified yet, so it's just arbitrary values.
1327: fix(interface-types) Stack pops items in the same order than Wasm invocation rule r=Hywan a=Hywan
This PR fixes the items order when popped from the stack. It matches [the Wasm invocation rule](https://webassembly.github.io/spec/core/exec/instructions.html#invocation-of-function-address).
Not that it is more performant in our case, since we use the `drain` API rather than `drain` + `rev`.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
1292: Experimental Support for Android (x86_64 and AArch64) r=syrusakbary a=igrep
# Description
Related: https://github.com/wasmerio/wasmer/issues/1113
# Current Status
- ~~This pull request is a draft until the next version of libc crate (which should contain https://github.com/rust-lang/libc/pull/1622)~~
- Now released! 🎉
- I confirmed the tests of wasmer-runtime-core pass on Android x86\_64.
- The other tests including ones on AArch64 seems too hard so far... 😓
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
# Note
I'm happy given any hint to test of Android specific code (esp. in libc I added in https://github.com/rust-lang/libc/pull/1622).
Co-authored-by: Yuji Yamamoto <yuji-yamamoto@iij.ad.jp>
Co-authored-by: YAMAMOTO Yuji <yuji-yamamoto@iij.ad.jp>
Co-authored-by: Mark McCaskey <5770194+MarkMcCaskey@users.noreply.github.com>
1288: Update some dependencies manually, removing duplicate deps r=MarkMcCaskey a=MarkMcCaskey
Removes all duplicate deps (as seen by `cargo +stable tree -d`). Primarily by updating `wasm-debug` but also by through updating some other dependencies.
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1320: Support multiple custom sections with the same name r=MarkMcCaskey a=MarkMcCaskey
The spec doesn't disallow duplicates and the [JS API spec](https://webassembly.github.io/spec/js-api/index.html#dom-module-customsections) supports them.
# Review
- [ ] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1322: inkwell::Builder is a per-function notion, remove it from LLVMModuleCodeGenerator. r=nlewycky a=nlewycky
This also removes it from the API to generate trampolines, which makes sense because those produce new functions, so it can produce a new builder for the new function.
Co-authored-by: Nick Lewycky <nick@wasmer.io>
Co-authored-by: nlewycky <nick@wasmer.io>
This also removes it from the API to generate trampolines, which makes sense because those produce new functions, so it can produce a new builder for the new function.
1315: Fix windows cross compilation r=MarkMcCaskey a=Jake-Shadle
# Description
When compiling to windows from any host other than windows, the `win-exception-handler` crate would not actually compile the C code since the compilation was guarded by `#[cfg(target_os = "windows")]`, which is evaluated when the build script itself is compiled which would mean it would != windows, which would eventually cause a link error due to the missing library.
This change gets the target os via the `CARGO_CFG_TARGET_OS` environment variable, which is set by cargo when invoking the build script, and will evaluate to `windows` when actually targetting windows, no matter the host platform.
It also changed from using cmake to use the cc crate to compile the code, as cmake seemed like massive overkill for a single C file, as well as complicating cross compilation again, though I can change it back to cmake if you don't want that change.
I also fixed a warning produced by clang by adding `#include <intrin.h>`, though there was another warning due to the trampoline function pointer taking a non-const `wasmer_instance_context_t*`, but wasmer actually sending in a const *.
# Review
- [ ] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Jake Shadle <jake.shadle@embark-studios.com>
cfg!()/env!() are applied on the host platform during the build script's
build, the environment of the build script's execution is the proper way
to determine eg target_os
We now use `,*` on the outside of a `$()` expression to match on
interspersed commas instead of trailing commas. To continue to handle
the trailing comma case, we optionally match on an extra comma at the
end with `$(,)?`.
1310: upgrade the blake3 dependency to 0.2 r=MarkMcCaskey a=oconnor663
Version 0.2 makes assembly implementations available. They're off by default, and I haven't enabled them here, because they require the build machine to have a C toolchain installed. But if that's already a requirement for Wasmer, we could enable them with the `"c"` feature, for both better runtime performance and faster build times.
Co-authored-by: Jack O'Connor <oconnor663@gmail.com>
1300: Update `wasi-tests` to test multiple versions of WASI r=MarkMcCaskey a=MarkMcCaskey
This change also cleans up the `wasi-test` generation a bit. It's
actually still really, really messy, but at least now it's split up
into easier to understand chunks.
There's still a lot of low-hanging fruit in terms of improving the
readability and maintainability of the code.
Improves test coverage over what's on master. Things in `ignores.txt` weren't being tested on master either; we should do a follow up to remove them from there (will require finding a good solution for raw WASI calls)
# 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 <5770194+MarkMcCaskey@users.noreply.github.com>
This change also cleans up the `wasi-test` generation a bit. It's
actually still really, really messy, but at least now it's split up
into easier to understand chunks.
There's still a lot of low-hanging fruit in terms of improving the
readibilty and maintainability of the code.
1283: Workaround for floating point arguments and return values in `DynamicFunc`s. r=syrusakbary a=losfair
This PR makes floating point arguments and return values for `DynamicFunc`s work correctly in all three backends.
Previously Singlepass used integer registers for all arguments. This PR adds another thin trampoline layer just before control is transferred to the import function, so that arguments will be rearranged strictly according to the System V ABI.
The full fix would require singlepass to implement the SysV calling convention internally too: https://github.com/wasmerio/wasmer/pull/1271 . This is just a workaround.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
Co-authored-by: losfair <zhy20000919@hotmail.com>
Co-authored-by: Heyang Zhou <zhy20000919@hotmail.com>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
1289: Enable `DynamicFunc` for closures with captured environment. r=syrusakbary a=losfair
Previously we disabled `DynamicFunc` for any non-zero-sized closures to leave space for future changes. However this feature is critical for applications that needs to bring context with host functions, like integrations with dynamic lauguages. So it might be good to enable it.
A question left is: should we put this behind a feature flag or enable it by default?
@Hywan @syrusakbary
Co-authored-by: losfair <zhy20000919@hotmail.com>
1281: feat(interface-types) Rename `call` to `call-core`, and remove `call-export` r=syrusakbary a=Hywan
The latest standard removes `call-export` and has a single `call-core` instruction.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
1262: Update to latest inkwell which adds context lifetime to basic blocks. r=nlewycky a=nlewycky
The latest inkwell adds lifetimes to basic blocks and also changes most APIs to pass them without reference.
Co-authored-by: Nick Lewycky <nick@wasmer.io>
1272: Fix WasmPtr to work with accesses accessing the final valid byte r=MarkMcCaskey a=MarkMcCaskey
Resolves#1258
The fix was to change `>=` into `>`. Doing this made us vulnerable to accessing memory to create an empty slice just out of bounds so we have to add some additional checks to make sure that that can't happen.
This PR also prevents accessing arrays of length 0 (the length bound is non-inclusive, so length 0 is never valid) and prevents access of zero-sized types.
The zero-sized type checks will probably be inlined (or will be in the future as `const fn` gets more mature) so provide no additional overhead. The checking of if length == 0 does add some overhead, but on modern CPUs it shouldn't be an issue as it's a branch that should be always false in normal use.
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
This also returns `None` for all accesses of zero sized types and
arrays of length 0. Because the array accesses have a non-inclusive
length, length of 0 is not valid. These checks prevent returning
empty slices that point just outside of memory bounds.
1268: Prepare for 0.15.0 release r=MarkMcCaskey a=MarkMcCaskey
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1267: Improve support for preopened directories in WASI syscalls r=MarkMcCaskey a=MarkMcCaskey
Ported over from #1263
# Description
<!--
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1264: feat(interface-types) Implement lifting and lowering instructions r=Hywan a=Hywan
For the moment, WIT defines [a bunch of lifting and lowering instructions](https://github.com/WebAssembly/interface-types/blob/master/proposals/interface-types/working-notes/instr.md). The encoders, the decoders and the AST support them, but we didn't have any instruction implementations for them. This PR implements the instructions for real.
To handle casting failure, I decided to use the `TryFrom` trait, instead of `as`, such as:
```rust
let x: i32 = 128;
let y: i8 = x.try_into().unwrap(); // fails
```
while:
```rust
let x: i32 = 128;
let y: i8 = x as _; // just overflows silently
```
Not all `*x` instructions aren't implement _yet_.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
1265: Improve `WasmPtr` documentation r=MarkMcCaskey a=MarkMcCaskey
This came up multiple times when responding to people on our issue tracker.
Adds an example and a lot more information about `WasmPtr` and `ValueType`
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1217: Polymorphic host functions based on dynamic trampoline generation. r=losfair a=losfair
This PR implements polymorphic host functions by dynamically generating the "glue" code that translates platform arguments to an array in `runtime-core`.
TODO:
- ~~Multiple return values.~~ Deferring to a future multivalue PR.
- [x] Dynamic signatures for polymorphic functions.
- [x] Use a proper executable memory allocator.
Co-authored-by: losfair <zhy20000919@hotmail.com>
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
Co-authored-by: Heyang Zhou <zhy20000919@hotmail.com>
1261: Fix our side of wasmparser typo. r=MarkMcCaskey a=nlewycky
This is a `cargo update` plus change to fix for ac6df05378 .
Co-authored-by: Nick Lewycky <nick@wasmer.io>
1212: Add support for GDB JIT debugging r=MarkMcCaskey a=MarkMcCaskey
This PR adds support for JIT debugging to Wasmer with the Cranelift backend using a fork of `wasmtime-debug`.
The motivation for this change is partially inspired by the feature in Wasmtime and the implementation is largely derived from Wasmtime's `wasmtime-debug` crate and not included in this PR. This implementation is currently Cranelift-only (if LLVM has value tracking we can add this there too without too much effort; we'd have to do the value tracking ourselves in Singlepass and I don't have enough context to know how hard that would be) and is based on a generic fork of the `wasmtime-debug` -- which will be published and uploaded in another repo.
This PR started out implementing the [Wasm-DWARF](https://yurydelendik.github.io/webassembly-dwarf/) reading and writing with gimli but after working on it for a few days, reading a chunk of the DWARF spec, seeing that Wasmtime had solved this well, and realizing how long this would likely take, I decided that it didn't make sense to spend the engineering effort there so I made a copy of `wasmtime-debug` and removed some of the less portable Cranelift pieces (very minor changes) and all code relying on data structures from wasmtime. The resulting crate is completely generic and would work fine with Wasmtime or any other Wasm runtime at the cost of requiring some `transmute`s or a linear pass over the debug data to reconstruct it in terms of the new types exposed by the fork. Perhaps there's a cleaner way to handle that that I haven't considered.
The integration with the GDB JIT interface is from the LLVM examples (I don't remember if I properly attributed everything in this PR/version of the code -- I still have the other branches locally though which I'll review before shipping this) and some of the code in this PR is from Wasmtime/Cranelift source code such as the sorting of the `ebb`s in `clif_backend::resolver`. I spent a long time debugging some subtle bugs and ended up using a few things from Wasmtime's integration with `wasmtime-debug` and some bits from `cranelift-wasm` and `cranelift-codegen`.
If there's interest from other people in working on the generic `wasmtime-debug` fork, I'm happy to get other maintainers involved and/or move it to a shared organization.
Special thanks to [Yury Delendik](https://github.com/yurydelendik) and the other `wasmtime-debug` authors for their work on Wasm debugging. Also shout out to Cranelift for the nice API for tracking variables/data.
### TODO:
- [x] Update attributions file for LLVM, [wasm-dwarf](https://github.com/yurydelendik/wasm-dwarf), and Wasmtime/Cranelift and do another pass over code to make sure we're in compliance with the licenses from the relevant projects and have properly attributed the code used from other projects.
- [x] Adjust API of wasm-debug based on feedback
- [x] Discuss with Nick integration with LLVM
- [x] Discuss with Heyang integration with Singlepass
- [x] Adjust implementation based on feedback from team (traits modified, etc.)
- [x] Clean up some pointer wrangling code
- [x] Add opt-in feature to wasmer-runtime-core to enale wasm-debug so library users who won't use debug info are not affected
# 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 <5770194+MarkMcCaskey@users.noreply.github.com>
1246: Prepare for 0.14.1 release r=MarkMcCaskey a=MarkMcCaskey
0.14.1 differs from 0.14.0 primarily in that the GNU/Linux build is
built on Ubuntu 16.04 instead of 18.04, meaning we'll use an earlier
version of GLIBC.
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
0.14.1 differs from 0.14.0 primarily in that the GNU/Linux build is
built on Ubuntu 16.04 instead of 18.04, meaning we'll use an earlier
version of GLIBC.
1245: Revert change of Ubuntu 18.04 to 16.04 r=MarkMcCaskey a=MarkMcCaskey
I didn't document why I changed it to 18.04 in #1163 ; making this PR to run CI and find out why.
It looks like CI is passing! I have no idea why I updated to 18.04. Perhaps I misread [the support table](https://wiki.ubuntu.com/Releases) and thought 16.04 no longer had standard support.
Either way, this PR seems good to merge.
# Review
- [ ] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
According to the last working notes, new interface types are s8, s16,
s32, s64, u8, u16, u32, u64, f32, f64, string, anyref, i32, and i64.
Their binary reprensentations are changing too, from 0x00 to 0x0d.
1241: Remove signatures_raw r=syrusakbary a=nlewycky
# Description
I previously added a new field to LLVMModuleCodeGenerator which wasn't necessary. The data is available in ModuleInfo which in turn is available everywhere we need it. Remove the dead field, use ModuleInfo instead.
Co-authored-by: Nick Lewycky <nick@wasmer.io>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
1232: feat(interface-types) Implement the WAT decoder r=Hywan a=Hywan
WIP
The goal is the define a minimal WAT to AST decoder for WIT, so that it's muuuuuuch easier to develop and debug.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
1233: Improved Wasmer C API release artifacts r=syrusakbary a=syrusakbary
<!--
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests
-->
# Description
This PR updates the artifacts generated for Wasmer C API, in a way that is much more consumable, including a quick README and License.
So, after running `make capi && make build-capi` We will have a `wasmer-c-api.tar.gz` file with the following structure
```
/
lib/
libwasmer.a
libwasmer.so
include/
wasmer.h
wasmer.hh
README.md
LICENSE
```
See example generated artifact here:
[wasmer-c-api.tar.gz](https://github.com/wasmerio/wasmer/files/4228560/wasmer-c-api.tar.gz)
<!--
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Syrus <me@syrusakbary.com>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
1223: feat(runtime-core) Implement `TryFrom<native_type>` for `Value` r=Hywan a=Hywan
Extracted from #1018.
This PR implements `TryFrom` for `Value`. It is required to support dynamically-typed values for polymorphic host functions.
This PR also refactors the code by using a macro (`value_conversions!`) to implement `From` and `TryFrom` in one shot.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
Co-authored-by: Ivan Enderlin <ivan.enderlin@wanadoo.fr>
1216: feat(interface-types) Add the binary encoder r=Hywan a=Hywan
This PR adds the `encoders::binary` module, which exposes the `ToBytes` trait. It is used to encode the AST into the WIT binary representation.
Check the tests to get examples, but quickly, the roundtrip works:
```rust
fn test_binary_encoding_decoding_roundtrip() {
// Let `original_ast` be an AST representing a set of WIT interfaces
let original_ast = Interfaces {
exports: vec![Export {
name: "ab",
input_types: vec![InterfaceType::I32],
output_types: vec![InterfaceType::I32],
}],
types: vec![Type::new(
"ab",
vec!["cd", "e"],
vec![InterfaceType::I32, InterfaceType::I32],
)],
imports: vec![Import {
namespace: "a",
name: "b",
input_types: vec![InterfaceType::I32],
output_types: vec![InterfaceType::I64],
}],
adapters: vec![Adapter::Import {
namespace: "a",
name: "b",
input_types: vec![InterfaceType::I32],
output_types: vec![InterfaceType::I32],
instructions: vec![Instruction::ArgumentGet { index: 1 }],
}],
forwards: vec![Forward { name: "a" }],
};
// Let's encode the AST into the WIT binary representation.
let mut binary = vec![];
original_ast
.to_bytes(&mut binary)
.expect("Failed to encode the AST.");
// And let's go back to the AST land.
let (remainder, ast) = parse::<()>(binary.as_slice()).expect("Failed to decode the AST.");
assert!(remainder.is_empty());
// They must equal.
assert_eq!(original_ast, ast);
}
```
The implementation with the `ToBytes` trait and the `io::Write` trait is —I hope— Rust idiomatic. I reckon the code is easy to read and understand.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
Co-authored-by: Ivan Enderlin <ivan.enderlin@wanadoo.fr>
1229: Add clippy::missing_safety_doc lint to wasi, misc clean up r=MarkMcCaskey a=MarkMcCaskey
Part of #1219
# Review
- [ ] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1222: feat(runtime-core) Simplify `WasmExternType` implementations with macros r=Hywan a=Hywan
Extracted from #1018.
This PR simplifies the code (understand, remove code duplication) of `WasmExternType` by using a macro.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
Co-authored-by: Ivan Enderlin <ivan.enderlin@wanadoo.fr>
1224: fix(runtime-core) Remove warnings r=Hywan a=Hywan
Because we can use the `impl_traits!` macro with only one identifier,
a warning is emitted saying the parenthesis are useless for this
specific usecase. They are required for all the other usecases
though. We can safely ignore this warning.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
Co-authored-by: Ivan Enderlin <ivan.enderlin@wanadoo.fr>
1221: doc(interface-types) Add a `README.md` file r=MarkMcCaskey a=Hywan
Just a small `README.md`, so that users aren't totally loss.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
Those are not necessary for the user. It's only internal
implementation, that must be public because it ends up in public
types, but the compiler infers everything automatically.
This patch adds a new field in `Func`: `signature`. It contains the
signature of the host function.
For non-polymorphic host functions, the signature is computed from the
`Args` and `Rets` implementation parameters at compile-time.
For polymorphic host functions though, to be fully dynamic, the
signature given to `new_polymorphic` is used in `Func` as the correct
signature.
Because we can use the `impl_traits!` macro with only one identifier,
a warning is emitted saying the parenthesis are useless for this
specific usecase. They are required for all the other usecases
though. We can safely ignore this warning.
1218: Enable clif verifier in debug mode, fix issue with verifier r=MarkMcCaskey a=MarkMcCaskey
Ensures we're using I32s to index into things that are indexed by I32s
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1209: Maybe improve safety of MemoryView Deref r=MarkMcCaskey a=MarkMcCaskey
Possibly slightly better... (effectively does exactly the same thing the same way):
Notably this code still violates the safety rules of its unsafe functions:
It violates rule 2 from https://doc.rust-lang.org/std/slice/fn.from_raw_parts_mut.html :
> The memory referenced by the returned slice must not be accessed through any other pointer (not derived from the return value) for the duration of lifetime ’a. Both read and write accesses are forbidden.
Some comments in the stdlib indicate that casting between `Cell<T>` and `T` isn't something that's safe to do outside of the stdlib 🤷♂ .
Fundamentally, `MemoryView` is unsound. Our docs say that it does not have undefined behavior, but we don't properly justify that. I believe it relies very heavily on undefined behavior.
Looking for feedback here about what we can do. It seems like we'll have to break the public API to make a sound API... if we can decide on a sufficiently good one, we can deprecate the old one and roll out the new one to prevent user breakage.
We may need to use something like https://docs.rs/crossbeam/0.7.3/crossbeam/atomic/struct.AtomicCell.html or implement something like it.
Where I'm at in regards to memory access from the host is that it's not possible to make any kind of efficient API that is not entirely `unsafe`. Even given that, we need to figure out the bounds with which the `unsafe` functions can be used relatively safely. I think even if we marked our existing functions as `unsafe`, it's too complex to figure out whether or not you're using it correctly...
Bonus points if your solution works across multiple threads properly...
# Review
- [ ] 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 <5770194+MarkMcCaskey@users.noreply.github.com>
1214: test(interface-types) Add `wasmer-interface-types` to `make check` r=MarkMcCaskey a=Hywan
Sequel of #787. Forgot to update the changelog, and to add `wasmer-interface-types` to `make check`.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
Co-authored-by: Mark McCaskey <5770194+MarkMcCaskey@users.noreply.github.com>
1213: Fixed WASI isatty r=syrusakbary a=syrusakbary
<!--
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests
-->
# Description
Current WASI implementation returns a wrong response when libc `isatty` is used for `stdin`, `stdout` or `stderr`.
This PR fixes it.
<!--
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Syrus <me@syrusakbary.com>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
787: feat(interface-types) Implement Interface Types (WIT) r=Hywan a=Hywan
So far, this PR implements a new crate named `wasmer-interface-types`. The goal is to implement the WebAssembly Interface Types (WIT) proposal, https://github.com/WebAssembly/interface-types. Keep in mind the proposal is highly unstable and experimental.
The `wasmer-interface-types` is designed to be _runtime agnostic_, which means that there is no connection between this crate and `wasmer-runtime-core` or `wasmer-runtime` (or any backend crates). The hope is that other runtimes could use `wasmer-interface-types` according to their needs.
The `wasmer-interface-types` is composed of 4 parts:
* AST: [The WIT language, represented as an AST](https://github.com/Hywan/wasmer/blob/feat-interface-types/lib/interface-types/src/ast.rs) (it's not really abstract though),
* Decoders: So far, it contains only [one parser that reads the WIT binary language](https://github.com/Hywan/wasmer/blob/feat-interface-types/lib/interface-types/src/decoders/binary.rs) and produces an AST,
* Encoders: So far, it contains only [one compiler that transforms the AST into "WIT.wat”](https://github.com/Hywan/wasmer/blob/feat-interface-types/lib/interface-types/src/encoders/wat.rs), i.e. the textual representation of an Interface Types AST
* Instructions: WIT defines a new concept called Adapters. An adapter contains a set of instructions. Those instructions are executed when data are bound. So, in more details, this module contains:
* [`interpreter.rs`](https://github.com/Hywan/wasmer/blob/feat-interface-types/lib/interface-types/src/interpreter/mod.rs), a stack-based interpreter, defined by:
* A compiler that transforms a set of instructions into a set of _executable_ instructions,
* A stack,
* A runtime that holds the “invocation inputs” (arguments of the interpreter), the stack, and the Wasm instance (which holds the exports, the imports, the memories, the tables etc.),
* [`stack.rs`](https://github.com/Hywan/wasmer/blob/feat-interface-types/lib/interface-types/src/interpreter/stack.rs), a very light and generic stack implementation, exposing only the API required by the interpreter,
* [`wasm/*.rs`](https://github.com/Hywan/wasmer/blob/feat-interface-types/lib/interface-types/src/interpreter/wasm/structures.rs), a set of enums, types, and traits to represent a Wasm runtime —basically this is the part a runtime should take a look to support the `wasmer-interface-types` crate—.
Progression:
* [x] WIT binary parser,
* [x] WIT.wat compiler,
* [ ] Interpreter:
* [ ] Wasm runtime traits to represent:
* [x] Instance,
* [x] Export,
* [x] Memory,
* [x] Import,
* [ ] Table,
* [x] Generic stack implementation,
* [ ] Implemented instructions:
* [x] `arg.get`,
* [x] `call`,
* [x] `call-export`,
* [x] `read-utf8`,
* [x] `write-utf8`,
* [ ] `as-wasm`,
* [ ] `as-interface`
* [ ] `table-ref-add`
* [ ] `table-ref-get`
* [ ] `call-method`
* [ ] `make-record`
* [ ] `get-field`
* [ ] `const`
* [ ] `fold-seq`
* [ ] `add`
* [ ] `mem-to-seq`
* [ ] `load`
* [ ] `seq.new`
* [ ] `list.push`
* [ ] `repeat-until`
* [ ] `seq-to-mem`
* [ ] `store`
* [ ] Plug `wasmer-interface-types` into `wasmer-runtime-core`
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
The LEB parser is renamed `uleb`. It now checks for overflow, and
badly-formed bits, resp. `TooLarge` or `Eof`. More test cases are
added, whose from the DWARF 4 standard.
As @MarkMcCaskey noted, `Type` can be corrupted because `field_names`
and `field_types` must have the same length. This patch removes the
public visibility, and adds methods like `new`, `add_field`,
`field_names` and `field_types` to encapsulate `Type` internal data.
1208: Fix trap handling bug on Windows and add test r=MarkMcCaskey a=MarkMcCaskey
Resolves#1204
# Review
- [ ] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1191: Fix singlepass miscompilation on `Operator::CallIndirect`. r=losfair a=losfair
This fixes the 3 failing tests mentioned in https://00f.net/2019/10/22/updated-webassembly-benchmark/ .
(TODO: Add test cases?)
Co-authored-by: losfair <zhy20000919@hotmail.com>
1207: Update Rust version used to build docs to be consistent r=syrusakbary a=MarkMcCaskey
In response to #1196
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1192: Use `ExceptionCode` for error representation. r=losfair a=losfair
Extends https://github.com/wasmerio/wasmer/pull/1129 to all backends.
Co-authored-by: losfair <zhy20000919@hotmail.com>
1202: doc(runtime-c-api) Improve documentation of the `memory` module r=syrusakbary a=Hywan
Address https://github.com/wasmerio/wasmer/issues/1203.
As part of the daily doc routine, this patch improves the documentation of `memory` module.
This patch also handles more null pointers.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
It allows the instance to create or update locals/imports when the
`local_or_import` function is called. It's not ideal, but fine enough
for a first step.
1183: Make full preemption an optional feature. r=syrusakbary a=losfair
Full preemption requires two additional memory loads on loop backedges and function calls. This PR allows disabling full preemption at code generation time, and disables it by default.
Co-authored-by: losfair <zhy20000919@hotmail.com>
Co-authored-by: Heyang Zhou <zhy20000919@hotmail.com>
1186: Improve some docs and misc code segments r=MarkMcCaskey a=MarkMcCaskey
A bit of a follow up to #1184 plus some clippy fixes and doc improvements
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1185: Bump supported Rust version to 1.40.0 r=MarkMcCaskey a=MarkMcCaskey
Rust 1.41.0 released yesterday
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1120: Port to FreeBSD r=MarkMcCaskey a=syrusakbary
<!--
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests
-->
# Description
I disovered this great patch today: https://github.com/MikaelUrankar/webasm/blob/master/www/wasmer/files/patch-freebsd
And then realized that @MikaelUrankar forked wasmer to add support for FreeBSD.
I'm creating this PR to follow up on that fork and merge the changes upstream.
@MikaelUrankar let us know if everything is good to go with this PR!
<!--
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->
# Review
- [ ] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: MikaelUrankar <mikael.urankar@gmail.com>
1174: Clean up misc. bits of runtime-core r=MarkMcCaskey a=MarkMcCaskey
Also includes the lock file which has been showing up in my diffs for a while, so I guess I should commit it
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1172: Share some more code in runtime-core::sys r=MarkMcCaskey a=MarkMcCaskey
This code was partially duplicated
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1170: Add new features to WasiState builder API r=MarkMcCaskey a=MarkMcCaskey
Allows for ergonomic swapping out of stdin, stdout, stderr as well as
a new PreopenDir sub-builder which enables for user control over the
permissions that the directory is preopened with.
This PR includes breaking changes to the pubilc API.
TODO:
- [x] Add doc examples of using the new sub-builder
- [x] Discuss and maybe readd removed broken API with `deprecated` attributes on them
# 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 <5770194+MarkMcCaskey@users.noreply.github.com>
Allows for ergonomic swapping out of stdin, stdout, stderr as well as
a new PreopenDir sub-builder which enables for user control over the
permissions that the directory is preopened with.
This PR includes breaking changes to the pubilc API.
1161: Require that imported functions must be `Send` r=MarkMcCaskey a=MarkMcCaskey
resolves#1074
# 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 <5770194+MarkMcCaskey@users.noreply.github.com>
1140: Use blake3 instead of blake2_simd r=syrusakbary a=syrusakbary
<!--
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests
-->
# Description
Blake3 has a much faster hashing rate than Blake2/Blake2b_simd. This PR updates wasmer to use it as the default hashing algorithm.
More info here: https://www.infoq.com/news/2020/01/blake3-fast-crypto-hash/
<!--
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Syrus <me@syrusakbary.com>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
1168: doc(runtime-c-api) Improve documentation of the `instance`, `error` and `export` modules r=syrusakbary a=Hywan
Daily doc', that turned to be an obsession. The entire `instance`, `error` modules are fully documented. The `exports` module's documentation have been improved too.
This PR also contains some “bug fixes” when `instance` pointers are null for instance (in this case, we do nothing or we return `void`).
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
1163: Add clippy error checking in lint step r=MarkMcCaskey a=MarkMcCaskey
# Review
- [ ] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1160: Docs/misc runtime core and cleanup r=MarkMcCaskey a=MarkMcCaskey
Adds some docs and deletes `mono_vec` (it's not publicly exposed, or used at all and I asked about it on Slack about it > 6 months ago and no one was attached to it)
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1156: Added release badge to wasmex in the README r=Hywan a=tessi
# Description
Added the release badge for wasmex to our README.
This time attempting not to break the layout ;)
<img width="917" alt="Screenshot 2020-01-16 at 13 13 42" src="https://user-images.githubusercontent.com/206108/72524372-0d575880-3862-11ea-986d-b0aeeb6a82d4.png">
# Review
- [ ] Add a short description of the the change to the CHANGELOG.md file
I guess this does not need a CHANGELOG entry 🤔
Co-authored-by: Philipp Tessenow <philipp@tessenow.org>
1153: Added Wasmex, an Elixir language integration r=MarkMcCaskey a=tessi
# Description
Thanks for creating wasmer. I missed a language integration and, thus, implemented it. This PR adds [Wasmex](https://github.com/tessi/wasmex), an integration into the Elixir language, to the list of supported languages in the README.
The implementation "borrows" some ideas (esp on the Rust side and documentation) of your language integrations. I hope this is OK with you. If not, tell me :)
# Review
- [ ] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Philipp Tessenow <philipp@tessenow.org>
1152: Update clif-backend to use new published crates r=MarkMcCaskey a=MarkMcCaskey
With help from @nlewycky, this updates clif-backend to use the published forks
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1151: Prepare for 0.13.0 release r=MarkMcCaskey a=MarkMcCaskey
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1143: Set backend_id to static str r=MarkMcCaskey a=syrusakbary
<!--
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests
-->
# Description
As per feedback in #1099, set backend_id to static str.
<!--
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->
# Review
- [ ] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Syrus <me@syrusakbary.com>
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1149: fix(bin) Remove a warning for unreachable code. r=MarkMcCaskey a=Hywan
The `panic!` statement is indeed unreachable for regular usages, but
not for wrong feature configurations. Allowing `unreachable_code` to
avoid a warning.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
The `panic!` statement is indeed unreachable for regular usages, but
not for wrong feature configurations. Allowing `unreachable_code` to
avoid a warning.
760: Add Publish_Docs stage, make it push to a fake gh-pages branch for testing whenever master is updated. r=syrusakbary a=nlewycky
bors r-
Co-authored-by: Nick Lewycky <nick@wasmer.io>
Co-authored-by: Syrus <me@syrusakbary.com>
Co-authored-by: Azure Pipelines <azuredevops@microsoft.com>
1133: feat(runtime-c-api) Implement `wasmer_trap` r=Hywan a=Hywan
Idea is to provide an API to get fallible host function by calling `wasmer_trap` to run the Wasmer trapping API.
This is probably the easiest solution to not break the existing API, and not add a lot of complexity in the code.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
1147: Update logging to use `log`, add command line flag to toggle it r=MarkMcCaskey a=MarkMcCaskey
This PR:
- ports our logging to the [`log`](https://crates.io/crates/log) crate which is the de-facto standard way to do logging in Rust (it defines a trait which logging backends can implement (we can also implement our own at a later date using these traits)). Another benefit of using the standard logging utilities is that we can now allow users of our libraries to filter and display log messages from Wasmer in a more natural way.
- adds a command line flag to enable/disable logging
- updates the `debug` and `trace` features to pass the correct static toggles to the `log` crate; judging by the `log` documentation these features need to only be set once
- copies and slightly modifies our `fern` configuration from wapm
- updates the makefile so that `make release` compiles out all log statements
- TODO: update CI to not print with color (may not be necessary actually)
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Here's some example output:
```
[1579035881.809 DEBUG wasmer_wasi::state] wasi::fs::inodes
[1579035881.809 DEBUG wasmer_wasi::state] wasi::fs::preopen_dirs
[1579035881.809 DEBUG wasmer_wasi::state] wasi::fs::mapped_dirs
[1579035881.809 DEBUG wasmer_wasi::state] wasi::fs::end
[1579035881.810 DEBUG wasmer_wasi::syscalls] wasi::fd_prestat_get: fd=3
[1579035881.810 DEBUG wasmer_wasi::state] in prestat_fd Fd { rights: 536870911, rights_inheriting: 536870911, flags: 0, offset: 0, open_flags: 1, inode: Index { index: 3, generation: 0 } }
[1579035881.810 DEBUG wasmer_wasi::syscalls] wasi::fd_prestat_dir_name: fd=3, path_len=2
[1579035881.810 DEBUG wasmer_wasi::syscalls] => result: "/"
[1579035881.810 DEBUG wasmer_wasi::syscalls] wasi::fd_fdstat_get: fd=3, buf_ptr=1048536
[1579035881.810 DEBUG wasmer_wasi::state] fdstat: Fd { rights: 536870911, rights_inheriting: 536870911, flags: 0, offset: 0, open_flags: 1, inode: Index { index: 3, generation: 0 } }
[1579035881.810 DEBUG wasmer_wasi::syscalls] wasi::fd_prestat_get: fd=4
[1579035881.810 DEBUG wasmer_wasi::syscalls] wasi::environ_sizes_get
[1579035881.810 DEBUG wasmer_wasi::syscalls] env_var_count: 0, env_buf_size: 0
[1579035881.810 DEBUG wasmer_wasi::syscalls] wasi::args_sizes_get
[1579035881.810 DEBUG wasmer_wasi::syscalls] => argc=3, argv_buf_size=92
[1579035881.810 DEBUG wasmer_wasi::syscalls] wasi::args_get
[1579035881.810 DEBUG wasmer_wasi::syscalls] => args:
0: /Users/mark/.wasmer/globals/wapm_packages/mark/rust-example@0.1.11/wasi-example.wasm
1: -e
2: HQ+
[1579035881.810 DEBUG wasmer_wasi::syscalls] wasi::args_sizes_get
[1579035881.811 DEBUG wasmer_wasi::syscalls] => argc=3, argv_buf_size=92
[1579035881.811 DEBUG wasmer_wasi::syscalls] wasi::args_get
[1579035881.811 DEBUG wasmer_wasi::syscalls] => args:
0: /Users/mark/.wasmer/globals/wapm_packages/mark/rust-example@0.1.11/wasi-example.wasm
1: -e
2: HQ+
[1579035881.811 DEBUG wasmer_wasi::syscalls] wasi::random_get buf_len: 16
[1579035881.811 DEBUG wasmer_wasi::syscalls] wasi::fd_write: fd=1
Hello, world!
[1579035881.811 DEBUG wasmer_wasi::syscalls] wasi::fd_write: fd=1
HQ+
```
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1099: Remove backend::Backend from runtime-core r=syrusakbary a=syrusakbary
<!--
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests
-->
# Description
This PR removes the dependency of a Backend in runtime-core. So it's agnostic and more backends can be plugged in easily.
Why this is important?
* By removing backends from wasmer-runtime-core we can make the runtime agnostic, so anyone can plug their own backend into Wasmer without needing to touch the main source code (V8, JavascriptCore, wasm3, ...).
* It simplifies the codebase and avoids code leaks from the backend to the runtime API.
<!--
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Syrus <me@syrusakbary.com>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
Co-authored-by: Mark McCaskey <mark@wasmer.io>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
1121: Add test for ImportObject's `allow_missing_functions` r=Hywan a=MarkMcCaskey
work in progress, testing to see if this test fails CI
resolves#1118
# Review
- [ ] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
Co-authored-by: Ivan Enderlin <ivan.enderlin@wanadoo.fr>
1128: fix(runtime-core) Avoid crashing when missing host functions are allowed r=Hywan a=Hywan
Fix#1118. #1121 can be merged after
This PR fixes 2 things:
* When droping the import backing, check that `vm::FuncCtx` isn't null before dropping it,
* Use an `always_trap` as a placeholder host function when a host function is missing.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
1130: Add WindowClosed event to experimental fb r=MarkMcCaskey a=MarkMcCaskey
Allows things to behave properly and know when the window closes
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1123: feat(runtime-c-api) Define the `DEPRECATED` C macro. r=Hywan a=Hywan
This PR defines a cross-compiler `DEPRECATED(message)` macro. It must
be used as follows in Rust:
```rust
/// This is a documentation.
/// cbindgen:prefix=DEPRECATED("This is a deprecation message.")
pub extern "C" fn wasmer_foo() -> c_uint {
42
}
```
It will generate the following C header:
```c
/**
* This is a documentation.
*/
DEPRECATED("This is a deprecation message.")
unsigned int wasmer_foo();
```
And once this code is used by a C compiler, it will print something
like this (example from Clang):
```
…/test.c:…:…: error: 'wasmer_foo' is deprecated: This is a deprecation message. [-Werror,-Wdeprecated-declarations]
unsigned int x = wasmer_foo();
^
…/wasmer.h:…:…: note: 'wasmer_foo' has been explicitly marked deprecated here
DEPRECATED("This is a deprecation message.")
^
…/wasmer.h:…:…: note: expanded from macro 'DEPRECATED'
```
This is required for further deprecations.
(cf https://github.com/eqrion/cbindgen/issues/408)
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
Co-authored-by: Ivan Enderlin <ivan.enderlin@wanadoo.fr>
Clang can emulate GNUC or MSVC behaviors. So instead of detecting
whether Clang is used to compile the code, it's better to detect the
targeted features are available.
Code proposed by @nlewycky, thanks!
1124: Update wapm submodule to 0.4.2 r=MarkMcCaskey a=MarkMcCaskey
Uses the updated wapm from the new release https://github.com/wasmerio/wapm-cli/releases/tag/0.4.2 which fixes a bug
Co-authored-by: Mark McCaskey <mark@wasmer.io>
This PR defines a cross-compiler `DEPRECATED(message)` macro. It must
be used as follows in Rust:
```rust
/// This is a documentation.
/// cbindgen:prefix=DEPRECATED(This is a deprecation message.")
pub extern "C" fn wasmer_foo() -> c_uint {
42
}
```
It will generate the following C header:
```c
/**
* This is a documentation.
*/
DEPRECATED("This is a deprecation message.")
unsigned int wasmer_foo();
```
And once this code is used by a C compiler, it will print something
like this (example from Clang):
```
…/test.c:…:…: error: 'wasmer_foo' is deprecated: This is a deprecation message. [-Werror,-Wdeprecated-declarations]
unsigned int x = wasmer_foo();
^
…/wasmer.h:…:…: note: 'wasmer_foo' has been explicitly marked deprecated here
DEPRECATED("This is a deprecation message.")
^
…/wasmer.h:…:…: note: expanded from macro 'DEPRECATED'
```
This is required for further deprecations.
1117: Improve formatting of error messages we display from wabt r=MarkMcCaskey a=MarkMcCaskey
Resolves#1107
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1101: Add MIT license to crates that were missing it r=syrusakbary a=repi
Ran into a few crates in this repo with our license scanner that didn't have any license attached to them.
Added MIT to be consistent with the other crates. Please adjust if not correct.
Co-authored-by: Johan Andersson <repi@repi.se>
Ran into a few crates in this repo with our license scanner that didn't have any license attached to them.
Added MIT to be consistent with the other crates. Please adjust if not correct.
1097: Move inline breakpoint outside of runtime backend r=syrusakbary a=syrusakbary
<!--
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests
-->
# Description
There was some code smell leaking inline breakpoint implementation into the runtime core backend instead of the compiler itself. This PR fixes it.
<!--
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Syrus <me@syrusakbary.com>
1095: Update to cranelift 0.52 r=nlewycky a=nlewycky
# Description
Update to cranelift 0.52.
To use our wasmer branch of cranelift, we point to its path on git. Per @syrusakbary , we don't want to push updated wasmer-clif crates until we're ready to release the matching wasmer that will use them.
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Nick Lewycky <nick@wasmer.io>
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1071: Add support for non-trapping float-to-int conversions. r=nlewycky a=nlewycky
# Description
Rewrites LLVM implementation of non-trapping float-to-int conversions. LLVM's conversion operations produce unspecified output when the input floats are out of range for the conversion.
Add implementation to singlepass for both x86-64 and AArch64.
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Nick Lewycky <nick@wasmer.io>
1092: Add function to get nul-terminated strings from memory r=MarkMcCaskey a=srenatus
## Description
This is meant to fix#1086.
❓ I'm a bit new to this -- is this how you'd do it? Happy to take directions! 😃
I've added a note regarding the special case in the comment.
Are there existing tests to expand?
## Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Stephan Renatus <srenatus@chef.io>
1089: Add misc doc link fixes and update old comment r=MarkMcCaskey a=MarkMcCaskey
I spent way too long trying to make things work, `#[doc(no_inline)]`, adding doc comments on top of things with doc comments, and linking in the context of inlining are way harder than they seem like they should be 🙀
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1087: Update stable Rust to 1.39.0; pin nightly to 2019-12-19 r=MarkMcCaskey a=MarkMcCaskey
Both of these should speed up compile times:
The new stable has better parallelization and the new nightly has [new parallelization features](https://internals.rust-lang.org/t/help-test-parallel-rustc/11503)
# Review
- [ ] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1084: Prepare for 0.12.0 release r=MarkMcCaskey a=MarkMcCaskey
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1083: Add experimental IO devices r=MarkMcCaskey a=MarkMcCaskey
Adds some private stuff for us to experiment with
Co-authored-by: Mark McCaskey <mark@wasmer.io>
Co-authored-by: Aaron Turner <aaron@aaronthedev.com>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
1078: Add more parameters to Func r=Hywan a=Jasper-Bekkers
<!--
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests
-->
# Description
We ran into the issue that we needed to pass more then the available number of parameters to wasm, so I've extended the parameter count for `Func` to have max 26 parameters now.
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Jasper-Bekkers <bekkers@gmail.com>
1075: Add include guards for WASI APIs in runtime-c-api r=syrusakbary a=MarkMcCaskey
Improves correctness, but the readability does suffer.
In the future we should probably have separate header files or find a way to merge the conditional includes
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1076: Use function defined in wasmer-runtime-core instead of llvm-backend's own copy of it. r=nlewycky a=nlewycky
Co-authored-by: Nick Lewycky <nick@wasmer.io>
1062: Add emscripten functions and types to the C API r=MarkMcCaskey a=MarkMcCaskey
resolves#574
Left to do:
- [x] Add tests
- [x] Add memory set up, etc (need to break up monolithic ("run" function in wasmer_emscripten into pieces)
- [x] Add passing args, etc
# 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 <5770194+markmccaskey@users.noreply.github.com>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
1068: Various cleanups for the singlepass backend on AArch64. r=losfair a=losfair
ref: https://github.com/wasmerio/wasmer/pull/713
Co-authored-by: losfair <zhy20000919@hotmail.com>
1069: Add fn for splitting borrow of memory & data in Ctx, use in WASI r=MarkMcCaskey a=MarkMcCaskey
Fixes a soundness issue / some undefined behavior
# Review
- [ ] 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 <5770194+markmccaskey@users.noreply.github.com>
1072: Add minor changes to runtime/vm doc comments + make fns const fns r=syrusakbary a=MarkMcCaskey
Slightly improves readability of docs and makes more functions `const fn`
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1070: Update Inkwell r=MarkMcCaskey a=MarkMcCaskey
Updates inkwell which removes the networking dep from building Inkwell -- this should speed up our CI
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1032: Fix abort signature in emscripten ABI r=MarkMcCaskey a=MarkMcCaskey
Needs tests; this is preventing python on wapm from working
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1044: Initial commit for support of AArch64 in the llvm backend. r=syrusakbary a=nlewycky
# Description
Enables AArch64 in the llvm backend, and inkwell when the target_arch is aarch64. Adds relevant failing spectests to the excludes.txt.
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Nick Lewycky <nick@wasmer.io>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
1060: Test the capi with multiple backends r=syrusakbary a=syrusakbary
<!--
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests
-->
# Description
This PR updates the codebase to test the capi with multiple backends.
<!--
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Syrus <me@syrusakbary.com>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
1059: Add doc comments for WASI FD associated constants r=MarkMcCaskey a=MarkMcCaskey
I want to try out something I'm going to call "daily docs" where I write documentation for one thing every day
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1058: Fix issue 1057 + improve llvm/state.rs code r=syrusakbary a=pventuzelo
# Description
This pull request is doing:
- Fix issue https://github.com/wasmerio/wasmer/issues/1057 (subtraction overflow panic in State::peek1_extra) by using `checked_sub`
- replace other part of `state.rs` subject to potential substration overflow with `checked_sub`
- add more detail on the Errors messages in `state.rs`
- rename some variable for better understanding of the code.
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Patrick Ventuzelo <ventuzelo.patrick@gmail.com>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
858: [fix 857] panic when target module don't have exported _start function r=syrusakbary a=pventuzelo
# Description
Fix#857
* replace `expect` by `map_err` for `loader`
* replace `expect` by `map_err` in other part of `wasmer.rs`
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Patrick Ventuzelo <ventuzelo.patrick@gmail.com>
Co-authored-by: Patrick Ventuzelo <9038181+pventuzelo@users.noreply.github.com>
1056: Integrate Ivan's arg parsing code into --invoke r=syrusakbary a=MarkMcCaskey
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
Because #281 is on a branch on a fork, I made a new branch.
Does arg parsing when using `--invoke`
Co-authored-by: Mark McCaskey <mark@wasmer.io>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
1027: Bump libc from 0.2.65 to 0.2.66 r=nlewycky a=dependabot-preview[bot]
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.65 to 0.2.66.
<details>
<summary>Commits</summary>
- [`4f11029`](4f11029a68) Bump patch version to 0.2.66
- [`bba019b`](bba019bff5) Auto merge of [#1610](https://github-redirect.dependabot.com/rust-lang/libc/issues/1610) - GrayJack:utmp_netbsd, r=gnzlbg
- [`ea0a54a`](ea0a54a661) Auto merge of [#1608](https://github-redirect.dependabot.com/rust-lang/libc/issues/1608) - lzutao:netbsd-mut-pthread_setname_np, r=gnzlbg
- [`42289eb`](42289eb64f) Implement utmp for NetBSD
- [`cfd561c`](cfd561c289) Auto merge of [#1605](https://github-redirect.dependabot.com/rust-lang/libc/issues/1605) - zvirja:fix-mipsel-unknown-linux-uclibc, r=gnzlbg
- [`51ae96a`](51ae96a5b0) Auto merge of [#1576](https://github-redirect.dependabot.com/rust-lang/libc/issues/1576) - GrayJack:utmpx_netbsd, r=gnzlbg
- [`096d868`](096d868a2f) Auto merge of [#1584](https://github-redirect.dependabot.com/rust-lang/libc/issues/1584) - psumbera:master, r=gnzlbg
- [`88f6587`](88f6587631) Auto merge of [#1607](https://github-redirect.dependabot.com/rust-lang/libc/issues/1607) - jclulow:futimens, r=gnzlbg
- [`5130285`](5130285ccd) Auto merge of [#1606](https://github-redirect.dependabot.com/rust-lang/libc/issues/1606) - msizanoen1:riscv, r=gnzlbg
- [`a06978b`](a06978b7c0) Fix breakage due to [rust-lang/cargo#7560](https://github-redirect.dependabot.com/rust-lang/cargo/pull/7560) and rust-lan...
- Additional commits viewable in [compare view](https://github.com/rust-lang/libc/compare/0.2.65...0.2.66)
</details>
<br />
[](https://dependabot.com/compatibility-score.html?dependency-name=libc&package-manager=cargo&previous-version=0.2.65&new-version=0.2.66)
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)
- Pull request limits (per update run and/or open at any time)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)
</details>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
1054: Improve wasmer invoke function r=syrusakbary a=syrusakbary
<!--
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests
-->
# Description
Prior to this PR, when executing wasmer, we will have this in the stdout:
```bash
➜ wasmer fib32.wasm --invoke fib 30
main() returned: [I32(832040)]
```
Note that it says `main()` returned even if the function called is `fib`.
This PR fixes this and improves the messaging also for WASI invoked functions
<!--
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
1053: For RuntimeError and breakpoints, use Box<Any + Send> instead of Box<Any>. r=syrusakbary a=nlewycky
# Description
For RuntimeError and breakpoints, use Box<Any + Send> instead of Box\<Any\>.
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Fixes#1049
Co-authored-by: Nick Lewycky <nick@wasmer.io>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
1052: Fix issue #1051 + replace assert, unreachable in singlepass codegen code r=syrusakbary a=pventuzelo
# Description
This pull request:
- fix the issue #1051
- replace `asserts` by Errors
- replace `unreachable!` by Errors
- Improve Error handling in singlepass codegen code
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Patrick Ventuzelo <ventuzelo.patrick@gmail.com>
Co-authored-by: Patrick Ventuzelo <9038181+pventuzelo@users.noreply.github.com>
1050: feat(github) Attach C & C++ headers to releases r=syrusakbary a=Hywan
This patch copies the generated C and C++ headers of `wasmer-runtime-c-api` in the `artifacts` directory, so that they are attached to releases as assets.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
1042: Make regression test work in release builds too. r=nlewycky a=nlewycky
Fix this regression test to detect the bug it was looking for in release builds too.
This bug triggered an assertion failure in debug, and by examining the pre-opt IR, we can check for the bug in release mode too.
Co-authored-by: Nick Lewycky <nick@wasmer.io>
709: new feature flag: `deterministic` r=MarkMcCaskey a=YaronWittenstein
The motivation for the PR is for introducing a new feature flag called `deterministic`.
When `deterministic` will be enabled (turned-off by default) it'll guarantee deterministic
execution of wasm programs across different hardware/circumstances.
This is critical for Blockchain projects that require execution to be deterministic
in order to reach a consensus of the state transition of each smart-contract transaction.
Co-authored-by: Yaron Wittenstein <yaron.wittenstein@gmail.com>
Co-authored-by: Yaron Wittenstein <yaronwittenstein@users.noreply.github.com>
Co-authored-by: Mark McCaskey <5770194+markmccaskey@users.noreply.github.com>
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1033: Improve default compiler story for wasmer cli r=MarkMcCaskey a=MarkMcCaskey
This PR needs the following to be ready to ship:
- [x] Verified make commands are still fine
- [x] Verified this doesn't do anything bad in CI
This PR adds:
- compile_error if no backend is specified in wasmer.rs
- readds clif as the default
- improves the error message saying "specified backend not found" to include the name of the backend that it couldn't find
Co-authored-by: Mark McCaskey <mark@wasmer.io>
Co-authored-by: Mark McCaskey <5770194+markmccaskey@users.noreply.github.com>
1036: Add experimental invoke support to WASI in wasmer cli r=MarkMcCaskey a=MarkMcCaskey
Resolves#1024
This PR also does a bit of code clean up
# Review
- [ ] 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 <5770194+markmccaskey@users.noreply.github.com>
1030: feat(runtime-c-api) Ability to generate `ImportObject` for a specific WASI version r=Hywan a=Hywan
❗️⚠️ Contains #1028, must be merged before this one.
This patch introduces 2 new functions:
* `wasmer_wasi_generate_import_object_for_version` and
* `wasmer_wasi_get_version`.
It mimics the current API provided by `wasmer_wasi`, nothing fancy
here. It's just a regular port to C/C++.
Because `wasmer_wasi::get_wasi_version` returns an option, and in
order to simplify the C/C++ API, `wasmer_wasi_get_version` can return
`Version::Unknown` in case of an error. It's up to the user to check
the version is valid (i.e. not unknown).
To see only the changes provided by this PR (excluding #1028), check https://github.com/Hywan/wasmer/compare/fix-wasi-get-version...feat-runtime-c-api-wasi-version.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
1028: feat(wasi) Introduce strict/non-strict modes for `get_wasi_version` r=Hywan a=Hywan
Sequel of https://github.com/wasmerio/wasmer/pull/957.
If a module has multiple import namespaces, `get_wasi_version` is
broken because it assumes a module must only have a single namespace.
This patch updates `get_wasi_version` to introduce a `strict` flag:
* In strict mode, the previous behavior applies; only one namespace is expected to be found, and this namespace must be a WASI namespace to detect the version,
* In non-strict mode, at least one WASI namespace must be declared, and the first one is used to detect the version if any.
The non-strict mode is slower because it compares namespace strings.
2 new private constants have been declared: `SNAPSHOT0_NAMESPACE` and `SNAPSHOT1_NAMESPACE` to avoid repetition and bugs.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
1040: Add the ability to pass backend specific options through CompilerConfig. r=nlewycky a=nlewycky
# Description
Add the ability to pass backend specific options through CompilerConfig.
Use this to replace wasmer_llvm_backend::GLOBAL_OPTIONS.
This adds a new item to CompilerConfig which can be any struct defined by a backend for backend specific configuration options. So far, we only implement the options that were previously in GLOBAL_OPTIONS, these move to wasmer.rs. The plan is to use these same callbacks for testing in llvm-backend-tests.
# Review
- [ ] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Nick Lewycky <nick@wasmer.io>
When the version has type `Version`, we expect the user to give a
valid `Version` variant. Since the `Version` is basically a `uint8_t`,
the user is able to pass everything she wants, which can create an
undefined behavior on the Rust side.
To avoid such situation, the version has now type `c_uchar` (`unsigned
char` or `uint8_t` on C side —on most platforms). Then the `From`
trait is implemented on `Version`. In case the value is unbound,
`Version::Unknown` is returned.
This patch updates `test-wasi-import-object` to test the new
`wasmer_wasi_get_version` &
`wasmer_wasi_generate_import_object_for_version` functions, and the
new `Version` type.
This patch introduces 2 new functions:
* `wasmer_wasi_generate_import_object_for_version` and
* `wasmer_wasi_get_version`.
It mimics the current API provided by `wasmer_wasi`, nothing fancy
here. It's just a regular port to C/C++.
Because `wasmer_wasi::get_wasi_version` returns an option, and in
order to simplify the C/C++ API, `wasmer_wasi_get_version` can return
`Version::Unknown` in case of an error. It's up to the user to check
the version is valid (i.e. not unknown).
1029: feat(wasi) Add the “floating” `WasiVersion::Latest` version. r=Hywan a=Hywan
In addition to `Snapshot0` and `Snapshot1`, I believe it is an
interesting API to provide the `Latest` version, so that the user can
write:
```rust
generate_import_object_for_version(WasiVersion::Latest, …);
```
This is a way to ensure that modules will run only if they come with
the latest WASI version (in case of security issues for instance), by
just updating the runtime.
Note that it can be dangerous if not used carefully, but we assume the
user knows what it does by sticking on a specific “floating” version.
Also note that the `Latest` version is never returned by any API. It
is provided only by the user.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
In strict mode, `get_wasi_version` uses the previous behavior, i.e. it
checks that there is only one namespace for all imports, and that this
namespace is a WASI namespace (and uses it to find the WASI version).
In non-strict mode, `get_wasi_version` checks that at least one WASI
namespace exists (and uses it to find the WASI version).
By default, `is_wasi_module` uses the non-strict mode.
1035: Fix/quiet some rustc warnings. r=nlewycky a=nlewycky
No functionality change.
Remaining warnings are either dead code in examples/parallel-guest, or due to macros in typed_func.rs for which removing the "extra" parentheses breaks the build.
Co-authored-by: Nick Lewycky <nick@wasmer.io>
1034: When modifying the value, also update its ExtraInfo. r=nlewycky a=nlewycky
Fixes a debug_assert! on python3.7 and rustpython in wapm.
Co-authored-by: Nick Lewycky <nick@wasmer.io>
1031: Improve portability of code by using c_char r=MarkMcCaskey a=MarkMcCaskey
This PR makes emscripten compile on ARM with an up to date nightly compiler
Co-authored-by: Mark McCaskey <mark@wasmer.io>
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 <zhy20000919@hotmail.com>
Co-authored-by: Heyang Zhou <zhy20000919@hotmail.com>
In addition to `Snapshot0` and `Snapshot1`, I believe it is an
interesting API to provide the `Latest` version, so that the user can
write:
```rust
generate_import_object_for_version(WasiVersion::Latest, …);
```
This is a way to ensure that modules will run only if they come with
the latest WASI version (in case of security issues for instance), by
just updating the runtime.
Note that it can be dangerous if not used carefully, but we assume the
user knows what it does by sticking on a specific “floating” version.
Also note that the `Latest` version is never returned by any API. It
is provided only by the user.
If a module has multiple import namespaces, `get_wasi_version` is
broken because it assumes a module must only have a single namespace.
This patch fixes it by a slower `get_wasi_version` function, but a
correct one. As soon as the `wasi_unstable` or
`wasi_snapshot_preview1` namespace is met, `get_wasi_version` maps it
to the respective `WasiVersion` variant. It assumes however that a
module must hold a unique WASI version.
1004: Adapt backend usage depending on wasm file executed r=MarkMcCaskey a=d0iasm
Adapt backend usage depending on wasm file executed in issue #998.
Close#998
# Description
Add `auto` backend into a runtime-core and use it as a default backend.
The `auto` backend is equivalent to:
* singlepass if singlepass is enabled and the wasm file size is larger than 10MiB, or singlepass is enable and the target architecture is aarch64.
* cranelift otherwise.
Co-authored-by: Asami Doi <doiasami1219@gmail.com>
1019: Update llvm backend to work with latest inkwell. r=nlewycky a=nlewycky
cargo update to pick up latest inkwell branch commit.
Add lifetime annotations to Module which now takes a lifetime.
Add <'ctx> across CtxType and Intrinsics. Remove it from reference bindings.
Use ManuallyDrop to ensure that context's members are dropped before the Context.
Co-authored-by: Mark McCaskey <mark@wasmer.io>
Co-authored-by: Nick Lewycky <nick@wasmer.io>
cargo update to pick up latest inkwell branch commit.
Add lifetime annotations to Module which now takes a lifetime, and more lifetime annotations across intrinsics.rs.
Add <'ctx> to missing places in CtxType and Intrinsics. Remove it from reference bindings.
Use ManuallyDrop to ensure that context's members are dropped before the Context.
Co-authored-by: Mark McCaskey <mark@wasmer.io>
1020: Turn a few more assert!s that should never fire into debug_assert!s. r=nlewycky a=nlewycky
These are here to protect against errors when refactoring more than anything else.
Co-authored-by: Nick Lewycky <nick@wasmer.io>
1006: fix 1005 panic sub overflow r=MarkMcCaskey a=pventuzelo
# Description
Fix issue https://github.com/wasmerio/wasmer/issues/1005
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Patrick Ventuzelo <ventuzelo.patrick@gmail.com>
Co-authored-by: Patrick Ventuzelo <9038181+pventuzelo@users.noreply.github.com>
934: In LLVM backend, track which floats are guaranteed to be arithmetic, which makes the canonicalization a no-op. r=nlewycky a=nlewycky
# Description
This is a reimplementation of the patch in PR #651.
Extend state.rs ExtraInfo to track more information about floats. In addition to tracking whether the value has a pending canonicalization of NaNs, also track whether the value is known to be arithmetic (which includes infinities, regular values, and non-signalling NaNs (aka. "arithmetic NaNs" in the webassembly spec)). When the value is arithmetic, the correct sequence of operations to canonicalize the value is a no-op. Therefore, we create a lattice where pending+arithmetic=arithmetic.
Also, this extends the tracking to track all values, including non-SIMD integers. That's why there are more places where pending canonicalizations are applied.
Looking at c-wasm-simd128-example, this provides no performance change to the non-SIMD case (takes 58s on my noisy dev machine). The SIMD case drops from 46s to 29s.
# Review
- [ ] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Nick Lewycky <nick@wasmer.io>
Fix a bug in Operator::Select and add a comment to explain the intention.
Use derived default for ExtraInfo.
Make ExtraInfo associated functions const.
Turn two asserts into debug_asserts.
We want to ignore the incoming pending NaN state (since the pending will propagate to the output if there was one on the input), and we want to add a new pending NaN state if we can (that is to say, if it isn't cancelled out by both inputs having arithmetic state). Do this by discarding the pending states on the inputs, intersecting them (to keep only the arithmetic state), then union in a pending nan state (which might do nothing, if it's arithmetic).
If the above sounds confusing, keep in mind that when a value is arithmetic, the act of performing the "NaN canonicalization" is a no-op. Thus, being arithmetic cancels out pending NaN states.
Unfortunately, this is quite buggy. For something as simple as F32Sub, to combine two ExtraInfos, we want to add a new pending_f32_nan(), unless both of the inputs are arithmetic_f32(). In this commit, we incorrectly calculate that we don't need a pending_f32_nan if either one of the inputs was arithmetic_f32().
It seemed like a good idea at the time, but in practice we discard the extra info all or almost all of the time.
This also introduces a new bug. In an operation like multiply, it's valid to multiply two values, one with a pending NaN and one without. As written, in the SIMD case (because of the two kinds of pending in play), we assert.
1017: Add a 'clear' method to map. r=nlewycky a=nlewycky
# Description
Motivated by work on the `nlewycky/inkwell-lifetimes` branch. No callers yet on master, but we use it on the branch and I'd like to merge in pieces.
Co-authored-by: Nick Lewycky <nick@wasmer.io>
1016: [fix 962] Activate pre_validation when llvm backend selected r=nlewycky a=pventuzelo
# Description
After analysis of issue https://github.com/wasmerio/wasmer/issues/962 by me and @nlewycky, it seems to be better to validate the wasm module before calling the llvm compiler.
This change will imply potential overhead in term of execution speed using llvm backend.
I will also suggest to set pre_validation to true for Singlepass by default:
5c1c786e35/lib/runtime-core/src/codegen.rs (L263-L269)
Additional improvement proposal for wasmer API & cli command options:
* add an API `compile_without_validation`.
* add a flag option in wasmer binary to deactivate `pre_validation` for all backend.
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Patrick Ventuzelo <ventuzelo.patrick@gmail.com>
1002: Update the LLVM pass list. r=nlewycky a=nlewycky
# Description
Adds optimizations of loops, and inlinling and some simple interprocedural optimization.
Measured on the libsodium benchmarks, the new pass pipeline is a 2.35% geomean improvement. No major performance regressions known.
Co-authored-by: Nick Lewycky <nick@wasmer.io>
1009: Fix LLVM crash on `return` with a float on the stack and a crash with gas metering. r=nlewycky a=nlewycky
# Description
This PR fixes some matters of testing. The return+float bug is caught by the LLVM verifier, which was accidentally unconditionally disabled even when running "make test check". Add a new cargo feature named "test" which is enabled by all the test crates. When the "test" feature is passed to the llvm-backend, run the LLVM verifier.
Add a new crate `llvm-backend-test` which has one test so far, to ensure that this bug with the return+float does not crash LLVM. Include this new crate in runs of `make llvm`.
Fix LLVM crash on `return` when there is a float with pending NaN canonicalization on the stack.
Now that we run the verifier in testing, we discover another bug where `internal_field()` incorrectly labels a GEP with a TBAA label instead of the intended load. Fix this by labeling the correct instruction. No new test is introduced since this is already caught with `make bench-llvm`.
# Review
- [ ] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Nick Lewycky <nick@wasmer.io>
713: Add AArch64 support for singlepass. r=syrusakbary a=losfair
This PR includes:
- Support for AArch64 (ARM64) in Singlepass backend. Implemented with a combination of x86_64 instruction translation and native code generation.
- State tracing and backtraces on AArch64/Singlepass. (Tiering is not implemented for this pair because there's no other backend supporting AArch64 yet)
- Debugging tools: `BlockTrace` middleware, and support for reading states of previous WebAssembly stack frames from middlewares.
Co-authored-by: losfair <zhy20000919@hotmail.com>
997: Compiler tests r=MarkMcCaskey a=syrusakbary
# Description
This PR simplifies the testing part, making `wasmer_runtime_core` the one responsible for picking the default backend.
This makes tests much simpler, and reliable when trying to run in different backends (this PR solves an issue when trying to run wasitests on ARM machines).
<!--
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Syrus <me@syrusakbary.com>
Co-authored-by: Mark McCaskey <mark@wasmer.io>
Co-authored-by: Mark McCaskey <5770194+markmccaskey@users.noreply.github.com>
995: fix(runtime-core) Remove a panic when generating globals with a corrupted module r=syrusakbary a=Hywan
Fix#979.
When we try to get a global that doesn't exist, a panic is
generated. This patch skips such panic and let a proper error be
generated.
Before this patch:
```
$ cargo run -- run panic_index_oob_all_backends.wasm
Error: ExportNotFound { name: "main" }
```
With this patch:
```sh
$ cargo run -- run panic_index_oob_all_backends.wasm
Error: Can't instantiate module: LinkError([Generic { message: "Trying to read the `0` global that isn\'t properly initialized." }])
```
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
Before this patch:
```
$ cargo run -- run panic_index_oob_all_backends.wasm
Error: ExportNotFound { name: "main" }
```
With this patch:
```sh
$ cargo run -- run panic_index_oob_all_backends.wasm
Error: Can't instantiate module: LinkError([Generic { message: "Trying to read the `0` global that isn\'t properly initialized." }])
```
Fix https://github.com/wasmerio/wasmer/issues/979.
When we try to get a global that doesn't exist, a panic is
generated. This patch just skip that path, and let a proper error be
generated later.
With this patch, we get:
```sh
$ cargo run -- run panic_index_oob_all_backends.wasm
Error: ExportNotFound { name: "main" }
```
which is kind of the expected behavior in such situation.
992: Update wapm-cli to latest version r=syrusakbary a=syrusakbary
<!--
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests
-->
# Description
This PR:
* [x] Updates WAPM version to 0.4.1
* [x] Fixes arguments issue introduced in #990
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Syrus <me@syrusakbary.com>
991: Run WASI C API tests based on feature; prevent cmake caching r=MarkMcCaskey a=MarkMcCaskey
Resolves#988
Co-authored-by: Mark McCaskey <mark@wasmer.io>
990: Allow to do wasmer execution without the `run` argument r=MarkMcCaskey a=syrusakbary
# Description
This PR allows Wasmer to run files directly without doing `wasmer run xyz.wasm`.
So you can do `wasmer xyz.wasm`
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Syrus <me@syrusakbary.com>
Co-authored-by: Mark McCaskey <mark@wasmer.io>
977: fix(runtime-core) Remove unnecessary implementation of `WasmTypeList` r=Hywan a=Hywan
The unit tests `test_func_arity_*` covers all possibilities, from 0 to
12. Removing this specific implementation of `WasmTypeList` for `(A,)`
doesn't break the test cases.
Also, the `impl_traits!` macro already implement `WasmTypeList` for
`(A,)` with `impl_traits!([transparent] S1, A)`. It's not clear why
`rustc` doesn't detect that though.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
978: test(runtime-core) Test closures in `Func::new` r=Hywan a=Hywan
This patch contains 2 commits:
1. Test closures in `Func::new`
2. Fix a warning about `unused_parens` (since Rust 1.39, the behavior of `unused_parens` has changed a little bit).
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
973: Add sign extension spec tests; add sign extension to singlepass r=nlewycky a=MarkMcCaskey
Adds missing spectests from official repo, implements instructions for singlepass
# Review
- [ ] 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 <5770194+markmccaskey@users.noreply.github.com>
981: Revert "Update Rust version to 1.39.0." r=MarkMcCaskey a=MarkMcCaskey
As far as I know we still want to be 1 behind latest stable to minimize breakage and bug reports (the compiler says you should install nightly when encountering new features)
# Review
- [ ] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
974: Update to Rust 1.39 r=losfair a=losfair
This PR updates the default Rust version to 1.39.
Necessary for code formatted with newer versions of `rustfmt` to pass the CI lint check.
Co-authored-by: losfair <zhy20000919@hotmail.com>
The unit tests `test_func_arity_*` covers all possibilities, from 0 to
12. Removing this specific implementation of `WasmTypeList` for `(A,)`
doesn't break the test cases.
Also, the `impl_traits!` macro already implement `WasmTypeList` for
`(A,)` with `impl_traits!([transparent] S1, A)`. It's not clear why
`rustc` doesn't detect that though.
964: Enable compilation for specific target r=MarkMcCaskey a=xofyarg
<!--
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests
-->
# Description
<!--
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->
By exposing the target information through `CompilerConfig`,
compiler(only LLVM at the moment) could create a machine with
different CPU feature flags other than current host, which makes it
capable to "cross compile" to some degree.
Update #959
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: anb <anb@dev.null>
By exposing the target information through `CompilerConfig`,
compiler(only LLVM at the moment) could create a machine with
different CPU feature flags other than current host, which makes it
capable to "cross compile" to some degree.
Update #959
971: When accessing memory, use byte aligned accesses. r=nlewycky a=nlewycky
# Description
When accessing memory, use byte aligned accesses.
LLVM's instcombine will attempt to bump the alignment when it can prove that it's safe to do so.
Fixes#969.
# Review
- [ ] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Nick Lewycky <nick@wasmer.io>
968: Added invoke option to the command r=syrusakbary a=syrusakbary
# Description
This PR adds an `--invoke` to the Wasmer CLI
<!--
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Syrus <me@syrusakbary.com>
966: Add deny missing docs to runtime lib r=bjfish a=bjfish
<!--
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests
-->
# Description
<!--
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->
Co-authored-by: Brandon Fish <brandon.j.fish@gmail.com>
960: feat(runtime-c-api) Add support for clang in `WASMER_H_MACROS` r=MarkMcCaskey a=Hywan
In #952, the `WASMER_H_MACROS` constant has been defined. The `ARCH_X86_64` constant is defined under 2 conditions: If the compiler is MSVC + `_M_AMD64` is defined, or if the compiler is GCC + `__x86_64__` is defined.
Clang is missing. And it breaks some projects (like https://github.com/wasmerio/php-ext-wasm or https://github.com/wasmerio/go-ext-wasm for instance).
This patch supports Clang.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
955: feat(runtime-core) Replace the `field-offset` crate by a custom `offset_of!` macro r=Hywan a=Hywan
The `field-offset` crate is unmaintained. When using its `offset_of!`
macro on a struct with a field of type `std::ptr::NonNull`, in release
mode, it generates a sigill.
This patch removes the `field-offset` crate, and implements a custom
`offset_of!` macro.
See #925 last commits to see an illustration of this bug.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
954: Deny missing docs in the clif backend crate r=bjfish a=bjfish
<!--
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests
-->
# Description
Deny missing docs in the clif backend crate
<!--
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->
Co-authored-by: Brandon Fish <brandon.j.fish@gmail.com>
Co-authored-by: Brandon Fish <bjfish@users.noreply.github.com>
925: feat(runtime-core) Support closures with a captured environment as host functions r=Hywan a=Hywan
Reboot of #882 and #219.
For the moment, host functions (aka imported functions) can be regular function pointers, or (as a side-effect) closures without a captured environment. This PR extends the support of host functions to closures with a captured environment. This is required for many other features (incl. the Python integration, the Ruby integration, WebAssembly Interface Types [see #787], and so on).
This PR is the culmination of previous ones, notably #915, #916 and #917.
### General idea
The user-defined host function is wrapped inside a `wrap` function. This wrapper function initially receives a `vm::Ctx` as its first argument, which is passed to the host function when necessary. The patch keeps this behavior but it comes from `vm::FuncCtx`, which is a new structure. A `vm::FuncCtx` is held by `vm::ImportedFunc` such as:
```rust
#[repr(C)]
pub struct ImportedFunc {
pub(crate) func: *const Func,
pub(crate) func_ctx: NonNull<FuncCtx>,
}
```
where `vm::FuncCtx` is:
```rust
#[repr(C)]
pub struct FuncCtx {
pub(crate) vmctx: NonNull<Ctx>,
pub(crate) func_env: Option<NonNull<FuncEnv>>,
}
```
where `vm::FuncEnv` is:
```rust
#[repr(transparent)]
pub struct FuncEnv(pub(self) *mut c_void);
```
i.e. a raw opaque pointer.
So the wrapper function of a host function receives a `vm::Ctx`, which is used to find out the associated `FuncCtx` (by using the import backing), which holds `vm::FuncEnv`. It holds a pointer to the closure captured environment.
### Implementation details
#### How to get a pointer to a closure captured environment
A closure with a captured environment has a memory size greater than zero. This is how we detect it:
```rust
if mem::size_of::<Self>() != 0 { … }
```
To get a pointer to its captured environment, we use this statement:
```rust
NonNull::new(Box::into_raw(Box::new(self))).map(NonNull::cast)
```
(in `typed_func.rs`, in the `wrap` functions).
To reconstruct the closure based on the pointer, we use this statement:
```rust
let func: &FN = {
let func: NonNull<FN> = func_env.cast();
&*func.as_ptr()
};
```
That's basically how it works. And that's the core idea of this patch.
As a side effect, we have removed an undefined behavior (UB) in 2 places: The `mem::transmute(&())` has been removed (it was used to get the function pointer of `FN`). The transmute is replaced by `FuncEnv`, which provides a unified API, erasing the difference between host functions as closures with a captured environment, and host functions as function pointer. For a reason I ignore, the UB wasn't showing himself until this PR and a modification in the Singlepass backend. But now it's fixed.
#### Impact on `Backing`
After the modification on the `typed_func` and the `vm` modules, this is the other core idea of this patch: Updating the `backing` module so that `vm::ImportedFunc` replaces `vm::Ctx` by `vm::FuncCtx`.
When creating `vm::ImportedFunc`, a new `vm::FuncCtx` is created and its pointer is used. We are purposely leaking `vm::FuncCtx` so that the pointer is always valid. Hence the specific `Drop` implementation on `ImportBacking` to dereference the pointer, and to drop it properly.
#### Impact on the backends
Since the structure of `vm::ImportedFunc` has changed, backends must be updated. We must deref `FuncCtx` to reach its `vmctx` field.
#### Impact on `Instance`
Because `vm::ImportedFunc` has changed, it has a minor impact on the `instance` module, nothing crazy though.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
The `field-offset` crate is unmaintained. When using its `offset_of!`
macro on a struct with a field of type `std::ptr::NonNull`, in release
mode, it generates a sigill.
This patch removes the `field-offset` crate, and implements a custom
`offset_of!` macro.
952: Generate C preprocessor code to hide things not on Windows r=MarkMcCaskey a=MarkMcCaskey
resolves#804
# 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: nlewycky <nick@wasmer.io>
923: Add probable fix of memory leak in trampoline code r=MarkMcCaskey a=MarkMcCaskey
might be what's needed for #810 ; but despite my best efforts I could not get asan working on osx, so I did not test it.
By my count this accounts for 40 bytes, so there may be another issue
edit: unless Rust is optimizing out turning a zero-sized type into a Box, in which case, this should account for 48 bytes
Co-authored-by: Mark McCaskey <mark@wasmer.io>
942: Deny missing docs in runtime core and add missing docs r=bjfish a=bjfish
<!--
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests
-->
# Description
Deny missing docs in runtime core and add missing docs
<!--
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Brandon Fish <brandon.j.fish@gmail.com>
940: Update supported Rust version to 1.38 r=MarkMcCaskey a=MarkMcCaskey
Bump stable version to latest release - 1
Co-authored-by: Mark McCaskey <mark@wasmer.io>
935: Apply TBAA to the correct instruction. r=nlewycky a=nlewycky
Another instance of the bug in PR #933.
Co-authored-by: Nick Lewycky <nick@wasmer.io>
933: Apply TBAA to the correct instruction. r=syrusakbary a=nlewycky
Caught by LLVM verifier complaining about !tbaa on a getelementptr.
Co-authored-by: Nick Lewycky <nick@wasmer.io>
Host functions use `Context::External` with a `*mut vm::FuncCtx`
pointer, casted to `*mut vm::Ctx`. It creates a conflict with exports
that also use `Context::External`.
This patch introduces `Context::ExternalWithEnv` to create a specific
path in the code for an external context with `*mut vm::FuncEnv`.
This patch fixes all the `linking.wast` tests in the spectests.
In the `wrap` functions, we use `std::mem::transmute(&())` to get the
pointer to the value “around” `wrap` (`Fn` has a method `to_raw` which
declares a `wrap` function, which uses `transmute` to retrieve
`Fn`). This is an undefined behavior. It was working until the
`FuncCtx` is introduced. Since then, the undefined behavior was
causing an error with the Singlepass backend.
This patch stores the pointer to `Fn` in `func_env`, so that the
pointer to the user-defined host function is always predictable.
929: Update __wasi_rights_t and __wasi_signal_t with published changes r=MarkMcCaskey a=MarkMcCaskey
Follow up to #926 ; fixes everything else listed at https://github.com/WebAssembly/WASI/pull/135
Co-authored-by: Mark McCaskey <mark@wasmer.io>
921: Apply TBAA metadata in the LLVM backend. r=nlewycky a=nlewycky
# Description
Inform LLVM that the pointers to memory, globals, locals, etc., are distinct.
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Nick Lewycky <nick@wasmer.io>
Co-authored-by: nlewycky <nick@wasmer.io>
911: Don't emit bounds checks when the offset is known at compile time to be less than the minimum memory size. r=nlewycky a=nlewycky
Co-authored-by: Nick Lewycky <nick@wasmer.io>
917: feat(runtime-core) Host function without a `vm::Ctx` argument r=Hywan a=Hywan
Extracted from https://github.com/wasmerio/wasmer/pull/882.
~Includes https://github.com/wasmerio/wasmer/pull/916. Must not be merged until #916 lands in `master`.~
~If you want to compare only the different commits, see https://github.com/Hywan/wasmer/compare/feat-runtime-core-tests...Hywan:feat-runtime-core-host-function-without-vmctx?expand=1.~
This patch updates the `ExternalFunction` implementation to support host functions (aka imported functions) without having an explicit `vm::Ctx` argument.
It is thus possible to write:
```rust
fn add_one(x: i32) -> i32 {
x + 1
}
let import_object = imports! {
"env" => {
"add_one" => func!(add_one);
},
};
```
The previous form is still working though:
```rust
fn add_one(_: &mut vm::Ctx, x: i32) -> i32 {
x + 1
}
```
The backends aren't modified. It means that the pointer to `vm::Ctx` is still inserted in the stack, but it is not used when the function doesn't need it.
We thought this is an acceptable trade-off.
About the C API. It has not check to ensure the type signature. Since the pointer to `vm::Ctx` is always inserted, the C API can digest host functions with or without a `vm::Ctx` argument. The C API uses [the `Export` + `FuncPointer` API](cf5b3cc09e/lib/runtime-c-api/src/import/mod.rs (L630-L653)) instead of going through the `Func` API (which is modified by this API), which is only possible since the C API only receives an opaque function pointer. Conclusion is: We can't ensure anything on the C side, but it will work with or without the `vm::Ctx` argument in theory.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
915: fix(runtime-core) Share the definition of `Trampoline` across all the backends r=Hywan a=Hywan
Extracted from https://github.com/wasmerio/wasmer/pull/882.
This patch updates all the backends to use the definition of
`Trampoline` as defined in the `wasmer_runtime_core::typed_func`
module. That way, there is no copy of that type, and as such, it is
easier to avoid regression (a simple `cargo check` does the job).
This patch also formats the `use` statements in the updated files.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
This patch allows host functions to get a signature without an
explicit `vm::Ctx` argument.
It is for Rust only. The C API receives a function pointer and has no
clue whether a `vm::Ctx` argument is present or not, so it assumes it
is always declared.
From the backend point of view, the pointer to `vm::Ctx` is always
inserted in the stack, but it is not used by the function when the
argument is absent.
916: feat(runtime-core-tests) Introduce the new `wasmer-runtime-core-tests` crate r=Hywan a=Hywan
Extracted from https://github.com/wasmerio/wasmer/pull/882.
This non-publishable new crate contains a test suite for the
`wasmer-runtime-core` crate. So far, the test suite is rather small,
but it aims to be extended in a close future.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
This non-publishable new crate contains a test suite for the
`wasmer-runtime-core` crate. So far, the test suite is rather small,
but it aims to be extended in a close future.
This patch updates all the backends to use the definition of
`Trampoline` as defined in the `wasmer_runtime_core::typed_func`
module. That way, there is no copy of that type, and as such, it is
easier to avoid regression (a simple `cargo check` does the job).
This patch also formats the `use` statements in the updated files.
914: Fix bug in getting a Memory from export in C API r=Hywan a=MarkMcCaskey
I believe this fixes the non-deterministic crashing on OSX in `go-ext-wasm`
Co-authored-by: Mark McCaskey <mark@wasmer.io>
856: Add WASI support to C API r=MarkMcCaskey a=MarkMcCaskey
This is an additive change (with one unrelated clean up of `*mut ptr -> *const ptr`). It exposes the functions to get a WASI import object. It also implements a function on import object to get an `import` with namespace and name.
These changes should be okay to ship now, we can follow up to finish adding methods to ImportObject on the C API side and start migrating away from `*imports`.
# 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: Ivan Enderlin <ivan.enderlin@hoa-project.net>
Co-authored-by: Mark McCaskey <markmccaskey@users.noreply.github.com>
Co-authored-by: nlewycky <nick@wasmer.io>
910: Use getrandom instead of rand r=MarkMcCaskey a=newpavlov
Closes#909
Note: I am reusing `__WASI_EIO` as an error code to denote a potential OS RNG failure.
Co-authored-by: newpavlov <newpavlov@gmail.com>
Co-authored-by: Artyom Pavlov <newpavlov@gmail.com>
883: For floating point operations, allow inputs to be arbitrary, including SNaNs. r=nlewycky a=nlewycky
# Description
For floating point operations, allow inputs to be arbitrary, including SNaNs.
Instead of ensuring inputs are canonical NaNs on every operation, we tag outputs as pending such a canonicalization check, so that a sequence of computations 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. Since a canonicalization may change the bit patterns in a way that transforms one non-NaN to another non-NaN in the next subsequent instructions interpretation, most SIMD functions apply pending canonicalizations to their inputs, even the integer SIMD operations.
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Nick Lewycky <nick@wasmer.io>
Co-authored-by: nlewycky <nick@wasmer.io>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
901: Set target triple and datalayout when creating the LLVM module. r=nlewycky a=nlewycky
We were giving LLVM a triple and datalayout only when producing native code from the LLVM IR. With this change, we tell LLVM as early as possible so that the entire optimization stack knows that it's safe to use target-specific constructs (including target intrinsics `@llvm.x86.sse2.ucomieq.sd`) as well as cost models (for autovectorization) and knowing the bitwidth of the registers so that we can know it's profitable to eliminate redundant extend/truncate casts.
Co-authored-by: Nick Lewycky <nick@wasmer.io>
904: Use getelementptr instruction instead of int_to_ptr and ptr_to_int. r=nlewycky a=nlewycky
The main part of this change is that we no longer turn pointers into integers to do arithmetic on them, then turn them back into pointers. Doing so is a signal to LLVM that it should not attempt to analyze the provenance of the pointers, disabling some optimizations. Using getelementptr allows us to perform arithmetic on pointers while keeping them in pointer types, which LLVM can then analyze.
Most of the textual change is a refactoring to reorder the operations. Previously the bounds checking and determining of the base and bounds were combined because you could put both into the same match, since both actions are performed differently depending on whether the memory is static or dynamic. In this case, we simply check the type twice and do two different things, with comments labelling the steps.
Co-authored-by: Nick Lewycky <nick@wasmer.io>
ptr_to_int and int_to_ptr are not treated the same as type-safe pointer operations. LLVM intentionally performs fewer optimizations to code using the former as compared with the latter. We don't need that in our code, standard pointer optimizations are safe for us.
902: Insert allocas as a contiguous block at the top of the entry block. r=syrusakbary a=nlewycky
This minimizes the chance we accidentally get categorized as having a dynamic alloca.
Co-authored-by: Nick Lewycky <nick@wasmer.io>
861: [fix issue #679] add details when calling unimplemented! r=MarkMcCaskey a=pventuzelo
# Description
As discuss in issue #679, `unimplemented!` should provide a string to explain at least where the issue occurs. This pull request only add messages on existing `unimplemented!` and don't change any previous logics/behaviors in the code.
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Patrick Ventuzelo <ventuzelo.patrick@gmail.com>
Co-authored-by: Mark McCaskey <markmccaskey@users.noreply.github.com>
894: Bump indexmap from 1.2.0 to 1.3.0 r=nlewycky a=dependabot-preview[bot]
Bumps [indexmap](https://github.com/bluss/indexmap) from 1.2.0 to 1.3.0.
<details>
<summary>Commits</summary>
- [`c820451`](c8204515dc) 1.3.0
- [`4868359`](4868359456) DOC: Edit README and release notes for 1.3. Clean up a bit in the readme.
- [`899fc93`](899fc93a0b) DOC: Add a doc section drawing attention to some extra features
- [`aef602a`](aef602a139) Merge pull request [#106](https://github-redirect.dependabot.com/bluss/indexmap/issues/106) from bluss/auto-nostd
- [`c7d07f1`](c7d07f1b59) FIX: Use repr(transparent) on &str wrapper in benchmark
- [`634c503`](634c5031a0) Merge pull request [#107](https://github-redirect.dependabot.com/bluss/indexmap/issues/107) from bluss/take-back-deprecation-warnings
- [`6bd5fb6`](6bd5fb67af) MAINT: Update crate keywords and categories
- [`3e8d9b5`](3e8d9b5c80) DOC: Add docs for nostd
- [`268665b`](268665b0aa) API: Remove deprecation warnings on the removal methods again
- [`aa0778a`](aa0778a59c) FEAT: indexmap!() macros require std
- Additional commits viewable in [compare view](https://github.com/bluss/indexmap/compare/1.2.0...1.3.0)
</details>
<br />
[](https://dependabot.com/compatibility-score.html?dependency-name=indexmap&package-manager=cargo&previous-version=1.2.0&new-version=1.3.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)
---
<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)
- Pull request limits (per update run and/or open at any time)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)
</details>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
895: Bump libc from 0.2.62 to 0.2.65 r=nlewycky a=dependabot-preview[bot]
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.62 to 0.2.65.
<details>
<summary>Commits</summary>
- [`53bdffc`](53bdffc028) Auto merge of [#1557](https://github-redirect.dependabot.com/rust-lang/libc/issues/1557) - gnzlbg:dupe, r=gnzlbg
- [`8823376`](8823376ffa) Remove duplicate target
- [`07d1f7a`](07d1f7a495) Remove broken link
- [`5041053`](504105347a) Do not run style checks on master
- [`39decff`](39decff1f6) Add job on master that publishes the website
- [`bf877ba`](bf877ba712) Auto merge of [#1549](https://github-redirect.dependabot.com/rust-lang/libc/issues/1549) - GrayJack:solaris-settime, r=gnzlbg
- [`bc5c15e`](bc5c15efd0) Auto merge of [#1556](https://github-redirect.dependabot.com/rust-lang/libc/issues/1556) - senden9:patch-1, r=gnzlbg
- [`5747422`](5747422855) Sort targets in documentation. Fixes [#1524](https://github-redirect.dependabot.com/rust-lang/libc/issues/1524).
- [`6dae870`](6dae870ecd) Auto merge of [#1554](https://github-redirect.dependabot.com/rust-lang/libc/issues/1554) - nmattia:nm-mcontext, r=gnzlbg
- [`e691d94`](e691d9490e) Ensure comments are no longer than 80 chars
- Additional commits viewable in [compare view](https://github.com/rust-lang/libc/compare/0.2.62...0.2.65)
</details>
<br />
[](https://dependabot.com/compatibility-score.html?dependency-name=libc&package-manager=cargo&previous-version=0.2.62&new-version=0.2.65)
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)
- Pull request limits (per update run and/or open at any time)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)
</details>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
893: Bump cc from 1.0.45 to 1.0.46 r=nlewycky a=dependabot-preview[bot]
Bumps [cc](https://github.com/alexcrichton/cc-rs) from 1.0.45 to 1.0.46.
<details>
<summary>Commits</summary>
- [`e83150e`](e83150ecd0) Bump to 1.0.46
- [`0eeafcc`](0eeafcc903) Added public function to add flags to archiver
- [`047bf5b`](047bf5b128) Fix typo in lib.rs doc
- [`02ed9e6`](02ed9e6895) add mechanism for forcing frame pointer.
- [`0ed1d0a`](0ed1d0a146) Fix Windows CI for now
- See full diff in [compare view](https://github.com/alexcrichton/cc-rs/compare/1.0.45...1.0.46)
</details>
<br />
[](https://dependabot.com/compatibility-score.html?dependency-name=cc&package-manager=cargo&previous-version=1.0.45&new-version=1.0.46)
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)
- Pull request limits (per update run and/or open at any time)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)
</details>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
898: Disable track-state by default, disable @llvm.experimental.stackmap emission in the LLVM backend when it's disabled. r=nlewycky a=nlewycky
Co-authored-by: Nick Lewycky <nick@wasmer.io>
897: Remove special casing of stdin, stdout, and stderr in WASI FS r=MarkMcCaskey a=MarkMcCaskey
# Description
Properly fixes closing stdin, stdout, stderr. Cleans up this part of the code while it's at it.
This PR introduces breaking changes to the pubic WASI API
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
877: Reimplement F32Min, F32Max, F64Min and F64Max. r=nlewycky a=nlewycky
# Description
Reimplement F32Min, F32Max, F64Min and F64Max.
Adds XMM8--15 registers. Adds VMOVA, VBLEND and VXORP, and the VCMPUNORD and VCMPORD comparisons.
Fixes 419 test failures.
Co-authored-by: Nick Lewycky <nick@wasmer.io>
887: Get aggressive about running cargo check over all packages with all features. r=nlewycky a=nlewycky
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.
Co-authored-by: Nick Lewycky <nick@wasmer.io>
Co-authored-by: Mark McCaskey <mark@wasmer.io>
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.
867: Initial implementation of `assert_uninstantiable`. r=nlewycky a=nlewycky
# Description
Add a basic implementation of `assert_uninstantiable` in the spectest runner. Fixes one line of spectests in all three backends.
Co-authored-by: Nick Lewycky <nick@wasmer.io>
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>
884: Show the full hex value of a float that fails assert returns arithmetic nan or assert returns canonical nan. r=nlewycky a=nlewycky
Co-authored-by: Nick Lewycky <nick@wasmer.io>
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.
880: Remove usage of LZCNT and TZCNT from singlepass. r=nlewycky a=nlewycky
# Description
This PR removes usage of LZCNT and TZCNT in singlepass to work on machines that don't support them. Unlike other instructions that fail loudly when not supported, LZCNT and TZCNT silently change behaviour by falling back to BSR and BSF which may produce different answers. They were used in the I32Clz, I32Ctz, I64Clz and I64Ctz instructions. Fixes i32.wast and i64.wast test failures on our Mac buildbot.
As an alternative, we could detect presence of LZCNT and TZCNT at runtime, either by running them directly or by querying CPUID to detect whether the CPU claims support for these instructions. I decided against that because having multiple paths is more complicated, and we aren't concerned with runtime of singlepass code, as a rule.
Co-authored-by: Nick Lewycky <nick@wasmer.io>
Co-authored-by: nlewycky <nick@wasmer.io>
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…
876: Bump structopt from 0.3.2 to 0.3.3 r=Hywan a=dependabot-preview[bot]
Bumps [structopt](https://github.com/TeXitoi/structopt) from 0.3.2 to 0.3.3.
<details>
<summary>Changelog</summary>
*Sourced from [structopt's changelog](https://github.com/TeXitoi/structopt/blob/master/CHANGELOG.md).*
> # v0.3.3 (2019-10-10)
>
> * Add `from_flag` custom parser to create flags from non-bool types.
> Fixes [#185](https://github-redirect.dependabot.com/TeXitoi/structopt/issues/185)
</details>
<details>
<summary>Commits</summary>
- [`2cb1fbf`](2cb1fbf679) v0.3.3
- [`fd2cc62`](fd2cc62b63) Add from_flag parser ([#271](https://github-redirect.dependabot.com/TeXitoi/structopt/issues/271))
- [`6a3fc8b`](6a3fc8bc79) Run ui tests only on stable
- [`8d86616`](8d86616957) Fix code formatting
- [`cf61ff1`](cf61ff1eaf) Fix nightly tests
- [`0c888e9`](0c888e962d) Fix clippy warnings
- [`1cae9fa`](1cae9fab4b) Suppress all clippy warnings
- [`c228c23`](c228c2399b) Fix version in docs (AGAIN)
- See full diff in [compare view](https://github.com/TeXitoi/structopt/compare/v0.3.2...v0.3.3)
</details>
<br />
[](https://dependabot.com/compatibility-score.html?dependency-name=structopt&package-manager=cargo&previous-version=0.3.2&new-version=0.3.3)
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)
- Pull request limits (per update run and/or open at any time)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)
</details>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
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>
872: Pass llvm debug flags to the llvm backend. r=nlewycky a=nlewycky
This was accidentally removed in 124ad73e8ae2c6864bad3ebe5572d79736cfd688 .
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>
868: Replace "be the i32 type" with "be an i32" in error messages. r=nlewycky a=nlewycky
# Description
Adjust wording in error messages.
Co-authored-by: Nick Lewycky <nick@wasmer.io>
execution of wasm programs across different hardware/circumstances.
This is very useful for Blockchain projects having wasm smart-contracts
This is critical for Blockchain projects that require execution to be deterministic
in order to reach a consensus of the state transition of each smart-contract transaction.
831: Add support for atomic operations, excluding wait and notify, to singlepass. r=nlewycky a=nlewycky
# Description
Adds support for atomic operations, excluding wait and notify, to singlepass. Enable with `--enable-threads`.
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Nick Lewycky <nick@wasmer.io>
Co-authored-by: nlewycky <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>
828: No need to emit add of constant zero. r=losfair a=nlewycky
# Description
While debugging singlepass generated code, I noticed unnecessary adds of zero. Removing them made the resulting assembly shorter and easier to analyze.
Co-authored-by: Nick Lewycky <nick@wasmer.io>
Co-authored-by: nlewycky <nick@wasmer.io>
Co-authored-by: Heyang Zhou <zhy20000919@hotmail.com>
841: Add lots of rustdocs and clean up one line of code r=MarkMcCaskey a=MarkMcCaskey
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
835: Add parallel execution example r=Hywan a=MarkMcCaskey
A bit wip
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
836: Update cranelift backend to fork version 0.44.0 r=bjfish a=bjfish
<!--
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests
-->
# Description
Update cranelift dependency to updated fork version 0.44.0
<!--
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Brandon Fish <brandon.j.fish@gmail.com>
839: Update CI to use Rust 1.37 r=MarkMcCaskey a=MarkMcCaskey
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
832: Delete unused runtime-abi r=syrusakbary a=syrusakbary
<!--
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests
-->
# Description
Delete unused runtime-abi
<!--
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Syrus <me@syrusakbary.com>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
809: Fix issue 800 - check index before accessing imports.globals r=syrusakbary a=pventuzelo
# Description
Fix issue #800
* Check if `import_global_index` is valid i.e inside imports.globals range.
* Related functions:
* validate_memories
* validate_tables
* finalize_memories
* finalize_tables
# After the fix
``` sh
$ ./target/release/wasmer run index_oob_LocalBacking_validate_memories_152.wasm
execute_wasm: "Can\'t instantiate module: LinkError([Generic { message: \"incorrect global index for initializer\" }])"
--------------------------------------------------------------------------------------------------------
$ ./target/release/wasmer run index_oob_LocalBacking_validate_tables_276.wasm
execute_wasm: "Can\'t instantiate module: LinkError([Generic { message: \"incorrect global index for initializer\" }])"
```
# Review
- [x] Create a short description of the the change in the CHANGELOG.md file
Co-authored-by: Patrick Ventuzelo <ventuzelo.patrick@gmail.com>
Co-authored-by: Patrick Ventuzelo <9038181+pventuzelo@users.noreply.github.com>
822: Cranelift backend update to fork of clif version 0.43.1 r=bjfish a=bjfish
The corresponding update to fork is here (which should merge first):
https://github.com/wasmerio/cranelift/pull/4
<!--
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests
-->
# Description
<!--
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Brandon Fish <brandon.j.fish@gmail.com>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
806: Fix issue 653 (panic in MemoryDescriptor) + remove panic in UnsharedMemory r=syrusakbary a=pventuzelo
#Description
Based on comment from @syrusakbary [here](https://github.com/wasmerio/wasmer/pull/654#issuecomment-520908172) and previous pull request from @bjfish.
* Reformat MemoryDescriptor (new structure field, function new, function memory_type)
* Remove panic for MemoryDescriptor
* Remove panic for UnsharedMemory
# Review
- [ ] Create a short description of the the change in the CHANGELOG.md file
Co-authored-by: Patrick Ventuzelo <ventuzelo.patrick@gmail.com>
Co-authored-by: Patrick Ventuzelo <9038181+pventuzelo@users.noreply.github.com>
829: Fix bench targets in makefile r=MarkMcCaskey a=MarkMcCaskey
# Review
- [x] Add a short description of the the change to the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
824: Bump structopt from 0.3.1 to 0.3.2 r=MarkMcCaskey a=dependabot-preview[bot]
Bumps [structopt](https://github.com/TeXitoi/structopt) from 0.3.1 to 0.3.2.
<details>
<summary>Changelog</summary>
*Sourced from [structopt's changelog](https://github.com/TeXitoi/structopt/blob/master/CHANGELOG.md).*
> # v0.3.2 (2019-09-18)
>
> * `structopt` does not replace `:` with `, ` inside "author" strings while inside `<...>`.
> Fixes [#156](https://github-redirect.dependabot.com/TeXitoi/structopt/issues/156)
> * Introduced [`#[structopt(skip = expr)]` syntax](https://docs.rs/structopt/0.3.2/structopt/#skipping-fields).
</details>
<details>
<summary>Commits</summary>
- [`80a55c0`](80a55c0f35) v0.3.2
- [`5005c47`](5005c47d6d) Support `skip = value` syntax
- [`c3c6273`](c3c6273bb9) Update version in the documentation
- [`fe9e049`](fe9e049596) Do not mangle `author` string inside `\<...>`
- [`52fa726`](52fa726208) Propagate span info from origin code to generated code
- [`af8a4b8`](af8a4b8ff6) Fix nightly tests
- See full diff in [compare view](https://github.com/TeXitoi/structopt/compare/v0.3.1...v0.3.2)
</details>
<br />
[](https://dependabot.com/compatibility-score.html?dependency-name=structopt&package-manager=cargo&previous-version=0.3.1&new-version=0.3.2)
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)
- Pull request limits (per update run and/or open at any time)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- 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>
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>
817: Add feature matrix document r=MarkMcCaskey a=MarkMcCaskey
[rendered](https://github.com/wasmerio/wasmer/blob/docs/add-feature-matrix/docs/feature_matrix.md)
# 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>
It implies to create the `wasm::Memory` trait.
Also, the patch updates `wasm::Type` and `wasm::Value` to
`wasm::InterfaceType` and `wasm::InterfaceValue`. It enforces a new
rule that is: All values in the stack must be owned by the stack. Any
value going in or out must be cloned.
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>
820: Remove null pointer checks generally, re-add them in Emscripten r=MarkMcCaskey a=MarkMcCaskey
Resolves#818
- [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>
813: Fix test printf typo r=Hywan a=ethanfrey
<!--
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests
-->
# Description
<!--
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->
Fixes#812
`%lld -> %ld fixes cargo test compile error`
# Review
- [ ] Create a short description of the the change in the CHANGELOG.md file
Co-authored-by: Ethan Frey <ethanfrey@users.noreply.github.com>
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
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>
792: Remove colored CLI output from wasmer-runtime-core lib r=syrusakbary a=repi
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.
`colored` also had quite a few dependencies and, while well used, is not super actively maintained. So this change also removes 6 transitive dependencies of the `colored` crate which is great.
This could potentially be a feature flag instead also, but would be a bit messier.
Co-authored-by: Johan Andersson <repi@repi.se>
808: Bump rand from 0.7.0 to 0.7.2 r=MarkMcCaskey a=dependabot-preview[bot]
Bumps [rand](https://github.com/rust-random/rand) from 0.7.0 to 0.7.2.
<details>
<summary>Changelog</summary>
*Sourced from [rand's changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md).*
> ## [0.7.2] - 2019-09-16
> ### Fixes
> - Fix dependency on `rand_core` 0.5.1 ([#890](https://github-redirect.dependabot.com/rust-random/rand/issues/890))
>
> ### Additions
> - Unit tests for value stability of distributions added ([#888](https://github-redirect.dependabot.com/rust-random/rand/issues/888))
>
> ## [0.7.1] - 2019-09-13
> ### Fixes
> - Fix `no_std` behaviour, appropriately enable c2-chacha's `std` feature ([#844](https://github-redirect.dependabot.com/rust-random/rand/issues/844))
> - `alloc` feature in `no_std` is available since Rust 1.36 ([#856](https://github-redirect.dependabot.com/rust-random/rand/issues/856))
> - Fix or squelch issues from Clippy lints ([#840](https://github-redirect.dependabot.com/rust-random/rand/issues/840))
>
> ### Additions
> - Add a `no_std` target to CI to continously evaluate `no_std` status ([#844](https://github-redirect.dependabot.com/rust-random/rand/issues/844))
> - `WeightedIndex`: allow adjusting a sub-set of weights ([#866](https://github-redirect.dependabot.com/rust-random/rand/issues/866))
</details>
<details>
<summary>Commits</summary>
- [`249ebfc`](249ebfc435) Merge pull request [#888](https://github-redirect.dependabot.com/rust-random/rand/issues/888) from dhardy/master
- [`5ac4cbd`](5ac4cbd38c) Prepare rand 0.7.2
- [`f39915a`](f39915a496) rand_distr: work around tan func issue
- [`802ba8f`](802ba8f7f5) rand_distr: add missing value_stability tests
- [`a43d7f1`](a43d7f1166) Fix tests
- [`2ef2e66`](2ef2e669b6) Add value_stability tests for uniform
- [`096a5dd`](096a5dd5d6) UniformSampler: add doc on usage of sample_single
- [`f78781a`](f78781aa84) Uniform: replace inner field with struct tuple
- [`856fdfb`](856fdfb433) Distribution: add doc of portability
- [`72af6f8`](72af6f84f2) Add value_stability tests for bernoulli, int, float and other distrs
- Additional commits viewable in [compare view](https://github.com/rust-random/rand/compare/0.7.0...0.7.2)
</details>
<br />
[](https://dependabot.com/compatibility-score.html?dependency-name=rand&package-manager=cargo&previous-version=0.7.0&new-version=0.7.2)
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)
- Pull request limits (per update run and/or open at any time)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- 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>
802: This is no longer referring to the correct line. r=nlewycky a=nlewycky
It's supposed to be 352 which is already there. Three lines were deleted in #785.
Co-authored-by: Nick Lewycky <nick@wasmer.io>
Depending on the micro-arch, this function may trigger emission of a stack realignment. If it does, OSR can't statically prove that it's safe to insert a function call and asserts.
790: Switch llvm-backend from PIC+Default (small) to Static+Large. r=nlewycky a=nlewycky
# Description
Should fix flaky test failure:
```
spectest-a277b7d051ac0dde: /home/nick/llvm-8.0.1.src/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp:304: void llvm::RuntimeDyldELF::resolveX86_64Relocation(const llvm::SectionEntry&, uint64_t, uint64_t, uint32_t, int64_t, uint64_t): Assertion `isInt<32>(RealOffset)' failed.
```
(with assertions-enabled LLVM). The relocation in question is a `R_X86_64_PC32` with small offset against `.rodata`.
The switch from Default (small, JITDefault is a different default that we weren't using which is medium) to Large should fix the bug. Once we're using large code model, I think we can switch from PIC to static as either an optimization or a no-op.
# Review
- [x] Create a short description of the the change in the CHANGELOG.md file
Co-authored-by: Nick Lewycky <nick@wasmer.io>
798: Replace panics in codegen_x64 by CodegenError r=nlewycky a=pventuzelo
Replace panics! inside `lib/singlepass-backend/src/codegen_x64.rs` by CodegenError
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.
782: Turn this unreachable into a panic with an error message. r=nlewycky a=nlewycky
# Description
All errors with messages in this file are `panic!`s. Give this `unreachable!` a message (so I can debug when I hit it, only possible due to local changes) and turn it into a `panic!`.
# Review
- [ ] Create a short description of the the change in the CHANGELOG.md file
Too minor for changelog.
Co-authored-by: Nick Lewycky <nick@wasmer.io>
Co-authored-by: nlewycky <nick@wasmer.io>
788: Use union merge on the changelog file. r=MarkMcCaskey a=nlewycky
# Description
This keeps both sides of a conflict. It's essentially the same as removing the
conflict markers.
# Review
- [x] Create a short description of the the change in the CHANGELOG.md file
Co-authored-by: Nick Lewycky <nick@wasmer.io>
785: Copy the spectest repository license from the official WebAssembly testsuite. These tests are under that license. r=nlewycky a=nlewycky
Remove our own license statements on a few files since they're now redundant. They were all referencing this license.
Co-authored-by: Nick Lewycky <nick@wasmer.io>
786: Implement atomic load and store instructions with actual atomics in the LLVM backend. r=nlewycky a=nlewycky
Includes a run of `cargo update` to pick up the newer inkwell required.
# Review
- [x] Create a short description of the the change in the CHANGELOG.md file
Co-authored-by: Nick Lewycky <nick@wasmer.io>
784: Wasmer run can run text wat files, not webassembly spectest files. r=nlewycky a=nlewycky
# Description
Correct an incorrect description of the `wasmer run` subcommand. It can't run webassembly spectest files (`.wast`), it can run webassembly text files (`.wat`).
# Review
- [x] Create a short description of the the change in the CHANGELOG.md file
n/a
Co-authored-by: Nick Lewycky <nick@wasmer.io>
766: Bump indexmap from 1.1.0 to 1.2.0 r=Hywan a=dependabot-preview[bot]
Bumps [indexmap](https://github.com/bluss/indexmap) from 1.1.0 to 1.2.0.
<details>
<summary>Commits</summary>
- [`45dad09`](45dad09a97) 1.2.0
- [`0cfdf7d`](0cfdf7d284) MAINT: Fix cargo-release setting for tag name
- [`380e55c`](380e55c6a3) Merge pull request [#102](https://github-redirect.dependabot.com/bluss/indexmap/issues/102) from cuviper/lints
- [`042e1b4`](042e1b4a93) Avoid scoped lints for Rust 1.30
- [`f799d95`](f799d9558e) Allow clippy::eq_op in tests
- [`75850ce`](75850ce359) Fix clippy::writeln_empty_string
- [`6b19c0e`](6b19c0e95d) Fix clippy::transmute_ptr_to_ptr
- [`0206d91`](0206d91a33) Fix clippy::single_match
- [`abfffac`](abfffac4a7) Fix clippy::redundant_static_lifetimes
- [`d5acca7`](d5acca76be) Fix clippy::redundant_pattern_matching
- Additional commits viewable in [compare view](https://github.com/bluss/indexmap/compare/1.1.0...1.2.0)
</details>
<br />
[](https://dependabot.com/compatibility-score.html?dependency-name=indexmap&package-manager=cargo&previous-version=1.1.0&new-version=1.2.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)
---
<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>
781: Prepare for 0.7.0 release r=MarkMcCaskey a=MarkMcCaskey
<!--
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests
-->
# Description
<!--
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->
# Review
- [x] Create a short description of the the change in the CHANGELOG.md file
Co-authored-by: Mark McCaskey <mark@wasmer.io>
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 />
[](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 />
[](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>
779: Add comment to generated code saying that it's generated code for wasi r=MarkMcCaskey a=MarkMcCaskey
Co-authored-by: Mark McCaskey <mark@wasmer.io>
776: Add test for closing wasi preopen fd r=MarkMcCaskey a=MarkMcCaskey
As discussed in WASI, we should be able to close preopen fds
Co-authored-by: Mark McCaskey <mark@wasmer.io>
742: Bump structopt from 0.2.18 to 0.3.0 r=MarkMcCaskey a=dependabot-preview[bot]
Bumps [structopt](https://github.com/TeXitoi/structopt) from 0.2.18 to 0.3.0.
<details>
<summary>Changelog</summary>
*Sourced from [structopt's changelog](https://github.com/TeXitoi/structopt/blob/master/CHANGELOG.md).*
> # v0.3.0 (2019-08-30)
>
> ## Breaking changes
>
> ### Bump minimum rustc version to 1.36 by [@​TeXitoi](https://github.com/TeXitoi)
> Now `rustc` 1.36 is the minimum compiler version supported by `structopt`,
> it likely won't work with older compilers.
>
> ### Remove "nightly" feature
> Once upon a time this feature had been used to enable some of improvements
> in `proc-macro2` crate that were available only on nightly. Nowadays this feature doesn't
> mean anything so it's now removed.
>
> ### Support optional vectors of arguments for distinguishing between `-o 1 2`, `-o` and no option provided at all by [@​sphynx](https://github.com/sphynx) ([#180](https://github-redirect.dependabot.com/TeXitoi/structopt/issues/188)).
>
> ```rust
> #[derive(StructOpt)]
> struct Opt {
> #[structopt(long)]
> fruit: Option<Vec<String>>,
> }
>
> fn main() {
> assert_eq!(Opt::from_args(&["test"]), None);
> assert_eq!(Opt::from_args(&["test", "--fruit"]), Some(vec![]));
> assert_eq!(Opt::from_args(&["test", "--fruit=apple orange"]), Some(vec!["apple", "orange"]));
> }
> ```
>
> If you need to fall back to the old behavior you can use a type alias:
> ```rust
> type Something = Vec<String>;
>
> #[derive(StructOpt)]
> struct Opt {
> #[structopt(long)]
> fruit: Option<Vec<String>>,
> }
> ```
>
> ### Change default case from 'Verbatim' into 'Kebab' by [@​0ndorio](https://github.com/0ndorio) ([#202](https://github-redirect.dependabot.com/TeXitoi/structopt/issues/202)).
> `structopt` 0.3 uses field renaming to deduce a name for long options and subcommands.
>
> ```rust
> #[derive(StructOpt)]
> struct Opt {
> #[structopt(long)]
> http_addr: String, // will be renamed to `--http-addr`
>
> #[structopt(subcommand)]
></tr></table> ... (truncated)
</details>
<details>
<summary>Commits</summary>
- [`673dbcc`](673dbcc910) Bump minimum rustc version to 1.36
- [`b57dde1`](b57dde1923) Update dependencies ([#227](https://github-redirect.dependabot.com/TeXitoi/structopt/issues/227))
- [`8830771`](8830771a60) Update documentation and changelog ([#236](https://github-redirect.dependabot.com/TeXitoi/structopt/issues/236))
- [`6bd1a69`](6bd1a69bbc) Update keyvalue example ([#234](https://github-redirect.dependabot.com/TeXitoi/structopt/issues/234))
- [`73db781`](73db7813de) Update raw_bool_literal.rs ([#231](https://github-redirect.dependabot.com/TeXitoi/structopt/issues/231))
- [`2363815`](236381545d) Update changelog
- [`dc5ec7a`](dc5ec7aeec) Emit error about `raw` removal
- [`a91109c`](a91109c3db) Change behavior of `about/author/version` and ad `no_version`
- [`5dfa606`](5dfa60660d) Now error messages highlight the error location ([#225](https://github-redirect.dependabot.com/TeXitoi/structopt/issues/225))
- [`94946c3`](94946c3b5f) Add documentation for `env` ([#221](https://github-redirect.dependabot.com/TeXitoi/structopt/issues/221))
- Additional commits viewable in [compare view](https://github.com/TeXitoi/structopt/compare/v0.2.18...v0.3.0)
</details>
<br />
[](https://dependabot.com/compatibility-score.html?dependency-name=structopt&package-manager=cargo&previous-version=0.2.18&new-version=0.3.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>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
Co-authored-by: Mark McCaskey <mark@wasmer.io>
756: feat(runtime-c-api) Allow to call `wasmer_export_func_call` with null inputs and a 0 arity r=syrusakbary a=Hywan
Fix#753
This PR allows to call `wasmer_export_func_call` with inputs set to NULL, and an arity of 0. It avoids to create an empty inputs array. So basically:
```c
wasmer_export_func_call(exported_function, NULL, 0, …, …);
```
instead of:
```c
wasmer_value_t inputs = {};
wasmer_export_func_call(exported_function, inputs, 0, …, …);
```
This PR also updates the test suite for exports. Instead of just the famous `sum` function, we now test more functions, so that all Wasm types are covered, including void functions.
Finally, this PR updates the `wasmer_export_func_call` signature to forbid negative arities.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
726: Add serialization for WASI state r=MarkMcCaskey a=MarkMcCaskey
part of #700
Due to the trait objects from #583 , we can't use `serde` derive for this or use serde traits directly, we have to do some custom serialization (edit: luckily there's a crate for this: `typetag`)
Co-authored-by: Mark McCaskey <mark@wasmer.io>
Co-authored-by: Mark McCaskey <markmccaskey@users.noreply.github.com>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
This patch changes the list of language integrations into a table, which includes:
* The author of the language integrations (to show whether its community-made),
* The maintenance status (based on Cargo vocabulary),
* Last release badge,
* Number of Github stars.
731: Always flush when writing, even if we get invalid pointers r=MarkMcCaskey a=MarkMcCaskey
Not exactly an "invalid pointer" but, we were seeing an iovec of length 0 passed in which was causing `__WASI_EFAULT` which was preventing things from flushing properly.
While I was fixing this, I decided to clean it up and make the behavior more obvious by creating a wrapper function.
Co-authored-by: Mark McCaskey <mark@wasmer.io>
708: runtime-c-api: not installing cranelift if not necessary r=Hywan a=YaronWittenstein
having `default-features = false` lets us install the `runtime-c-api` with `default-backend-singlepass` without installing also `cranelift`
Co-authored-by: Yaron Wittenstein <yaron.wittenstein@gmail.com>
566: doc(runtime-c-api) Document and reorganize `exports.rs`. r=Hywan a=Hywan
This patch moves all structs at the beginning of the file, and
documents them.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
663: Bump nix from 0.14.1 to 0.15.0 r=Hywan a=dependabot-preview[bot]
Bumps [nix](https://github.com/nix-rust/nix) from 0.14.1 to 0.15.0.
<details>
<summary>Changelog</summary>
*Sourced from [nix's changelog](https://github.com/nix-rust/nix/blob/master/CHANGELOG.md).*
> ## [0.15.0] - 10 August 2019
> ### Added
> - Added `MSG_WAITALL` to `MsgFlags` in `sys::socket`.
> ([#1079](https://github-redirect.dependabot.com/nix-rust/nix/pull/1079))
> - Implemented `Clone`, `Copy`, `Debug`, `Eq`, `Hash`, and `PartialEq` for most
> types that support them. ([#1035](https://github-redirect.dependabot.com/nix-rust/nix/pull/1035))
> - Added `copy_file_range` wrapper
> ([#1069](https://github-redirect.dependabot.com/nix-rust/nix/pull/1069))
> - Add `mkdirat`.
> ([#1084](https://github-redirect.dependabot.com/nix-rust/nix/pull/1084))
> - Add `posix_fadvise`.
> ([#1089](https://github-redirect.dependabot.com/nix-rust/nix/pull/1089))
> - Added `AF_VSOCK` to `AddressFamily`.
> ([#1091](https://github-redirect.dependabot.com/nix-rust/nix/pull/1091))
> - Add `unlinkat`
> ([#1058](https://github-redirect.dependabot.com/nix-rust/nix/pull/1058))
> - Add `renameat`.
> ([#1097](https://github-redirect.dependabot.com/nix-rust/nix/pull/1097))
>
> ### Changed
> - Support for `ifaddrs` now present when building for Android.
> ([#1077](https://github-redirect.dependabot.com/nix-rust/nix/pull/1077))
> - Minimum supported Rust version is now 1.31.0
> ([#1035](https://github-redirect.dependabot.com/nix-rust/nix/pull/1035))
> ([#1095](https://github-redirect.dependabot.com/nix-rust/nix/pull/1095))
> - Now functions `statfs()` and `fstatfs()` return result with `Statfs` wrapper
> ([#928](https://github-redirect.dependabot.com/nix-rust/nix/pull/928))
>
> ### Fixed
> - Enabled `sched_yield` for all nix hosts.
> ([#1090](https://github-redirect.dependabot.com/nix-rust/nix/pull/1090))
>
> ### Removed
</details>
<details>
<summary>Commits</summary>
- See full diff in [compare view](https://github.com/nix-rust/nix/commits)
</details>
<br />
[](https://dependabot.com/compatibility-score.html?dependency-name=nix&package-manager=cargo&previous-version=0.14.1&new-version=0.15.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>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
702: Add support for shared memory in Wasm. r=nlewycky a=nlewycky
Add support for memory regions with the shared flag. These are part of the threads proposal.
- Add new `--enable-threads` flags and pass it through to wasmparser.rs and wabt (for .wat files).
- Enable `--enable-threads` when parsing spectests. Enables the shared memory region in `simd.wast`.
- Adds `atomic.wast`, the spec test for the threads proposal. With the LLVM backend, all tests pass.
- Removes the `runtime-core/src/memory/static_` directory since there's no need for it to include two implementations. We use the same implementation of static memory for shared and unshared static memory.
- Implements the atomic instructions in the LLVM backend. However, `atomic.load` and `atomic.store` are provided **with no atomicity.** The rmw and cmpxchg instructions are sequentially consistent.
- `atomic.notify` and `atomic.wait` are unimplemented.
Co-authored-by: Nick Lewycky <nick@wasmer.io>
703: Fix compilation on AArch64 Linux. r=losfair a=losfair
This only fixes compilation. Cranelift still reports many `not yet implemented` on AArch64.
Co-authored-by: losfair <zhy20000919@hotmail.com>
666: Bump serde_bytes from 0.11.1 to 0.11.2 r=Hywan a=dependabot-preview[bot]
Bumps [serde_bytes](https://github.com/serde-rs/bytes) from 0.11.1 to 0.11.2.
<details>
<summary>Release notes</summary>
*Sourced from [serde_bytes's releases](https://github.com/serde-rs/bytes/releases).*
> ## 0.11.2
> - Support "alloc" feature on stable Rust 1.36+ ([#16](https://github-redirect.dependabot.com/serde-rs/bytes/issues/16), thanks [@​martindisch](https://github.com/martindisch))
</details>
<details>
<summary>Commits</summary>
- [`4856e26`](4856e2611f) Release 0.11.2
- [`1d40bb5`](1d40bb5994) Merge pull request [#16](https://github-redirect.dependabot.com/serde-rs/bytes/issues/16) from martindisch/alloc-stable
- [`a626ecc`](a626ecce86) Remove unstable feature attribute for alloc crate
- See full diff in [compare view](https://github.com/serde-rs/bytes/compare/0.11.1...0.11.2)
</details>
<br />
[](https://dependabot.com/compatibility-score.html?dependency-name=serde_bytes&package-manager=cargo&previous-version=0.11.1&new-version=0.11.2)
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>
695: Bump serde from 1.0.98 to 1.0.99 r=Hywan a=dependabot-preview[bot]
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.98 to 1.0.99.
<details>
<summary>Release notes</summary>
*Sourced from [serde's releases](https://github.com/serde-rs/serde/releases).*
> ## v1.0.99
> - Update Syn dependency to 1.0.
>
> *Note: This raises the minimum required compiler version for serde_derive from rustc 1.15 to rustc 1.31. The minimum required compiler version for serde remains at rustc 1.13.*
</details>
<details>
<summary>Commits</summary>
- [`192f5cd`](192f5cd647) Release 1.0.99
- [`7dceee6`](7dceee64fe) Merge pull request [#1591](https://github-redirect.dependabot.com/serde-rs/serde/issues/1591) from dtolnay/up
- [`8ad6ae7`](8ad6ae71c6) Update serde_derive minimum rustc version to 1.31
- [`3ea85a2`](3ea85a28cf) Update to syn/quote 1.0
- [`273ecdb`](273ecdb786) Update ui tests on nightly-2019-08-16
- [`de40eb7`](de40eb7306) Update serde_derive to use question mark
- [`b9c4407`](b9c44073ce) Update serde_test to use question mark
- [`d6e5947`](d6e5947ad2) Suppress warnings about try! macro
- [`668651e`](668651ee01) Format with rustfmt 2019-07-30
- [`fb1cacc`](fb1cacc10e) Update Attr structs to hold symbols
- Additional commits viewable in [compare view](https://github.com/serde-rs/serde/compare/v1.0.98...v1.0.99)
</details>
<br />
[](https://dependabot.com/compatibility-score.html?dependency-name=serde&package-manager=cargo&previous-version=1.0.98&new-version=1.0.99)
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>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
680: Fix singlepass error when no function code present r=bjfish a=bjfish
Co-authored-by: Brandon Fish <brandon.j.fish@gmail.com>
Co-authored-by: Brandon Fish <bjfish@users.noreply.github.com>
693: Bump cc from 1.0.38 to 1.0.40 r=Hywan a=dependabot-preview[bot]
Bumps [cc](https://github.com/alexcrichton/cc-rs) from 1.0.38 to 1.0.40.
<details>
<summary>Commits</summary>
- [`6ad3da7`](6ad3da7558) Bump to 1.0.40
- [`9fcdab9`](9fcdab9102) Fix a bad merge typo
- [`fa98eb0`](fa98eb054d) Bump to 1.0.39
- [`0187762`](0187762feb) Add CUDA support for MSVC ([#426](https://github-redirect.dependabot.com/alexcrichton/cc-rs/issues/426))
- [`5c0dc67`](5c0dc67db0) Merge pull request [#433](https://github-redirect.dependabot.com/alexcrichton/cc-rs/issues/433) from turboladen/feature/config-ios-version-min
- [`f99a424`](f99a4248b7) Merge pull request [#432](https://github-redirect.dependabot.com/alexcrichton/cc-rs/issues/432) from BaoshanPang/master
- [`5ab556e`](5ab556e5f9) use wr-c++ instead of vx-cxx
- [`bae28ef`](bae28efb21) Detect and use `IPHONEOS_DEPLOYMENT_TARGET` for the `-mi*os-version-min` flag
- [`13e04b1`](13e04b1ec0) Merge pull request [#430](https://github-redirect.dependabot.com/alexcrichton/cc-rs/issues/430) from laanwj/2019_08_rv_nopic
- [`c7cd5dd`](c7cd5ddf6c) Merge pull request [#429](https://github-redirect.dependabot.com/alexcrichton/cc-rs/issues/429) from laanwj/2019_08_rv_correct_abi
- Additional commits viewable in [compare view](https://github.com/alexcrichton/cc-rs/compare/1.0.38...1.0.40)
</details>
<br />
[](https://dependabot.com/compatibility-score.html?dependency-name=cc&package-manager=cargo&previous-version=1.0.38&new-version=1.0.40)
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>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
689: Replace wasmer_runtime_code::memory::Atomic with std::sync::atomic atomics. r=nlewycky a=nlewycky
This means we lose op_new(), op_weak() and proxy() from the interface.
Co-authored-by: Nick Lewycky <nick@wasmer.io>
Co-authored-by: nlewycky <nick@wasmer.io>
671: Add wasi::poll_oneoff for Unix r=MarkMcCaskey a=MarkMcCaskey
Part of #570
Co-authored-by: Mark McCaskey <mark@wasmer.io>
Co-authored-by: Mark McCaskey <markmccaskey@users.noreply.github.com>
677: Mark memory.size VM intrinsics as not modifying state, and throw.trap/breakpoint as functions which do not return. r=syrusakbary a=nlewycky
Co-authored-by: Nick Lewycky <nick@wasmer.io>
657: Spectest Fixes r=bjfish a=bjfish
- Invalid table size for elems should produce link error
- Remove filter which prevents initializer offset check
Co-authored-by: Brandon Fish <brandon.j.fish@gmail.com>
Co-authored-by: Brandon Fish <bjfish@users.noreply.github.com>
649: Fix some spectest imports and namespace_table issue r=bjfish a=bjfish
Co-authored-by: Brandon Fish <brandon.j.fish@gmail.com>
Co-authored-by: Brandon Fish <bjfish@users.noreply.github.com>
647: Add support for backend flags. Backend flags are opaque to src/bin/wasmer.rs. r=nlewycky a=nlewycky
Use them to implement three features in the LLVM backend, getting a valid ELF object file, the post-optimization LLVM IR and the pre-optimization LLVM IR.
Presently they are also global to the backend which is not ideal.
Co-authored-by: Nick Lewycky <nicholas@mxc.ca>
Use them to implement three features in the LLVM backend, getting a valid ELF object file, the post-optimization LLVM IR and the pre-optimization LLVM IR.
Presently they are also global to the backend which is not ideal.
645: Fix a bug where we would fail to find llvm-config-M or llvm-config-M-N when llvm-sys would. r=nlewycky a=nlewycky
Fix another bug where we wouldn't rebuild when certain environment variables changed.
Update to match features in newer llvm-sys.
Co-authored-by: Nick Lewycky <nicholas@mxc.ca>
640: Protect::ReadWriteExec is readable and writable. r=syrusakbary a=nlewycky
Also assert that page size is a power of two in two places we assume it is.
Co-authored-by: Nick Lewycky <nick@wasmer.io>
608: Implement more wasi syscalls r=MarkMcCaskey a=MarkMcCaskey
Co-authored-by: Mark McCaskey <mark@wasmer.io>
Co-authored-by: Mark McCaskey <markmccaskey@users.noreply.github.com>
517: add instance creation benchmark r=syrusakbary a=MarkMcCaskey
a benchmark for creating a bunch of instances
Co-authored-by: Mark McCaskey <mark@wasmer.io>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
More info of the failure: https://circleci.com/gh/wasmerio/wasmer/11663
```
cargo test --manifest-path lib/middleware-common/Cargo.toml --release --features llvm
Compiling wasmer-llvm-backend v0.6.0 (/home/circleci/project/lib/llvm-backend)
Compiling inkwell v0.1.0 (https://github.com/wasmerio/inkwell?branch=llvm8-0#4c5359e5)
Compiling wasmer-middleware-common v0.6.0 (/home/circleci/project/lib/middleware-common)
Finished release [optimized] target(s) in 14.54s
Running target/release/deps/wasmer_middleware_common-3c263452f3b7d07e
running 2 tests
test metering::tests::test_points_reduced_after_call ... test metering::tests::test_points_reduced_after_call has been running for over 60 seconds
test metering::tests::test_traps_after_costly_call ... test metering::tests::test_traps_after_costly_call has been running for over 60 seconds
Makefile:59: recipe for target 'middleware-llvm' failed
make: *** [middleware-llvm] Terminated
Too long with no output (exceeded 10m0s)
```
623: Add support for (register) command in spec tests and enable importing mutable globals. r=nlewycky a=nlewycky
Enable the part of the simd spec tests that now pass.
Co-authored-by: Nick Lewycky <nick@wasmer.io>
616: runtime-c-api: create the import object separately from instance instantiation r=bjfish a=YaronWittenstein
Creating an `import object` separately from the `wasmer` instance, let's us build the import object incrementally and support the use-case of having import functions (a.k.a `vmcalls`) implemented in 2 programming languages (Rust and Golang for example) and consumed by the same `wasmer` instance.
Co-authored-by: Yaron Wittenstein <yaron.wittenstein@gmail.com>
Co-authored-by: Brandon Fish <bjfish@users.noreply.github.com>
Before C++17, throw() was equivalent to wrapping the function in a try {} catch
{ std::unexpected(); }. In C++17 throw() was made equivalent to noexcept and
in C++20 throw() was removed.
618: Implement InternalEvent::Breakpoint in the llvm backend. r=nlewycky a=nlewycky
Enable now-working metering unit tests when run with the llvm backend.
Co-authored-by: Nick Lewycky <nick@wasmer.io>
Co-authored-by: nlewycky <nick@wasmer.io>
The feed_event() function is called for every wasm binary instruction.
Let's optimize it by storing FunctionEnvironment object in
CraneliftFunctionCodeGenerator, rather than constructing it for every
feed_event() invocation.
This change reduces the time to run "ngix compile" benchmark by 68%:
Before:
nginx compile time: [1.4152 s 1.4186 s 1.4222 s]
Found 1 outliers among 10 measurements (10.00%)
1 (10.00%) high mild
After:
nginx compile time: [447.76 ms 448.32 ms 448.80 ms]
change: [-68.542% -68.440% -68.352%] (p = 0.00 < 0.05)
Performance has improved.
I assume some of the clone() calls are very expensive (Vec::clone(),
likely). I did see libc malloc()/free() high up in "perf top" profiles,
which are eliminted by this change.
I also looked into eliminating FunctionBuilder construction from
feed_event(). That turns out to be painful on lifetime rules because it
borrows bunch of other objects, so I am leaving it for someone who knows
the code better than I do.
609: Update dependencies r=syrusakbary a=syrusakbary
This PR does:
* Update dependencies (to explicitly use only one version of a package, in all the places we use it)
* Remove explicit dependency on `hashbrown` since it's already adopted as the default algorithm for `HashMap`
* Small fixes on code to use latest versions
Co-authored-by: Syrus <me@syrusakbary.com>
606: Cleanup Wasmer r=syrusakbary a=syrusakbary
This PR moves a few things around trying to make Wasmer more compelling to use:
* Two less directories on the root (`fuzz` is moved to the `lib/` folder, `media` is moved to `src/installer` folder)
* Improved README
* Moved `ARCHITECTURE.md` into the `docs` folder.
Co-authored-by: Syrus <me@syrusakbary.com>
590: wasmer-c-api: error visibility changes r=bjfish a=YaronWittenstein
I've changed the visibility to `public` in order to support code like here:
https://github.com/spacemeshos/svm/blob/52f04b52cc/crates/svm-wasmer-c-api/src/macros.rs#L150
@syrusakbary @bjfish @Hywan
Co-authored-by: Yaron Wittenstein <yaron.wittenstein@gmail.com>
Co-authored-by: Brandon Fish <bjfish@users.noreply.github.com>
589: wasmer-c-api-changes: making `wasmer_byte_array` fields `public` r=bjfish a=YaronWittenstein
I've added this PR since I've tests that need access to `wasmer_byte_array` field.
Here is an example:
52f04b52cc/crates/svm-wasmer-c-api/tests/c_api.rs (L96)
```rust
unsafe fn cast_wasmer_byte_array_to_string(wasmer_bytes: &wasmer_byte_array) -> String {
let slice: &[u8] =
std::slice::from_raw_parts(wasmer_bytes.bytes, wasmer_bytes.bytes_len as usize);
if let Ok(s) = std::str::from_utf8(slice) {
s.to_string()
} else {
panic!("error converting `wasmer_byte_array` to string")
}
}
```
@syrusakbary @bjfish @Hywan
Co-authored-by: Yaron Wittenstein <yaron.wittenstein@gmail.com>
Co-authored-by: Brandon Fish <bjfish@users.noreply.github.com>
600: Remove all uses of mem::uninitialized for Rust 1.38 r=syrusakbary a=MarkMcCaskey
Co-authored-by: Mark McCaskey <mark@wasmer.io>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
595: Add useful functions for external use of WASI filesystem r=MarkMcCaskey a=MarkMcCaskey
part of #583
Co-authored-by: Mark McCaskey <mark@wasmer.io>
Co-authored-by: Mark McCaskey <markmccaskey@users.noreply.github.com>
594: Improvement cache in Windows r=syrusakbary a=syrusakbary
Caching was disabled on Windows, but can be re-enabled easily by improving the folder cache naming.
Reason why caching was disabled on Windows: We use a very long string (64 chars) for the wasmer version (hash). But we can use the version directly (no need to hashing)
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
587: Use --enable-simd to control whether SIMD is enabled in the wasmparser. r=nlewycky a=nlewycky
Before this change, 'wasmer run --backend=llvm some-simd.wasm' would run without complaint.
Also, note that the flag is not part of the cache key, so after any successful run, we can run it again without passing the flag.
Co-authored-by: Nick Lewycky <nicholas@mxc.ca>
Co-authored-by: Nick Lewycky <nick@wasmer.io>
Co-authored-by: nlewycky <nick@wasmer.io>
Before this change, 'wasmer run --backend=llvm some-simd.wasm' would run without complaint.
Also, note that the flag is not part of the cache key, so after any successful run, we can run it again without passing the flag.
Building Wasmer is bit of a pain, because it requires Rust nightly, and
bunch of OS specific packages.
To make building easier, this adds a "build" script at the top-level
directory, which can be used to build Wasmer within a Docker sandbox
that has all the necessary dependencies installed. The build environment
is based on latest Ubuntu 19.04.
You first need to build a Docker image of the sandbox:
docker build --file Dockerfile.build --tag wasmer-build .
Then, to build Wasmer, run:
./build make
To test Wasmer, run:
./build make test
and so on.
You can also drop into a shell within the Docker with:
./build
The "build" script bind mounts current directory as "/wasmer" in the
Docker container, which allows inspecting the build contents like you
had built them on your local machine.
For future improvements, we should consider:
- Consolidation with existing Dockerfile (that is used for Circle CI)
- Publishing the build sandbox image on Docker Hub so that people
don't have to build it themselves
- Moving dependency installation to separate script, which can be
reused outside of the Docker sandbox.
The work has been inspired by "devtool" in the Firecracker project:
https://github.com/firecracker-microvm/firecracker/blob/master/tools/devtool
and "dbuild" in the Scylla project:
https://github.com/scylladb/scylla/blob/master/tools/toolchain/dbuild
Not handled here is @llvm.minnum and @llvm.maxnum which should be replaced with
@llvm.minimum and @llvm.maximum, but using those currently leads to LLVM backend
fatal errors.
586: Fixes case with empty module, handle case with no signatures r=bjfish a=bjfish
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:373:21
Co-authored-by: Brandon Fish <brandon.j.fish@gmail.com>
I expect that the V128 changes have broken kernel-loader because I haven't taken care to ensure that the interface was updated the same way on both sides.
555: wasi filesystem rewrite + implementation of many syscalls r=MarkMcCaskey a=MarkMcCaskey
This lets the go compiler print its help text...
The rest of symlink code to follow...
This PR also does a major refactor of the file system code. So we'll have to add more tests to be sure we didn't break anything
Co-authored-by: Mark McCaskey <mark@wasmer.io>
Co-authored-by: Mark McCaskey <markmccaskey@users.noreply.github.com>
These is one test failure remaining with V128 global variables.
* Fix trunc_sat. We need both the largest float that can be converted to an int
and the largest int, they are not the same number.
* Implement calling of functions that take V128 by passing in two i64's.
* Improve support for V128 in spectests. Parse binary modules with the same
features as the outer spectest. Fix compilation error involving Result in
emitted .rs file. Handle V128 in more cases when producing .rs file. Parse
the wast script with SIMD enabled.
* Adjust the WAVM spectest so that it parses with WABT and mostly passes with
wasmer. Wabt is particular about ints not having decimal places and floats
having decimal places. Wasmer does not support mutable globals or shared
memory. Tests of shuffles are disabled. Some assert_invalid tests that wabt
won't even parse are disabled.
"Then thou must count to three. Three shall be the number of the counting and the number of the counting shall be three. Four shalt thou not count, neither shalt thou count two, excepting that thou then proceedeth to three."
559: Initial commit of a fuzzer. Run with "cargo fuzz run simple_instantiate". r=nlewycky a=nlewycky
Used to discover issue #558.
We'll probably want to reconsider the default .gitignore of the artifacts and corpus directories. The fuzzer wastes a lot of time not having even a single exampel of a valid .wasm file to start with.
Co-authored-by: Nick Lewycky <nicholas@mxc.ca>
Co-authored-by: nlewycky <nicholas@mxc.ca>
Used to discover issue #558.
We'll probably want to reconsider the default .gitignore of the artifacts and corpus directories. The fuzzer wastes a lot of time not having even a single exampel of a valid .wasm file to start with.
557: Update loader-kernel feature name, fix compilation track state r=syrusakbary a=bjfish
- feature name `loader:kernel` -> `loader-kernel` (no colons)
- add track state `false` to loader kernel default, @losfair let me know if this default is incorrect
- cargo fmt
Co-authored-by: Brandon Fish <brandon.j.fish@gmail.com>
552: Allow disabling state tracking for faster startup. r=bjfish a=losfair
~10% compilation speedup when `--no-track-state` is enabled.
Co-authored-by: losfair <zhy20000919@hotmail.com>
551: Try a new list of optimization passes. r=nlewycky a=nlewycky
A few notes:
a) the inliner doesn't help because all the calls are indirect and not even opt -O2 can figure out which functions they're actually calling.
b) aggressive instruction combining is not a super-set of the instruction combiner. Instcombine is made up of a large number (probably 10,000s) of patterns, and some particularly slow ones were taken out and moved to the aggressive instruction combiner. Aggressive instcombine *only* runs that handful of optimizations, which fired zero times on our example wasm files.
c) NewGVN is not ready for production, it has asserts that fire when building sqlite or cowsay. This is why sqlite didn't build with the llvm backend.
d) Scalar-replacement-of-aggregates (sroa) is a strict superset of promote-memory-to-registers (mem2reg), and you probably want sroa because it's usually faster. It also fires 10,000s more times than mem2reg on lua.wasm.
e) Aggressive-dead-code-elimination was only deleting as much regular dead-code-elimination, but is slower because it depends on a postdominator tree (PDT) analysis that. Other passes don't need PDT so we'll have to build it for just this one pass (as opposed to regular dominator-tree which is reused by many passes). I've replaced this with bit-tracking dead-code-elimination which deletes more code than dce/adce.
Co-authored-by: Nick Lewycky <nicholas@mxc.ca>
Co-authored-by: nlewycky <nicholas@mxc.ca>
Fix typo in function name. Use two fcmp instructions instead of unpacking the bits of the IEEE float and using integer arithmetic to determine details about its value.
A few notes:
a) the inliner doesn't help because all the calls are indirect and not even opt -O2 can figure out which functions they're actually calling.
b) aggressive instruction combining is not a super-set of the instruction combiner. Instcombine is made up of a large number (probably 10,000s) of patterns, and some particularly slow ones were taken out and moved to the aggressive instruction combiner. Aggressive instcombine *only* runs that handful of optimizations, which fired zero times on our example wasm files.
c) NewGVN is not ready for production, it has asserts that fire when building sqlite or cowsay. This is why sqlite didn't build with the llvm backend.
d) Scalar-replacement-of-aggregates (sroa) is a strict superset of promote-memory-to-registers (mem2reg), and you probably want sroa because it's usually faster. It also fires 10,000s more times than mem2reg on lua.wasm.
e) Aggressive-dead-code-elimination was only deleting as much regular dead-code-elimination, but is slower because it depends on a postdominator tree (PDT) analysis that. Other passes don't need PDT so we'll have to build it for just this one pass (as opposed to regular dominator-tree which is reused by many passes). I've replaced this with bit-tracking dead-code-elimination which deletes more code than dce/adce.
543: update version numbers to 0.5.5 r=MarkMcCaskey a=MarkMcCaskey
544: Use bitcast instead of alloca+load+ptrcast+store sequence. r=MarkMcCaskey a=nlewycky
Co-authored-by: Mark McCaskey <mark@wasmer.io>
Co-authored-by: Mark McCaskey <markmccaskey@users.noreply.github.com>
Co-authored-by: Nick Lewycky <nick@wasmer.io>
Co-authored-by: nlewycky <nick@wasmer.io>
536: Update cache key generation to use backend compiler name too r=MarkMcCaskey a=MarkMcCaskey
Co-authored-by: Mark McCaskey <mark@wasmer.io>
Co-authored-by: Mark McCaskey <markmccaskey@users.noreply.github.com>
529: update to version 0.5.4 r=syrusakbary a=MarkMcCaskey
Co-authored-by: Mark McCaskey <mark@wasmer.io>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
530: Improved clarity on tests r=syrusakbary a=syrusakbary
Improved clarity on tests.
* This PR improves the [Makefile making it much easier to test and readable](685ed53070/Makefile).
* It also assumes we are building always with `+nightly`, so the cache can be reused in the CI.
* It improves the testing section in the [main README](685ed53070/README.md (testing))
Co-authored-by: Brandon Fish <brandon.j.fish@gmail.com>
Co-authored-by: Syrus <me@syrusakbary.com>
525: Fix build warnings in wasmer and kwasmd r=bjfish a=bjfish
Co-authored-by: Brandon Fish <brandon.j.fish@gmail.com>
Co-authored-by: Brandon Fish <bjfish@users.noreply.github.com>
489: Su Engine: Decoding and encoding runtime state. r=losfair a=losfair
This PR implements a managed runtime that is able to suspend a running WebAssembly program at arbitrary point in time, decode its machine state (registers and stack) into the corresponding WebAssembly abstract state (call frames, locals and the value stack), and encode the abstract state back into machine state for resuming execution later.
Features enabled by this PR include:
- Tier (compiler backend) switching at runtime.
- Debugging with backtraces and local variables.
- Suspending to disk.
- Live migration.
The name "Su" corresponds to 「溯」 in Chinese, originating from 「溯洄从之」 in The Book of Songs.
Co-authored-by: losfair <zhy20000919@hotmail.com>
A clear and concise description of what the bug is.
Copy and paste the result of executing the following in your shell, so we can know the version of wasmer, Rust (if available) and architecture of your environment.
-->
```bash
```sh
echo "`wasmer -V` | `rustc -V` | `uname -m`"
```
### Steps to reproduce
### Steps to reproduce
<!--
Include steps that will help us recreate the issue.
For example,
1. Go to '…'
2. Compile with '…'
3. Run '…'
4. See error
If applicable, add a link to a test case (as a zip file or link to a repository we can clone).
-->
### Expected behavior
A clear and concise description of what you expected to happen.
<!-- A clear and concise description of what you expected to happen. -->
### Actual behavior
<!--
A clear and concise description of what actually happened.
If applicable, add screenshots to help explain your problem.
-->
### Additional context
Add any other context about the problem here.
<!-- Add any other context about the problem here. -->
- Compiler backends: for compiling Wasm binaries to machine code ([more info here](https://github.com/wasmerio/wasmer/tree/master/lib#backends))
- [wabt](https://github.com/pepyakin/wabt-rs): for transforming `.wast` files to `.wasm` and running WebAssembly spec tests
- [wasmparser](https://github.com/yurydelendik/wasmparser.rs): for parsing the `.wasm` files and translating them into WebAssembly modules
## How Wasmer works
The first time you run `wasmer run myfile.wasm`, Wasmer will:
- Check if is a `.wast` file, and if so, transform it to `.wasm`
- Check that the provided binary is a valid WebAssembly one, i.e. its binary format starts with `\0asm`.
- Parse it with `wasmparser` and generate a `Module` from it
- Generate an `Instance` with the proper `import_object` (that means, if is detected to be an Emscripten file, it will add the Emscripten expected imports)
- Try to call the WebAssembly `start` function, or if it does not exist, try to search for the function that is exported as `main`
Find a more detailed explanation of the process below:
### Phase 1: Generating the Module / IR
As the WebAssembly file is being parsed, it will read the sections in the WebAssembly file (memory, table, function, global and element definitions) using the `Module` (or `ModuleEnvironment`) as the structure to hold this information.
However, the real IR initialization happens while a function body is being parsed/created, i.e. when the parser reads the section `(func ...)`.
While the function body is being parsed the corresponding `FuncEnvironment` methods will be called.
So for example, if the function is using a table, the `make_table` method within that `FuncEnvironment` will be called.
Each of this methods will return the corresponding IR representation.
The `Module` creation will be finished once the parsing is done, and will hold all the function IR as well as the imports/exports.
### Phase 2: Compiling the Functions
Now that we have a `Module` (and all its definitions living in `ModuleInfo`) we should be ready to compile its functions.
Right now, the `Instance` is the one in charge of compiling this functions into machine code.
When creating the `Instance`, each of the function bodies (IR) will be compiled into machine code that our architecture can understand.
Once we have the compiled values, we will push them to memory and mark them as executable, so we can call them from anywhere in our code.
#### Relocations
Sometimes the functions that we generate will need to call other functions, but the generated code has no idea how to link these functions together.
For example, if a function `A` is calling function `B` (that means is having a `(call b)` on its body) while compiling `A` we will have no idea where the function `B` lives on memory (as `B` is not yet compiled nor pushed into memory).
For that reason, we will start collecting all the calls that function `A` will need to do under the hood, and save it's offsets.
We do that, so we can patch the function calls after compilation, to point to the correct memory address.
Note: sometimes this functions rather than living in the same WebAssembly module, they will be provided as import values.
#### Traps
There will be other times where the function created will cause a trap (for example, if executing `0 / 0`).
When this happens, we will save the offset of the trap (while the function is being compiled).
Thanks to that when we execute a function, if it traps (that means a sigaction is called), we would be able to backtrack from a memory address to a specific trap case.
### Phase 3: Finalizing
Once all the functions are compiled and patched with the proper relocations addresses, we will initialize the corresponding tables (where we save the pointers to all the exported functions), memories and globals that the instance need.
Once that's finished, we will have a `Instance` function that will be ready to execute any function we need.
## Emscripten
Wasmer's Emscripten integration tries to wrap (and emulate) all the different syscalls that Emscripten needs.
We provide this integration by filling the `import_object` with the Emscripten functions, while instantiating the WebAssembly Instance.
## WASI
Wasmer's WASI integration implements all the different syscalls that WASI needs.
We provide this integration by filling the `import_object` with the WASI functions, while instantiating the WebAssembly Instance.
In order to build the best WebAssembly runtime it's our duty to see how other runtimes are approaching the same space
and get inspired from them on the things that they got right, so Wasmer and its community can benefit from a solid
foundation.
Wasmer is a community effort and makes use of code from various other
projects. Listed below are notable sections of code that are licensed
from other projects and the relevant license of those projects.
These are the different project that we used as inspiration:
These are the projects that were used as inspiration and/or that we are using code from:
- [Nebulet](https://github.com/nebulet/nebulet): as the base for creating a great Rust WebAssembly runtime
- [WAVM](https://github.com/wavm/wavm): for their great integration and testing framework
- [greenwasm](https://github.com/Kimundi/greenwasm): for their [spectests framework](https://github.com/Kimundi/greenwasm/tree/master/greenwasm-spectest)
- [wasmtime](https://github.com/CraneStation/wasmtime): for their [mmap implementation](https://github.com/CraneStation/wasmtime/blob/3f24098edc81cd9bf0f877fb7fba018cad0f039e/lib/runtime/src/mmap.rs)
For their [mmap implementation](https://github.com/CraneStation/wasmtime/blob/3f24098edc81cd9bf0f877fb7fba018cad0f039e/lib/runtime/src/mmap.rs), the wast test implementation and the implementation of the `__jit_debug_register_code` function
in Rust, the structure of using Cranelift with the GDB JIT
interface including implementation details regarding the structure
of generating debug information for each function with Cranelift
(for example, the sorting of the extended basic blocks before
processing the instructions), and the API for transforming DWARF
see [wasm-debug's attribution file](https://github.com/wasmerio/wasm-debug/blob/master/ATTRIBUTIONS.md)
for more information
- [stackoverflow](https://stackoverflow.com/a/45795699/1072990): to create an efficient HashMap with pair keys
- [Emscripten](https://github.com/kripken/emscripten): for emtests test sources to ensure compatibility
- [The WebAssembly spec](https://github.com/WebAssembly/spec/tree/master/test): for implementation details of WebAssembly and spectests
We would love to hear from you if you think we can take inspiration from other projects that we haven't covered here.
😊
Please let us know if you believe there is an error or omission in
All PRs to the Wasmer repository must add to this file.
Blocks of changes will separated by version increments.
## **[Unreleased]**
## 0.5.3
- [#1439](https://github.com/wasmerio/wasmer/pull/1439) Move `wasmer-interface-types` into its own repository
## 0.17.0 - 2020-05-11
- [#1401](https://github.com/wasmerio/wasmer/pull/1401) Make breaking change to `RuntimeError`: `RuntimeError` is now more explicit about its possible error values allowing for better insight into why a call into Wasm failed.
- [#1382](https://github.com/wasmerio/wasmer/pull/1382) Refactored test infranstructure (part 2)
- [#1380](https://github.com/wasmerio/wasmer/pull/1380) Refactored test infranstructure (part 1)
- [#1357](https://github.com/wasmerio/wasmer/pull/1357) Refactored bin commands into separate files
- [#1331](https://github.com/wasmerio/wasmer/pull/1331) Implement the `record` type and instrutions for WIT
- [#1345](https://github.com/wasmerio/wasmer/pull/1345) Adding ARM testing in Azure Pipelines
- [#1335](https://github.com/wasmerio/wasmer/pull/1335) Change mutability of `memory` to `const` in `wasmer_memory_data_length` in the C API
- [#1329](https://github.com/wasmerio/wasmer/pull/1329) New numbers and strings instructions for WIT
- [#1332](https://github.com/wasmerio/wasmer/pull/1332) Add option to `CompilerConfig` to force compiler IR verification off even when `debug_assertions` are enabled. This can be used to make debug builds faster, which may be important if you're creating a library that wraps Wasmer and depend on the speed of debug builds.
- [#1320](https://github.com/wasmerio/wasmer/pull/1320) Change `custom_sections` field in `ModuleInfo` to be more standards compliant by allowing multiple custom sections with the same name. To get the old behavior with the new API, you can add `.last().unwrap()` to accesses. For example, `module_info.custom_sections["custom_section_name"].last().unwrap()`.
- [#1313](https://github.com/wasmerio/wasmer/pull/1313) Add new high-level public API through `wasmer` crate. Includes many updates including:
- Minor improvement: `imports!` macro now handles no trailing comma as well as a trailing comma in namespaces and between namespaces.
- New methods on `Module`: `exports`, `imports`, and `custom_sections`.
- New way to get exports from an instance with `let func_name: Func<i32, i64> = instance.exports.get("func_name");`.
- Improved `Table` APIs including `set` which now allows setting functions directly. TODO: update this more if `Table::get` gets made public in this PR
- TODO: finish the list of changes here
- [#1303](https://github.com/wasmerio/wasmer/pull/1303) NaN canonicalization for singlepass backend.
- [#1292](https://github.com/wasmerio/wasmer/pull/1292) Experimental Support for Android (x86_64 and AArch64)
- [#1305](https://github.com/wasmerio/wasmer/pull/1305) Handle panics from DynamicFunc.
- [#1301](https://github.com/wasmerio/wasmer/pull/1301) Update supported stable Rust version to 1.41.1.
- [#1300](https://github.com/wasmerio/wasmer/pull/1300) Add support for multiple versions of WASI tests: wasitests now test all versions of WASI.
- [#1285](https://github.com/wasmerio/wasmer/pull/1285) Greatly improve errors in `wasmer-interface-types`
- [#1283](https://github.com/wasmerio/wasmer/pull/1283) Workaround for floating point arguments and return values in `DynamicFunc`s.
## 0.16.2 - 2020-03-11
- [#1294](https://github.com/wasmerio/wasmer/pull/1294) Fix bug related to system calls in WASI that rely on reading from WasmPtrs as arrays of length 0. `WasmPtr` will now succeed on length 0 arrays again.
## 0.16.1 - 2020-03-11
- [#1291](https://github.com/wasmerio/wasmer/pull/1291) Fix installation packaging script to package the `wax` command.
## 0.16.0 - 2020-03-11
- [#1286](https://github.com/wasmerio/wasmer/pull/1286) Updated Windows Wasmer icons. Add wax
- [#1284](https://github.com/wasmerio/wasmer/pull/1284) Implement string and memory instructions in `wasmer-interface-types`
- [#1272](https://github.com/wasmerio/wasmer/pull/1272) Fix off-by-one error bug when accessing memory with a `WasmPtr` that contains the last valid byte of memory. Also changes the behavior of `WasmPtr<T, Array>` with a length of 0 and `WasmPtr<T>` where `std::mem::size_of::<T>()` is 0 to always return `None`
## 0.15.0 - 2020-03-04
- [#1263](https://github.com/wasmerio/wasmer/pull/1263) Changed the behavior of some WASI syscalls to now handle preopened directories more properly. Changed default `--debug` logging to only show Wasmer-related messages.
- [#1217](https://github.com/wasmerio/wasmer/pull/1217) Polymorphic host functions based on dynamic trampoline generation.
- [#1252](https://github.com/wasmerio/wasmer/pull/1252) Allow `/` in wasi `--mapdir` wasm path.
- [#1212](https://github.com/wasmerio/wasmer/pull/1212) Add support for GDB JIT debugging:
- Add `--generate-debug-info` and `-g` flags to `wasmer run` to generate debug information during compilation. The debug info is passed via the GDB JIT interface to a debugger to allow source-level debugging of Wasm files. Currently only available on clif-backend.
- Break public middleware APIs: there is now a `source_loc` parameter that should be passed through if applicable.
- Break compiler trait methods such as `feed_local`, `feed_event` as well as `ModuleCodeGenerator::finalize`.
## 0.14.1 - 2020-02-24
- [#1245](https://github.com/wasmerio/wasmer/pull/1245) Use Ubuntu 16.04 in CI so that we use an earlier version of GLIBC.
- [#1234](https://github.com/wasmerio/wasmer/pull/1234) Check for unused excluded spectest failures.
- [#1232](https://github.com/wasmerio/wasmer/pull/1232) `wasmer-interface-types` has a WAT decoder.
## 0.14.0 - 2020-02-20
- [#1233](https://github.com/wasmerio/wasmer/pull/1233) Improved Wasmer C API release artifacts.
- [#1216](https://github.com/wasmerio/wasmer/pull/1216) `wasmer-interface-types` receives a binary encoder.
- [#1228](https://github.com/wasmerio/wasmer/pull/1228) Singlepass cleanup: Resolve several FIXMEs and remove protect_unix.
- [#1218](https://github.com/wasmerio/wasmer/pull/1218) Enable Cranelift verifier in debug mode. Fix bug with table indices being the wrong type.
- [#787](https://github.com/wasmerio/wasmer/pull/787) New crate `wasmer-interface-types` to implement WebAssembly Interface Types.
- [#1213](https://github.com/wasmerio/wasmer/pull/1213) Fixed WASI `fdstat` to detect `isatty` properly.
- [#1192](https://github.com/wasmerio/wasmer/pull/1192) Use `ExceptionCode` for error representation.
- [#1191](https://github.com/wasmerio/wasmer/pull/1191) Fix singlepass miscompilation on `Operator::CallIndirect`.
- [#1180](https://github.com/wasmerio/wasmer/pull/1180) Fix compilation for target `x86_64-unknown-linux-musl`.
- [#1170](https://github.com/wasmerio/wasmer/pull/1170) Improve the WasiFs builder API with convenience methods for overriding stdin, stdout, and stderr as well as a new sub-builder for controlling the permissions and properties of preopened directories. Also breaks that implementations of `WasiFile` must be `Send` -- please file an issue if this change causes you any issues.
- [#1161](https://github.com/wasmerio/wasmer/pull/1161) Require imported functions to be `Send`. This is a breaking change that fixes a soundness issue in the API.
- [#1140](https://github.com/wasmerio/wasmer/pull/1140) Use [`blake3`](https://github.com/BLAKE3-team/BLAKE3) as default hashing algorithm for caching.
- [#1129](https://github.com/wasmerio/wasmer/pull/1129) Standard exception types for singlepass backend.
## 0.13.1 - 2020-01-16
- Fix bug in wapm related to the `package.wasmer_extra_flags` entry in the manifest
## 0.13.0 - 2020-01-15
Special thanks to [@repi](https://github.com/repi) and [@srenatus](https://github.com/srenatus) for their contributions!
- [#1153](https://github.com/wasmerio/wasmer/pull/1153) Added Wasmex, an Elixir language integration, to the README
- [#1133](https://github.com/wasmerio/wasmer/pull/1133) New `wasmer_trap` function in the C API, to properly error from within a host function
- [#1147](https://github.com/wasmerio/wasmer/pull/1147) Remove `log` and `trace` macros from `wasmer-runtime-core`, remove `debug` and `trace` features from `wasmer-*` crates, use the `log` crate for logging and use `fern` in the Wasmer CLI binary to output log messages. Colorized output will be enabled automatically if printing to a terminal, to force colorization on or off, set the `WASMER_COLOR` environment variable to `true` or `false`.
- [#1128](https://github.com/wasmerio/wasmer/pull/1128) Fix a crash when a host function is missing and the `allow_missing_functions` flag is enabled
- [#1099](https://github.com/wasmerio/wasmer/pull/1099) Remove `backend::Backend` from `wasmer_runtime_core`
- [#1097](https://github.com/wasmerio/wasmer/pull/1097) Move inline breakpoint outside of runtime backend
- [#1095](https://github.com/wasmerio/wasmer/pull/1095) Update to cranelift 0.52.
- [#1092](https://github.com/wasmerio/wasmer/pull/1092) Add `get_utf8_string_with_nul` to `WasmPtr` to read nul-terminated strings from memory.
- [#1071](https://github.com/wasmerio/wasmer/pull/1071) Add support for non-trapping float-to-int conversions, enabled by default.
## 0.12.0 - 2019-12-18
Special thanks to [@ethanfrey](https://github.com/ethanfrey), [@AdamSLevy](https://github.com/AdamSLevy), [@Jasper-Bekkers](https://github.com/Jasper-Bekkers), [@srenatus](https://github.com/srenatus) for their contributions!
- [#1078](https://github.com/wasmerio/wasmer/pull/1078) Increase the maximum number of parameters `Func` can take
- [#1062](https://github.com/wasmerio/wasmer/pull/1062) Expose some opt-in Emscripten functions to the C API
- [#1032](https://github.com/wasmerio/wasmer/pull/1032) Change the signature of the Emscripten `abort` function to work with Emscripten 1.38.30
- [#1060](https://github.com/wasmerio/wasmer/pull/1060) Test the capi with all the backends
- [#1069](https://github.com/wasmerio/wasmer/pull/1069) Add function `get_memory_and_data` to `Ctx` to help prevent undefined behavior and mutable aliasing. It allows accessing memory while borrowing data mutably for the `Ctx` lifetime. This new function is now being used in `wasmer-wasi`.
- [#1058](https://github.com/wasmerio/wasmer/pull/1058) Fix minor panic issue when `wasmer::compile_with` called with llvm backend.
- [#858](https://github.com/wasmerio/wasmer/pull/858) Minor panic fix when wasmer binary with `loader` option run a module without exported `_start` function.
- [#1056](https://github.com/wasmerio/wasmer/pull/1056) Improved `--invoke` args parsing (supporting `i32`, `i64`, `f32` and `f32`) in Wasmer CLI
- [#1054](https://github.com/wasmerio/wasmer/pull/1054) Improve `--invoke` output in Wasmer CLI
- [#1053](https://github.com/wasmerio/wasmer/pull/1053) For RuntimeError and breakpoints, use Box<Any+Send> instead of Box<Any>.
- [#1052](https://github.com/wasmerio/wasmer/pull/1052) Fix minor panic and improve Error handling in singlepass backend.
- [#1050](https://github.com/wasmerio/wasmer/pull/1050) Attach C & C++ headers to releases.
- [#1033](https://github.com/wasmerio/wasmer/pull/1033) Set cranelift backend as default compiler backend again, require at least one backend to be enabled for Wasmer CLI
- [#1044](https://github.com/wasmerio/wasmer/pull/1044) Enable AArch64 support in the LLVM backend.
- [#1030](https://github.com/wasmerio/wasmer/pull/1030) Ability to generate `ImportObject` for a specific version WASI version with the C API.
- [#1028](https://github.com/wasmerio/wasmer/pull/1028) Introduce strict/non-strict modes for `get_wasi_version`
- [#1029](https://github.com/wasmerio/wasmer/pull/1029) Add the “floating” `WasiVersion::Latest` version.
- [#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.
- [#1068](https://github.com/wasmerio/wasmer/pull/1068) Various cleanups for the singlepass backend on AArch64.
## 0.11.0 - 2019-11-22
- [#713](https://github.com/wasmerio/wasmer/pull/713) Add AArch64 support for singlepass.
- [#995](https://github.com/wasmerio/wasmer/pull/995) Detect when a global is read without being initialized (emit a proper error instead of panicking)
- [#996](https://github.com/wasmerio/wasmer/pull/997) Refactored spectests, emtests and wasitests to use default compiler logic
- [#992](https://github.com/wasmerio/wasmer/pull/992) Updates WAPM version to 0.4.1, fix arguments issue introduced in #990
- [#990](https://github.com/wasmerio/wasmer/pull/990) Default wasmer CLI to `run`. Wasmer will now attempt to parse unrecognized command line options as if they were applied to the run command: `wasmer mywasm.wasm --dir=.` now works!
- [#987](https://github.com/wasmerio/wasmer/pull/987) Fix `runtime-c-api` header files when compiled by gnuc.
- [#957](https://github.com/wasmerio/wasmer/pull/957) Change the meaning of `wasmer_wasi::is_wasi_module` to detect any type of WASI module, add support for new wasi snapshot_preview1
- [#934](https://github.com/wasmerio/wasmer/pull/934) Simplify float expressions in the LLVM backend.
## 0.10.2 - 2019-11-18
- [#968](https://github.com/wasmerio/wasmer/pull/968) Added `--invoke` option to the command
- [#964](https://github.com/wasmerio/wasmer/pull/964) Enable cross-compilation for specific target
- [#971](https://github.com/wasmerio/wasmer/pull/971) In LLVM backend, use unaligned loads and stores for non-atomic accesses to wasmer memory.
- [#960](https://github.com/wasmerio/wasmer/pull/960) Fix `runtime-c-api` header files when compiled by clang.
- [#925](https://github.com/wasmerio/wasmer/pull/925) Host functions can be closures with a captured environment.
- [#917](https://github.com/wasmerio/wasmer/pull/917) Host functions (aka imported functions) may not have `&mut vm::Ctx` as first argument, i.e. the presence of the `&mut vm::Ctx` argument is optional.
- [#915](https://github.com/wasmerio/wasmer/pull/915) All backends share the same definition of `Trampoline` (defined in `wasmer-runtime-core`).
## 0.10.1 - 2019-11-11
- [#952](https://github.com/wasmerio/wasmer/pull/952) Use C preprocessor to properly hide trampoline functions on Windows and non-x86_64 targets.
## 0.10.0 - 2019-11-11
Special thanks to [@newpavlov](https://github.com/newpavlov) and [@Maxgy](https://github.com/Maxgy) for their contributions!
- [#942](https://github.com/wasmerio/wasmer/pull/942) Deny missing docs in runtime core and add missing docs
- [#939](https://github.com/wasmerio/wasmer/pull/939) Fix bug causing attempts to append to files with WASI to delete the contents of the file
- [#940](https://github.com/wasmerio/wasmer/pull/940) Update supported Rust version to 1.38+
- [#923](https://github.com/wasmerio/wasmer/pull/923) Fix memory leak in the C API caused by an incorrect cast in `wasmer_trampoline_buffer_destroy`
- [#921](https://github.com/wasmerio/wasmer/pull/921) In LLVM backend, annotate all memory accesses with TBAA metadata.
- [#883](https://github.com/wasmerio/wasmer/pull/883) Allow floating point operations to have arbitrary inputs, even including SNaNs.
- [#856](https://github.com/wasmerio/wasmer/pull/856) Expose methods in the runtime C API to get a WASI import object
## 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
Special thanks to @jdanford for their contributions!
- [#850](https://github.com/wasmerio/wasmer/pull/850) New `WasiStateBuilder` API. small, add misc. breaking changes to existing API (for example, changing the preopen dirs arg on `wasi::generate_import_object` from `Vec<String>` to `Vec<Pathbuf>`)
- [#852](https://github.com/wasmerio/wasmer/pull/852) Make minor grammar/capitalization fixes to README.md
- [#841](https://github.com/wasmerio/wasmer/pull/841) Slightly improve rustdoc documentation and small updates to outdated info in readme files
- [#836](https://github.com/wasmerio/wasmer/pull/836) Update Cranelift fork version to `0.44.0`
- [#839](https://github.com/wasmerio/wasmer/pull/839) Change supported version to stable Rust 1.37+
- [#834](https://github.com/wasmerio/wasmer/pull/834) Fix panic when unwraping `wasmer` arguments
- [#835](https://github.com/wasmerio/wasmer/pull/835) Add parallel execution example (independent instances created from the same `ImportObject` and `Module` run with rayon)
- [#834](https://github.com/wasmerio/wasmer/pull/834) Fix panic when parsing numerical arguments for no-ABI targets run with the wasmer binary
- [#833](https://github.com/wasmerio/wasmer/pull/833) Add doc example of using ImportObject's new `maybe_with_namespace` method
- [#832](https://github.com/wasmerio/wasmer/pull/832) Delete unused runtime ABI
- [#809](https://github.com/wasmerio/wasmer/pull/809) Fix bugs leading to panics in `LocalBacking`.
- [#831](https://github.com/wasmerio/wasmer/pull/831) Add support for atomic operations, excluding wait and notify, to singlepass.
- [#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]
- [#821](https://github.com/wasmerio/wasmer/issues/821) Remove patch version on most deps Cargo manifests. This gives Wasmer library users more control over which versions of the deps they use.
- [#820](https://github.com/wasmerio/wasmer/issues/820) Remove null-pointer checks in `WasmPtr` from runtime-core, re-add them in Emscripten
- [#803](https://github.com/wasmerio/wasmer/issues/803) Add method to `Ctx` to invoke functions by their `TableIndex`
- [#790](https://github.com/wasmerio/wasmer/pull/790) Fix flaky test failure with LLVM, switch to large code model.
- [#788](https://github.com/wasmerio/wasmer/pull/788) Use union merge on the changelog file.
- [#785](https://github.com/wasmerio/wasmer/pull/785) Include Apache license file for spectests.
- [#786](https://github.com/wasmerio/wasmer/pull/786) In the LLVM backend, lower atomic wasm operations to atomic machine instructions.
- [#784](https://github.com/wasmerio/wasmer/pull/784) Fix help string for wasmer run.
## 0.7.0 - 2019-09-12
Special thanks to @YaronWittenstein@penberg for their contributions.
- [#776](https://github.com/wasmerio/wasmer/issues/776) Allow WASI preopened fds to be closed
- [#774](https://github.com/wasmerio/wasmer/issues/774) Add more methods to the `WasiFile` trait
- [#772](https://github.com/wasmerio/wasmer/issues/772) [#770](https://github.com/wasmerio/wasmer/issues/770) Handle more internal failures by passing back errors
- [#756](https://github.com/wasmerio/wasmer/issues/756) Allow NULL parameter and 0 arity in `wasmer_export_func_call` C API
- [#747](https://github.com/wasmerio/wasmer/issues/747) Return error instead of panicking on traps when using the Wasmer binary
- [#733](https://github.com/wasmerio/wasmer/issues/733) Remove dependency on compiler backends for `middleware-common`
- [#732](https://github.com/wasmerio/wasmer/issues/732) [#731](https://github.com/wasmerio/wasmer/issues/731) WASI bug fixes and improvements
- [#726](https://github.com/wasmerio/wasmer/issues/726) Add serialization and deserialization for Wasi State
- [#716](https://github.com/wasmerio/wasmer/issues/716) Improve portability of install script
- [#714](https://github.com/wasmerio/wasmer/issues/714) Add Code of Conduct
- [#708](https://github.com/wasmerio/wasmer/issues/708) Remove unconditional dependency on Cranelift in the C API
- [#703](https://github.com/wasmerio/wasmer/issues/703) Fix compilation on AArch64 Linux
- [#702](https://github.com/wasmerio/wasmer/issues/702) Add SharedMemory to Wasmer. Add `--enable-threads` flag, add partial implementation of atomics to LLVM backend.
- [#698](https://github.com/wasmerio/wasmer/issues/698) [#690](https://github.com/wasmerio/wasmer/issues/690) [#687](https://github.com/wasmerio/wasmer/issues/690) Fix panics in Emscripten
- [#689](https://github.com/wasmerio/wasmer/issues/689) Replace `wasmer_runtime_code::memory::Atomic` with `std::sync::atomic` atomics, changing its interface
- [#677](https://github.com/wasmerio/wasmer/issues/677) [#675](https://github.com/wasmerio/wasmer/issues/675) [#674](https://github.com/wasmerio/wasmer/issues/674) LLVM backend fixes and improvements
- [#671](https://github.com/wasmerio/wasmer/issues/671) Implement fs polling in `wasi::poll_oneoff` for Unix-like platforms
- [#656](https://github.com/wasmerio/wasmer/issues/656) Move CI to Azure Pipelines
- [#650](https://github.com/wasmerio/wasmer/issues/650) Implement `wasi::path_rename`, improve WASI FS public api, and allow open files to exist even when the underlying file is deleted
- [#643](https://github.com/wasmerio/wasmer/issues/643) Implement `wasi::path_symlink` and improve WASI FS public api IO error reporting
- [#608](https://github.com/wasmerio/wasmer/issues/608) Implement wasi syscalls `fd_allocate`, `fd_sync`, `fd_pread`, `path_link`, `path_filestat_set_times`; update WASI fs API in a WIP way; reduce coupling of WASI code to host filesystem; make debug messages from WASI more readable; improve rights-checking when calling syscalls; implement reference counting on inodes; misc bug fixes and improvements
- [#616](https://github.com/wasmerio/wasmer/issues/616) Create the import object separately from instance instantiation in `runtime-c-api`
- [#620](https://github.com/wasmerio/wasmer/issues/620) Replace one `throw()` with `noexcept` in llvm backend
- [#618](https://github.com/wasmerio/wasmer/issues/618) Implement `InternalEvent::Breakpoint` in the llvm backend to allow metering in llvm
- [#615](https://github.com/wasmerio/wasmer/issues/615) Eliminate `FunctionEnvironment` construction in `feed_event()` speeding up to 70% of compilation in clif
- fixes arg parsing from comments & fixes the mapdir test to have the native code doing the same thing as the WASI code
- makes wasitests-generate output stdout/stderr by default & adds function to print stdout and stderr for a command if it fails
- compiles wasm with size optimizations & strips generated wasm with wasm-strip
- [#554](https://github.com/wasmerio/wasmer/pull/554) Finish implementation of `wasi::fd_seek`, fix bug in filestat
- [#550](https://github.com/wasmerio/wasmer/pull/550) Fix singlepass compilation error with `imul` instruction
## 0.5.5 - 2019-07-10
- [#541](https://github.com/wasmerio/wasmer/pull/541) Fix dependency graph by making separate test crates; ABI implementations should not depend on compilers. Add Cranelift fork as git submodule of clif-backend
- [#537](https://github.com/wasmerio/wasmer/pull/537) Add hidden flag (`--cache-key`) to use prehashed key into the compiled wasm cache and change compiler backend-specific caching to use directories
- [#536](https://github.com/wasmerio/wasmer/pull/536) ~Update cache to use compiler backend name in cache key~
## 0.5.4 - 2019-07-06
- [#529](https://github.com/wasmerio/wasmer/pull/529) Updates the Wasm Interface library, which is used by wapm, with bug fixes and error message improvements
## 0.5.3 - 2019-07-03
- [#523](https://github.com/wasmerio/wasmer/pull/523) Update wapm version to fix bug related to signed packages in the global namespace and locally-stored public keys
## 0.5.2 - 2019-07-02
- [#516](https://github.com/wasmerio/wasmer/pull/516) Add workaround for singlepass miscompilation on GetLocal
- [#521](https://github.com/wasmerio/wasmer/pull/521) Update Wapm-cli, bump version numbers
- [#518](https://github.com/wasmerio/wasmer/pull/518) Update Cranelift and WasmParser
- [#514](https://github.com/wasmerio/wasmer/pull/514) [#519](https://github.com/wasmerio/wasmer/pull/519) Improved Emscripten network related calls, added a null check to `WasmPtr`
@ -26,7 +293,7 @@ Blocks of changes will separated by version increments.
- [#493](https://github.com/wasmerio/wasmer/pull/493) `wasmer_module_instantiate` has better error messages in the runtime C API
- [#474](https://github.com/wasmerio/wasmer/pull/474) Set the install name of the dylib to `@rpath`
- [#490](https://github.com/wasmerio/wasmer/pull/490) Add MiddlewareChain and StreamingCompiler to runtime
- [#487](https://github.com/wasmerio/wasmer/pull/487) Fix stack offset check in singlepass backend
- [#487](https://github.com/wasmerio/wasmer/pull/487) Fix stack offset check in singlepass backend
Thank you for your interest in contributing to Wasmer. This document outlines some recommendations on how to contribute.
## Issues & Feature Requests
Please use the issue template and provide a failing example if possible to help us recreate the issue.
## Pull Requests
For large changes, please try reaching communicating with the Wasmer maintainers via GitHub Issues or Spectrum Chat to ensure we can accept the change once it is ready.
We recommend trying the following commands before sending a pull request to ensure code quality:
- `cargo fmt --all` Ensures all code is correctly formatted.
- Run `cargo test` in the crates that you are modifying.
- Run `cargo build --all` (nightly) or `cargo build --all --exclude wasmer-singlepass-backend`
A comprehensive CI test suite will be run by a Wasmer team member after the PR has been created.
### Common Build Issues
#### LLVM Dependency
`Didn't find usable system-wide LLVM`
Building Wasmer with the LLVM backend requires LLVM to be installed
#### Singlepass Nightly Only
`error[E0554]: #![feature] may not be used on the stable release channel`
Building Wasmer with the singlepass backend requires the nightly version of Rust
[Wasmer](https://wasmer.io/) is a standalone JIT WebAssembly runtime, aiming to be fully compatible with [WASI](https://github.com/WebAssembly/WASI) and [Emscripten](https://emscripten.org/).
<br/>
Install Wasmer with:
[Wasmer](https://wasmer.io/) is a standalone [WebAssembly](https://webassembly.org/) runtime:
* **Universal**: Wasmer is available in *Linux, macOS and Windows* (for both Desktop and [ARM](https://medium.com/wasmer/running-webassembly-on-arm-7d365ed0e50c))
* **Fast**: Wasmer aims to run WebAssembly at near-native speed
* **Pluggable**: Wasmer can be used from almost **any programming language**
* **Safe**: supporting [WASI](https://github.com/WebAssembly/WASI) and [Emscripten](https://emscripten.org/)
It is used to run software fast, universally and safely: standalone applications and universal libraries.
## Contents
- [Quickstart](#quickstart)
- [Language Integrations](#language-integrations)
- [Contribute](#contribute)
- [Community](#community)
## Quickstart
Get started with Wasmer:
#### 1. Install Wasmer
```sh
curl https://get.wasmer.io -sSfL | sh
```
> Note: *Wasmer is also [available on Windows](https://github.com/wasmerio/wasmer/releases)*
Wasmer runtime can also be embedded in different languages, so you can use WebAssembly anywhere ✨:
Wasmer can execute both the standard binary format (`.wasm`) and the text
format defined by the WebAssembly reference interpreter (`.wat`).
Once installed, you will be able to run any WebAssembly files (_including Lua, PHP, SQLite and nginx!_):
<details>
<summary><b>Alternative</b>: Install with Homebrew</summary>
<p>
```sh
# Run Lua
wasmer run examples/lua.wasm
# Run PHP
wasmer run examples/php.wasm
# Run SQLite
wasmer run examples/sqlite.wasm
# Run nginx
wasmer run examples/nginx/nginx.wasm -- -p examples/nginx -c nginx.conf
brew install wasmer
```
#### With WAPM
</p>
</details>
Installing Wasmer through `wasmer.io` includes
[wapm](https://github.com/wasmerio/wapm-cli), the WebAssembly package manager.
#### 2. Use Wasmer
Wapm allows you to easily download, run, and distribute WebAssembly binaries.
Download a WASM file, and use it universally! You can start with QuickJS: [qjs.wasm](https://registry-cdn.wapm.io/contents/_/quickjs/0.0.3/build/qjs.wasm)
```sh
# Install cowsay globally
wapm install -g cowsay
# Run cowsay
wapm run cowsay "Hello, world!"
```bash
wasmer qjs.wasm
```
For more information about wapm, check out the [website](https://www.wapm.io)
and this [example program](https://github.com/wapm-packages/rust-wasi-example).
#### 3. Next steps
## Code Structure
Here is what you can do next:
Wasmer is structured into different directories:
- [Use Wasmer from your Rust application](https://docs.wasmer.io/integrations/rust)
- [Publish a Wasm package on WAPM](https://docs.wasmer.io/ecosystem/wapm/publishing-your-package)
- [Read more about Wasmer](https://medium.com/wasmer/)
- [`src`](./src): code related to the Wasmer executable itself
- [`lib`](./lib): modularized libraries that Wasmer uses under the hood
- [`examples`](./examples): some useful examples to getting started with Wasmer
## Dependencies
### Language Integrations
Building Wasmer requires [rustup](https://rustup.rs/).
Wasmer runtime can be used as a library embedded in different languages, so you can **use WebAssembly anywhere** 🎉
To build on Windows, download and run [`rustup-init.exe`](https://win.rustup.rs/)
| ❓ | [your language is missing?](https://github.com/wasmerio/wasmer/issues/new?assignees=&labels=%F0%9F%8E%89+enhancement&template=---feature-request.md&title=) | | | | |
To build on other systems, run:
```sh
curl https://sh.rustup.rs -sSf | sh
```
## Contribute
### Other dependencies
**We welcome any form of contribution, especially from new members of our community** 💜
Please select your operating system:
You can check how to build the Wasmer runtime in [our awesome docs](https://docs.wasmer.io/ecosystem/wasmer/building-from-source)!
- [macOS](#macos)
- [Debian-based Linuxes](#debian-based-linuxes)
- [FreeBSD](#freebsd)
- [Microsoft Windows](#windows-msvc)
### Testing
#### macOS
Test you want? The [Wasmer docs will show you how](https://docs.wasmer.io/ecosystem/wasmer/building-from-source/testing).
If you have [Homebrew](https://brew.sh/) installed:
## Community
```sh
brew install cmake
```
Wasmer has an amazing community developers and contributors. Welcome, please join us! 👋
Or, in case you have [MacPorts](https://www.macports.org/install.php):
### Channels
```sh
sudo port install cmake
```
#### Debian-based Linuxes
```sh
sudo apt install cmake pkg-config libssl-dev
```
#### FreeBSD
```sh
pkg install cmake
```
#### Windows (MSVC)
Windows support is _highly experimental_. Only simple Wasm programs may be run, and no syscalls are allowed. This means
nginx and Lua do not work on Windows. See [this issue](https://github.com/wasmerio/wasmer/issues/176) regarding Emscripten syscall polyfills for Windows.
Wasmer is built with [Cargo](https://crates.io/), the Rust package manager.
```sh
# checkout code
git clone https://github.com/wasmerio/wasmer.git
cd wasmer
# install tools
# make sure that `python` is accessible.
cargo install --path .
```
## Testing
Thanks to [spec tests](https://github.com/wasmerio/wasmer/tree/master/lib/spectests/spectests) we can ensure 100% compatibility with the WebAssembly spec test suite.
Tests can be run with:
```sh
make test
```
If you need to regenerate the Rust tests from the spec tests
you can run:
```sh
make spectests
```
You can also run integration tests with:
```sh
make integration-tests
```
## Benchmarking
Benchmarks can be run with:
```sh
cargo bench --all
```
## Roadmap
Wasmer is an open project guided by strong principles, aiming to be modular, flexible and fast. It is open to the community to help set its direction.
Below are some of the goals of this project (in order of priority):
- [x] It should be 100% compatible with the [WebAssembly spec tests](https://github.com/wasmerio/wasmer/tree/master/lib/spectests/spectests)
- [x] It should be fast _(partially achieved)_
- [x] Support WASI - released in [0.3.0](https://github.com/wasmerio/wasmer/releases/tag/0.3.0)
- [ ] Support Emscripten calls _(in the works)_
- [ ] Support Rust ABI calls
- [ ] Support Go ABI calls
## Architecture
If you would like to know how Wasmer works under the hood, please see [ARCHITECTURE.md](./ARCHITECTURE.md).
## License
Wasmer is primarily distributed under the terms of the [MIT license](http://opensource.org/licenses/MIT) ([LICENSE](./LICENSE)).
The `Dockerfile` included in the project root directory could be used for development purposes or to build a small image containing the `wasmer` executable.
The `wasmer-build-env` stage in the Dockerfile contains the dependencies needed to compile Wasmer including LLVM.
The `wasmer-debug-env` stage adds the `valgrind` profiling tool to the `wasmer-build-env` stage.
The `wasmer-build` stage in the Dockerfile will copy the current directory, assuming the build context is the `wasmer` project, and build the project using `cargo build --release`.
The `wasmer` stage will copy the resulting `wasmer` executable from the `wasmer-build` stage into a new base image to create a smaller image containing `wasmer`.
## Example Usages
### Wasmer image
1. From the `wasmer` project directory, build the image:
`docker build -t wasmer --target=wasmer .`
2. List options:
`docker run wasmer --help`
3. Mount a directory, and run an example wasm file:
`docker run -v /Users/admin/Documents/wasmer-workspace:/root/wasmer-workspace wasmer run /root/wasmer-workspace/examples/hello.wasm`
;; Test case for correctness of reading state with the presence of parameters passed on (machine) stack.
;; Usage: Run with a backend with support for OSR. Interrupt execution randomly.
;; Should see the stack frame for `$foo` to have locals `[0] = 1, [1] = 2, [2] = 3, [3] = 4, [4] = 5, [5] = 6, [6] = 7, [7] = 8` with high probability.
;; If the logic for reading stack parameters is broken, it's likely to see `[0] = 1, [1] = 2, [2] = 3, [3] = 4, [4] = 5, [5] = ?, [6] = ?, [7] = ?`.
This example shows executing independent code from multiple threads on an "embarassingly parallel" problem
This is a toy example of cracking md5 hashes. This is not a benchmark. This example is not optimized, it will compare poorly to an implementation that is.
It will continue to generate random inputs forever, until it finds a bug or is terminated. The testcases for bugs it finds go into `fuzz/artifacts/simple_instantiate` and you can rerun the fuzzer on a single input by passing it on the command line `cargo fuzz run simple_instantiate my_testcase.wasm`.
## Seeding the corpus, optional
The fuzzer works best when it has examples of small Wasm files to start with. Using `wast2json` from [wabt](https://github.com/WebAssembly/wabt), we can easily produce `.wasm` files out of the WebAssembly spec tests.
```sh
mkdir spec-test-corpus
for i in lib/spectests/spectests/*.wast; do wast2json --enable-all $i -o spec-test-corpus/$(basename $i).json; done
The corpus directory is created on the first run of the fuzzer. If it doesn't exist, run it first and then seed the corpus. The fuzzer will pick up new files added to the corpus while it is running.
@ -24,6 +24,7 @@ Wasmer intends to support different integrations:
- [WASI](./wasi): run WebAssembly files with the [WASI ABI](https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webassembly-system-interface/).
- [Emscripten](./emscripten): run Emscripten-generated WebAssembly files, such as [Lua](../examples/lua.wasm) or [nginx](../examples/nginx/nginx.wasm).
- **Your own ABI**: Do you want to create your own ABI? Here's a [repo showcasing how](https://github.com/wasmerio/wasmer-rust-customabi-example)!
- Go ABI: _we will work on this soon! Want to give us a hand? ✋_
- Blazor: _research period, see [tracking issue](https://github.com/wasmerio/wasmer/issues/97)_
This crate is not ready to be used directly yet. If you're interested in using the Wasmer runtime, checkout the [wasmer-runtime](https://crates.io/crates/wasmer-runtime) crate!
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.