From 8ead45c20b31377320c5320964da8cddcb5f59a4 Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Tue, 4 Aug 2020 15:40:23 +0200 Subject: [PATCH] core/vm: avoid map lookups for accessing jumpdest analysis --- core/vm/contract.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/vm/contract.go b/core/vm/contract.go index 9112eabde6..915193d137 100644 --- a/core/vm/contract.go +++ b/core/vm/contract.go @@ -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]