From 48a17e95027cfbe7a4d31a1e6c22a30f0f301468 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 16 Dec 2021 10:10:19 -0600 Subject: [PATCH] Add CLI options for more configuration options (#3603) This commit adds a few more CLI flags for random fiddly bits in the `Config` structure to make it a bit easier to play around on the command line and see the effect of various flags on compiled code. --- src/lib.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index bd11c77f4c..bb62f4d6e2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -231,6 +231,19 @@ struct CommonOptions { /// Enable Cranelift's internal NaN canonicalization #[structopt(long)] enable_cranelift_nan_canonicalization: bool, + + /// Executing wasm code will consume fuel, limiting its execution. + #[structopt(long)] + consume_fuel: bool, + + /// Disables the on-by-default address map from native code to wasm code. + #[structopt(long)] + disable_address_map: bool, + + /// Switches memory initialization to happen in a paged fashion instead of + /// the data segments specified in the original wasm module. + #[structopt(long)] + paged_memory_initialization: bool, } impl CommonOptions { @@ -301,6 +314,10 @@ impl CommonOptions { config.dynamic_memory_guard_size(size); } + config.consume_fuel(self.consume_fuel); + config.generate_address_map(!self.disable_address_map); + config.paged_memory_initialization(self.paged_memory_initialization); + Ok(config) }