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
```
This commit is contained in:
Peter Huene
2021-03-24 18:49:33 -07:00
parent 90aa5cf49f
commit 29d366db7b
35 changed files with 1618 additions and 278 deletions

View File

@@ -80,3 +80,18 @@ with:
```sh
$ wasmtime wasm2obj foo.wasm foo.o
```
## `compile`
This subcommand is used to Ahead-Of-Time (AOT) compile a WebAssembly module to produce
a "compiled wasm" (.cwasm) file.
The `wasmtime run` subcommand can then be used to run a AOT-compiled WebAssembly module:
```sh
$ wasmtime compile foo.wasm
$ wasmtime foo.cwasm
```
AOT-compiled modules can be run from hosts that are compatible with the target
environment of the AOT-completed module.