Skip to content

Commit d1b4d6e

Browse files
authored
Update README and document Wasmi crate features (#1430)
* remove unnecessary README infos * readme: add section about Wasmi crate features * readme: restructure Wasm proposals section * add Wasmi crate feature sections to docs * improve crate feature section in readme and docs * apply rustfmt * add tracking issue for Wasm relaxed-simd proposal * render docs of crates with `simd` feature enabled
1 parent 7949063 commit d1b4d6e

File tree

4 files changed

+46
-28
lines changed

4 files changed

+46
-28
lines changed

README.md

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ Wasmi is suitable for safety critical use cases and has been audited several tim
4040

4141
## Distinct Features
4242

43-
The following list states some of the distinct features of Wasmi.
44-
4543
- Simple, correct and deterministic execution of WebAssembly.
4644
- Low-overhead and cross-platform WebAssembly runtime for embedded environments.
4745
- JIT bomb resisting translation.
@@ -54,33 +52,24 @@ The following list states some of the distinct features of Wasmi.
5452

5553
Refer to the [Wasmi usage guide](./docs/usage.md) to learn how properly to use [Wasmi](https://crates.io/crates/wasmi).
5654

57-
## WebAssembly Proposals
58-
59-
The new Wasmi engine supports a variety of WebAssembly proposals and will support even more of them in the future.
60-
61-
| | WebAssembly Proposal | |
55+
## WebAssembly Features
56+
57+
| | WebAssembly Proposal | | | | WebAssembly Proposal | |
58+
|:-:|:--|:--|:-:|:--|:--|:--|
59+
|| [`mutable-global`] |`0.14.0` | || [`custom-page-sizes`] | [`0.41.0`][(#1197)] |
60+
|| [`saturating-float-to-int`] |`0.14.0` | || [`memory64`] | [`0.41.0`][(#1357)] |
61+
|| [`sign-extension`] |`0.14.0` | || [`wide-arithmetic`] | [`0.42.0`][(#1369)] |
62+
|| [`multi-value`] |`0.14.0` | || [`simd`] | [`0.43.0`][(#1364)] |
63+
|| [`bulk-memory`] | [`0.24.0`][(#628)] | | 📅 | [`relaxed-simd`] | [Tracking Issue][(#1431)] |
64+
|| [`reference-types`] | [`0.24.0`][(#635)] | | 📅 | [`function-references`] | [Tracking Issue][(#774)] |
65+
|| [`tail-calls`] | [`0.28.0`][(#683)] | | 📅 | [`gc`] | [Tracking Issue][(#775)] |
66+
|| [`extended-const`] | [`0.29.0`][(#707)] | | 📅 | [`threads`] | [Tracking Issue][(#777)] |
67+
|| [`multi-memory`] | [`0.37.0`][(#1191)] | | 📅 | [`exception-handling`] | [Tracking Issue][(#1037)] |
68+
69+
| | Embeddings | |
6270
|:-:|:--|:--|
63-
|| [`mutable-global`] |`0.14.0` |
64-
|| [`saturating-float-to-int`] |`0.14.0` |
65-
|| [`sign-extension`] |`0.14.0` |
66-
|| [`multi-value`] |`0.14.0` |
67-
|| [`bulk-memory`] | [`0.24.0`][(#628)] |
68-
|| [`reference-types`] | [`0.24.0`][(#635)] |
69-
|| [`tail-calls`] | [`0.28.0`][(#683)] |
70-
|| [`extended-const`] | [`0.29.0`][(#707)] |
71-
|| [`multi-memory`] | [`0.37.0`][(#1191)] |
72-
|| [`custom-page-sizes`] | [`0.41.0`][(#1197)] |
73-
|| [`memory64`] | [`0.41.0`][(#1357)] |
74-
|| [`wide-arithmetic`] | [`0.42.0`][(#1369)] |
75-
| 📅 | [`simd`] | [Tracking Issue][(#1364)] |
76-
| 📅 | [`relaxed-simd`] | Depends on `simd`. |
77-
| 📅 | [`function-references`] | [Tracking Issue][(#774)] |
78-
| 📅 | [`gc`] | [Tracking Issue][(#775)] |
79-
| 📅 | [`threads`] | [Tracking Issue][(#777)] |
80-
| 📅 | [`exception-handling`] | [Tracking Issue][(#1037)] |
81-
| | |
82-
| 👨‍🔬 | [WASI] | WASI (`wasip1`) support via the [`wasmi_wasi` crate]. |
83-
| 👨‍🔬 | [C-API] | Official Wasm C-API support via the [`wasmi_c_api_impl` crate]. |
71+
|| [WASI] | WASI (`wasip1`) support via the [`wasmi_wasi` crate]. |
72+
|| [C-API] | Official Wasm C-API support via the [`wasmi_c_api_impl` crate]. |
8473

8574
[`mutable-global`]: https://github.com/WebAssembly/mutable-global
8675
[`saturating-float-to-int`]: https://github.com/WebAssembly/nontrapping-float-to-int-conversions
@@ -124,6 +113,18 @@ The new Wasmi engine supports a variety of WebAssembly proposals and will suppor
124113
[(#1357)]: https://github.com/wasmi-labs/wasmi/issues/1357
125114
[(#1364)]: https://github.com/wasmi-labs/wasmi/issues/1364
126115
[(#1369)]: https://github.com/wasmi-labs/wasmi/issues/1369
116+
[(#1431)]: https://github.com/wasmi-labs/wasmi/issues/1431
117+
118+
## Crate Features
119+
120+
| Feature | Crates | Description |
121+
|:-:|:--|:--|
122+
| `std` | `wasmi`<br>`wasmi_core`<br>`wasmi_ir`<br>`wasmi_collections` | Enables usage of Rust's standard library. This may have some performance advantages when enabled. Disabling this feature makes Wasmi compile on platforms that do not provide Rust's standard library such as many embedded platforms. <br><br> Enabled by default. |
123+
| `wat` | `wasmi` | Enables support to parse Wat encoded Wasm modules. <br><br> Enabled by default. |
124+
| `simd` | `wasmi`<br>`wasmi_core`<br>`wasmi_ir`<br>`wasmi_cli` | Enables support for the Wasm `simd` proposal. Note that this may introduce execution overhead and increased memory consumption for Wasm executions that do not need Wasm `simd` functionality. <br><br> Disabled by default. |
125+
| `hash-collections` | `wasmi`<br>`wasmi_collections` | Enables use of hash-map based collections in Wasmi internals. This might yield performance improvements in some use cases. <br><br> Disabled by default. |
126+
| `prefer-btree-collections` | `wasmi`<br>`wasmi_collections` | Enforces use of btree-map based collections in Wasmi internals. This may yield performance improvements and memory consumption decreases in some use cases. Also it enables Wasmi to run on platforms that have no random source. <br><br> Disabled by default. |
127+
| `extra-checks` | `wasmi` | Enables extra runtime checks in the Wasmi executor. Expected execution overhead is ~20%. Enable this if your focus is on safety. Disable this for maximum execution performance. <br><br> Disabled by default. |
127128

128129
## Development
129130

crates/ir/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,6 @@ std = [
2727
"wasmi_core/std",
2828
]
2929
simd = ["wasmi_core/simd"]
30+
31+
[package.metadata.docs.rs]
32+
features = ["std", "simd"]

crates/wasmi/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,6 @@ extra-checks = []
7272
[[bench]]
7373
name = "benches"
7474
harness = false
75+
76+
[package.metadata.docs.rs]
77+
features = ["std", "wat", "simd"]

crates/wasmi/src/lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,17 @@
5858
//! Ok(())
5959
//! }
6060
//! ```
61+
//!
62+
//! # Crate Features
63+
//!
64+
//! | Feature | Crates | Description |
65+
//! |:-:|:--|:--|
66+
//! | `std` | `wasmi`<br>`wasmi_core`<br>`wasmi_ir`<br>`wasmi_collections` | Enables usage of Rust's standard library. This may have some performance advantages when enabled. Disabling this feature makes Wasmi compile on platforms that do not provide Rust's standard library such as many embedded platforms. <br><br> Enabled by default. |
67+
//! | `wat` | `wasmi` | Enables support to parse Wat encoded Wasm modules. <br><br> Enabled by default. |
68+
//! | `simd` | `wasmi`<br>`wasmi_core`<br>`wasmi_ir`<br>`wasmi_cli` | Enables support for the Wasm `simd` proposal. Note that this may introduce execution overhead and increased memory consumption for Wasm executions that do not need Wasm `simd` functionality. <br><br> Disabled by default. |
69+
//! | `hash-collections` | `wasmi`<br>`wasmi_collections` | Enables use of hash-map based collections in Wasmi internals. This might yield performance improvements in some use cases. <br><br> Disabled by default. |
70+
//! | `prefer-btree-collections` | `wasmi`<br>`wasmi_collections` | Enforces use of btree-map based collections in Wasmi internals. This may yield performance improvements and memory consumption decreases in some use cases. Also it enables Wasmi to run on platforms that have no random source. <br><br> Disabled by default. |
71+
//! | `extra-checks` | `wasmi` | Enables extra runtime checks in the Wasmi executor. Expected execution overhead is ~20%. Enable this if your focus is on safety. Disable this for maximum execution performance. <br><br> Disabled by default. |
6172
6273
#![no_std]
6374
#![warn(

0 commit comments

Comments
 (0)