Commit Graph

4056 Commits

Author SHA1 Message Date
bors[bot]
2dbe80ad34
Merge #856
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>
2019-10-29 22:39:51 +00:00
Mark McCaskey
d87e81cf62
Merge pull request #912 from wasmerio/nlewycky-patch-1
Use printf portably.
2019-10-29 15:34:40 -07:00
Mark McCaskey
6d6b8779d4
Merge pull request #913 from wasmerio/nlewycky-patch-2
Move the linkage before the type.
2019-10-29 15:34:33 -07:00
nlewycky
44f026adfb
Move the linkage before the type.
Though both orders work, this is customary.
2019-10-29 15:30:59 -07:00
nlewycky
ae07620818
Use printf portably.
PRId64 is defined to the right printf format string to print a int64_t on the current system.
2019-10-29 15:28:59 -07:00
Mark McCaskey
bc9b92c323 Add null checks to new destructors in C API 2019-10-29 15:18:45 -07:00
Mark McCaskey
a104d08c04 Update ImportObject C API to use iterators 2019-10-29 14:55:14 -07:00
Nick Lewycky
9224db6d1e Don't emit bounds checks when the offset is less than the minimum memory size. 2019-10-28 15:57:16 -07:00
bors[bot]
d46e5d499c
Merge #910
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>
2019-10-28 18:07:18 +00:00
Artyom Pavlov
56475594e9
compilation error fix 2019-10-28 17:57:29 +00:00
newpavlov
8e6f4c448b reuse __WASI_EIO error code 2019-10-28 18:37:14 +03:00
newpavlov
b67f2c9f18 use getrandom instead of rand 2019-10-28 18:33:15 +03:00
Mark McCaskey
aa82df7bc5 Fix github merge
move entry in changelog due to release
2019-10-25 14:52:09 -07:00
Mark McCaskey
c2d3f29cb4
Merge branch 'master' into feature/wasi-in-c-api 2019-10-25 14:38:14 -07:00
Mark McCaskey
2a532b8ce5 Add tests for C API import_object and WASI updates 2019-10-25 14:24:22 -07:00
bors[bot]
8653216b1a
Merge #883
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>
2019-10-25 20:16:19 +00:00
Nick Lewycky
dae99497ee Add changelog entry. 2019-10-25 13:15:32 -07:00
Syrus Akbary
1a91f0e9ca
Merge branch 'master' into feature/llvm-nan-but-fast 2019-10-25 12:52:47 -07:00
bors[bot]
03a5b1fbf4
Merge #901
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>
2019-10-25 17:57:11 +00:00
bors[bot]
83c63d0b27
Merge #904
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>
2019-10-25 17:22:25 +00:00
Syrus Akbary
1fee31b525
Merge pull request #905 from Maxgy/master
fix README grammar
2019-10-25 01:03:15 -07:00
Maxwell Anderson
a52246bb9d
fix README grammar 2019-10-24 21:54:30 -04:00
Nick Lewycky
f3d4fde7ef Run cargo update to pick up new commit to wasmerio/inkwell llvm8-0 branch. 2019-10-24 18:15:39 -07:00
Nick Lewycky
9c71561927 Rewrite resolve_memory_ptr to use GEPs as much as possible.
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.
2019-10-24 18:15:32 -07:00
bors[bot]
56f9651a90
Merge #902
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>
2019-10-24 21:06:51 +00:00
Mark McCaskey
80cfeb590e Clean up comments
add headers too
2019-10-24 11:51:35 -07:00
Nick Lewycky
894c5084f3 Insert allocas as a contiguous block at the top of the entry block.
This minimizes the chance we accidentally get categorized as having a dynamic alloca.
2019-10-23 19:21:12 -07:00
Nick Lewycky
bc64b4ce6c Set target triple and datalayout when creating the LLVM module. 2019-10-23 16:04:29 -07:00
bors[bot]
aa8b968d40
Merge #900
900: Prepare for 0.9.0 release r=MarkMcCaskey a=MarkMcCaskey



Co-authored-by: Mark McCaskey <mark@wasmer.io>
2019-10-23 20:43:47 +00:00
Mark McCaskey
82f258b888 Prepare for 0.9.0 release 2019-10-23 13:40:35 -07:00
bors[bot]
9ccbe2da9b
Merge #861
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>
2019-10-23 19:30:44 +00:00
Mark McCaskey
0fd0ab6e58
Merge branch 'master' into ventuzelo/add-detail-unimplemented-calls-runtime 2019-10-23 12:30:14 -07:00
bors[bot]
c2c03172df
Merge #894
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>
2019-10-23 18:48:26 +00:00
dependabot-preview[bot]
0818a0434b
Bump indexmap from 1.2.0 to 1.3.0
Bumps [indexmap](https://github.com/bluss/indexmap) from 1.2.0 to 1.3.0.
- [Release notes](https://github.com/bluss/indexmap/releases)
- [Commits](https://github.com/bluss/indexmap/compare/1.2.0...1.3.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-10-23 18:45:38 +00:00
bors[bot]
2954b6fee4
Merge #895
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>
2019-10-23 18:06:35 +00:00
dependabot-preview[bot]
efce780807
Bump libc from 0.2.62 to 0.2.65
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.62 to 0.2.65.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.62...0.2.65)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-10-23 17:45:10 +00:00
bors[bot]
f1bb385751
Merge #893
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>
2019-10-23 17:09:05 +00:00
bors[bot]
d2f9047952
Merge #899
899: Remove dead intrinsics. r=Hywan a=nlewycky



Co-authored-by: Nick Lewycky <nick@wasmer.io>
2019-10-23 12:32:09 +00:00
Nick Lewycky
6410da9c24 Remove dead intrinsics. 2019-10-22 23:36:18 -07:00
bors[bot]
912beff1fe
Merge #898
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>
2019-10-23 06:24:55 +00:00
Nick Lewycky
92f0b1b2e3 Thread whether state tracking is enabled into the LLVM backend. 2019-10-22 23:15:05 -07:00
Nick Lewycky
93dc713330 Flip the default for 'track-state' from on to off. The flag is --track-state. 2019-10-22 23:14:42 -07:00
bors[bot]
6e69374a07
Merge #897
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>
2019-10-23 00:30:14 +00:00
Mark McCaskey
5353af79ad Improve fd_close wasi test: explicitly close file 2019-10-22 17:29:19 -07:00
Mark McCaskey
3a87edc0c1 Remove special casing of stdin, stdout, and stderr in WASI FS 2019-10-22 16:40:01 -07:00
Mark McCaskey
5327a8b686
Merge pull request #873 from Hywan/feature/wasi-in-c-api
Update feature/wasi-in-c-api
2019-10-22 12:14:37 -07:00
dependabot-preview[bot]
85ddbe38da
Bump cc from 1.0.45 to 1.0.46
Bumps [cc](https://github.com/alexcrichton/cc-rs) from 1.0.45 to 1.0.46.
- [Release notes](https://github.com/alexcrichton/cc-rs/releases)
- [Commits](https://github.com/alexcrichton/cc-rs/compare/1.0.45...1.0.46)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-10-22 18:16:36 +00:00
bors[bot]
77527c23ce
Merge #877
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>
2019-10-22 17:33:44 +00:00
Nick Lewycky
88dc613385 Save and restore the additional XMM registers in OSR too. 2019-10-21 19:44:16 -07:00
Syrus Akbary
fe158d0ce9
Merge pull request #886 from Hywan/fix-win-exception-handler-cargo-build-deps
fix(win-exception-handler) Remove `bindgen` and `regex` from cargo build deps
2019-10-21 17:02:11 -07:00