Commit Graph

230 Commits

Author SHA1 Message Date
Ulrich Weigand
3735453afa Add s390x build workflow (#3375) 2021-09-20 12:42:26 -05:00
Ulrich Weigand
7c5acfa96c Add QEMU CI runner for the s390x architecture
* Add QEMU CI runner for s390x

* Disable lightbeam tests for s390x
2021-09-20 17:19:04 +02:00
Dan Gohman
47490b4383 Use rsix to make system calls in Wasmtime. (#3355)
* Use rsix to make system calls in Wasmtime.

`rsix` is a system call wrapper crate that we use in `wasi-common`,
which can provide the following advantages in the rest of Wasmtime:

 - It eliminates some `unsafe` blocks in Wasmtime's code. There's
   still an `unsafe` block in the library, but this way, the `unsafe`
   is factored out and clearly scoped.

 - And, it makes error handling more consistent, factoring out code for
   checking return values and `io::Error::last_os_error()`, and code that
   does `errno::set_errno(0)`.

This doesn't cover *all* system calls; `rsix` doesn't implement
signal-handling APIs, and this doesn't cover calls made through `std` or
crates like `userfaultfd`, `rand`, and `region`.
2021-09-17 15:28:56 -07:00
Afonso Bordado
d20194fa4c Enable all aarch64 features in QEMU CI runner, except PAC (#3325)
* Enable all aarch64 features in QEMU CI runner, except PAC

* Upgrade QEMU version to 6.1.0
2021-09-15 09:30:17 -05:00
Benjamin Bouvier
0cf9b2d5e6 Remove cargo check for old rustc versions
Firefox has updated its toolchain to something much more recent.
2021-09-02 16:06:02 +02:00
Aaron Turner
191051b644 Docs: Created the Wasmtime Markdown Parser Example (#3193)
* Finished the Markdown Parser Example for Wasmtime

* Made requested changes

* Tiny change to explanation of `--dir` CLI arg

* Add `bash` annotations to shell script code blocks

* Trying to fix the markdown example bug

* Figured out rustdoc, and what needed to be done

* Made requested changes

Co-authored-by: Till Schneidereit <till@tillschneidereit.net>
2021-09-01 12:25:36 -05:00
Benjamin Bouvier
18fe7d124e Fix VTune build (#3219)
* Fix vtune build

* Add vtune build to automation

* don't allocate a different module id for each function
2021-08-20 10:17:54 -05:00
Nick Fitzgerald
74c18a6af4 Add automatic labeling for the wasmtime:ref-types label (#3213) 2021-08-19 12:05:47 -05:00
Nick Fitzgerald
7a5e76e115 Subscribe @fitzgen to the wasmtime:ref-types label 2021-08-19 09:57:42 -07:00
Alex Crichton
9e8e0e8352 Update wasmtime-08-19.md (#3211)
* Update wasmtime-08-19.md

* Don't run CI for changes only in meetings dir
2021-08-19 09:08:30 -05:00
Alex Crichton
ddfadaeb38 Add a cranelift compile-time feature to wasmtime (#3206)
* Remove unnecessary into_iter/map

Forgotten from a previous refactoring, this variable was already of the
right type!

* Move `wasmtime_jit::Compiler` into `wasmtime`

This `Compiler` struct is mostly a historical artifact at this point and
wasn't necessarily pulling much weight any more. This organization also
doesn't lend itself super well to compiling out `cranelift` when the
`Compiler` here is used for both parallel iteration configuration
settings as well as compilation.

The movement into `wasmtime` is relatively small, with
`Module::build_artifacts` being the main function added here which is a
merging of the previous functions removed from the `wasmtime-jit` crate.

* Add a `cranelift` compile-time feature to `wasmtime`

This commit concludes the saga of refactoring Wasmtime and making
Cranelift an optional dependency by adding a new Cargo feature to the
`wasmtime` crate called `cranelift`, which is enabled by default.

This feature is implemented by having a new cfg for `wasmtime` itself,
`cfg(compiler)`, which is used wherever compilation is necessary. This
bubbles up to disable APIs such as `Module::new`, `Func::new`,
`Engine::precompile_module`, and a number of `Config` methods affecting
compiler configuration. Checks are added to CI that when built in this
mode Wasmtime continues to successfully build. It's hoped that although
this is effectively "sprinkle `#[cfg]` until things compile" this won't
be too too bad to maintain over time since it's also an use case we're
interested in supporting.

With `cranelift` disabled the only way to create a `Module` is with the
`Module::deserialize` method, which requires some form of precompiled
artifact.

Two consequences of this change are:

* `Module::serialize` is also disabled in this mode. The reason for this
  is that serialized modules contain ISA/shared flags encoded in them
  which were used to produce the compiled code. There's no storage for
  this if compilation is disabled. This could probably be re-enabled in
  the future if necessary, but it may not end up being all that necessary.

* Deserialized modules are not checked to ensure that their ISA/shared
  flags are compatible with the host CPU. This is actually already the
  case, though, with normal modules. We'll likely want to fix this in
  the future using a shared implementation for both these locations.

Documentation should be updated to indicate that `cranelift` can be
disabled, although it's not really the most prominent documentation
because this is expected to be a somewhat niche use case (albeit
important, just not too common).

* Always enable cranelift for the C API

* Fix doc example builds

* Fix check tests on GitHub Actions
2021-08-18 16:47:47 -05:00
Alex Crichton
e8aa7bb53b Reimplement how unwind information is stored (#3180)
* Reimplement how unwind information is stored

This commit is a major refactoring of how unwind information is stored
after compilation of a function has finished. Previously we would store
the raw `UnwindInfo` as a result of compilation and this would get
serialized/deserialized alongside the rest of the ELF object that
compilation creates. Whenever functions were registered with
`CodeMemory` this would also result in registering unwinding information
dynamically at runtime, which in the case of Unix, for example, would
dynamically created FDE/CIE entries on-the-fly.

Eventually I'd like to support compiling Wasmtime without Cranelift, but
this means that `UnwindInfo` wouldn't be easily available to decode into
and create unwinding information from. To solve this I've changed the
ELF object created to have the unwinding information encoded into it
ahead-of-time so loading code into memory no longer needs to create
unwinding tables. This change has two different implementations for
Windows/Unix:

* On Windows the implementation was much easier. The unwinding
  information on Windows is already stored after the function itself in
  the text section. This was actually slightly duplicated in object
  building and in code memory allocation. Now the object building
  continues to do the same, recording unwinding information after
  functions, and code memory no longer manually tracks this.
  Additionally Wasmtime will emit a special custom section in the object
  file with unwinding information which is the list of
  `RUNTIME_FUNCTION` structures that `RtlAddFunctionTable` expects. This
  means that the object file has all the information precompiled into it
  and registration at runtime is simply passing a few pointers around to
  the runtime.

* Unix was a little bit more difficult than Windows. Today a `.eh_frame`
  section is created on-the-fly with offsets in FDEs specified as the
  absolute address that functions are loaded at. This absolute
  address hindered the ability to precompile the FDE into the object
  file itself. I've switched how addresses are encoded, though, to using
  `DW_EH_PE_pcrel` which means that FDE addresses are now specified
  relative to the FDE itself. This means that we can maintain a fixed
  offset between the `.eh_frame` loaded in memory and the beginning of
  code memory. When doing so this enables precompiling the `.eh_frame`
  section into the object file and at runtime when loading an object no
  further construction of unwinding information is needed.

The overall result of this commit is that unwinding information is no
longer stored in its cranelift-data-structure form on disk. This means
that this unwinding information format is only present during
compilation, which will make it that much easier to compile out
cranelift in the future.

This commit also significantly refactors `CodeMemory` since the way
unwinding information is handled is not much different from before.
Previously `CodeMemory` was suitable for incrementally adding more and
more functions to it, but nowadays a `CodeMemory` either lives per
module (in which case all functions are known up front) or it's created
once-per-`Func::new` with two trampolines. In both cases we know all
functions up front so the functionality of incrementally adding more and
more segments is no longer needed. This commit removes the ability to
add a function-at-a-time in `CodeMemory` and instead it can now only
load objects in their entirety. A small helper function is added to
build a small object file for trampolines in `Func::new` to handle
allocation there.

Finally, this commit also folds the `wasmtime-obj` crate directly into
the `wasmtime-cranelift` crate and its builder structure to be more
amenable to this strategy of managing unwinding tables.

It is not intentional to have any real functional change as a result of
this commit. This might accelerate loading a module from cache slightly
since less work is needed to manage the unwinding information, but
that's just a side benefit from the main goal of this commit which is to
remove the dependence on cranelift unwinding information being available
at runtime.

* Remove isa reexport from wasmtime-environ

* Trim down reexports of `cranelift-codegen`

Remove everything non-essential so that only the bits which will need to
be refactored out of cranelift remain.

* Fix debug tests

* Review comments
2021-08-17 17:14:18 -05:00
Andrew Brown
ddb80d2d14 ci: install OCaml packages necessary for 'differential_spec' fuzz target 2021-08-10 11:56:07 -07:00
Alex Crichton
c8950cf842 Update nightly toolchains in CI (#3097)
This will hopefully fix CI issues we've been seeing with downloads
2021-07-19 13:20:52 -05:00
Dan Gohman
6a5a295019 Port wasi-common from unsafe-io to io-lifetimes (#3049)
* Port wasi-common to io-lifetimes.

This ports wasi-common from unsafe-io to io-lifetimes.

Ambient authority is now indicated via calls to `ambient_authority()`
from the ambient-authority crate, rather than using `unsafe` blocks.

The `GetSetFdFlags::set_fd_flags` function is now split into two phases,
to simplify lifetimes in implementations which need to close and re-open
the underlying file.

* Use posish for errno values instead of libc.

This eliminates one of the few remaining direct libc dependencies.

* Port to posish::io::poll.

Use posish::io::poll instead of calling libc directly. This factors out
more code from Wasmtime, and eliminates the need to manipulate raw file
descriptors directly.

And, this eliminates the last remaining direct dependency on libc in
wasi-common.

* Port wasi-c-api to io-lifetimes.

* Update to posish 0.16.0.

* Embeded NULs in filenames now get `EINVAL` instead of `EILSEQ`.

* Accept either `EILSEQ` or `EINVAL` for embedded NULs.

* Bump the nightly toolchain to 2021-07-12.

This fixes build errors on the semver crate, which as of this writing
builds with latest nightly and stable but not 2021-04-11, the old pinned
version.

* Have cap-std-sync re-export ambient_authority so that users get the same version.
2021-07-14 15:39:09 -07: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
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
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
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
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
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
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
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
Till Schneidereit
3b3b126fe2 Refer to BA security policy (#2912) 2021-05-19 18:24:42 +02:00
Peter Huene
1b8efa7bbd Implement simple benchmarks for instantiation.
This adds benchmarks around module instantiation using criterion.

Both the default (i.e. on-demand) and pooling allocators are tested
sequentially and in parallel using a thread pool.

Instantiation is tested with an empty module, a module with a single page
linear memory, a larger linear memory with a data initializer, and a "hello
world" Rust WASI program.
2021-05-13 19:27:39 -07:00
Pat Hickey
86bd56f6d1 turn off fail-fast again 2021-05-07 15:42:03 -07:00
Pat Hickey
2a0eb391c2 get rid of debugging changes to ci 2021-05-05 17:02:46 -07:00
Pat Hickey
148afd3949 fix yaml syntax 2021-05-05 14:57:33 -07:00
Pat Hickey
6616c1eaf1 fix warnings 2021-05-05 13:32:05 -07:00
Pat Hickey
909d691b55 run wasi-tokio test early, turn off fail-fast so we see all platforms 2021-05-05 12:01:04 -07:00
Chris Fallin
908d47011f CI: pin nightly Rust version to limit breakages to explicit pinning updates. 2021-04-13 11:12:07 -07:00
Chris Fallin
cb48ea406e Switch default to new x86_64 backend.
This PR switches the default backend on x86, for both the
`cranelift-codegen` crate and for Wasmtime, to the new
(`MachInst`-style, `VCode`-based) backend that has been under
development and testing for some time now.

The old backend is still available by default in builds with the
`old-x86-backend` feature, or by requesting `BackendVariant::Legacy`
from the appropriate APIs.

As part of that switch, it adds some more runtime-configurable plumbing
to the testing infrastructure so that tests can be run using the
appropriate backend. `clif-util test` is now capable of parsing a
backend selector option from filetests and instantiating the correct
backend.

CI has been updated so that the old x86 backend continues to run its
tests, just as we used to run the new x64 backend separately.

At some point, we will remove the old x86 backend entirely, once we are
satisfied that the new backend has not caused any unforeseen issues and
we do not need to revert.
2021-04-02 11:35:53 -07:00
Nick Fitzgerald
fefd7f94be Merge pull request #2777 from alexcrichton/tweak-ci-config
Don't document peepmatic in CI
2021-04-01 10:35:36 -07:00
Alex Crichton
910f59114d Use unpacked debuginfo on macOS CI (#2781)
This shaves ~10 minutes off the testing builder since `dsymutil` is
never run and the linker isn't exactly speedy moving around so much debuginfo.
2021-03-29 09:03:56 -05:00
Alex Crichton
7a7667baeb Don't document peepmatic in CI
Avoids building z3 and shaves about ~15 minutes off that builder's CI
time.
2021-03-26 07:36:21 -07:00
Alex Crichton
3f694ae319 Use stable Rust on CI to test the x64 backend (#2766)
* Use stable Rust on CI to test the x64 backend

This commit leverages the newly-released 1.51.0 compiler to test the
new backend on Windows and Linux with a stable compiler instead of a
nightly compiler. This isolates the nightly build to just the nightly
documentation generation and fuzzing, both of which rely on nightly for
the best results right now.

* Use updated stable in book build job

* Run rustfmt for new stable

* Silence new warnings for wasi-nn

* Allow some dead code in the x64 backend

Looks like new rustc is better about emitting some dead-code warnings

* Update rust in peepmatic job

* Fix a test in the pooling allocator

* Remove `package.metdata.docs.rs` temporarily

Needs resolution of https://github.com/rust-lang/cargo/pull/9300 first

* Fix a warning in a wasi-nn example
2021-03-25 13:18:59 -05:00
Chris Fallin
69f27c06d2 Explicitly install LLDB in CI to fix intermittent failure on 20.04 image. 2021-03-18 11:13:14 -07:00
Chris Fallin
05688aa8f4 Add Windows/MinGW to CI for the new backend in order to test Fastcall. 2021-03-10 18:41:39 -08:00
Peter Huene
57dfe99aa5 Run wast tests with both instance allocators.
This commit adds a "pooling" variant to the wast tests that uses the pooling
instance allocation strategy.

This should help with the test coverage of the pooling instance allocator.
2021-03-05 22:28:51 -08:00
Peter Huene
89d3b5d25c Switch CI back to latest nightly.
The issue that required the pin to the older version has been resolved.

This keeps the x64 backend tests on an older nightly version to support the
`-Z` flags being passed without having to update Cargo.toml to a new feature
resolver version.

The doc task is also kept on the older nightly for the same reason.
2021-03-04 18:19:46 -08:00
Peter Huene
f170d0b328 Test the uffd feature on Linux. 2021-03-04 18:19:45 -08:00
Peter Huene
a2c439117a Implement user fault handling with userfaultfd on Linux.
This commit implements the `uffd` feature which turns on support for utilizing
the `userfaultfd` system call on Linux for the pooling instance allocator.

By handling page faults in userland, we are able to detect guard page accesses
without having to constantly change memory page protections.

This should help reduce the number of syscalls as well as kernel lock
contentions when many threads are allocating and deallocating instances.

Additionally, the user fault handler can lazy initialize linear
memories of an instance (implementation to come).
2021-03-04 18:18:52 -08:00
Alex Crichton
7795a230f2 Implement support for async functions in Wasmtime (#2434)
* Implement support for `async` functions in Wasmtime

This is an implementation of [RFC 2] in Wasmtime which is to support
`async`-defined host functions. At a high level support is added by
executing WebAssembly code that might invoke an asynchronous host
function on a separate native stack. When the host function's future is
not ready we switch back to the main native stack to continue execution.

There's a whole bunch of details in this commit, and it's a bit much to
go over them all here in this commit message. The most important changes
here are:

* A new `wasmtime-fiber` crate has been written to manage the low-level
  details of stack-switching. Unixes use `mmap` to allocate a stack and
  Windows uses the native fibers implementation. We'll surely want to
  refactor this to move stack allocation elsewhere in the future. Fibers
  are intended to be relatively general with a lot of type paremters to
  fling values back and forth across suspension points. The whole crate
  is a giant wad of `unsafe` unfortunately and involves handwritten
  assembly with custom dwarf CFI directives to boot. Definitely deserves
  a close eye in review!

* The `Store` type has two new methods -- `block_on` and `on_fiber`
  which bridge between the async and non-async worlds. Lots of unsafe
  fiddly bits here as we're trying to communicate context pointers
  between disparate portions of the code. Extra eyes and care in review
  is greatly appreciated.

* The APIs for binding `async` functions are unfortunately pretty ugly
  in `Func`. This is mostly due to language limitations and compiler
  bugs (I believe) in Rust. Instead of `Func::wrap` we have a
  `Func::wrapN_async` family of methods, and we've also got a whole
  bunch of `Func::getN_async` methods now too. It may be worth
  rethinking the API of `Func` to try to make the documentation page
  actually grok'able.

This isn't super heavily tested but the various test should suffice for
engaging hopefully nearly all the infrastructure in one form or another.
This is just the start though!

[RFC 2]: https://github.com/bytecodealliance/rfcs/pull/2

* Add wasmtime-fiber to publish script

* Save vector/float registers on ARM too.

* Fix a typo

* Update lock file

* Implement periodically yielding with fuel consumption

This commit implements APIs on `Store` to periodically yield execution
of futures through the consumption of fuel. When fuel runs out a
future's execution is yielded back to the caller, and then upon
resumption fuel is re-injected. The goal of this is to allow cooperative
multi-tasking with futures.

* Fix compile without async

* Save/restore the frame pointer in fiber switching

Turns out this is another caller-saved register!

* Simplify x86_64 fiber asm

Take a leaf out of aarch64's playbook and don't have extra memory to
load/store these arguments, instead leverage how `wasmtime_fiber_switch`
already loads a bunch of data into registers which we can then
immediately start using on a fiber's start without any extra memory
accesses.

* Add x86 support to wasmtime-fiber

* Add ARM32 support to fiber crate

* Make fiber build file probing more flexible

* Use CreateFiberEx on Windows

* Remove a stray no-longer-used trait declaration

* Don't reach into `Caller` internals

* Tweak async fuel to eventually run out.

With fuel it's probably best to not provide any way to inject infinite
fuel.

* Fix some typos

* Cleanup asm a bit

* Use a shared header file to deduplicate some directives
* Guarantee hidden visibility for functions
* Enable gc-sections on macOS x86_64
* Add `.type` annotations for ARM

* Update lock file

* Fix compile error

* Review comments
2021-02-26 16:19:56 -06:00
Nick Fitzgerald
a4a841cb6c Ensure all issue templates use Title Case 2021-02-19 10:30:28 -08:00
Nick Fitzgerald
25a9c73901 Clean up our github issue templates
* Don't use HTML comments, as they are noisy, which makes the templates more
  intimidating.

* Use "TODO" to clearly demarcate everywhere the issue reporter should fill in
  some information.

* Use headers and white space abundantly, which makes it easier to visually
  process the template and its sections at a glance, and less of an intimidating
  wall of text.

Fixes #2661
2021-02-19 09:44:19 -08:00
Pat Hickey
23b8c6be79 wasi-nn CI: use the same nightly as rest of file (#2624)
in particular, this 2020-08-25 fails to build `posish 0.5.9` which is
a dep in PR #2487. But there's no reason for this to be lagging
behind...
2021-02-01 10:22:59 -06:00
Frank Denis
a0fad6065a Add support for the experimental wasi-crypto APIs (#2597)
* Add support for the experimental wasi-crypto APIs

The sole purpose of the implementation is to allow bindings and
application developers to test the proposed APIs.

Rust and AssemblyScript bindings are also available as examples.

Like `wasi-nn`, it is currently disabled by default, and requires
the `wasi-crypto` feature flag to be compiled in.

* Rename the wasi-crypto/spec submodule

* Add a path dependency into the submodule for wasi-crypto

* Tell the publish script to vendor wasi-crypto
2021-01-25 09:32:58 -06:00
Chris Fallin
557a932757 Fix GitHub Actions config (actually run gdb tests on new backend).
I had missed that the CI config didn't actually run the tests, because
(I think) `matrix.target` is not set by default (?). All of our hosts
are native x86-64, so we can just gate on OS (Ubuntu) instead.

I also discovered that while I had been testing with the gdb tests
locally, when *all* `debug::*` tests are run, there are two that do not
pass on the new backend because of specific differences in compiled
code. One is a value-lifetime issue (the value is "optimized out" at the
point the breakpoint is set) and the other has to do with basic-block
order (it is trying to match against hardcoded machine-code offsets
which have changed).
2021-01-22 16:42:40 -08:00
Chris Fallin
c84d6be6f4 Detailed debug-info (DWARF) support in new backends (initially x64).
This PR propagates "value labels" all the way from CLIF to DWARF
metadata on the emitted machine code. The key idea is as follows:

- Translate value-label metadata on the input into "value_label"
  pseudo-instructions when lowering into VCode. These
  pseudo-instructions take a register as input, denote a value label,
  and semantically are like a "move into value label" -- i.e., they
  update the current value (as seen by debugging tools) of the given
  local. These pseudo-instructions emit no machine code.

- Perform a dataflow analysis *at the machine-code level*, tracking
  value-labels that propagate into registers and into [SP+constant]
  stack storage. This is a forward dataflow fixpoint analysis where each
  storage location can contain a *set* of value labels, and each value
  label can reside in a *set* of storage locations. (Meet function is
  pairwise intersection by storage location.)

  This analysis traces value labels symbolically through loads and
  stores and reg-to-reg moves, so it will naturally handle spills and
  reloads without knowing anything special about them.

- When this analysis converges, we have, at each machine-code offset, a
  mapping from value labels to some number of storage locations; for
  each offset for each label, we choose the best location (prefer
  registers). Note that we can choose any location, as the symbolic
  dataflow analysis is sound and guarantees that the value at the
  value_label instruction propagates to all of the named locations.

- Then we can convert this mapping into a format that the DWARF
  generation code (wasmtime's debug crate) can use.

This PR also adds the new-backend variant to the gdb tests on CI.
2021-01-21 15:59:49 -08:00