evmone
evmone copied to clipboard
Optimize jumps
Notice that the jump instructions (JUMP
, JUMPI
) always land on OPX_BEGINBLOCK
. Therefor we can execute the "beginblock" from within the jump instruction and then target the instruction after OPX_BEGINBLOCK
.
The OPX_BEGINBLOCK
instructions must stay at least for JUMPDEST
case.
For other cases (new block after terminating instruction, the first instruction in the code) we could remove it, but it might be hard to properly specify check in the analysis for this. However, that would be beneficial, because then the size of the instruction table will be not greater than the original code size (when ignoring the additional terminating STOP). Better estimation gives us ability to pre-allocate the instruction table with guarantees that the iterators are not going to be invalidated.