Skip to content

Commit

Permalink
cache init
Browse files Browse the repository at this point in the history
  • Loading branch information
sunny2022da committed Feb 1, 2024
1 parent 94f150c commit e0a0423
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/vm/compiler/OpCodeCache.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (c *OpCodeCache) UpdateCodeCache(address common.Address, code OptCode, code
c.codeCacheSize = 0
}
if c.opcodesCache[address] == nil {
c.opcodesCache[address] = map[common.Hash]OptCode{}
c.opcodesCache[address] = make(map[common.Hash]OptCode, 3)
}
c.opcodesCache[address][codeHash] = code
c.codeCacheSize += uint64(len(code))
Expand Down Expand Up @@ -100,8 +100,8 @@ var opcodeCache *OpCodeCache

func newOpCodeCache() *OpCodeCache {
codeCache := new(OpCodeCache)
codeCache.opcodesCache = map[common.Address]map[common.Hash]OptCode{}
codeCache.shlAndSubMap = map[ThreeU8Operands]*uint256.Int{}
codeCache.opcodesCache = make(map[common.Address]map[common.Hash]OptCode, CodeCacheGCThreshold>>10)
codeCache.shlAndSubMap = make(map[ThreeU8Operands]*uint256.Int, 4096)
codeCache.codeCacheMutex = sync.RWMutex{}
opcodeCache = codeCache
return codeCache
Expand Down

0 comments on commit e0a0423

Please sign in to comment.