---
eip: 615
label: EIP-615
title: Subroutines and Static Jumps for the EVM
status: Stagnant
type: Standards Track
category: Core
created: 2016-12-10
official: https://eips.ethereum.org/EIPS/eip-615
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-615.md
canonical: https://eips.huatuo.xyz/eip-615/
lang: en
tldr: "A proposal to replace the EVM's dynamic jumps with static jumps, real subroutines and deploy-time validation, so EVM code becomes easier to analyze, verify and compile."
tags: [evm, opcodes, subroutines, validation, core]
---

# EIP-615: Subroutines and Static Jumps for the EVM

> In the 21st century, on a blockchain circulating billions of ETH, formal specification and verification are an essential tool against loss. Yet the design of the EVM makes this unnecessarily difficult. Further, the design of the EVM makes near-linear-time compilation to machine code difficult.

**TL;DR:** A proposal to replace the EVM's dynamic jumps with static jumps, real subroutines and deploy-time validation, so EVM code becomes easier to analyze, verify and compile.

## What problem does it solve?

The EVM has only one kind of jump: `JUMP` / `JUMPI` to an address taken from the **stack**. Compilers even use these dynamic jumps for function returns. Because a jump target can be any value computed at runtime, tools cannot easily work out the control flow of a contract. That makes these jobs hard or slow:

- formal verification and static analysis for bugs,
- compiling EVM bytecode to fast machine code,
- proving ahead of time that code won't hit stack underflow or bad jumps.

The authors argue that analysis must run in near-linear (`n log n`) time, otherwise attackers can craft contracts that cause quadratic blow-ups in validators or optimizers.

## How it works

EIP-615 deprecates `JUMP` and `JUMPI` for new code and adds structured replacements that map closely to Wasm and CPU instructions:

| New opcode | Purpose |
| --- | --- |
| `JUMPTO t` / `JUMPIF t` | Unconditional / conditional jump to an **immediate** target |
| `JUMPV n, targets` | Jump table (switch) through an inline vector of targets |
| `BEGINSUB n_args, n_results` | Marks a subroutine entry and its stack signature |
| `JUMPSUB t` / `JUMPSUBV n, targets` | Call a subroutine, directly or through a table |
| `RETURNSUB` | Return to the instruction after the call |
| `GETLOCAL n` / `PUTLOCAL n` | Read and write frame-local stack slots |
| `BEGINDATA` | Everything after this is data, not code |

Subroutine calls use a separate return stack and frame pointer that the program cannot touch. New-style bytecode starts with a header (`\0evm` plus a version) and is **validated at deploy time**. Code that could underflow the stack, jump to an invalid place or misuse subroutines is rejected before it reaches the chain. Only out-of-gas and stack overflow still need runtime checks. Mixing new and legacy code relies on account versioning ([EIP-1702](/eip-1702/)).

## Sample code

Illustrative assembly: a subroutine that adds two numbers, called with a static jump.

```text
; header: "\0evm" + version
BEGINSUB 0, 0          ; main routine
  PUSH1 10
  PUSH1 11
  JUMPSUB add          ; immediate target, no dynamic jump
  ; stack now holds 21
  STOP

add:
BEGINSUB 2, 1          ; takes 2 args, returns 1
  ADD
  RETURNSUB

BEGINDATA              ; optional data section
```

Compare with legacy EVM, where the caller pushes a return address and the callee does `JUMP` to whatever is on the stack.

## Things to know

- This proposal is **Stagnant** and was never adopted. Current EVM bytecode still uses dynamic `JUMP` / `JUMPI`.
- Its ideas continued in later proposals. [EIP-2315](/eip-2315/) (simple subroutines) is Withdrawn. The EVM Object Format family, including [EIP-3540](/eip-3540/), [EIP-4750](/eip-4750/) (functions) and the meta [EIP-7692](/eip-7692/), brought back deploy-time validation and real functions, and is also listed as Stagnant.
- The opcode numbers and header format here are specific to this draft. Do not assume they match any later design.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-615
