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 {
72
72
#[ cold]
73
73
#[ inline( never) ]
74
74
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 ( ) ;
76
76
self . current_hash = hash;
77
77
// Converts the mutable reference to a `NonNull` pointer.
78
78
self . current_map = self
@@ -89,14 +89,10 @@ impl LineCoverageCollector {
89
89
/// tx) then the hash is calculated from the bytecode.
90
90
#[ inline]
91
91
fn 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 ( ) )
102
98
}
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ extern crate tracing;
10
10
11
11
use alloy_primitives:: {
12
12
Bytes ,
13
- map:: { B256HashMap , HashMap } ,
13
+ map:: { B256HashMap , HashMap , rustc_hash :: FxHashMap } ,
14
14
} ;
15
15
use analysis:: SourceAnalysis ;
16
16
use eyre:: Result ;
@@ -208,8 +208,8 @@ impl DerefMut for HitMaps {
208
208
/// Contains low-level data about hit counters for the instructions in the bytecode of a contract.
209
209
#[ derive( Clone , Debug ) ]
210
210
pub struct HitMap {
211
+ hits : FxHashMap < u32 , u32 > ,
211
212
bytecode : Bytes ,
212
- hits : HashMap < u32 , u32 > ,
213
213
}
214
214
215
215
impl HitMap {
You can’t perform that action at this time.
0 commit comments