@@ -299,19 +299,21 @@ pub struct InspectorStack {
299
299
/// See [`InspectorStack`].
300
300
#[ derive( Default , Clone , Debug ) ]
301
301
pub struct InspectorStackInner {
302
+ // Inspectors.
302
303
pub chisel_state : Option < ChiselState > ,
303
- pub line_coverage : Option < LineCoverageCollector > ,
304
304
pub edge_coverage : Option < EdgeCovInspector > ,
305
305
pub fuzzer : Option < Fuzzer > ,
306
+ pub line_coverage : Option < LineCoverageCollector > ,
306
307
pub log_collector : Option < LogCollector > ,
307
308
pub printer : Option < CustomPrintTracer > ,
308
- pub tracer : Option < TracingInspector > ,
309
+ pub revert_diag : Option < RevertDiagnostic > ,
309
310
pub script_execution_inspector : Option < ScriptExecutionInspector > ,
311
+ pub tracer : Option < TracingInspector > ,
312
+
313
+ // InspectorExt and other internal data.
310
314
pub enable_isolation : bool ,
311
315
pub odyssey : bool ,
312
316
pub create2_deployer : Address ,
313
- pub revert_diag : Option < RevertDiagnostic > ,
314
-
315
317
/// Flag marking if we are in the inner EVM context.
316
318
pub in_inner_context : bool ,
317
319
pub inner_context_data : Option < InnerContextData > ,
@@ -788,63 +790,83 @@ impl InspectorStackRefMut<'_> {
788
790
ecx. journaled_state . state = std:: mem:: take ( & mut self . top_frame_journal ) ;
789
791
}
790
792
}
791
- }
792
793
793
- impl Inspector < EthEvmContext < & mut dyn DatabaseExt > > for InspectorStackRefMut < ' _ > {
794
- fn initialize_interp (
794
+ # [ inline ( always ) ]
795
+ fn step_inlined (
795
796
& mut self ,
796
797
interpreter : & mut Interpreter ,
797
798
ecx : & mut EthEvmContext < & mut dyn DatabaseExt > ,
798
799
) {
799
800
call_inspectors ! (
800
801
[
801
- & mut self . line_coverage ,
802
+ & mut self . fuzzer ,
802
803
& mut self . tracer,
803
- & mut self . cheatcodes,
804
+ & mut self . line_coverage,
805
+ & mut self . edge_coverage,
804
806
& mut self . script_execution_inspector,
805
- & mut self . printer
807
+ & mut self . printer,
808
+ & mut self . revert_diag,
809
+ // Keep `cheatcodes` last to make use of the tail call.
810
+ & mut self . cheatcodes,
806
811
] ,
807
- |inspector| inspector. initialize_interp ( interpreter, ecx) ,
812
+ |inspector| ( * inspector) . step ( interpreter, ecx) ,
808
813
) ;
809
814
}
810
815
811
- fn step (
816
+ #[ inline( always) ]
817
+ fn step_end_inlined (
812
818
& mut self ,
813
819
interpreter : & mut Interpreter ,
814
820
ecx : & mut EthEvmContext < & mut dyn DatabaseExt > ,
815
821
) {
816
822
call_inspectors ! (
817
823
[
818
- & mut self . fuzzer,
819
824
& mut self . tracer,
820
- & mut self . line_coverage,
821
- & mut self . edge_coverage,
822
- & mut self . cheatcodes,
823
- & mut self . script_execution_inspector,
825
+ & mut self . chisel_state,
824
826
& mut self . printer,
825
- & mut self . revert_diag
827
+ & mut self . revert_diag,
828
+ // Keep `cheatcodes` last to make use of the tail call.
829
+ & mut self . cheatcodes,
826
830
] ,
827
- |inspector| inspector. step ( interpreter, ecx) ,
831
+ |inspector| ( * inspector) . step_end ( interpreter, ecx) ,
828
832
) ;
829
833
}
834
+ }
830
835
831
- fn step_end (
836
+ impl Inspector < EthEvmContext < & mut dyn DatabaseExt > > for InspectorStackRefMut < ' _ > {
837
+ fn initialize_interp (
832
838
& mut self ,
833
839
interpreter : & mut Interpreter ,
834
840
ecx : & mut EthEvmContext < & mut dyn DatabaseExt > ,
835
841
) {
836
842
call_inspectors ! (
837
843
[
844
+ & mut self . line_coverage,
838
845
& mut self . tracer,
839
846
& mut self . cheatcodes,
840
- & mut self . chisel_state,
841
- & mut self . printer,
842
- & mut self . revert_diag
847
+ & mut self . script_execution_inspector,
848
+ & mut self . printer
843
849
] ,
844
- |inspector| inspector. step_end ( interpreter, ecx) ,
850
+ |inspector| inspector. initialize_interp ( interpreter, ecx) ,
845
851
) ;
846
852
}
847
853
854
+ fn step (
855
+ & mut self ,
856
+ interpreter : & mut Interpreter ,
857
+ ecx : & mut EthEvmContext < & mut dyn DatabaseExt > ,
858
+ ) {
859
+ self . step_inlined ( interpreter, ecx) ;
860
+ }
861
+
862
+ fn step_end (
863
+ & mut self ,
864
+ interpreter : & mut Interpreter ,
865
+ ecx : & mut EthEvmContext < & mut dyn DatabaseExt > ,
866
+ ) {
867
+ self . step_end_inlined ( interpreter, ecx) ;
868
+ }
869
+
848
870
#[ allow( clippy:: redundant_clone) ]
849
871
fn log (
850
872
& mut self ,
@@ -1063,22 +1085,20 @@ impl InspectorExt for InspectorStackRefMut<'_> {
1063
1085
}
1064
1086
1065
1087
impl Inspector < EthEvmContext < & mut dyn DatabaseExt > > for InspectorStack {
1066
- #[ inline]
1067
1088
fn step (
1068
1089
& mut self ,
1069
1090
interpreter : & mut Interpreter ,
1070
1091
ecx : & mut EthEvmContext < & mut dyn DatabaseExt > ,
1071
1092
) {
1072
- self . as_mut ( ) . step ( interpreter, ecx)
1093
+ self . as_mut ( ) . step_inlined ( interpreter, ecx)
1073
1094
}
1074
1095
1075
- #[ inline]
1076
1096
fn step_end (
1077
1097
& mut self ,
1078
1098
interpreter : & mut Interpreter ,
1079
1099
ecx : & mut EthEvmContext < & mut dyn DatabaseExt > ,
1080
1100
) {
1081
- self . as_mut ( ) . step_end ( interpreter, ecx)
1101
+ self . as_mut ( ) . step_end_inlined ( interpreter, ecx)
1082
1102
}
1083
1103
1084
1104
fn call (
0 commit comments