@@ -11,7 +11,7 @@ use crate::rr::{ConstMemorySliceCell, MemorySliceCell};
1111use crate :: rr:: {
1212 RREvent , RecordBuffer , ReplayError , Replayer , component_events:: ReallocEntryEvent ,
1313} ;
14- #[ cfg( all ( feature = "rr-component" , feature = "rr-validate" ) ) ]
14+ #[ cfg( feature = "rr-component" ) ]
1515use crate :: rr:: { ResultEvent , Validate , component_events:: ReallocReturnEvent } ;
1616use crate :: runtime:: vm:: component:: {
1717 CallContexts , ComponentInstance , InstanceFlags , ResourceTable , ResourceTables ,
@@ -403,7 +403,7 @@ impl<'a, T: 'static> LowerContext<'a, T> {
403403 new_size,
404404 } ) ?;
405405 let result = self . realloc_inner ( old, old_size, old_align, new_size) ;
406- #[ cfg( all ( feature = "rr-component" , feature = "rr-validate" ) ) ]
406+ #[ cfg( feature = "rr-component" ) ]
407407 self . store . 0 . record_event_validation ( || {
408408 ReallocReturnEvent ( ResultEvent :: from_anyhow_result ( & result) )
409409 } ) ?;
@@ -576,23 +576,19 @@ impl<'a, T: 'static> LowerContext<'a, T> {
576576 mut result_storage : Option < & mut [ MaybeUninit < ValRaw > ] > ,
577577 phase : ReplayLoweringPhase ,
578578 ) -> Result < ( ) > {
579- // There is a lot of `rr-validate` feature gating here for optimal replay performance
580- // and memory overhead in a non-validating scenario. If this proves to not produce a huge
581- // overhead in practice, gating can be removed in the future in favor of readability
582579 if self . store . 0 . replay_buffer_mut ( ) . is_none ( ) {
583580 return Ok ( ( ) ) ;
584581 }
585582 let mut complete = false ;
586583 let mut lowering_error: Option < ReplayError > = None ;
587584 // No nested expected; these depths should only be 1
588- let mut _realloc_stack = Vec :: < Result < usize > > :: new ( ) ;
585+ let mut realloc_stack = Vec :: < Result < usize > > :: new ( ) ;
589586 // Lowering tracks is only for ordering entry/exit events
590- let mut _lower_stack = Vec :: < ( ) > :: new ( ) ;
591- let mut _lower_store_stack = Vec :: < ( ) > :: new ( ) ;
587+ let mut lower_stack = Vec :: < ( ) > :: new ( ) ;
588+ let mut lower_store_stack = Vec :: < ( ) > :: new ( ) ;
592589 while !complete {
593590 let buf = self . store . 0 . replay_buffer_mut ( ) . unwrap ( ) ;
594591 let event = buf. next_event ( ) ?;
595- #[ cfg( feature = "rr-validate" ) ]
596592 let run_validate = buf. settings ( ) . validate && buf. trace_settings ( ) . add_validation ;
597593 match event {
598594 RREvent :: HostFuncReturn ( e) => {
@@ -624,27 +620,22 @@ impl<'a, T: 'static> LowerContext<'a, T> {
624620 complete = true ;
625621 }
626622 RREvent :: ComponentReallocEntry ( e) => {
627- let _result =
623+ let result =
628624 self . realloc_inner ( e. old_addr , e. old_size , e. old_align , e. new_size ) ;
629- #[ cfg( feature = "rr-validate" ) ]
630625 if run_validate {
631- _realloc_stack . push ( _result ) ;
626+ realloc_stack . push ( result ) ;
632627 }
633628 }
634629 // No return value to validate for lower/lower-store; store error and just check that entry happened before
635630 RREvent :: ComponentLowerFlatReturn ( e) => {
636- #[ cfg( feature = "rr-validate" ) ]
637631 if run_validate {
638- _lower_stack
639- . pop ( )
640- . ok_or ( ReplayError :: InvalidEventPosition ) ?;
632+ lower_stack. pop ( ) . ok_or ( ReplayError :: InvalidEventPosition ) ?;
641633 }
642634 lowering_error = e. 0 . ret ( ) . map_err ( Into :: into) . err ( ) ;
643635 }
644636 RREvent :: ComponentLowerMemoryReturn ( e) => {
645- #[ cfg( feature = "rr-validate" ) ]
646637 if run_validate {
647- _lower_store_stack
638+ lower_store_stack
648639 . pop ( )
649640 . ok_or ( ReplayError :: InvalidEventPosition ) ?;
650641 }
@@ -664,25 +655,21 @@ impl<'a, T: 'static> LowerContext<'a, T> {
664655 bail ! ( "Cannot call into host during lowering" )
665656 }
666657 // Unwrapping should never occur on valid executions since *Entry should be before *Return in trace
667- RREvent :: ComponentReallocReturn ( _e) =>
668- {
669- #[ cfg( feature = "rr-validate" ) ]
658+ RREvent :: ComponentReallocReturn ( e) => {
670659 if run_validate {
671- lowering_error = _e . 0 . validate ( & _realloc_stack . pop ( ) . unwrap ( ) ) . err ( )
660+ lowering_error = e . 0 . validate ( & realloc_stack . pop ( ) . unwrap ( ) ) . err ( )
672661 }
673662 }
674663 RREvent :: ComponentLowerFlatEntry ( _) => {
675664 // All we want here is ensuring Entry occurs before Return
676- #[ cfg( feature = "rr-validate" ) ]
677665 if run_validate {
678- _lower_stack . push ( ( ) )
666+ lower_stack . push ( ( ) )
679667 }
680668 }
681669 RREvent :: ComponentLowerMemoryEntry ( _) => {
682670 // All we want here is ensuring Entry occurs before Return
683- #[ cfg( feature = "rr-validate" ) ]
684671 if run_validate {
685- _lower_store_stack . push ( ( ) )
672+ lower_store_stack . push ( ( ) )
686673 }
687674 }
688675
0 commit comments