Skip to content

Commit 8ead45c

Browse files
committed
core/vm: avoid map lookups for accessing jumpdest analysis
1 parent 82a9e11 commit 8ead45c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

core/vm/contract.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,13 @@ func (c *Contract) validJumpSubdest(udest uint64) bool {
112112
// isCode returns true if the provided PC location is an actual opcode, as
113113
// opposed to a data-segment following a PUSHN operation.
114114
func (c *Contract) isCode(udest uint64) bool {
115+
// Do we already have an analysis laying around?
116+
if c.analysis != nil {
117+
return c.analysis.codeSegment(udest)
118+
}
115119
// Do we have a contract hash already?
120+
// If we do have a hash, that means it's a 'regular' contract. For regular
121+
// contracts ( not temporary initcode), we store the analysis in a map
116122
if c.CodeHash != (common.Hash{}) {
117123
// Does parent context have the analysis?
118124
analysis, exist := c.jumpdests[c.CodeHash]

0 commit comments

Comments
 (0)