Skip to content

Commit

Permalink
Merge pull request #21411 from holiman/fix_codelookup
Browse files Browse the repository at this point in the history
core/vm: avoid map lookups for accessing jumpdest analysis
  • Loading branch information
karalabe authored Aug 6, 2020
2 parents 4a04127 + 8ead45c commit 4fde0ca
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/vm/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,13 @@ func (c *Contract) validJumpSubdest(udest uint64) bool {
// isCode returns true if the provided PC location is an actual opcode, as
// opposed to a data-segment following a PUSHN operation.
func (c *Contract) isCode(udest uint64) bool {
// Do we already have an analysis laying around?
if c.analysis != nil {
return c.analysis.codeSegment(udest)
}
// Do we have a contract hash already?
// If we do have a hash, that means it's a 'regular' contract. For regular
// contracts ( not temporary initcode), we store the analysis in a map
if c.CodeHash != (common.Hash{}) {
// Does parent context have the analysis?
analysis, exist := c.jumpdests[c.CodeHash]
Expand Down

0 comments on commit 4fde0ca

Please sign in to comment.