github.com/karalabe/go-ethereum@v0.8.5/vm/analysis.go (about) 1 package vm 2 3 import "gopkg.in/fatih/set.v0" 4 5 func analyseJumpDests(code []byte) (dests *set.Set) { 6 dests = set.New() 7 8 for pc := uint64(0); pc < uint64(len(code)); pc++ { 9 var op OpCode = OpCode(code[pc]) 10 switch op { 11 case PUSH1, PUSH2, PUSH3, PUSH4, PUSH5, PUSH6, PUSH7, PUSH8, PUSH9, PUSH10, PUSH11, PUSH12, PUSH13, PUSH14, PUSH15, PUSH16, PUSH17, PUSH18, PUSH19, PUSH20, PUSH21, PUSH22, PUSH23, PUSH24, PUSH25, PUSH26, PUSH27, PUSH28, PUSH29, PUSH30, PUSH31, PUSH32: 12 a := uint64(op) - uint64(PUSH1) + 1 13 14 pc += a 15 case JUMPDEST: 16 dests.Add(pc) 17 } 18 } 19 return 20 }