@@ -4,7 +4,8 @@ use crate::ValRaw;
44use crate :: component:: { ComponentInstanceId , func:: LowerContext } ;
55#[ cfg( feature = "rr" ) ]
66use crate :: rr:: {
7- RRFuncArgVals , RRFuncArgValsConvertable , RecordBuffer , Recorder , ResultEvent , Validate ,
7+ RREvent , RRFuncArgVals , RRFuncArgValsConvertable , RecordBuffer , Recorder , ResultEvent ,
8+ Validate ,
89 common_events:: { HostFuncEntryEvent , HostFuncReturnEvent , WasmFuncReturnEvent } ,
910 component_events:: {
1011 InstantiationEvent , LowerFlatEntryEvent , LowerFlatReturnEvent , LowerMemoryEntryEvent ,
@@ -153,9 +154,13 @@ pub fn record_host_func_return(
153154 store : & mut StoreOpaque ,
154155) -> Result < ( ) > {
155156 #[ cfg( feature = "rr" ) ]
156- store. record_event ( || HostFuncReturnEvent {
157- args : RRFuncArgVals :: from_flat_storage ( args, flat_results) ,
158- } ) ?;
157+ if args. is_empty ( ) {
158+ store. record_event ( || RREvent :: HostFuncReturnEmptyEvent ) ?;
159+ } else {
160+ store. record_event ( || HostFuncReturnEvent {
161+ args : RRFuncArgVals :: from_flat_storage ( args, flat_results) ,
162+ } ) ?;
163+ }
159164 #[ cfg( not( feature = "rr" ) ) ]
160165 let _ = ( args, flat_results, store) ;
161166 Ok ( ( ) )
@@ -181,9 +186,9 @@ where
181186 } ) ?;
182187 let store_result = lower_store ( cx, ty, offset) ;
183188 #[ cfg( feature = "rr" ) ]
184- cx. store
185- . 0
186- . record_event ( || LowerMemoryReturnEvent ( ResultEvent :: from_anyhow_result ( & store_result ) ) ) ?;
189+ cx. store . 0 . record_event_validation ( || {
190+ LowerMemoryReturnEvent ( ResultEvent :: from_anyhow_result ( & store_result ) )
191+ } ) ?;
187192 store_result
188193}
189194
@@ -203,9 +208,9 @@ where
203208 . record_event_validation ( || LowerFlatEntryEvent { ty } ) ?;
204209 let lower_result = lower ( cx, ty) ;
205210 #[ cfg( feature = "rr" ) ]
206- cx. store
207- . 0
208- . record_event ( || LowerFlatReturnEvent ( ResultEvent :: from_anyhow_result ( & lower_result ) ) ) ?;
211+ cx. store . 0 . record_event_validation ( || {
212+ LowerFlatReturnEvent ( ResultEvent :: from_anyhow_result ( & lower_result ) )
213+ } ) ?;
209214 lower_result
210215}
211216
0 commit comments