@@ -31,25 +31,41 @@ pub struct WastCommand {
3131 /// compiling natively.
3232 #[ arg( long) ]
3333 precompile_load : Option < PathBuf > ,
34+
35+ /// Whether or not to run wasm in async mode.
36+ ///
37+ /// This is enabled by default but disabling it may be useful when testing
38+ /// Wasmtime itself.
39+ #[ arg( long = "async" , require_equals = true , value_name = "true|false" ) ]
40+ async_ : Option < Option < bool > > ,
3441}
3542
3643impl WastCommand {
3744 /// Executes the command.
3845 pub fn execute ( mut self ) -> Result < ( ) > {
3946 self . common . init_logging ( ) ?;
4047
48+ let async_ = optional_flag_with_default ( self . async_ , true ) ;
4149 let mut config = self . common . config ( None ) ?;
42- config. async_support ( true ) ;
50+ config. async_support ( async_ ) ;
4351 let engine = Engine :: new ( & config) ?;
44- let mut wast_context = WastContext :: new ( & engine, wasmtime_wast:: Async :: Yes , move |store| {
45- if let Some ( fuel) = self . common . wasm . fuel {
46- store. set_fuel ( fuel) . unwrap ( ) ;
47- }
48- if let Some ( true ) = self . common . wasm . epoch_interruption {
49- store. epoch_deadline_trap ( ) ;
50- store. set_epoch_deadline ( 1 ) ;
51- }
52- } ) ;
52+ let mut wast_context = WastContext :: new (
53+ & engine,
54+ if async_ {
55+ wasmtime_wast:: Async :: Yes
56+ } else {
57+ wasmtime_wast:: Async :: No
58+ } ,
59+ move |store| {
60+ if let Some ( fuel) = self . common . wasm . fuel {
61+ store. set_fuel ( fuel) . unwrap ( ) ;
62+ }
63+ if let Some ( true ) = self . common . wasm . epoch_interruption {
64+ store. epoch_deadline_trap ( ) ;
65+ store. set_epoch_deadline ( 1 ) ;
66+ }
67+ } ,
68+ ) ;
5369
5470 wast_context. generate_dwarf ( optional_flag_with_default ( self . generate_dwarf , true ) ) ;
5571 wast_context
0 commit comments