Commit Graph

8397 Commits

Author SHA1 Message Date
Alex Crichton
0c90d789e8 Update Cargo.lock, remove deny.toml warning (#2965)
This runs through and updates all our dependencies, additionally
removing the need for ignoring a rustsec warning.

Closes #2882
2021-06-03 17:11:07 -05:00
Alex Crichton
05baddfb2b Add the ability to cache typechecking an instance (#2962)
* Add the ability to cache typechecking an instance

This commit adds the abilty to cache the type-checked imports of an
instance if an instance is going to be instantiated multiple times. This
can also be useful to do a "dry run" of instantiation where no wasm code
is run but it's double-checked that a `Linker` possesses everything
necessary to instantiate the provided module.

This should ideally help cut down repeated instantiation costs slightly
by avoiding type-checking and allocation a `Vec<Extern>` on each
instantiation. It's expected though that the impact on instantiation
time is quite small and likely not super significant. The functionality,
though, of pre-checking can be useful for some embeddings.

* Fix build with async
2021-06-03 17:04:07 -05:00
Andrew Brown
e25bf362ab Switch to using TargetFrontendConfig in the frontend memory tests
Commit 7d36fd9a1e avoided these
x86-specific tests altogether. This change avoids any dependency on x86
entirely by specifying a frontend configuration (SystemV + U64); this is
enough information for the `FunctionBuilder` to correctly generate the
syscalls.
2021-06-03 11:01:13 -07:00
Chris Fallin
88b6e88781 Merge pull request #2963 from olivierlemasle/main
Remove empty crates directories
2021-06-03 10:21:09 -07:00
Olivier Lemasle
9dde98e33c Remove empty crates directories
In commit 33c791e1f5 (PR #2944), I added LICENSE files to all published
crates. However, since then PR #2897 has been merged and remove 3 crates,
resulting in license files in empty directories.
2021-06-03 18:42:07 +02:00
Alex Crichton
7a1b7cdf92 Implement RFC 11: Redesigning Wasmtime's APIs (#2897)
Implement Wasmtime's new API as designed by RFC 11. This is quite a large commit which has had lots of discussion externally, so for more information it's best to read the RFC thread and the PR thread.
2021-06-03 09:10:53 -05:00
Chris Fallin
a5a28b1c5b Merge pull request #2958 from abrown/fix-avx512-flags
x64: fix AVX512 flag checks
2021-06-02 18:03:51 -07:00
Olivier Lemasle
7d36fd9a1e Restrict running tests dependent of x86_64
These 5 tests fail with the error "This test requires x86_64 support." when
executed on another architecture.
2021-06-02 10:35:35 -07:00
Andrew Brown
8dc4cc9fe3 x64: fix AVX512 flag checks
Previously, the multiple flags for certain AVX512 instructions were
checked using `OR`: e.g., if the CPU has AVX512VL `OR` AVX512DQ,
emit `VPMULLQ`. This is incorrect--the logic should be `AND`. The Intel
Software Developer Manual, vol. 1, sec. 15.4, has more information on
this (notable there is the suggestion to check with `XGETBV` that the OS
is allowing the use of the XMM registers--but that is a separate issue).
This change switches to `AND` logic in the new backend.
2021-06-01 11:41:16 -07:00
Andrew Brown
2a9f458ea3 x64: lower i8x16.shuffle to VPERMI2B when possible
When shuffling values from two different registers, the x64 lowering for
`i8x16.shuffle` must first shuffle each register separately and then OR
the results with SSE instructions. With `VPERMI2B`, available in
AVX512VL + AVX512VBMI, this can be done in a single instruction after
the shuffle mask has been moved into the destination register. This
change uses `VPERMI2B` for that case when the CPU supports it.
2021-06-01 11:40:53 -07:00
Benjamin Bouvier
51edea9e57 cranelift: introduce a new WasmtimeAppleAarch64 calling convention
The previous choice to use the WasmtimeSystemV calling convention for
apple-aarch64 devices was incorrect: padding of arguments was
incorrectly computed. So we have to use some flavor of the apple-aarch64
ABI there.

Since we want to support the wasmtime custom convention for multiple
returns on apple-aarch64 too, a new custom Wasmtime calling convention
was introduced to support this.
2021-06-01 17:29:12 +02:00
Benjamin Bouvier
aa2c0cd0ec CI: put tests into a separate script so they can be run externally (#2956) 2021-06-01 17:28:47 +02:00
Olivier Lemasle
eadafb1554 s390x: Fix import
cranelift-codegen's build failed on s390x, with this error:

```
error[E0432]: unresolved import `crate::isa::unwind::systemv`
 --> cranelift/codegen/src/isa/s390x/mod.rs:6:25
  |
6 | use crate::isa::unwind::systemv::RegisterMappingError;
  |                         ^^^^^^^ could not find `systemv` in `unwind`
```

This import should be used only with `unwind` feature enabled.
2021-06-01 15:16:41 +02:00
Andrew Brown
40d546c420 Upgrade capstone to v0.8 (#2948) 2021-05-28 09:51:14 -05:00
Olivier Lemasle
33c791e1f5 Add license files
This commit adds LICENSE files to all **published** crates which do
not have it already (most of the crates have it).

Providing the license files is a requiment of the Apache 2.0 License.
2021-05-27 11:56:58 -07:00
Alex Crichton
b90d7d6aed Remove long-outdated misc/rust crate (#2942)
I had no idea this was still in the repository, much less building!
There are much different ways to use wasmtime in Rust nowadays, such as
the `wasmtime` crate!
2021-05-27 12:05:35 -05:00
Amanieu d'Antras
76664fc73e Optimize codegen for SecondaryMap indexing (#2940)
Moves the slow path which resizes the vector out-of-line. The actual
indexing is also done in the out-of-line path which avoids the need for
a second bounds check in the fast path after a potential resize.
2021-05-27 11:09:15 -05:00
Alex Crichton
8127346b4d ci: Use something else for zip files on Windows (#2941)
Apparently `powershell Compress-Archive` produces zip files with
backslashes in filesnames which makes them unable to be extracted with
some Unix variants of extraction. For example [this failure][build] and
using macOS's built-in unzip feature it creates filenames with
backslashes in them rather than subdirectories.

[build]: https://github.com/bytecodealliance/wasmtime-go/runs/2680596219?check_suite_focus=true
2021-05-27 11:08:19 -05:00
Alex Crichton
a2e71dafac ci: Don't test release binaries, nightly, or beta (#2939)
This commit attempts to slim down our CI (more from #2933) by removing
testing both in debug and release mode. I can't actually recall a
concrete issue that this has turned up on CI itself, and otherwise we're
spending quite a lot of time building all of the dev-dependencies in
release mode when testing.

Additionally it removes testing for nightly/beta channels of Rust. One
of the main benefits of this, staying on top of breakage, is already
moot because we pin to a nightly anyway. We have a few nightly
references elsewhere in CI (fuzzing/docs) so we can largely rely on that
(and upstream testing with rust-lang/rust). We in general shouldn't need
to do nightly/beta testing on all builds.

The release builders were actually the only location that MinGW and
AArch64 was tested however. This means that the old nightly/beta
builders are now replaced with AArch64 and MinGW builders. Overall, the
changes made to CI here are:

* Upgrade to QEMU 6.0.0. I thought this would make aarch64 emulation
  faster, but it didn't. Seems good to stay up to date though.
* Replace nightly/beta testing in debug mode with MinGW and AArch64 testing.
* Use `-g0` for C compilation on MinGW because otherwise `gcc` as used
  on CI generates an ICE (!!)
* Exclude `wasi-crypto` from testing. We already exclude
  `wasmtime-wasi-crypto` and it was an accident we were testing the
  `wasi-crypto` crate (which isn't even part of this workspace).
* Remove testing DWARF on the old backend step, which nowadays didn't
  actually do that.
* Remove testing on release builders, making then purely tasked with
  release builds, nothing else.
* Rename `QEMU_VERSION` to `QEMU_BUILD_VERSION` so qemu doesn't just
  immediately exit after printing its version.

Timing wise the release builds are ~20-30 minutes faster, depending on
the platform. This is not really because of testing time but rather we
have a huge dependency tree when `dev-dependencies` are considered
(criterion, tokio, proptest, ...).

MinGW tests are pretty fast since we don't run examples (we're not too
interested in doing examples there, just windows/mac/linux coverage).
AArch64 tests are run with optimizations enabled because unoptimized
tests take ~45 minutes to finish while optimized tests take ~20 minutes.
The build is naturally much faster in debug mode but apparently under
QEMU emulation the debug mode binaries are *extremely* slow compared to
the release binaries, which means that extra time we spend compiling
release tests is more than made up by faster test emulation time.

Closes #2938
2021-05-26 10:12:29 -05:00
Nick Fitzgerald
137e6e8332 Merge pull request #2937 from fitzgen/bench-api-stdio-and-repeated-instantiations
bench-api: pass in explicit stdio files, allow repeated instantiations per compilation
2021-05-25 14:44:51 -07:00
Andrew Brown
459fce3467 x64: lower i8x16.popcnt to VPOPCNTB when possible
When AVX512VL or AVX512BITALG are available, Wasm SIMD's `popcnt`
instruction can be lowered to a single x64 instruction, `VPOPCNTB`,
instead of 8+ instructions.
2021-05-25 12:16:25 -07:00
Alex Crichton
2b0649c74c ci: Remove "publish" step (#2936)
This commit removes the publish step in GitHub actions, insteading
folding all functionality into the release build steps. This avoids
having a separately scheduled job after all the release build jobs which
ends up getting delayed for quite a long time given the current
scheduling algorithm.

This involves refactoring the tarball assembly scripts and refactoring the
github asset upload script too. Tarball assembly now manages everything
internally and does platform-specific bits where necessary. The upload
script is restructured to be run in parallel (in theory) and hopefully
catches various errors and tries to not stomp over everyone else's work.
The main trickiness here is handling `dev`, which is less critical for
correctness than than tags themselves.

As a small tweak build-wise the QEMU build for cross-compiled builders
is now cached unlike before where it was unconditionally built, shaving
a minute or two off build time.
2021-05-25 12:52:41 -05:00
Nick Fitzgerald
18fabd7700 bench-api: Allow multiple instantiations per compilation
We used to allow at most one instantiation per compilation, but there is no
fundamental reason why that should be the case. Allowing multiple instantiations
per compilation allows us to, for example, benchmark repeated instantiation
within Wasmtime's pooling allocator.

This additionally switches to using host functions for WASI and for
`bench_{start,end}` rather than defining them on the linker, this way we can use
a new store for every instantiation and don't need to keep other instances alive
when instantiating new instances.

Finally, we switch all timing to be done through callback functions, rather than
having the bench API caller implicitly start/end timers around bench API
calls. This allows us to more precisely measure phases and exclude things like
file I/O performed when creating a WASI context.
2021-05-24 16:53:22 -07:00
Alex Crichton
e5ac9350b1 ci: Try other syntax for concurrency key (#2935)
After #2932 that [immediately failed][build] on the main branch so this
tries a different key to see if it'll work...

[build]: https://github.com/bytecodealliance/wasmtime/actions/runs/872766013/workflow
2021-05-24 18:26:14 -05:00
Alex Crichton
beaa07eb96 ci: Merge all doc builders into one (#2934)
Also move the gh-pages pushing step from the `publish` phase to just
this singular doc builder.

The motivation for this is to eventually remove the `publish` step since
it interacts badly with GitHub's scheduling of actions. This is
hopefully the first step towards that by removing the doc publish part
of the phase.
2021-05-24 18:26:05 -05:00
Nick Fitzgerald
ba6635dba0 bench-api: Pass in explicit stdin/stdout/stderr
Instead of inheriting stdio, pass in explicit file paths that are opened for
reading (stdin) or writing (stderr/stdout). This will allow sightglass to assert
that benchmarks produce the expected output.
2021-05-24 15:20:10 -07:00
Nick Fitzgerald
13741284b3 bench-api: Add a feature for the old x86_64 backend
This makes it easier to benchmark old vs new backends.
2021-05-24 15:20:10 -07:00
Alex Crichton
8c2413e009 Try to ease up on CI usage slightly (#2932)
* First remove `fail-fast: false` annotations to fail faster. If desired
  this could always be added in a on-off fashion to PRs.
* Next use the new `concurrency` feature to try to cancel previous
  builds, ideally meaning that if a branch is pushed to multiple times
  it only runs CI once.
2021-05-24 16:31:48 -05:00
Chris Fallin
f2fe0c669e Merge pull request #2929 from cfallin/bb-offsets
Provide BB layout info externally in terms of code offsets.
2021-05-24 14:27:53 -07:00
Chris Fallin
37ca06ad3a Merge pull request #2928 from afonso360/aarch64-i128-ops
Implement iadd,isub,imul for i128 in AArch64
2021-05-24 13:27:36 -07:00
Chris Fallin
800cf25bb5 Make the CFG metadata computation conditional on a flag. 2021-05-24 13:01:15 -07:00
Afonso Bordado
4ddbfe50ba aarch64: Implement imul for i128 operands 2021-05-24 18:23:30 +01:00
Chris Fallin
11a2ef01e7 Provide BB layout info externally in terms of code offsets.
This is sometimes useful when performing analyses on the generated
machine code: for example, some kinds of code verifiers will want to do
a control-flow analysis, and it is much easier to do this if one does
not have to recover the CFG from the machine code (doing so requires
heavyweight analysis when indirect branches are involved). If one trusts
the control-flow lowering and only needs to verify other properties of
the code, this can be very useful.
2021-05-24 09:18:06 -07:00
Afonso Bordado
a2e74b2c45 aarch64: Implement isub for i128 operands 2021-05-22 21:51:41 +01:00
Afonso Bordado
d3b525fa29 aarch64: Implement iadd for i128 operands 2021-05-22 21:21:44 +01:00
Alex Crichton
76c6b83f6a Use tarballs for Rust API docs on CI (#2922)
Looks like GitHub Actions takes 10m+ to upload the documentation and
nearly 10 minutes to download it. I suspect this has to do with the
creation of thousands of files, and using `tar` here is likely much
faster. Let's test it out!
2021-05-22 11:08:45 -05:00
Dan Gohman
b8fd632fb5 Remove test-all.sh. (#2926)
test-all.sh isn't run in CI, and is out of date with respect to what we
do run in CI, so remove it so that we don't have to awkwardly maintain it.
2021-05-22 00:02:11 -05:00
Johnnie Birch
9a5c9607e1 Vpopcnt for x64 2021-05-21 19:23:26 -07:00
Chris Fallin
65e0e20210 Merge pull request #2892 from afonso360/aarch64-multireg-args
Handle i128 arguments in the aarch64 ABI
2021-05-21 16:57:42 -07:00
Alex Crichton
7db94f5869 Don't verify publishing peepmatic crates (#2923)
Using `--no-verify` avoids building z3 which should shave at least 10
minutes off CI where the `verify-publish` builder currently takes ~30
minutes.
2021-05-21 16:26:55 -05:00
Chris Fallin
824fa69756 Merge pull request #2924 from cfallin/remove-readme-wasi-tokio
Remove reference to non-existent README.md in wasi-tokio crate.
2021-05-21 14:12:46 -07:00
Chris Fallin
ca39f954da Remove reference to non-existent README.md in wasi-tokio crate 2021-05-21 14:08:28 -07:00
Chris Fallin
95559c01aa Merge pull request from GHSA-hpqh-2wqx-7qp5
Fix spillslot reload of narrow values: zero-extend, don't sign-extend. Release v0.74.0 as security-patch release.
2021-05-21 12:01:55 -07:00
Pat Hickey
0f5bdc6497 only wasi_cap_std_sync and wasi_tokio need to define WasiCtxBuilders (#2917)
* wasmtime-wasi: re-exporting this WasiCtxBuilder was shadowing the right one

wasi-common's WasiCtxBuilder is really only useful wasi_cap_std_sync and
wasi_tokio to implement their own Builder on top of.

This re-export of wasi-common's is 1. not useful and 2. shadow's the
re-export of the right one in sync::*.

* wasi-common: eliminate WasiCtxBuilder, make the builder methods on WasiCtx instead

* delete wasi-common::WasiCtxBuilder altogether

just put those methods directly on &mut WasiCtx.

As a bonus, the sync and tokio WasiCtxBuilder::build functions
are no longer fallible!

* bench fixes

* more test fixes
2021-05-21 12:59:39 -05:00
Afonso Bordado
fbcfffdeab Handle spilling i128 arguments into the stack in aarch64 2021-05-21 17:05:41 +01:00
theduke
817d72a7b7 Implement std::fmt::Debug for InterruptHandle (#2915) 2021-05-21 10:54:47 -05:00
Alex Crichton
7d20368756 Try to fix CI (#2918)
Fixes a few issues that have been cropping up:

* Update `rustup` on Windows to latest to skip over the 1.24.1 installed
  on GitHub Actions which can fail to install.
* Remove the no-longer-needed `define-llvm-env` action
* Install generic llvm/lldb packges instead of specific ones that may
  migrate in versions over time.
2021-05-21 10:54:37 -05:00
Chris Fallin
88455007b2 Bump Wasmtime to v0.27.0 and Cranelift to v0.74.0. 2021-05-20 14:06:41 -07:00
Chris Fallin
8b9057a18f Merge pull request #2914 from abrown/fcvt_from_uint
x64: lower fcvt_from_uint to VCVTUDQ2PS when possible
2021-05-19 15:59:41 -07:00
Andrew Brown
54b45d28a3 x64: lower fcvt_from_uint to VCVTUDQ2PS when possible
When AVX512VL and AVX512F are available, use a single instruction
(`VCVTUDQ2PS`) instead of a length 9-instruction sequence. This
optimization is a port from the legacy x86 backend.
2021-05-19 12:20:11 -07:00