Commit Graph

8347 Commits

Author SHA1 Message Date
Chris Fallin
ae19bd5daf Update RELEASES.md. 2021-04-05 10:17:33 -07:00
Chris Fallin
8d78212a15 Merge pull request #2718 from cfallin/new-backend
Switch default to new x86_64 backend.
2021-04-05 09:38:08 -07:00
Alex Crichton
04bf6e5bbb Move some scopes around to fix a leak on raising a trap (#2803)
Some recent refactorings accidentally had a local `Store` on the stack
when a longjmp was initiated, bypassing its destructor and causing
`Store` to leak.

Closes #2802
2021-04-05 10:29:18 -05:00
Peter Huene
4d036a4e34 Merge pull request #2801 from peterhuene/fix-initialize-instance-range
Fix incorrect range in `ininitialize_instance`.
2021-04-02 17:30:35 -07:00
Peter Huene
37bb7af454 Fix incorrect range in ininitialize_instance.
This commit fixes a bug where the wrong destination range was used when copying
data from the module's memory initialization upon instance initialization.

This affects the on-demand allocator only when using the `uffd` feature on
Linux and when the Wasm page being initialized is not the last in the module's
initial pages.

Fixes #2784.
2021-04-02 16:27:22 -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
Peter Huene
b7b47e380d Merge pull request #2791 from peterhuene/compile-command
Add a compile command to Wasmtime.
2021-04-02 11:18:14 -07:00
Andrew Brown
d32501c554 x64: refactor REX-specific encoding machinery to its own module
In preparation for adding new encoding modes to the x64 backend (e.g. VEX,
EVEX), this change moves all of the current instruction encoding functions to
`encodings::rex`. This refactor does not change any logic.
2021-04-02 11:17:39 -07:00
Chris Fallin
074b83eee4 Merge pull request #2800 from wrbs/switch-bug
cranelift-frontend: Seal unsealed block in switch generation
2021-04-02 10:32:49 -07:00
Alex Crichton
29949505d6 Fix printing float results from the CLI (#2797)
Previously their bit patterns were printed interpreted as decimals, now
they're printed as floats.
2021-04-02 10:07:59 -05:00
Will Robson
da33496063 Seal the block that should have been sealed 2021-04-02 15:35:12 +01:00
Will Robson
f5f3c2fb25 Add test cases to show the unsealed block in switch generation 2021-04-02 15:34:49 +01:00
Peter Huene
0ddfe97a09 Change how flags are stored in serialized modules.
This commit changes how both the shared flags and ISA flags are stored in the
serialized module to detect incompatibilities when a serialized module is
instantiated.

It improves the error reporting when a compiled module has mismatched shared
flags.
2021-04-01 21:39:57 -07:00
Peter Huene
4ad0099da4 Update wat crate.
Update the `wat` crate to latest version and use `Error::set_path` in
`Module::from_file` to properly record the path associated with errors.
2021-04-01 20:11:26 -07:00
Peter Huene
3da03bcfcf Code review feedback.
* Expand doc comment on `Engine::precompile_module`.
* Add FIXME comment regarding a future ISA flag compatibility check before
  doing a JIT from `Module::from_binary`.
* Remove no-longer-needed CLI groups from the `compile` command.
2021-04-01 19:38:20 -07:00
Peter Huene
9e7d2fed98 Sort output in wasmtime settings.
This commit sorts the settings output by the `wasmtime settings` command.
2021-04-01 19:38:19 -07:00
Peter Huene
d1313b1291 Code review feedback.
* Move `Module::compile` to `Engine::precompile_module`.
* Remove `Module::deserialize` method.
* Make `Module::serialize` the same format as `Engine::precompile_module`.
* Make `Engine::precompile_module` return a `Vec<u8>`.
* Move the remaining serialization-related code to `serialization.rs`.
2021-04-01 19:38:19 -07:00
Peter Huene
abf3bf29f9 Add a wasmtime settings command to print Cranelift settings.
This commit adds the `wasmtime settings` command to print out available
Cranelift settings for a target (defaults to the host).

The compile command has been updated to remove the Cranelift ISA options in
favor of encouraging users to use `wasmtime settings` to discover what settings
are available.  This will reduce the maintenance cost for syncing the compile
command with Cranelift ISA flags.
2021-04-01 19:38:19 -07:00
Peter Huene
a474524d3b Code review feedback.
* Removed `Config::cranelift_clear_cpu_flags`.
* Renamed `Config::cranelift_other_flag` to `Config::cranelift::flag_set`.
* Renamed `--cranelift-flag` to `--cranelift-set`.
* Renamed `--cranelift-preset` to `--cranelift-enable`.
2021-04-01 19:38:19 -07:00
Peter Huene
0000aa0646 Replace WebAssembly feature CLI options with --wasm-features.
This commit hides the existing WebAssembly feature CLI options (e.g.
`--enable-simd`) and adds a `--wasm-features` flag that enables multiple
(or all) WebAssembly features.

Features can be disabled by prefixing the value with `-`, e.g.
`--wasm-features=-simd`.
2021-04-01 19:38:19 -07:00
Peter Huene
1ce2a87149 Code review feedback.
* Remove `Config::for_target` in favor of setter `Config::target`.
* Remove explicit setting of Cranelift flags in `Config::new` in favor of
  calling the `Config` methods that do the same thing.
* Serialize the package version independently of the data when serializing a
  module.
* Use struct deconstructing in module serialization to ensure tunables and
  features aren't missed.
* Move common log initialization in the CLI into `CommonOptions`.
2021-04-01 19:38:19 -07:00
Peter Huene
273597903b Fix spelling error. 2021-04-01 19:38:18 -07:00
Peter Huene
7e02940c72 Add Wasmtime to AOT header.
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2021-04-01 19:38:18 -07:00
Peter Huene
29d366db7b Add a compile command to Wasmtime.
This commit adds a `compile` command to the Wasmtime CLI.

The command can be used to Ahead-Of-Time (AOT) compile WebAssembly modules.

With the `all-arch` feature enabled, AOT compilation can be performed for
non-native architectures (i.e. cross-compilation).

The `Module::compile` method has been added to perform AOT compilation.

A few of the CLI flags relating to "on by default" Wasm features have been
changed to be "--disable-XYZ" flags.

A simple example of using the `wasmtime compile` command:

```text
$ wasmtime compile input.wasm
$ wasmtime input.cwasm
```
2021-04-01 19:38:18 -07:00
Alex Crichton
90aa5cf49f Daily update of wasm-smith (#2798)
Because apparently it's daily now!
2021-04-01 15:05:38 -05:00
Pat Hickey
e6140c9c16 Merge pull request #2796 from bytecodealliance/pch/revert_2782
Revert "wiggle: generate a span that is present at all levels"
2021-04-01 10:51:03 -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
Pat Hickey
0508394c62 Revert "wiggle: generate a span that is present at all levels"
This reverts commit 0466f47cb4.
2021-04-01 09:33:37 -07:00
Alex Crichton
dfffc69150 Update wasm-smith again (#2794)
More fuzz tweaks!
2021-03-31 15:39:37 -05:00
Nick Fitzgerald
db65fa80e0 Merge pull request #2793 from alexcrichton/spectest-fuzz-tweak
Disable module linking in spectest fuzzing
2021-03-31 09:27:50 -07:00
Alex Crichton
6748dfa43a Disable module linking in spectest fuzzing
Module linking implicitly enables multiple tables but that isn't
supported by the spec tests today.
2021-03-31 07:20:22 -07:00
Nick Fitzgerald
27ce383306 Merge pull request #2792 from alexcrichton/update-wasm-smith
Update wasm-smith dependency
2021-03-30 10:33:11 -07:00
Alex Crichton
e0440eebb7 Update wasm-smith dependency
Brings in a fuzzing bug fix!
2021-03-30 07:13:10 -07:00
Alex Crichton
a301202b7d Remove the type-driven ability for duplicates in a Linker (#2789)
When `Linker` was first created it was attempted to be created with the
ability to instantiate any wasm modules, including those with duplicate
import strings of different types. In an effort to support this a
`Linker` supports defining the same names twice so long as they're
defined with differently-typed values.

This ended up causing wast testsuite failures module linking is enabled,
however, because the wrong error message is returned. While it would be
possible to fix this there's already the possibility for confusing error
messages today due to the `Linker` trying to take on this type-level
complexity. In a way this is yet-another type checker for wasm imports,
but sort of a bad one because it only supports things like
globals/functions, and otherwise you can only define one `Memory`, for
example, with a particular name.

This commit completely removes this feature from `Linker` to simplify
the implementation and make error messages more straightforward. This
means that any error message coming from a `Linker` is purely "this
thing wasn't defined" rather than a hybrid of "maybe the types didn't
match?". I think this also better aligns with the direction that we see
conventional wasm modules going which is that duplicate imports are not
ever present.
2021-03-29 17:26:02 -05:00
Pat Hickey
cc0ec75a29 Merge pull request #2790 from bytecodealliance/pch/wiggle_async_trait_reexport
wiggle::async_trait is defined as async_trait::async_trait(?Send)
2021-03-29 11:03:25 -07:00
Pat Hickey
e38166ac3f wiggle::async_trait is defined as async_trait::async_trait(?Send)
async methods used by wiggle currently need to Not have the Send
constraint, so rather than make all use sites pass the argument
to the re-exported async_trait macro, define a new macro that
applies the argument.
2021-03-29 10:04:42 -07:00
Alex Crichton
b1a3c9047f Actually make spectest fuzzing deterministic
Turns out #2106 missed the actual sorting operation. Silly me!
2021-03-29 09:12:16 -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
Pat Hickey
2ad8cd889a Merge pull request #2787 from bjorn3/remove_todo
Remove fixed todo
2021-03-28 15:08:10 -07:00
Pat Hickey
0a255c19de Merge pull request #2782 from bytecodealliance/pch/wiggle_tracing_span_fix
wiggle: generate a span that is present at all levels
2021-03-28 15:04:33 -07:00
Pat Hickey
3c00440b0e Merge pull request #2785 from bytecodealliance/pch/bugfix_wiggle_wasmtime_async
wiggle-wasmtime: use fully qualified Rc, RefCell in expansion
2021-03-28 15:03:42 -07:00
bjorn3
16e2e3a002 Remove fixed todo 2021-03-28 15:16:33 +02:00
Pat Hickey
3abc29e279 Merge pull request #2776 from bytecodealliance/pch/wasmtime_wasi_usability
`wasmtime-wasi` usability: re-exports of common siblings
2021-03-26 17:36:44 -07:00
Pat Hickey
8da3de6756 wiggle-wasmtime: use fully qualified std::rc::Rc<std::cell::RefCell<>> in expansion 2021-03-26 17:21:51 -07:00
Pat Hickey
ae4c5a9d7f fixes in tests and examples 2021-03-26 15:37:57 -07:00
Pat Hickey
0466f47cb4 wiggle: generate a span that is present at all levels
The code I wrote here prior was incorrect: a span is present at the
level specified and below; previously I thought it was present at the
level specified and above. So, previously, a TRACE-level event inside
this span would be associated with the module and function name provided
here. Now all events inside this span should be associated with it.
2021-03-26 14:25:10 -07:00
Alex Crichton
550c774c1d fuzz: Allow incompatible import types in instantiation (#2778)
Yesterday fuzzing was switched to using a `Linker` to improve coverage
when using module linking since we can fake instance imports with
definitions of each individual item. Using a `Linker`, however, means
that we can't necessarily instantiate all modules, such as

    (module
      (import "" "" (memory (;0;) 0 1))
      (import "" "" (memory (;1;) 2)))

As a result this just allows these sorts of "incompatible import type"
errors when fuzzing to not trigger crashes.
2021-03-26 14:38:34 -05:00
Johnnie Birch
31d3db1ec2 Implements convert low signed integer to float for x64 simd 2021-03-26 12:13:29 -07:00
Andrew Brown
c43d00fa34 doc: link to where oss-fuzz issues are recorded (#2780) 2021-03-26 13:01:13 -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