File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ impl FuzzValType {
4545struct Swarm {
4646 store_new : bool ,
4747 store_drop : bool ,
48+ store_gc : bool ,
4849 module_new : bool ,
4950 module_drop : bool ,
5051 instance_new : bool ,
@@ -148,6 +149,9 @@ pub enum ApiCall {
148149 StoreDrop {
149150 id : usize ,
150151 } ,
152+ StoreGc {
153+ id : usize ,
154+ } ,
151155 ModuleNew {
152156 id : usize ,
153157 wasm : Vec < u8 > ,
@@ -668,6 +672,13 @@ impl<'a> Arbitrary<'a> for ApiCalls {
668672 Ok ( StoreDrop { id } )
669673 } ) ;
670674 }
675+ if swarm. store_gc && !scope. stores . is_empty ( ) {
676+ choices. push ( |input, scope| {
677+ let stores: Vec < _ > = scope. stores . iter ( ) . collect ( ) ;
678+ let id = * * input. choose ( & stores) ?;
679+ Ok ( StoreGc { id } )
680+ } ) ;
681+ }
671682 if swarm. module_new {
672683 choices. push ( |input, scope| {
673684 let id = scope. next_id ( ) ;
Original file line number Diff line number Diff line change @@ -65,6 +65,15 @@ pub fn make_api_calls(api: ApiCalls) {
6565 stores. remove ( & id) ;
6666 }
6767
68+ ApiCall :: StoreGc { id } => {
69+ log:: trace!( "collecting garbage in store {id}" ) ;
70+ let st = match stores. get_mut ( & id) {
71+ Some ( s) => s,
72+ None => continue ,
73+ } ;
74+ let _ = st. gc ( None ) ;
75+ }
76+
6877 ApiCall :: ModuleNew { id, wasm } => {
6978 log:: debug!( "creating module: {id}" ) ;
7079 log_wasm ( & wasm) ;
You can’t perform that action at this time.
0 commit comments