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 />
[![Dependabot compatibility score](https://api.dependabot.com/badges/compatibility_score?dependency-name=indexmap&package-manager=cargo&previous-version=1.2.0&new-version=1.3.0)](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 />
[![Dependabot compatibility score](https://api.dependabot.com/badges/compatibility_score?dependency-name=libc&package-manager=cargo&previous-version=0.2.62&new-version=0.2.65)](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 />
[![Dependabot compatibility score](https://api.dependabot.com/badges/compatibility_score?dependency-name=cc&package-manager=cargo&previous-version=1.0.45&new-version=1.0.46)](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>