@@ -34,14 +34,11 @@ where
3434 . unwrap ( )
3535 . checksum ( ) ;
3636 store. 0 . record_event ( || {
37- let flat = ty
38- . params ( )
39- . map ( |t| t. to_wasm_type ( ) . byte_size ( ) )
40- . collect :: < Vec < u8 > > ( ) ;
37+ let flat = ty. params ( ) . map ( |t| t. to_wasm_type ( ) . byte_size ( ) ) ;
4138 WasmFuncEntryEvent {
4239 module : checksum,
4340 origin,
44- args : RRFuncArgVals :: from_flat_u8 ( args, & flat) ,
41+ args : RRFuncArgVals :: from_flat_iter ( args, flat) ,
4542 }
4643 } ) ?;
4744 }
5047 #[ cfg( all( feature = "rr" , feature = "rr-validate" ) ) ]
5148 {
5249 if origin. is_some ( ) {
53- let flat = ty
54- . results ( )
55- . map ( |t| t. to_wasm_type ( ) . byte_size ( ) )
56- . collect :: < Vec < u8 > > ( ) ;
57- let result = result. map ( |_| RRFuncArgVals :: from_raw_slice ( args, flat. iter ( ) . copied ( ) ) ) ;
50+ let flat = ty. results ( ) . map ( |t| t. to_wasm_type ( ) . byte_size ( ) ) ;
51+ let result = result. map ( |_| RRFuncArgVals :: from_flat_iter ( args, flat) ) ;
5852 store. 0 . record_event_validation ( || {
5953 WasmFuncReturnEvent ( ResultEvent :: from_anyhow_result ( & result) )
6054 } ) ?;
@@ -75,38 +69,47 @@ where
7569#[ inline]
7670pub fn record_and_replay_validate_host_func_entry < T > (
7771 args : & [ T ] ,
78- flat : & [ u8 ] ,
72+ flat : impl Iterator < Item = u8 > ,
7973 store : & mut StoreOpaque ,
8074) -> Result < ( ) >
8175where
8276 T : FlatBytes ,
8377{
78+ let _ = ( args, & flat, & store) ;
8479 #[ cfg( all( feature = "rr" , feature = "rr-validate" ) ) ]
8580 {
8681 // Record/replay the raw parameter args
87- store. record_event_validation ( || HostFuncEntryEvent {
88- args : RRFuncArgVals :: from_flat_u8 ( args, flat) ,
89- } ) ?;
90- store. next_replay_event_validation :: < HostFuncEntryEvent , _ , _ > ( || HostFuncEntryEvent {
91- args : RRFuncArgVals :: from_flat_u8 ( args, flat) ,
92- } ) ?;
82+ if store. replay_enabled ( ) {
83+ store. next_replay_event_validation :: < HostFuncEntryEvent , _ , _ > ( || {
84+ HostFuncEntryEvent {
85+ args : RRFuncArgVals :: from_flat_iter ( args, flat) ,
86+ }
87+ } ) ?;
88+ } else {
89+ store. record_event_validation ( || HostFuncEntryEvent {
90+ args : RRFuncArgVals :: from_flat_iter ( args, flat) ,
91+ } ) ?;
92+ }
9393 }
94- let _ = ( args, flat, store) ;
9594 Ok ( ( ) )
9695}
9796
9897/// Record hook operation for host function return events
9998#[ inline]
100- pub fn record_host_func_return < T > ( args : & [ T ] , flat : & [ u8 ] , store : & mut StoreOpaque ) -> Result < ( ) >
99+ pub fn record_host_func_return < T > (
100+ args : & [ T ] ,
101+ flat : impl Iterator < Item = u8 > ,
102+ store : & mut StoreOpaque ,
103+ ) -> Result < ( ) >
101104where
102105 T : FlatBytes ,
103106{
107+ let _ = ( args, & flat, & store) ;
104108 // Record the return values
105109 #[ cfg( feature = "rr" ) ]
106110 store. record_event ( || HostFuncReturnEvent {
107- args : RRFuncArgVals :: from_flat_u8 ( args, flat) ,
111+ args : RRFuncArgVals :: from_flat_iter ( args, flat) ,
108112 } ) ?;
109- let _ = ( args, flat, store) ;
110113 Ok ( ( ) )
111114}
112115
0 commit comments