Commit Graph

28 Commits

Author SHA1 Message Date
Alex Crichton
ba0dc40b2b Handle select relocations while generating trampolines (#1347)
* Handle select relocations while generating trampolines

Trampoline generation for all function signatures exposed a preexisting
bug in wasmtime where trampoline generation occasionally does have
relocations, but it's asserted that trampolines don't generate
relocations, causing a panic. The relocation is currently primarily the
probestack function which happens when functions might have a huge
number of parameters, but not so huge as to blow the wasmparser limit of
how many parameters are allowed.

This commit fixes the issue by handling relocations for trampolines in
the same manner as the rest of the code. Note that dynamically-generated
trampolines via the `Func` API still panic if they have too many
arguments and generate a relocation, but it seems like we can try to fix
that later if the need truly arises.

Closes #1322

* Log trampoline relocations
2020-03-17 16:30:21 -05:00
Nathan Froyd
af709ded94 bump cranelift version to 0.60.0 (#1328) 2020-03-17 15:29:20 -04:00
Alex Crichton
5f1cba0b7f Hook up all crates via path dependencies 2020-02-28 09:16:05 -08:00
Dan Gohman
588cdd47f9 Add dependency versions and a README.md (#1004)
* Add a version to a path dependeency for publishing on crates.io.

* Add a README.md for wasmtime-profiling.

* Add versions to the wasmtime-profiling dependencies.
2020-02-26 18:13:50 -06:00
Alex Crichton
33a39ff4f0 Bump to 0.12.0 (#997)
* Bump to 0.12.0

* Another lockfile update
2020-02-26 16:19:12 -06:00
Nick Fitzgerald
de4ad31cbd Update cranelift to 0.59.0 2020-02-24 15:21:27 -08:00
Johnnie Birch
9c6150b103 Adds perf jitdump support (#360)
Patch adds support for the perf jitdump file specification.
With this patch it should be possible to see profile data for code
generated and maped at runtime. Specifically the patch adds support
for the JIT_CODE_LOAD and the JIT_DEBUG_INFO record as described in
the specification. Dumping jitfiles is enabled with the --jitdump
flag. When the -g flag is also used there is an attempt to dump file
and line number information where this option would be most useful
when the WASM file already includes DWARF debug information.

The generation of the jitdump files has been tested on only a few wasm
files. This patch is expected to be useful/serviceable where currently
there is no means for jit profiling, but future patches may benefit
line mapping and add support for additional jitdump record types.

Usage Example:
Record
  sudo perf record -k 1 -e instructions:u target/debug/wasmtime -g
  --jitdump test.wasm
Combine
  sudo perf inject -v -j -i perf.data -o perf.jit.data
Report
  sudo perf report -i perf.jit.data -F+period,srcline
2020-02-21 08:30:21 -06: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
9dffaf9d57 Update wasmparser dependency (#912)
* Update wasmparser dependency

Closes #905

* Fix lightbeam compilation
2020-02-06 12:25:32 -06:00
Dan Gohman
9a88d3d894 Replace the global-exports mechanism with a caller-vmctx mechanism. (#789)
* Replace the global-exports mechanism with a caller-vmctx mechanism.

This eliminates the global exports mechanism, and instead adds a
caller-vmctx argument to wasm functions so that WASI can obtain the
memory and other things from the caller rather than looking them up in a
global registry.

This replaces #390.

* Fixup some merge conflicts

* Rustfmt

* Ensure VMContext is aligned to 16 bytes

With the removal of `global_exports` it "just so happens" that this
isn't happening naturally any more.

* Fixup some bugs with double vmctx in wasmtime crate

* Trampoline stub needed adjusting
* Use pointer type instead of always using I64 for caller vmctx
* Don't store `ir::Signature` in `Func` since we don't know the pointer
  size at creation time.
* Skip the first 2 arguments in IR signatures since that's the two vmctx
  parameters.

* Update cranelift to 0.56.0

* Handle more merge conflicts

* Rustfmt

Co-authored-by: Alex Crichton <alex@alexcrichton.com>
2020-01-21 14:50:59 -08:00
Sergei Pepyakin
7890fa6705 Use __chkstk for aarch64 instead of __rust_probestack. (#800)
* Use __chkstk for aarch64 instead of __rust_probestack.

* Demote rustdoc to a regular comment to fix the build.
2020-01-16 20:23:32 -08:00
Yury Delendik
2a50701f0a Backtrace WebAssembly function JIT frames (#759)
* Create backtrace

* Extend unwind information with FDE data.

* Expose backtrace via API/Trap

* wasmtime_call returns not-str

* Return Arc<JITFrameTag>

* rename frame -> function

* Fix windows crashes and unwrap UNWIND_HISTORY_TABLE

* mmaps -> entries

* pass a backtrace in ActionOutcome

* add test_trap_stack_overflow

* Update cranelift version.
2020-01-15 13:48:24 -06: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
Dan Gohman
336ee94c89 Bump version to 0.9.0 (#790) 2020-01-09 21:57:40 -08:00
Andrew Brown
296ebc46fd Update wasmparser to 0.45.1 (#776) 2020-01-07 16:21:50 -06:00
Andrew Brown
69683e8b67 Update Cranelift to 0.52.0 (#710)
* Add unimplemented stubs for Cranelift interfaces

Cranelift changes to FuncEnvironment, TargetEnvironment, and GlobalInit (see https://github.com/bytecodealliance/cranelift/pull/1073) require these changes to compile wasmtime.

* Upgrade Cranelift to 0.52.0
2019-12-31 12:24:56 -06:00
Andrew Brown
086ff63e6b Update wasmparser to 0.45.0 (#733) 2019-12-18 10:24:01 -06:00
Yury Delendik
cc6e8e1af2 Move cranelift dependencies to wasmtime-environ (#669)
Groups all CL data structures into single dependency to be used accross wasmtime project.
2019-12-05 16:07:34 -06:00
Nick Fitzgerald
0fce2ac288 deps: Update wasmparser in most places (#670)
Doesn't update it in lightbeam.
2019-12-05 13:51:47 -06:00
Alex Crichton
39e57e3e9a Migrate back to std:: stylistically (#554)
* Migrate back to `std::` stylistically

This commit moves away from idioms such as `alloc::` and `core::` as
imports of standard data structures and types. Instead it migrates all
crates to uniformly use `std::` for importing standard data structures
and types. This also removes the `std` and `core` features from all
crates to and removes any conditional checking for `feature = "std"`

All of this support was previously added in #407 in an effort to make
wasmtime/cranelift "`no_std` compatible". Unfortunately though this
change comes at a cost:

* The usage of `alloc` and `core` isn't idiomatic. Especially trying to
  dual between types like `HashMap` from `std` as well as from
  `hashbrown` causes imports to be surprising in some cases.
* Unfortunately there was no CI check that crates were `no_std`, so none
  of them actually were. Many crates still imported from `std` or
  depended on crates that used `std`.

It's important to note, however, that **this does not mean that wasmtime
will not run in embedded environments**. The style of the code today and
idioms aren't ready in Rust to support this degree of multiplexing and
makes it somewhat difficult to keep up with the style of `wasmtime`.
Instead it's intended that embedded runtime support will be added as
necessary. Currently only `std` is necessary to build `wasmtime`, and
platforms that natively need to execute `wasmtime` will need to use a
Rust target that supports `std`. Note though that not all of `std` needs
to be supported, but instead much of it could be configured off to
return errors, and `wasmtime` would be configured to gracefully handle
errors.

The goal of this PR is to move `wasmtime` back to idiomatic usage of
features/`std`/imports/etc and help development in the short-term.
Long-term when platform concerns arise (if any) they can be addressed by
moving back to `no_std` crates (but fixing the issues mentioned above)
or ensuring that the target in Rust has `std` available.

* Start filling out platform support doc
2019-11-18 22:04:06 -08:00
Alex Crichton
f2718a9573 Update faerie, remove usage of failure (#591)
This commit removes the usage of the `failure` crate and finishes up the
final pieces of the migration to `std::error::Error` and `anyhow`. The
`faerie` crate was updated to pull in its migration from `failure` to
`anyhow` as well.
2019-11-18 14:26:37 -08:00
Dan Gohman
c5f998add2 Update the crates.io publishing scripts (#580)
* Fix fuzz target compilation.

* Bump version to 0.7.0

* Temporarily disable fuzz tests

Temporarily disable fuzz tests until https://github.com/bytecodealliance/cranelift/issues/1216 is resolved.

* Fix publish-all.sh to not modify the witx crate.

* Remove the "publish = false" attribute from Lightbeam.

* Add a README.md for wasmtime-interface-types.

* Remove the "rust" category.

This fixes the following warning:

warning: the following are not valid category slugs and were ignored: rust. Please see https://crates.io/category_slugs for the list of all category slugs.

* Mark wasmtime-cli as "publish = false".

* Sort the publishing rules in topological order.

Also, publish nightly-only crates with cargo +nightly.
2019-11-15 12:17:19 -08:00
Dan Gohman
c78196bd01 Update repository URLs for the Bytecode Alliance. (#550) 2019-11-12 09:18:59 -08:00
Nick Fitzgerald
01ab20e372 Bump cranelift deps to 0.50.0 2019-11-11 15:52:49 -08:00
Dan Gohman
1a0ed6e388 Use the more-asserts crate in more places.
This provides assert_le, assert_lt, and so on, which can print the
values of the operands.
2019-11-08 15:24:53 -08:00
Dan Gohman
a2b4148a91 General Cargo.toml cleanup. (#529)
* General Cargo.toml cleanup.

 - Remove travis-ci attributes.
 - Remove "experimental" badges from actively-developed crates.
 - Reflow some long lines.
 - Use dependency features consistently.
 - Add readme attributes

* Update WASI to the latest trunk.

This notably adds a .gitignore file for the WASI directory.
2019-11-08 17:22:37 -06:00
Dan Gohman
22641de629 Initial reorg.
This is largely the same as #305, but updated for the current tree.
2019-11-08 06:35:40 -08:00