File tree Expand file tree Collapse file tree 2 files changed +9
-13
lines changed
Expand file tree Collapse file tree 2 files changed +9
-13
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ impl LineCoverageCollector {
7272 #[ cold]
7373 #[ inline( never) ]
7474 fn insert_map ( & mut self , interpreter : & mut Interpreter ) {
75- let hash = interpreter. bytecode . hash ( ) . unwrap_or_else ( || eof_panic ( ) ) ;
75+ let hash = interpreter. bytecode . hash ( ) . unwrap ( ) ;
7676 self . current_hash = hash;
7777 // Converts the mutable reference to a `NonNull` pointer.
7878 self . current_map = self
@@ -89,14 +89,10 @@ impl LineCoverageCollector {
8989/// tx) then the hash is calculated from the bytecode.
9090#[ inline]
9191fn get_or_insert_contract_hash ( interpreter : & mut Interpreter ) -> B256 {
92- if interpreter. bytecode . hash ( ) . is_none_or ( |h| h. is_zero ( ) ) {
93- interpreter. bytecode . regenerate_hash ( ) ;
94- }
95- interpreter. bytecode . hash ( ) . unwrap_or_else ( || eof_panic ( ) )
96- }
97-
98- #[ cold]
99- #[ inline( never) ]
100- fn eof_panic ( ) -> ! {
101- panic ! ( "coverage does not support EOF" ) ;
92+ // TODO: use just `get_or_calculate_hash`
93+ interpreter
94+ . bytecode
95+ . hash ( )
96+ . filter ( |h| !h. is_zero ( ) )
97+ . unwrap_or_else ( || interpreter. bytecode . regenerate_hash ( ) )
10298}
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ extern crate tracing;
1010
1111use alloy_primitives:: {
1212 Bytes ,
13- map:: { B256HashMap , HashMap } ,
13+ map:: { B256HashMap , HashMap , rustc_hash :: FxHashMap } ,
1414} ;
1515use analysis:: SourceAnalysis ;
1616use eyre:: Result ;
@@ -208,8 +208,8 @@ impl DerefMut for HitMaps {
208208/// Contains low-level data about hit counters for the instructions in the bytecode of a contract.
209209#[ derive( Clone , Debug ) ]
210210pub struct HitMap {
211+ hits : FxHashMap < u32 , u32 > ,
211212 bytecode : Bytes ,
212- hits : HashMap < u32 , u32 > ,
213213}
214214
215215impl HitMap {
You can’t perform that action at this time.
0 commit comments