Commit Graph

295 Commits

Author SHA1 Message Date
Alex Crichton
e659d5cecd Add initial support for the multi-memory proposal (#2263)
This commit adds initial (gated) support for the multi-memory wasm
proposal. This was actually quite easy since almost all of wasmtime
already expected multi-memory to be implemented one day. The only real
substantive change is the `memory.copy` intrinsic changes, which now
accounts for the source/destination memories possibly being different.
2020-10-13 19:13:52 -05:00
Joshua Warner
eb650f6fe0 filesystem example (#2236) 2020-09-29 13:20:14 -05:00
Nick Fitzgerald
92d3261366 docs: Fix link to contributing sub-page 2020-09-28 13:16:42 -07:00
Kam Y. Tse
5514c74b06 update golang example (#2227) 2020-09-24 19:25:03 -05:00
Steve Phillips
a577667f9f Update introduction.md: typo fixes 2020-08-14 11:47:27 -04:00
Nick Fitzgerald
ef13e80bcf docs: Add contributor docs for implementing and enabling new Wasm proposals 2020-08-07 16:54:51 -07:00
Nick Fitzgerald
5647dcbb8f docs: Document and advertise our support for various Wasm proposals 2020-08-07 16:54:51 -07:00
Nick Fitzgerald
47d3c8de52 docs: Better title formatting for the coding guidelines 2020-08-07 16:54:51 -07:00
Nick Fitzgerald
bf16b33739 docs: Use Title Case for the Table of Contents 2020-08-07 16:54:51 -07:00
Leon Wang
fec77c16ac Fix a typo error in docs (#2098) 2020-08-05 09:16:32 -05:00
Alex Crichton
39ea64140f Expand doc section about "what about #![no_std]?" (#2024)
* Expand doc section about "what about `#![no_std]`?"

This commit expands the `#![no_std]` section of the documentation with
an FAQ-style set of words which explains in more detail about why we
don't support `#![no_std]` at this time, and how we can support it in
the future.

* Review comments

* Add some more words about -Zbuild-std
2020-07-29 12:53:32 -05:00
Peter Huene
9b340f27f7 Update the .NET docs for the current .NET API. (#2069) 2020-07-24 23:49:05 -05:00
Alex Crichton
978070c020 Verify crates are publish-able on CI (#2036)
This commit updates our CI to verify that all crates are publish-able at
all times on every commit. During the 0.19.0 release we found another
case where the crates as they live in this repository weren't
publish-able, so the hope is that this no longer comes up again!

The script added in this commit also takes the time/liberty to remove
the existing bump/publish scripts and instead replace them with one Rust
script originally sourced from wasm-bindgen. The intention of this
script is that it has three modes:

* `./publish bump` - bumps version numbers which are sent as a PR to get
  reviewed (probably with a changelog as well)

* `./publish verify` - run on CI on every commit, builds every crate we
  publish as if it's being published to crates.io, notably without raw
  access to other crates in the repository.

* `./publish publish` - publishes all crates to crates.io, passing the
  `--no-verify` flag to make this a much speedier process than it is
  today.
2020-07-17 16:19:35 -05:00
Alex Crichton
806d197472 Update platform support docs (#2023)
Be sure to mention Linux AArch64 as a supported platform of Wasmtime
now.
2020-07-15 10:22:08 -05:00
Jakub Konka
c3d385e935 Add link to C API docs in the guide (#2006) 2020-07-10 09:29:52 -05:00
Davy Duperron
8d7ba0ad76 wasmtime: fix typo in summary 2020-07-03 14:34:30 +02:00
Alex Crichton
920e0984d3 Link to C API docs and make a landing page
Spice up the landing page a bit for the C API documentation and then
link to it from a few places to ensure it's discoverable.
2020-07-02 08:49:27 -07:00
Alex Crichton
a92a31d850 Rename the master branch to main (#1924)
* This PR is against a branch called `main`
* Internally all docs/CI/etc is updated
* The default branch of the repo is now `main`
* All active PRs have been updated to retarget `main`

Closes #1914
2020-06-25 14:03:21 -05:00
Thomas
2dbe98b823 📝 update crate requirement for the tust example (#1870) 2020-06-12 10:21:26 -05:00
Yury Delendik
15c68f2cc1 Disconnects Store state fields from Compiler (#1761)
*  Moves CodeMemory, VMInterrupts and SignatureRegistry from Compiler
*  CompiledModule holds CodeMemory and GdbJitImageRegistration
*  Store keeps track of its JIT code
*  Makes "jit_int.rs" stuff Send+Sync
*  Adds the threads example.
2020-06-02 13:44:39 -05:00
Dan Gohman
09ccdc9285 Add documentation for building programs using AssemblyScript. (#1782)
* Add documentation for building programs using AssemblyScript.

* Add the assemblyscript hello world as an example and display it inline.

* Move the AssemblyScript hello world into the docs directory.

That way Cargo doesn't try to run it like a Rust example.
2020-05-28 17:16:20 -07:00
Chris Fallin
6e8666826d Docs: add section on running under qemu. 2020-05-18 11:43:53 -07:00
Alex Crichton
f22f415b14 Document cross-compiling Wasmtime (#1721)
Closes #1720
2020-05-18 10:52:00 -05:00
Austin Abell
e40fd9d6ab Fix Wasm from rust docs (#1719)
* Update Wasm from Rust docs

* oops

* oops x2
2020-05-18 06:58:21 -05:00
Alex Crichton
d6b1589926 Fix broken links to old embed.html (#1604)
Closes #1596
2020-04-27 08:43:04 -07:00
Dan Gohman
cfe5c4b8e8 Add a documentation link to the official application-abi.md document. (#1562) 2020-04-21 09:10:52 -05:00
Dan Gohman
9364eb1d98 Refactor (#1524)
* Compute instance exports on demand.

Instead having instances eagerly compute a Vec of Externs, and bumping
the refcount for each Extern, compute Externs on demand.

This also enables `Instance::get_export` to avoid doing a linear search.

This also means that the closure returned by `get0` and friends now
holds an `InstanceHandle` to dynamically hold the instance live rather
than being scoped to a lifetime.

* Compute module imports and exports on demand too.

And compute Extern::ty on demand too.

* Add a utility function for computing an ExternType.

* Add a utility function for looking up a function's signature.

* Add a utility function for computing the ValType of a Global.

* Rename wasmtime_environ::Export to EntityIndex.

This helps differentiate it from other Export types in the tree, and
describes what it is.

* Fix a typo in a comment.

* Simplify module imports and exports.

* Make `Instance::exports` return the export names.

This significantly simplifies the public API, as it's relatively common
to need the names, and this avoids the need to do a zip with
`Module::exports`.

This also changes `ImportType` and `ExportType` to have public members
instead of private members and accessors, as I find that simplifies the
usage particularly in cases where there are temporary instances.

* Remove `Instance::module`.

This doesn't quite remove `Instance`'s `module` member, it gets a step
closer.

* Use a InstanceHandle utility function.

* Don't consume self in the `Func::get*` methods.

Instead, just create a closure containing the instance handle and the
export for them to call.

* Use `ExactSizeIterator` to avoid needing separate `num_*` methods.

* Rename `Extern::func()` etc. to `into_func()` etc.

* Revise examples to avoid using `nth`.

* Add convenience methods to instance for getting specific extern types.

* Use the convenience functions in more tests and examples.

* Avoid cloning strings for `ImportType` and `ExportType`.

* Remove more obviated clone() calls.

* Simplify `Func`'s closure state.

* Make wasmtime::Export's fields private.

This makes them more consistent with ExportType.

* Fix compilation error.

* Make a lifetime parameter explicit, and use better lifetime names.

Instead of 'me, use 'instance and 'module to make it clear what the
lifetime is.

* More lifetime cleanups.
2020-04-20 15:55:33 -05:00
Alex Crichton
44e897ddad Add Go as an embedding to the book (#1481)
* Add Go as an embedding to the book

Also take this time to list out all embeddings in the README of wasmtime
itself.
2020-04-08 11:03:30 -05:00
Peter Huene
9de0ab302c Remove the .NET implementation. (#1477)
This commit removes the .NET implementation from Wasmtime.

It now exists at https://github.com/bytecodealliance/wasmtime-dotnet.

Also updates the Wasmtime book to include information about using Wasmtime from
.NET.
2020-04-06 20:03:49 -05:00
Johnnie Birch
dff789c7c6 Adds JIT profiling support for VTune (#819)
This patch adds initial support for ittapi which is an open
source profiling api for instrumentation and tracing and profiling
of jitted code. Result files can be read by VTune for analysis

Build:
    cargo build --features=vtune
Profile: // Using amplxe-cl from VTune
    amplxe-cl -v -collect hostpost target/debug/wasmtime --vtune test.wasm
2020-04-02 09:04:08 -05:00
Alex Crichton
1a0325014f Remove the wasmtime Python extension from this repo (#1457)
* Remove the wasmtime Python extension from this repo

This commit removes the `crates/misc/py` folder and all associated
doo-dads like CI. This module has been rewritten to use the C API
natively and now lives at
https://github.com/bytecodealliance/wasmtime-py as discussed on #1390
2020-04-01 13:52:59 -05:00
EchoSysBen
00200504b1 correct typo in the docs profiling section (#1442) 2020-03-31 09:22:56 -05:00
Dan Gohman
6c0c9a46f3 Fixes for cargo publish (#1416)
* Publishing fixes.

* Make WASI a symlink.

* More fixes.

* Cargo doesn't allow dev-dependencies to have optional features.

* Remove the symlink.

* Add WASI as another git submodule.
2020-03-26 20:31:12 -07:00
Dan Gohman
5cfcbeb59d Correctly capitalize "WebAssembly" in docs. (#1399) 2020-03-24 21:46:58 -05:00
John Sullivan
222a73c150 Initial documentation for python users (#1378)
* Fix instructions for building rust modules in python examples

When I ran `rustc +nightly ...` the compiler just looked for a source file
called `+nightly`. I changed these instructions to use rustup + rustc instead.

* Initial documentation for python users

Added documentation for using the Wasmtime loader in python, and explained the
first two examples in the repo. Changed the import example to demonstrate
working with module linear memory.

* Fix include in python guide

* Wording

* Clarify memory usage

* Flow through the example better

* More word choice

* Make rustup a prereq

* Fix source code paths in python guide

* Fix rustup example in python guide

Co-Authored-By: Samrat Man Singh <samratmansingh@gmail.com>

* Replace command examples with preformat blocks

* Revert "Fix instructions for building rust modules in python examples"

This reverts commit 1738888a2df4e15aba1e26c8ef42058e7a2053bb.

* Left a block quote in a preformat example

Co-authored-by: Samrat Man Singh <samratmansingh@gmail.com>
2020-03-24 09:44:05 -05:00
Dan Gohman
66460f2139 Miscellaneous doc updates (#1383)
* Add additional links to embedding and tutorial documentation.

* Fix a broken link to CONTRIBUTING.md.

Fixes #1280.
2020-03-23 09:58:08 -07:00
Alex Crichton
e245e6dd9c Add examples of linking and WASI (#1369)
* Add examples of linking and WASI

This commit adds two example programs, one for linking two modules
together and one for instantiating WASI. The linkage example
additionally uses WASI to get some meaningful output at this time.

cc #1272

* Add examples to the book as well

* More links!

* Ignore examples from rustdoc testsing

* More example updates

* More ignored
2020-03-20 18:10:53 -05:00
Alex Crichton
adff432767 Fix build of the book (#1368) 2020-03-20 12:18:57 -05:00
Alex Crichton
3b7cb6ee64 Enable jitdump profiling support by default (#1310)
* Enable jitdump profiling support by default

This the result of some of the investigation I was doing for #1017. I've
done a number of refactorings here which culminated in a number of
changes that all amount to what I think should result in jitdump support being
enabled by default:

* Pass in a list of finished functions instead of just a range to
  ensure that we're emitting jit dump data for a specific module rather
  than a whole `CodeMemory` which may have other modules.
* Define `ProfilingStrategy` in the `wasmtime` crate to have everything
  locally-defined
* Add support to the C API to enable profiling
* Documentation added for profiling with jitdump to the book
* Split out supported/unsupported files in `jitdump.rs` to avoid having
  lots of `#[cfg]`.
* Make dependencies optional that are only used for `jitdump`.
* Move initialization up-front to `JitDumpAgent::new()` instead of
  deferring it to the first module.
* Pass around `Arc<dyn ProfilingAgent>` instead of
  `Option<Arc<Mutex<Box<dyn ProfilingAgent>>>>`

The `jitdump` Cargo feature is now enabled by default which means that
our published binaries, C API artifacts, and crates will support
profiling at runtime by default. The support I don't think is fully
fleshed out and working but I think it's probably in a good enough spot
we can get users playing around with it!
2020-03-20 11:44:51 -05:00
Gabor Greif
1d0026e4f5 Tweak the submodule update command (#1364) 2020-03-19 16:04:44 -05:00
Alex Crichton
f63c3c814e Add a first-class way of accessing caller's exports (#1290)
* Add a first-class way of accessing caller's exports

This commit is a continuation of #1237 and updates the API of `Func` to
allow defining host functions which have easy access to a caller's
memory in particular. The new APIs look like so:

* The `Func::wrap*` family of functions was condensed into one
  `Func::wrap` function.
* The ABI layer of conversions in `WasmTy` were removed
* An optional `Caller<'_>` argument can be at the front of all
  host-defined functions now.

The old way the wasi bindings looked up memory has been removed and is
now replaced with the `Caller` type. The `Caller` type has a
`get_export` method on it which allows looking up a caller's export by
name, allowing you to get access to the caller's memory easily, and even
during instantiation.

* Add a temporary note

* Move some docs
2020-03-18 16:57:31 -05:00
Dan Gohman
3f8fb37b22 Add some high-level sandboxing documentation. (#1353)
* Add some high-level sandboxing documentation.

* Update docs/security-sandboxing.md

Co-Authored-By: Nick Fitzgerald <fitzgen@gmail.com>

* Update docs/security-sandboxing.md

Co-Authored-By: bjorn3 <bjorn3@users.noreply.github.com>

* Grammar fixes.

* Mention that ANSI-style escape sequences sometimes augment other attacks.

* Fix another wordo.

Co-authored-by: Nick Fitzgerald <fitzgen@gmail.com>
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2020-03-18 12:42:28 -07:00
Nick Fitzgerald
612b806ac3 Update contributing docs with new script name 2020-03-17 12:56:58 -07:00
Prathyush
e2f6c08052 Remove superfluous are (#1326) 2020-03-15 13:15:32 +01:00
Alex Crichton
34f768ddd5 Temporarily remove support for interface types (#1292)
* Temporarily remove support for interface types

This commit temporarily removes support for interface types from the
`wasmtime` CLI and removes the `wasmtime-interface-types` crate. An
error is now printed for any input wasm modules that have wasm interface
types sections to indicate that support has been removed and references
to two issues are printed as well:

* #677 - tracking work for re-adding interface types support
* #1271 - rationale for removal and links to other discussions

Closes #1271

* Update the python extension
2020-03-12 15:05:39 -05:00
Ifenna Ozoekwe-Awagu
67b3a890dc Add tutorial for building and running hello-world.wasm (#1285)
* Add tutorial for building and running hello-world.wasm

* Fix issues with directory trees in last commit

* Add more information on various ways of creating .wasm files and running them with Wasmtime

* Fix internal links and add more information on Wasmtime CLI installation
2020-03-12 10:49:31 -05:00
Dan Gohman
ac0ee271b1 Log to stderr by default. (#1266)
Change the default from file-per-thread-logger to pretty-env-logger,
which is more common in Rust projects, and change the option from `-d`
to `--log-to-files`.
2020-03-10 09:36:56 -05:00
Till Schneidereit
2ee35c9d3a Add instructions to initialize git submodules to build docs 2020-03-09 08:44:19 -07:00
Till Schneidereit
8f824a9fc1 Update outdated references to the Cranelift repository
This patch updates or removes all references to the Cranelift repository. It affects links in README documents, issues that were transferred to the Wasmtime repository, CI badges, and a small bunch of sundry items.
2020-03-09 14:06:24 +01:00
Dan Gohman
fbe29da5cc Miscelaneous docs updates and fixes. (#1249)
Update references to things in CraneStation which have moved, WASI documentation
which has moved to the WASI repo, and fix a few typos.
2020-03-08 16:11:17 +01:00