EIP-8013 · Draft · Core · 2025-08-19
EIP-8013: Static relative jumps and calls for the EVM
Adds five EVM jump instructions (RJUMP, RJUMPI, RJUMPV, RJUMPSUB, RJUMPSUBV) whose targets are fixed signed offsets in the bytecode, making control flow cheaper, faster and statically analyzable.
What problem does it solve?
The EVM only has dynamic jumps: JUMP and JUMPI take their destination from the stack. That is flexible, but tools cannot easily tell where code can go, which makes analysis hard and sometimes intractable, and it is part of why the JUMPDEST marker and its runtime checks exist. In practice almost all control flow is static (loops, if/else, function calls) and does not need that flexibility.
EIP-8013 gives compilers static, relative jumps for these cases, so they can avoid JUMP/JUMPI while the old opcodes keep working for existing code.
How it works
Each instruction carries its target in an immediate argument. Offsets are 16-bit signed big-endian values, relative to the PC right after the instruction and its immediate.
| Opcode | Name | Behavior |
|---|---|---|
0xe0 |
RJUMP off |
Jump to pc_post + off |
0xe1 |
RJUMPI off |
Pop cond; jump if non-zero |
0xe2 |
RJUMPV max off… |
Pop case; jump to off[case], or fall through if case > max |
0xe3 |
RJUMPSUB off |
Push return address to the return stack and jump to an ENTERSUB |
0xe4 |
RJUMPSUBV max off… |
Table version of RJUMPSUB |
- Jump tables hold
max_index + 1offsets (up to 256); the default case sits right after the instruction. - The subroutine forms build on EIP-7979 (
CALLSUB,ENTERSUB,RETURNSUB); their target must be anENTERSUB. - Code validation (extended from EIP-7979) ensures every target is a real instruction inside the code: not PUSH data, not another jump's immediate. Targets need no
JUMPDEST, saving a byte at deploy time and gas per jump. - Suggested costs:
RJUMP2,RJUMPI/RJUMPV4,RJUMPSUB/RJUMPSUBV5, compared with 8/10 forJUMP/JUMPI.
Relative addressing makes code relocatable, so a snippet can be injected anywhere. The ±32767-byte range covers the 24,576-byte code size limit (EIP-170).
Sample code
A countdown loop using RJUMPI with a negative offset (assembly with byte offsets):
0x00 60 05 PUSH1 5 ; counter
0x02 60 01 PUSH1 1 ; loop body starts here
0x04 90 SWAP1
0x05 03 SUB ; counter - 1
0x06 80 DUP1
0x07 e1 ff f8 RJUMPI -8 ; pc_post = 0x0a, 0x0a - 8 = 0x02
0x0a 00 STOP
No JUMPDEST is needed at 0x02; validation checks the target once, before execution.
Things to know
- Status: Draft. Opcode numbers, gas costs and its reliance on EIP-7979 (in Review) may change, and it is not scheduled for any upgrade.
- These instructions first appeared in EIP-4200 as part of the EVM Object Format (EOF). EIP-8013 brings them to the EVM without requiring the EOF container.
- Background on why static control flow matters for the EVM roadmap is collected in EIP-8173.
- A different take on the immediate-argument problem is EIP-7921, which would make every
0x5bbyte a valid jump destination.