Add more CLI flags for wasm features (#917)

* Add more CLI flags for wasm features

This commit adds a few more flags to enable wasm features via the CLI,
mirroring the existing `--enable-simd` flag:

* `--enable-reference-types`
* `--enable-multi-value`
* `--enable-threads`
* `--enable-bulk-memory`

Additionally the bulk memory feature is now automatically enabled if
`reference-types` or `threads` are enabled since those two proposals
largely depend on `bulk-memory`.

* Add --enable-all to enable all wasm features

* Update src/lib.rs

Co-Authored-By: Peter Huene <peterhuene@protonmail.com>

* Apply suggestions from code review

Co-Authored-By: Peter Huene <peterhuene@protonmail.com>

Co-authored-by: Peter Huene <peterhuene@protonmail.com>
This commit is contained in:
Alex Crichton
2020-02-07 04:06:59 -06:00
committed by GitHub
parent 344bf2d6f3
commit a6adf52429
4 changed files with 60 additions and 46 deletions

View File

@@ -70,13 +70,18 @@ impl Config {
/// be enabled through this method for appropriate wasm modules.
///
/// This feature gates items such as shared memories and atomic
/// instructions.
/// instructions. Note that enabling the threads feature will
/// also enable the bulk memory feature.
///
/// This is `false` by default.
///
/// [threads]: https://github.com/webassembly/threads
pub fn wasm_threads(&mut self, enable: bool) -> &mut Self {
self.features.threads = enable;
// The threads proposal depends on the bulk memory proposal
if enable {
self.features.bulk_memory = true;
}
self
}
@@ -90,13 +95,18 @@ impl Config {
/// modules.
///
/// This feature gates items such as the `anyref` type and multiple tables
/// being in a module.
/// being in a module. Note that enabling the reference types feature will
/// also enable the bulk memory feature.
///
/// This is `false` by default.
///
/// [proposal]: https://github.com/webassembly/reference-types
pub fn wasm_reference_types(&mut self, enable: bool) -> &mut Self {
self.features.reference_types = enable;
// The reference types proposal depends on the bulk memory proposal
if enable {
self.features.bulk_memory = true;
}
self
}