This repository was archived by the owner on Nov 6, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-9
lines changed
ethcore/evm/src/interpreter Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -186,8 +186,7 @@ impl<Cost: CostType> vm::Vm for Interpreter<Cost> {
186
186
match result {
187
187
InstructionResult :: JumpToPosition ( position) => {
188
188
if valid_jump_destinations. is_none ( ) {
189
- let code_hash = params. code_hash . clone ( ) . unwrap_or_else ( || keccak ( code. as_ref ( ) ) ) ;
190
- valid_jump_destinations = Some ( self . cache . jump_destinations ( & code_hash, code) ) ;
189
+ valid_jump_destinations = Some ( self . cache . jump_destinations ( & params. code_hash , code) ) ;
191
190
}
192
191
let jump_destinations = valid_jump_destinations. as_ref ( ) . expect ( "jump_destinations are initialized on first jump; qed" ) ;
193
192
let pos = self . verify_jump ( position, jump_destinations) ?;
Original file line number Diff line number Diff line change @@ -50,17 +50,22 @@ impl SharedCache {
50
50
}
51
51
52
52
/// Get jump destinations bitmap for a contract.
53
- pub fn jump_destinations ( & self , code_hash : & H256 , code : & [ u8 ] ) -> Arc < BitSet > {
54
- if code_hash == & KECCAK_EMPTY {
55
- return Self :: find_jump_destinations ( code) ;
56
- }
53
+ pub fn jump_destinations ( & self , code_hash : & Option < H256 > , code : & [ u8 ] ) -> Arc < BitSet > {
54
+ if let Some ( ref code_hash) = code_hash {
55
+ if code_hash == & KECCAK_EMPTY {
56
+ return Self :: find_jump_destinations ( code) ;
57
+ }
57
58
58
- if let Some ( d) = self . jump_destinations . lock ( ) . get_mut ( code_hash) {
59
- return d. 0 . clone ( ) ;
59
+ if let Some ( d) = self . jump_destinations . lock ( ) . get_mut ( code_hash) {
60
+ return d. 0 . clone ( ) ;
61
+ }
60
62
}
61
63
62
64
let d = Self :: find_jump_destinations ( code) ;
63
- self . jump_destinations . lock ( ) . insert ( code_hash. clone ( ) , Bits ( d. clone ( ) ) ) ;
65
+
66
+ if let Some ( ref code_hash) = code_hash {
67
+ self . jump_destinations . lock ( ) . insert ( * code_hash, Bits ( d. clone ( ) ) ) ;
68
+ }
64
69
65
70
d
66
71
}
You can’t perform that action at this time.
0 commit comments