Commit Graph

295 Commits

Author SHA1 Message Date
Piotr Sikora
b9de8eb3e2 docs: SIMD proposal is enabled by default. (#4050)
Missed in #3601.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
2022-04-19 06:47:14 -07:00
Alex Crichton
35377bd33f Fixup release documentation (#3988)
* Fill out some missing comments on the workflow itself
* Fix some formatting in the book to properly render sub-bullets
2022-04-05 14:14:44 -05:00
Alex Crichton
7b5176baea Upgrade all crates to the Rust 2021 edition (#3991)
* Upgrade all crates to the Rust 2021 edition

I've personally started using the new format strings for things like
`panic!("some message {foo}")` or similar and have been upgrading crates
on a case-by-case basis, but I think it probably makes more sense to go
ahead and blanket upgrade everything so 2021 features are always
available.

* Fix compile of the C API

* Fix a warning

* Fix another warning
2022-04-04 12:27:12 -05:00
Kk Shinkai
e6f110dc2f Fix document formatting (#3990) 2022-04-04 09:05:40 -05:00
Alex Crichton
c89dc55108 Add a two-week delay to Wasmtime's release process (#3955)
* Bump to 0.36.0

* Add a two-week delay to Wasmtime's release process

This commit is a proposal to update Wasmtime's release process with a
two-week delay from branching a release until it's actually officially
released. We've had two issues lately that came up which led to this proposal:

* In #3915 it was realized that changes just before the 0.35.0 release
  weren't enough for an embedding use case, but the PR didn't meet the
  expectations for a full patch release.

* At Fastly we were about to start rolling out a new version of Wasmtime
  when over the weekend the fuzz bug #3951 was found. This led to the
  desire internally to have a "must have been fuzzed for this long"
  period of time for Wasmtime changes which we felt were better
  reflected in the release process itself rather than something about
  Fastly's own integration with Wasmtime.

This commit updates the automation for releases to unconditionally
create a `release-X.Y.Z` branch on the 5th of every month. The actual
release from this branch is then performed on the 20th of every month,
roughly two weeks later. This should provide a period of time to ensure
that all changes in a release are fuzzed for at least two weeks and
avoid any further surprises. This should also help with any last-minute
changes made just before a release if they need tweaking since
backporting to a not-yet-released branch is much easier.

Overall there are some new properties about Wasmtime with this proposal
as well:

* The `main` branch will always have a section in `RELEASES.md` which is
  listed as "Unreleased" for us to fill out.
* The `main` branch will always be a version ahead of the latest
  release. For example it will be bump pre-emptively as part of the
  release process on the 5th where if `release-2.0.0` was created then
  the `main` branch will have 3.0.0 Wasmtime.
* Dates for major versions are automatically updated in the
  `RELEASES.md` notes.

The associated documentation for our release process is updated and the
various scripts should all be updated now as well with this commit.

* Add notes on a security patch

* Clarify security fixes shouldn't be previewed early on CI
2022-04-01 13:11:10 -05:00
Alex Crichton
5f53fd5ca2 Clarify patch release criteria (#3940)
In today's Wasmtime meeting we discussed the acceptance criteria for
patch releases for Wasmtime and Cranelift. The criteria we came up with
were:

* Cranelift will get a patch release for any miscompilation, whether or
  not it affects Wasmtime.
* Wasmtime will get a patch release for security issues and bugs which
  seriously hinder usability.

The consensus at the time was that due to Wasmtime's monthly release
schedule we want to be pretty strict about what generates a patch
release, hence the threshold being at serious bugs as opposed to any
bugs found.

This commit attempts to update the `stability-release.md` document with
our documented release process. The release cadence section is brought
up to date, the Wasmtime section was edited slightly (it largely already
said this which I only just realized), and a Cranelift section was
added.
2022-03-18 09:09:50 -05:00
Andrew Brown
6b4e84f2e3 doc: improve VTune documentation (#3907)
This change removes the Linux-specific wording of the VTune
documentation as well as fixing a link.
2022-03-09 15:51:20 -06:00
Andrew Brown
c183e93b80 x64: enable VTune support by default (#3821)
* x64: enable VTune support by default

After significant work in the `ittapi-rs` crate, this dependency should
build without issue on Wasmtime's supported operating systems: Windows,
Linux, and macOS. The difference in the release binary is <20KB, so this
change makes `vtune` a default build feature. This change upgrades
`ittapi-rs` to v0.2.0 and updates the documentation.

* review: add configuration for defaults in more places

* review: remove OS conditional compilation, add architecture

* review: do not default vtune feature in wasmtime-jit
2022-02-22 08:32:09 -08:00
Kyle Brown
5ff1ddee5b Mention --invoke on "CLI Options for wasmtime" page (#3828)
* Document the invoke argument of the run command.

* Update docs/cli-options.md

Co-authored-by: Kyle Brown <kyleb@liquidrocketry.com>
Co-authored-by: Nick Fitzgerald <fitzgen@gmail.com>
2022-02-17 14:55:11 -06:00
Tim Park
198d4d64b0 Make examples compile without warnings (#3716) 2022-01-24 09:26:11 -06:00
Andrew Brown
24bc4d6055 docs: replace 'amplxe-cl' with 'vtune' (#3622)
The name of the VTune collector CLI has [now
changed](https://github.com/intel/ittapi/pull/32#discussion_r771417365)
to `vtune`; `amplxe-cl` is deprecated.
2021-12-17 16:59:47 -08:00
Andrew Brown
99b00cd973 docs: update VTune documentation (#3604)
While using VTune, it seemed a good idea to check that the VTune
documentation for Wasmtime was still correct. It is and VTune support
still works (improvements: click-through to x86 assembly is not
available). These changes simply re-organize the documentation and add a
section for running VTune from a GUI.
2021-12-17 15:47:09 -08:00
Alex Crichton
00feefe9a7 Change the bump-version workflow's schedule (#3512)
* Change the bump-version workflow's schedule

Either I don't understand cron or GitHub doesn't understand cron. It's
not clear which. I think that
https://github.com/bytecodealliance/wasmtime/pull/3511 may have fallen
within our schedule but it was supposed to be on a weekday. Otherwise
https://github.com/bytecodealliance/wasmtime/pull/3499 was certainly
spurious. This commit moves to a simpler "just do it on the same day
each month" and we can manually figure out weekdays and such. Hopefully
this should reduce the number of spurious PRs we're getting to bump
versions.

This also removes the script to force a version bump since I found a
button on the GitHub UI to do the same thing. Additionally I've updated
the patch-release documentation to use this button. Note that this
button takes inputs as well which means we can further automate patch
releases to look even more like normal release process, differing only
in one part of the argument used to trigger the workflow.

* Fix a typo
2021-11-08 10:37:53 -06:00
Alex Crichton
807b528bfb Automate more of Wasmtime's release process (#3422)
* Automate more of Wasmtime's release process

This change revamps the release process for Wasmtime and intends to make
it nearly 100% automated for major release and hopefully still pretty
simple for patch releases. New workflows are introduced as part of
this commit:

* Once a month a PR is created with major version bumps
* Specifically hinted commit messages to the `main` branch will get
  tagged and pushed to the main repository.
* On tags we'll now not only build releases after running CI but
  additionally crates will be published to crates.io.

In conjunction with other changes this means that the release process
for a new major version of Wasmtime is simply merging a PR. Patch
releases will involve running some steps locally but most of the
nitty-gritty should be simply merging the PR that's generated.

* Use an anchor in a regex
2021-10-26 10:25:40 -05:00
Alex Crichton
b553d84362 Change how security advisories work on CI (#3461)
Before this commit we actually have two builders checking for security
advisories on CI, one is `cargo audit` and one is `cargo deny`. The
`cargo deny` builder is slightly different in that it checks a few other
things about our dependency tree such as licenses, duplicates, etc. This
commit removes the advisory check from `cargo deny` on CI and then moves
the `cargo audit` check to a separate workflow.

The `cargo audit` check will now run nightly and will open an issue on
the Wasmtime repository when an advisory is found. This should help make
it such that our CI is never broken by the publication of an advisory
but we're still promptly notified whenever an advisory is made. I've
updated the release process notes to indicate that the open issues
should be double-checked to ensure that there are no open advisories
that we need to take care of.
2021-10-19 10:12:36 -05:00
Nathan Froyd
35cdd53989 fix typo in stability-platform-support.md 2021-10-14 12:19:29 -04:00
Shinobu Hayashi
59a9bd6285 Chore fix typo in docs/contributing-architecture.md (#3449) 2021-10-13 09:56:56 -05:00
Alex Crichton
1ee2af0098 Remove the lightbeam backend (#3390)
This commit removes the Lightbeam backend from Wasmtime as per [RFC 14].
This backend hasn't received maintenance in quite some time, and as [RFC
14] indicates this doesn't meet the threshold for keeping the code
in-tree, so this commit removes it.

A fast "baseline" compiler may still be added in the future. The
addition of such a backend should be in line with [RFC 14], though, with
the principles we now have for stable releases of Wasmtime. I'll close
out Lightbeam-related issues once this is merged.

[RFC 14]: https://github.com/bytecodealliance/rfcs/pull/14
2021-09-27 12:27:19 -05:00
Alex Crichton
8ebaaf928d Remove the wasmtime wasm2obj command (#3301)
* Remove the `wasmtime wasm2obj` command

This commit removes the `wasm2obj` subcommand of the `wasmtime` CLI.
This subcommand has a very long history and dates back quite far. While
it's existed, however, it's never been documented in terms of the output
it's produced. AFAIK it's only ever been used for debugging to see the
machine code output of Wasmtime on some modules. With recent changes to
the module serialization output the output of `wasmtime compile`, the
`*.cwasm` file, is now a native ELF file which can be fed to standard
tools like `objdump`. Consequently I dont think there's any remaining
need to keep `wasm2obj` around itself, so this commit removes the
subcommand.

* More code to delete

* Try to fix debuginfo tests
2021-09-08 10:40:58 -05: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
Aaron Turner
331b0dee30 Updated the AssemblyScript example (#3185) 2021-08-19 09:20:04 -05:00
Aaron Turner
fb32e49ed7 Docs: Removed the extra markdown example from the Summary (#3194) 2021-08-17 11:22:08 +02:00
Alex Crichton
e0c8961333 Add memory64 support to the Wasmtime CLI and C API (#3182)
Accidentally forgotten from #3153!
2021-08-12 12:33:57 -05:00
Pat Hickey
ebbe399725 wasi tutorial: make usage string consistient between rust and c programs (#3098)
closes #3093
2021-07-19 15:04:33 -05:00
Olivier Lemasle
65a902f49d [doc] Update go example (#3065) 2021-07-12 09:01:44 -05:00
Andrew Brown
a83497e0b0 [doc] Add LLDB tips and tricks 2021-07-09 15:45:28 -07:00
Andrew Brown
16379db174 [doc] Add filler text to examples landing page 2021-07-09 06:22:25 -07:00
Andrew Brown
e5d25bc216 [doc] Add some documentation for debugging
The previous documentation only covers how to enable debug info when
embedding Wasmtime. This change should cover the commonly-asked
question: how do I debug in Wasmtime?
2021-07-09 06:22:25 -07:00
Benjamin Bouvier
93b7cdd6a2 Fix a few typos in the architecture doc (#3054) 2021-07-02 13:09:58 -05:00
Alex Crichton
aa5d837428 Start a high-level architecture document for Wasmtime (#3019)
* Start a high-level architecture document for Wasmtime

This commit cleands up some existing documentation by removing a number
of "noop README files" and starting a high-level overview of the
architecture of Wasmtime. I've placed this documentation under the
contributing section of the book since it seems most useful for possible
contributors.

I've surely left some things out in this pass, and am happy to add more!

* Review comments

* More rewording

* typos
2021-07-02 09:02:26 -05:00
Tshepang Lekhonkhobe
a3e08ee535 this option is default since early 2018 (#3042)
WASI was only added in Rust about a year from then
2021-06-30 09:34:34 -05: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
Till Schneidereit
3b3b126fe2 Refer to BA security policy (#2912) 2021-05-19 18:24:42 +02:00
Alex Crichton
7ec073cef1 Bring back per-thread lazy initialization (#2863)
* Bring back per-thread lazy initialization

Platforms Wasmtime supports may have per-thread initialization that
needs to run before WebAssembly. For example Unix needs to setup a
sigaltstack and macOS needs to set up mach ports. In #2757 this
per-thread setup was moved out of the invocation of a wasm function,
relying on the lack of Send for Store to initialize the thread at Store
creation time and never worry about it later.

This conflicted with [wasmtime's desired multithreading
story](https://github.com/bytecodealliance/wasmtime/pull/2812) so a new
[`Store::notify_switched_thread` was
added](https://github.com/bytecodealliance/wasmtime/pull/2822) to
explicitly indicate a Store has moved to another thread (if it unsafely
did so).

It turns out though that it's not always easy to determine when a
`Store` moves to a new thread. For example the Go bindings for Wasmtime
are generally unaware when a goroutine switches OS threads. This led to
https://github.com/bytecodealliance/wasmtime-go/issues/74 where a SIGILL
was left uncaught, making it appear that traps aren't working properly.

This commit revisits the decision in #2757 and moves per-thread
initialization back into the path of calling into WebAssembly. This is
differently from before, though, where there's still only one TLS access
on the path of calling into WebAssembly, unlike before where it was a
separate access. This allows us to get the speed benefits of #2757 as
well as the flexibility benefits of not having to explicitly move a
store between threads.

With this new ability this commit deletes the recently added
`Store::notify_switched_thread` method since it's no longer necessary.

* Fix a test compiling
2021-04-28 12:08:27 -05:00
Benjamin Bouvier
ba73b458b8 Introduce a new API that allows notifying that a Store has moved to a new thread (#2822)
* Introduce a new API that allows notifying that a Store has moved to a new thread

* Add backlink to documentation, and mention the new API in the multithreading doc;
2021-04-16 11:15:35 -05:00
Alex Crichton
e43d94033f Document guidance around multithreading and Wasmtime (#2812)
* Document guidance around multithreading and Wasmtime

This commit writes a page of documentation for the Wasmtime book to
serve as guidance for embedders looking to add multithreading with
Wasmtime support. As always with any safe Rust API this reading is
optional because you can't mis-use Wasmtime without `unsafe`, but I'm
hoping that this documentation can serve as a point of reference for
folks who want to add multithreading but are confused/annoyed that
Wasmtime's types do not implement the `Send` and `Sync` traits.

Closes #793

* I can type
2021-04-07 16:34:07 -05: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
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
Andrew Brown
c43d00fa34 doc: link to where oss-fuzz issues are recorded (#2780) 2021-03-26 13:01:13 -05:00
Alex Crichton
2697a18d2f Redo the statically typed Func API (#2719)
* Redo the statically typed `Func` API

This commit reimplements the `Func` API with respect to statically typed
dispatch. Previously `Func` had a `getN` and `getN_async` family of
methods which were implemented for 0 to 16 parameters. The return value
of these functions was an `impl Fn(..)` closure with the appropriate
parameters and return values.

There are a number of downsides with this approach that have become
apparent over time:

* The addition of `*_async` doubled the API surface area (which is quite
  large here due to one-method-per-number-of-parameters).
* The [documentation of `Func`][old-docs] are quite verbose and feel
  "polluted" with all these getters, making it harder to understand the
  other methods that can be used to interact with a `Func`.
* These methods unconditionally pay the cost of returning an owned `impl
  Fn` with a `'static` lifetime. While cheap, this is still paying the
  cost for cloning the `Store` effectively and moving data into the
  closed-over environment.
* Storage of the return value into a struct, for example, always
  requires `Box`-ing the returned closure since it otherwise cannot be
  named.
* Recently I had the desire to implement an "unchecked" path for
  invoking wasm where you unsafely assert the type signature of a wasm
  function. Doing this with today's scheme would require doubling
  (again) the API surface area for both async and synchronous calls,
  further polluting the documentation.

The main benefit of the previous scheme is that by returning a `impl Fn`
it was quite easy and ergonomic to actually invoke the function. In
practice, though, examples would often have something akin to
`.get0::<()>()?()?` which is a lot of things to interpret all at once.
Note that `get0` means "0 parameters" yet a type parameter is passed.
There's also a double function invocation which looks like a lot of
characters all lined up in a row.

Overall, I think that the previous design is starting to show too many
cracks and deserves a rewrite. This commit is that rewrite.

The new design in this commit is to delete the `getN{,_async}` family of
functions and instead have a new API:

    impl Func {
        fn typed<P, R>(&self) -> Result<&Typed<P, R>>;
    }

    impl Typed<P, R> {
        fn call(&self, params: P) -> Result<R, Trap>;
        async fn call_async(&self, params: P) -> Result<R, Trap>;
    }

This should entirely replace the current scheme, albeit by slightly
losing ergonomics use cases. The idea behind the API is that the
existence of `Typed<P, R>` is a "proof" that the underlying function
takes `P` and returns `R`. The `Func::typed` method peforms a runtime
type-check to ensure that types all match up, and if successful you get
a `Typed` value. Otherwise an error is returned.

Once you have a `Typed` then, like `Func`, you can either `call` or
`call_async`. The difference with a `Typed`, however, is that the
params/results are statically known and hence these calls can be much
more efficient.

This is a much smaller API surface area from before and should greatly
simplify the `Func` documentation. There's still a problem where
`Func::wrapN_async` produces a lot of functions to document, but that's
now the sole offender. It's a nice benefit that the
statically-typed-async verisons are now expressed with an `async`
function rather than a function-returning-a-future which makes it both
more efficient and easier to understand.

The type `P` and `R` are intended to either be bare types (e.g. `i32`)
or tuples of any length (including 0). At this time `R` is only allowed
to be `()` or a bare `i32`-style type because multi-value is not
supported with a native ABI (yet). The `P`, however, can be any size of
tuples of parameters. This is also where some ergonomics are lost
because instead of `f(1, 2)` you now have to write `f.call((1, 2))`
(note the double-parens). Similarly `f()` becomes `f.call(())`.

Overall I feel that this is a better tradeoff than before. While not
universally better due to the loss in ergonomics I feel that this design
is much more flexible in terms of what you can do with the return value
and also understanding the API surface area (just less to take in).

[old-docs]: https://docs.rs/wasmtime/0.24.0/wasmtime/struct.Func.html#method.get0

* Rename Typed to TypedFunc

* Implement multi-value returns through `Func::typed`

* Fix examples in docs

* Fix some more errors

* More test fixes

* Rebasing and adding `get_typed_func`

* Updating tests

* Fix typo

* More doc tweaks

* Tweak visibility on `Func::invoke`

* Fix tests again
2021-03-11 14:43:34 -06:00
Dan Gohman
81c67d9438 Add a link to the wasm-ld documentation. 2021-03-03 13:26:25 -08:00
Dan Gohman
66c2827ac9 Document the -Wl,--stack-first option to clang.
As discussed in WebAssembly/wasi-libc#233, document the
`-Wl,--stack-first` option to help users diagnose stack overflow errors.
2021-03-03 13:26:25 -08:00
Pat Hickey
d8f3a62b32 dont try to make a virtfs today. instead, delete virtfs example. 2021-01-29 17:27:05 -08:00
Nick Fitzgerald
ee7131bc0b Merge pull request #2555 from alexcrichton/doc-module-linking
Document that the module linking proposal is implemented
2021-01-07 13:21:49 -08:00
Nick Fitzgerald
79aaeb5eda docs: Add wasm-{smith,encoder} crates to Wasm proposal checklist (#2554) 2021-01-07 14:11:42 -06:00
Alex Crichton
6354edc7bd Document that the module linking proposal is implemented
Forgot to do this earlier!
2021-01-07 11:41:23 -08:00
hayasshi
4c7e66e58e Fix code in WASI-tutorial.md 2021-01-04 07:06:10 -08:00
Ivan Zvonimir Horvat
309354d9e1 1272: bash script; simple gcd example (#2421) 2020-11-20 11:43:54 -06:00
Nick Fitzgerald
5256cd2e87 Update docs to reflect that reference types work on aarch64 now 2020-11-16 08:23:03 -08:00
Till Schneidereit
fc1cedb2ff Add docs.wasmtime.dev as a CNAME for the Wasmtime docs (#2317)
* Update version of mdbook used in CI

* Configure cname for wasmtime docs
2020-10-25 15:48:20 -05:00