Commit Graph

40 Commits

Author SHA1 Message Date
Andrew Brown
5423683474 Enable spec test for SIMD load_extend 2020-03-31 11:35:26 -07:00
Andrew Brown
08e5484cdb Enable Wasm spec tests for SIMD load_splat (#1426) 2020-03-27 20:00:16 -05:00
Nick Fitzgerald
674a6208d8 Implement data.drop and memory.init and get the rest of the bulk memory spec tests passing (#1264)
* Enable the already-passing `bulk-memoryoperations/imports.wast` test

* Implement support for the `memory.init` instruction and passive data

This adds support for passive data segments and the `memory.init` instruction
from the bulk memory operations proposal. Passive data segments are stored on
the Wasm module and then `memory.init` instructions copy their contents into
memory.

* Implement the `data.drop` instruction

This allows wasm modules to deallocate passive data segments that it doesn't
need anymore. We keep track of which segments have not been dropped on an
`Instance` and when dropping them, remove the entry from the instance's hash
map. The module always needs all of the segments for new instantiations.

* Enable final bulk memory operations spec test

This requires special casing an expected error message for an `assert_trap`,
since the expected error message contains the index of an uninitialized table
element, but our trap implementation doesn't save that diagnostic information
and shepherd it out.
2020-03-10 09:30:11 -05:00
Nick Fitzgerald
ef0cabf8b4 Address review feedback 2020-02-26 14:37:28 -08:00
Nick Fitzgerald
aec8cc1904 List the bulk-memory tests that don't pass, rather than the ones that do
We've crossed the threshold where this is easier :)
2020-02-26 14:35:09 -08:00
Nick Fitzgerald
81227892da Implement bulk memory's partial failure instantiation semantics
Essentially, table and memory out of bounds errors are no longer link errors,
but traps after linking. This means that the partail writes / inits are visible.
2020-02-26 14:35:09 -08:00
Nick Fitzgerald
44c28612fb Implement the memory.fill instruction from the bulk memory proposal 2020-02-26 14:35:09 -08:00
Nick Fitzgerald
cb97e4ec8e Implement table.init and elem.drop from the bulk memory proposal 2020-02-26 14:35:09 -08:00
Nick Fitzgerald
33b4a37bcb Add support for table.copy
This adds support for the `table.copy` instruction from the bulk memory
proposal. It also supports multiple tables, which were introduced by the
reference types proposal.

Part of #928
2020-02-26 14:30:43 -08:00
Nick Fitzgerald
2af544de8b Update to cranelift 0.58.0 and enable (but ignore) reference types and bulk memory tests (#926)
* Update cranelift to 0.58.0

* Update `wasmprinter` dep to require 0.2.1

We already had it in the lock file, but this ensures we won't ever go back down.

* Ensure that our error messages match `assert_invalid`'s

The bulk of this work was done in
https://github.com/bytecodealliance/wasmparser/pull/186 but now we can test it
at the `wasmtime` level as well.

Fixes #492

* Stop feeling guilty about not matching `assert_malformed` messages

Remove the "TODO" and stop printing warning messages. These would just be busy
work to implement, and getting all the messages the exact same relies on using
the same structure as the spec interpreter's parser, which means that where you
have a helper function and they don't, then things go wrong, and vice versa. Not
worth it.

Fixes #492

* Enable (but ignore) the reference-types proposal tests

* Match test suite directly, instead of roundabout starts/endswith

* Enable (but ignore) bulk memory operations proposal test suite
2020-02-07 16:47:55 -06:00
Alex Crichton
1a64acf43b Don't rebuild wasmtime-cli on all file changes
Print out an explicit `rerun-if-changed` annotation in the `build.rs`
for the `wasmtime-cli` crate to avoid rebuilding it constantly as files
like tests change which don't need to cause a rebuild.
2020-02-01 02:45:27 -08:00
Andrew Brown
bc50815eac Re-enable simd_const.wast spec test (#872) 2020-01-29 09:02:24 +01:00
Andrew Brown
f592811c9a Update cranelifte and enable more SIMD spec tests (#806)
* Update cranelift to 0.54

* Enable entire SIMD spec test directory and skip failing tests
2020-01-10 17:02:42 -08:00
Dan Gohman
ef2177ed3a Update to the latest spec_testsuite and dependencies. (#803)
* Update to the latest spec_testsuite and dependencies.

Update to target-lexicon 0.10, cranelift 0.54, wast 0.6, faerie 0.14,
and the latest spec_testsuite.

For wast and cranelift-wasm, update the code for API changes.

* Factor out the code for matching f32, f64, and v128.

This takes the idea from #802 to split out `f32_matches`, `f64_matches`,
and `v128_matches` functions, which better factor out the matching
functionality between scalar and vector.
2020-01-10 13:57:38 -08:00
Alex Crichton
90db89d327 Refactor the wasmtime-wast crate, fix an early return (#798)
This commit refactors the `wasmtime-wast` crate to internally make it a
bit more concise with less repetition. Additionally it also improves the
error messages by guaranteeing that all failed tests have context
indicating where the test was defined.

It turns out there was also a bug in the previous implementation where
an `AssertMalformed` directive with a `quote` module would accidentally
skip all further tests. This has now been fixed, and all futher tests
continued to pass except for the `simd_const.wast` test. This test has
been disabled temporarily but once the `wasmparser` and `wast` crates
are updated (being worked on independently) this should be possible to
re-enable.
2020-01-10 14:17:49 -06:00
Alex Crichton
4197cc562e Don't rebuild the test suite if wast files change (#787)
They're read dynamically so there's no need to rebuild the test suite,
it'll automatically pick up the changes when it's read while the tests
are executed.
2020-01-09 17:10:05 -06:00
Alex Crichton
7474633cca Remove usage of CompilationStrategy from Config (#764)
* Remove usage of `CompilationStrategy` from `Config`

This commit removes the public API usage of the internal
`CompilationStrategy` enumeration from the `Config` type in the
`wasmtime` crate. To do this the `enum` was copied locally into the
crate and renamed `Strategy`. The high-level description of this change
is:

* The `Config::strategy` method now takes a locally-defined `Strategy`
  enumeration instead of an internal type.

* The contents of `Strategy` are always the same, not relying on Cargo
  features to indicate which variants are present. This avoids
  unnecessary downstream `#[cfg]`.

* A `lightbeam` feature was added to the `wasmtime` crate itself to
  lightbeam compilation support.

* The `Config::strategy` method is now fallible. It returns a runtime
  error if support for the selected strategy wasn't compiled in.

* The `Strategy` enum is listed as `#[non_exhaustive]` so we can safely
  add variants over time to it.

This reduces the public crate dependencies of the `wasmtime` crate
itself, removing the need to reach into internal crates even more!

cc #708

* Fix fuzz targets

* Update nightly used to build releases

* Run rustfmt
2020-01-06 18:08:13 -06:00
Nick Fitzgerald
b3b7ce4f6b Enable all Wasm multi-value proposal tests! 2019-11-11 15:39:48 -08:00
Dan Gohman
e8f08193fc Reformat some long lines and macros. 2019-11-08 17:15:37 -08:00
Dan Gohman
b158666f2b Reorganize tests.
- Move spec_testsuite and misc_testsuite under the tests directory.
 - Remove some redundant tests from filetests.
 - Move wat tests to wat/tests.
2019-11-08 10:31:44 -08:00
Alex Crichton
59b15eab13 Simplify #[test] generation for *.wast files (#507)
This commit simplifies the build script slightly for generating tests by
doing a few dull refactorings:

* Leaves formatting to `rustfmt`
* Extract bulk of code execution into a top-level shared `run_wast`
  function so each test is a one-liner
* Use `anyhow` for errors both in the script and in tests
2019-11-07 17:01:17 -06:00
Dan Gohman
d896cc34c2 Remove an obsolete workaround. (#505)
We needed a workaround when using wabt on old Linux distros due to using
old versions of `strtof`. With the switch to `wat`, we no longer need
these workarounds.
2019-11-07 13:33:17 -08:00
Peter Huene
920728d14d Implement registering JIT unwind information on Windows.
This commit implements registering unwind information for JIT functions on
Windows so that the operating system can both walk and unwind stacks containing
JIT frames.

Currently this only works with Cranelift as lightbeam does not emit unwind
information yet.

This commit also resets the stack guard page on Windows for stack overflow
exceptions, allowing reliable stack overflow traps.

With these changes, all previously disabled test suite tests (not including
the multi-value tests) on Windows are now passing.

Fixes #291.
2019-11-06 20:27:32 -08:00
Andrew Brown
3053444b57 Add more SIMD spec tests (#388)
* Add more SIMD spec tests

Also provides a helper, extract_name, for building the names needed for the generated code

* Use `cargo test ... -- --nocapture` to see test errors in CI

* Use OS-independent paths for WAST files

* Ignore 'skip-stack-guard-page'

* Temporarily disable SIMD tests

* Re-enable SIMD spec tests and only disable on Windows temporarily
2019-10-25 06:18:41 -07:00
Nick Fitzgerald
842faf5aa6 Support for multi-value wasm (#399)
* deps: bump wasmparser to 0.39.2

This has a bug fix for multi-value Wasm validation that is required for getting
the spec tests passing.

https://github.com/yurydelendik/wasmparser.rs/pull/135

* Update cranelift to 0.46.1 to get multi-value Wasm support

The `cranelift_wasm` APIs had to change a little bit to maintain state necessary
when translating multi-value Wasm blocks. The `translate_module` function now
returns a `ModuleTranslationState` that is borrowed during each function's
translation.

* Enable multi-value proposal's spec tests

This enables all the Wasm multi-value proposal's spec tests other than the ones
that rely on functions having more return values than registers available on the
target. That is not supported by cranelift yet.

* wasmtime-interface-types: always use multi-value Wasm

And remove the return pointer hacks that work around the lack of multi-value.
2019-10-17 17:12:01 -07:00
Dan Gohman
8e593506dc Don't run the spec_testsuite tests if the submodule isn't checked out. (#409)
* Don't run the spec_testsuite tests if the submodule isn't checked out.

This way, if someone checks out the repository without checking out the
submodules, they can still run "cargo test".

Also, fix a warning in the generated test runner code.

* Print a message if the spec_testsuite submodule is not enabled.

* Move the `#[cfg(test)]` to the top-level `mod`.
2019-10-09 13:34:09 -07:00
Dan Gohman
8e1b44b29c Make more code work with no_std. (#407)
* Make more code work with no_std.

no_std support is still incomplete, but this patch takes care of the
bulk of the straightforward parts.
2019-10-08 16:53:32 -07:00
Dan Gohman
5ccdf13b11 Rename --always-cranelift to --cranelift.
Also, enable use of Lightbeam in wasm2obj.
2019-10-04 17:02:31 -07:00
Dan Gohman
d4353f03cb Don't check assert_trap tests when Lightbeam is enabled.
Lightbeam doesn't yet produce trap metadata, so it can't yet match the
expected `assert_trap` messages. Disable them for now.
2019-10-02 13:42:26 -07:00
Dan Gohman
5bf2fc0ffa Don't enable Lightbeam tests if Lightbeam isn't enabled. 2019-10-02 12:06:00 -07:00
Dan Gohman
65b8afabe6 Make use of Lightbeam configurable.
This adds a `--always-lightbeam` option as well as an `--always-cranelift`
option, to allow the compilation strategy to be selected via the
command-line. This also enables regular testing for Lightbeam.
2019-10-02 11:54:06 -07:00
Andrew Brown
0667a2897d Ignore simd_const test when glibc has a floating point parsing issue 2019-09-26 15:46:18 -07:00
Andrew Brown
03a9f0e461 Run SIMD const spec test 2019-09-26 15:46:18 -07:00
Andrew Brown
ce8e8662ff Enable SIMD in WAST testsuites 2019-09-26 15:46:18 -07:00
Dan Gohman
86142f2e94 Use r# to escape strings which may be rust keywords. (#379)
This is a minor simplification, replacing a hardcoded list of keywords.
2019-09-26 13:44:43 -07:00
Dan Gohman
8ea883a603 Workaround a rounding difference in the strtof function in Centos 6. (#290)
* Workaround a rounding difference in the strtof function in Centos 6.

This difference causes the spec test const.wast to fail, so disable the
test on platforms where we detect the rounding difference occurs.
2019-08-20 23:29:19 -07:00
Till Schneidereit
a988443422 Set up CI and releases with Azure Pipelines (#237)
This Azure Pipelines setup compiles and tests Wasmtime for Linux, macOS, and Windows.

If the CI run was triggered by a new tag being created, a new release for that tag is created with a changelog relative to the last tag release and archives of the builds for all platforms.

If the CI run was triggered by new commits landing on `master`, the release `latest-master` is updated with a new changelog relative to the last tag release and archives of the new builds for all platforms.

Note: This PR also contains changes to disable a bunch of tests on Windows, which are failing due to issues with signal handling.
2019-08-03 13:41:10 +02:00
Dan Gohman
7592c99f3b Refactor the compilation and instantiation pipeline.
wasmtime-execute is now wasmtime-jit. Move `JITCode` and the TargetIsa
into a new `Compiler` type. `InstancePlus` is no more, with trampoline
functionality now handled by `Compiler`.
2019-01-03 11:47:55 -08:00
Dan Gohman
c4e10227de Tidy up trap-handling code. 2018-12-19 15:14:30 -08:00
Dan Gohman
3f24098edc Implement the remaining valid spec tests.
And lots of other miscellaneous changes. Rename InstanceWorld to
InstancePlus and reorganize its contents. This still isn't a great name,
but at least now it has a clear purpose.
2018-12-12 11:49:02 -08:00