369 Commits

Author SHA1 Message Date
Rik Huijzer 310e6677dc Reorder book-based documentation (#8130)
On a high level, this is what this PR changed:

1. Move the CLI chapter before the API chapter.
    I think this makes sense because the CLI is more high-level.
    The same change was proposed in
    https://github.com/bytecodealliance/wasmtime/pull/7987.
1. Move some Rust and C examples from the "Examples" chapter into the API chapter.
1. Remove the original main C and Rust chapter introduction files.
    They contained mostly outdated or duplicate information.
1. Rename the "Examples" chapter to "Further Examples".
    (For lack of a better name.)
1. Rename "Embedding" to "API" at some places since API is a more generally known term.
    The term "embedding" is also slightly more confusing, I think,
    because the term nowadays also used a lot in LLM-related communication.
1. Read through the entire document and fix some outdated links and information.
1. Fix a missing subheading for Elixir (it was mentioned on the lang page, but not in the menu).
2024-03-14 17:41:27 +00:00
Rik Huijzer daa7fdf2ce Clarify some wasm terms in the introduction (#8115)
* Clarify some wasm terms in the introduction

* Update docs/introduction.md

* Update docs/introduction.md

---------

Co-authored-by: Nick Fitzgerald <fitzgen@gmail.com>
2024-03-13 13:50:31 +00:00
Rik Huijzer 99ea051b02 Document wasmtime serve (#8077)
* Document `wasmtime serve`

* Mention `component` instead of `module`
2024-03-11 15:40:23 +00:00
Doctor 149858b111 [fix] broken links in WASI-intro.md (#8043) 2024-03-04 05:18:08 +00:00
Trevor Elliott 42f218d8e6 Add comments about updating release dates (#8022)
* Add comments about updating release dates

* Add a note about forward-porting release notes
2024-02-28 23:18:01 +00:00
Alex Crichton b81bb7a369 Add a "custom" platform configuration for Wasmtime (#7995)
* Add a "custom" platform configuration for Wasmtime

This commit leverages adds a new "platform" to Wasmtime to be supported
in the `crates/runtime/src/sys` folder. This joins preexisting platforms
such as Unix and Windows. The goal of this platform is to be an opt-in
way to build Wasmtime for targets that don't have a predefined way to
run.

The new "custom" platform requires `--cfg wasmtime_custom_platform` to
be passed to the Rust compiler, for example by using `RUSTFLAGS`. This
new platform bottoms out in a C API that is intended to be small and
Linux-like. The C API is effectively the interface to virtual memory
that Wasmtime requires. This C API is also available as a header file at
`examples/min-platform/embedding/wasmtime-platform.h` (generated by
`cbindgen`).

The main purpose of this is to make it easier to experiment with porting
Wasmtime to new platforms. By decoupling a platform implementation from
Wasmtime itself it should be possible to run these experiments
out-of-tree. An example of this I've been working on is getting
Wasmtime running on bare-metal with a custom kernel. This support
enables defining the platform interface of the custom kernel's syscalls
outside of Wasmtime.

* Exclude wasmtime-platform.h from formatting

* Include build-wasmtime-target-wasm32 in final job

* Don't force any single toolchain

* Add notes to no_std docs

* Add rust-src to CI

* Review comments

* Change APIs to be fallible

* Only compile the min-platform example on Linux

* Fix compile of min-platform example

* Fix another compile error in the example
2024-02-28 20:23:33 +00:00
Kevin Gibbons 9be5dd7c88 Fix description of fd_write in WASI-tutorial.md (#8000)
* Fix description of fd_write in WASI-tutorial.md

* *nwritten
2024-02-27 19:10:50 +00:00
Douglas Jose 4add8c1934 Update outdated testing instructions (#7988) 2024-02-23 15:47:30 +00:00
Nick Fitzgerald b762a91257 Add "what is a security vulnerability?" page to docs (#7963)
Taken from the recently merged RFC:
https://github.com/bytecodealliance/rfcs/blob/main/accepted/what-is-considered-a-security-bug.md
2024-02-20 15:57:30 +00:00
Pat Hickey 2b00a541f3 Make wasi-common self-contained, deprecate exports from wasmtime-wasi (#7881)
* WIP: try to make wasi-common self contained.

* rebase: cargo.lock

* remove all dependencies between wasi-common and wasmtime-wasi

* use wasi-common directly throughout tests, benches, examples, cli run

* wasi-threads: use wasi-common's maybe_exit_on_error in spawned thread

not a very modular design, but at this point wasi-common and
wasi-threads are forever wed

* fix wasmtime's docs

* re-introduce wasmtime-wasi's exports of wasi-common definitions behind deprecated

* factor out determining i32 process exit code

and remove libc dep because rustix provides the same constant

* commands/run: inline the logic about aborting on trap

since this is the sole place in the codebase its used

* Add high-level summary to wasi-common's top-level doc comment.

* c-api: fix use of wasi_cap_std_sync => wasi_common::sync, wasmtime_wasi => wasi_common

* fix tokio example

* think better of combining downcast and masking into one method

* fix references to wasmtime_wasi in docs

prtest:full

* benches: use wasi-common

* cfg-if around use of rustix::process because that doesnt exist on windows

* wasi-common: include tests, caught by verify-publish

* fix another bench

* exit requires wasmtime dep. caught by verify-publish.
2024-02-13 17:57:58 +00:00
Alex Crichton 6e2ff18a14 Fix contributor documentation for building the C API (#7814)
Needs to account for historical changes around rejiggering the build
process here.
2024-01-24 22:53:12 +00:00
Nick Fitzgerald aafe0a6ff6 docs: Add a page about test case reduction (#7780) 2024-01-16 19:35:05 +00:00
Adam Bratschi-Kaye 2fcf41f05b Remove wasmtime-jit (#7769)
* Move `jit` crate to `environ`

Move the platform agnostic parts of the crate `wasmtime-jit` to
`wasmtime-environ`. This is the first part of the refactoring discussed
here: https://github.com/bytecodealliance/wasmtime/issues/7652 and a
follow up will move the remaining parts of `wasmtime-jit` so that the
crate can be deleted.

* Move `jit` crate to `wasmtime`

Move the remaining parts of `wasmtime-jit` to the `wasmtime` crate and
remove `wasmtime-jit`. This is part of the refactoring discussed in
https://github.com/bytecodealliance/wasmtime/issues/7652.

* undo toml formatting

* Trigger pipeline: prtest:full

* Remove `jit` directory

* move `ProfilingAgent` out of `profiling` feature

* add links to ELF_NAME_DATA
2024-01-16 17:49:50 +00:00
Katie Bell 20079d9789 Add WASI async example and update the Rust WASI docs. (#7752) 2024-01-05 16:34:37 +00:00
vuittont60 523bc959f5 docs: fix typos (#7741) 2024-01-03 15:53:56 +00:00
Brett Cannon 866d97c5bf Update stability-tiers.md to fix a Markdown typo (#7703) 2023-12-18 23:09:38 +00:00
Alex Crichton 5c8bce70a1 Document cargo vet in contributing docs (#7635)
I realized just now that we haven't actually documented our usage of
`cargo vet` anywhere in our contributing documentation (or not that I
could find), so I decided to try and rectify that!
2023-12-05 17:21:36 +00:00
Matthew Phillips af38ee094a Update tutorial to use wasi_snapshot_preview1 (#7627) 2023-12-04 15:26:40 +00:00
vwkd b49e38a070 docs: clarify definition in Introduction (#7566)
* Update introduction.md

* Update introduction.md
2023-11-22 21:38:11 +00:00
Alex Crichton a00ff06c18 Update some CLI usage help texts (#7408)
Updating a few locations that I missed from the previous updates.
2023-10-30 19:22:12 +00:00
Colin D Murphy 038ddfeb66 Describe workflow for testing preview2 components (#7292)
* Describe workflow for testing preview2 components

* format text
2023-10-25 15:28:41 +00:00
Alex Crichton 205a5d2d80 Expand further minimization section of documentation (#7350)
* Expand further minimization section of documentation

This commit fills out the page about producing minimal builds a bit
more. The intention here is to provide examples of ideas about how to
reduce size further as well as current limitations and how they can be
evaluated.

* Review comments
2023-10-25 14:21:49 +00:00
Alex Crichton a80da753e0 Build "min" artifacts on CI (#7315)
* riscv64: Extend distance trampolines can jump

Use a PIC-friendly set of instructions to enable destination of the
trampoline to be more than 4k away from the tail call site of the
trampoline itself.

* Build "min" artifacts on CI

This commit updates the binary artifacts produced by CI to include "min"
builds where all default features are disabled. Additionally all the
stops are pulled in terms of build flags, nightly versions, etc, to get
a build that is as small as possible without actual source code changes.
This effectively codifies the instructions in #7282 into an easily
downloadable artifact.

No new tarballs are created for github releases but instead tarballs
that previously had a `wasmtime` executable for example now have a
`wasmtime-min` executable. Furthermore the C API which previously had
`libwasmtime.so` for example now has `libwasmtime-min.so`. The intention
is that the minimum-size artifacts are handy for determining a rough
size of Wasmtime but they're not so important that it seems worthwhile
to dedicate entire release entries for.

CI is refactored to support these minimum builds with separate builders.
This means that a single tarball produced as a final result is actually
two separate tarballs merged together, one for the normal build we do
today plus a new "min" tarball produced on the new "min" builders.
Various scripts and CI organization has been adjusted accordingly.

While here I went ahead and enabled `panic=abort` and debuginfo
stripping in our current release artifacts. While this doesn't affect a
whole lot it's less to upload to GitHub Actions all the time.

* Fix Windows unzip
2023-10-23 16:38:49 +00:00
Alex Crichton 183cb0f2f8 Swap the order of directories in --dir (#7301)
This commit changes the `--dir` argument on the `wasmtime` CLI to be
`HOST::GUEST` rather than `GUEST::HOST`. This matches Docker for example
and is a little more consistent with only `--dir path` where the first
argument is always treated as a host directory.

In terms of breaking-ness the movement from `--mapdir` to `--dir` hasn't
been released with Wasmtime 14 yet so my hope is that this can land on
both `main` and Wasmtime 14.0.0 before it's released to avoid any
breakage other than existing scripts migrating from `--mapdir` to
`--dir`.
2023-10-19 23:12:03 +00:00
Alex Crichton d86afc021d Gate many CLI/Wasmtime features behind Cargo features (#7282)
* Move `wasmtime explore` behind a Cargo feature

Enable this Cargo feature by default, but enable building the CLI
without the `explore` subcommand.

* Move the `wast` subcommand behind a Cargo feature

* Move support for `wat` behind a CLI feature

This was already conditional in crates such as `wasmtime` and this makes
it an optional dependency of the CLI as well.

* Move CLI cache support behind a Cargo feature

Additionally refactor `wasmtime-cli-flags` to not unconditionally pull
in caching support by removing its `default` feature and appropriately
enabling it from the CLI.

* Move `rayon` behind an optional feature

* Move `http-body-util` dependency behind `serve` feature

* Add a Cargo feature for compiling out log statements

This sets the static features of `log` and `tracing` to statically
remove all log statements from the binary to cut down on binary size.

* Move logging support behind a Cargo feature

Enables statically removing logging support in addition to the previous
compiling out log statements themselves.

* Move demangling support behind a Cargo feature

* Enable building the CLI without cranelift

Compile out the `compile` subcommand for example.

* Gate all profiling support behind one feature flag

This commit moves vtune/jitdump support behind a single `profiling`
feature flag that additionally includes the guest profiler dependencies
now too.

* Move support for core dumps behind a feature flag

* Move addr2line behind a feature

* Fix rebase

* Document cargo features and a minimal build

* Tidy up the source a bit

* Rename compile-out-logging

* Document disabling logging

* Note the host architecture as well

* Fix tests

* Fix tests

* Mention debuginfo stripping

* Fix CI configuration for checking features

* Fix book tests

* Update lock file after rebase

* Enable coredump feature by default
2023-10-19 18:01:35 +00:00