ethereum.forks.dao_fork.vm.instructions.control_flowethereum.forks.tangerine_whistle.vm.instructions.control_flow
Ethereum Virtual Machine (EVM) Control Flow Instructions.
.. contents:: Table of Contents :backlinks: none :local:
Introduction
Implementations of the EVM control flow instructions.
stop ¶
Stop further execution of EVM code.
Parameters
evm : The current EVM frame.
jump ¶
Alter the program counter to the location specified by the top of the stack.
Parameters
evm : The current EVM frame.
jumpi ¶
Alter the program counter to the specified location if and only if a condition is true. If the condition is not true, then the program counter would increase only by 1.
Parameters
evm : The current EVM frame.
def jumpi(evm: Evm) -> None:
| 74 | <snip> |
|---|---|
| 85 | # STACK |
| 86 | jump_dest = Uint(pop(evm.stack)) |
| 87 | conditional_value = pop(evm.stack) |
| 88 | |
| 89 | # GAS |
| 90 | charge_gas(evm, GasCosts.OPCODE_JUMPI) |
| 91 | |
| 92 | # OPERATION |
| 93 | if conditional_value == 0: |
| 94 | destination = evm.pc + Uint(1) |
| 95 | elif jump_dest not in evm.valid_jump_destinations: |
| 96 | raise InvalidJumpDestError |
| 97 | else: |
| 98 | destination = jump_dest |
| 99 | |
| 100 | # PROGRAM COUNTER |
| 101 | evm.pc = destination |
pc ¶
Push onto the stack the value of the program counter after reaching the current instruction and without increasing it for the next instruction.
Parameters
evm : The current EVM frame.
gas_left ¶
Push the amount of available gas (including the corresponding reduction for the cost of this instruction) onto the stack.
Parameters
evm : The current EVM frame.
jumpdest ¶
Mark a valid destination for jumps. This is a noop, present only
to be used by JUMP and JUMPI opcodes to verify that their jump is
valid.
Parameters
evm : The current EVM frame.