{"eip":6206,"title":"EOF - JUMPF and non-returning functions","description":"Introduces instruction for chaining function calls.","authors":["Andrei Maiboroda (@gumb0)","Alex Beregszaszi (@axic)","Paweł Bylica (@chfast)","Matt Garnett (@lightclient)"],"status":"Stagnant","type":"Standards Track","category":"Core","created":"2022-12-21","requires":[4750,5450],"discussionsTo":"https://ethereum-magicians.org/t/eip-4750-eof-functions/8195","repo":"EIPs","label":"EIP-6206","officialUrl":"https://eips.ethereum.org/EIPS/eip-6206","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-6206.md","url":"https://eips.huatuo.xyz/eip-6206/","tldr":{"en":"Adds JUMPF, an EOF instruction that jumps into another function without a return frame (a tail call), and lets functions be marked non-returning for smaller, cheaper code.","ja":"リターンフレームなしで別の関数へジャンプする（末尾呼び出し）EOF 命令 JUMPF を追加し、関数を「戻らない」と指定できるようにして、コードをより小さく安くする。","ko":"리턴 프레임 없이 다른 함수로 점프하는(꼬리 호출) EOF 명령 JUMPF를 추가하고, 함수를 반환하지 않는 것으로 표시할 수 있게 해 더 작고 저렴한 코드를 만든다.","zh":"新增 JUMPF，一条无需返回帧即可跳转到另一个函数的 EOF 指令（尾调用），并允许将函数标记为不返回，以获得更小、更便宜的代码。"},"tags":["evm","eof","opcodes","compilers","core"],"explainers":{"en":{"lang":"en","tldr":"Adds JUMPF, an EOF instruction that jumps into another function without a return frame (a tail call), and lets functions be marked non-returning for smaller, cheaper code.","tags":["evm","eof","opcodes","compilers","core"],"related":[4750,5450,4200,3540,7692],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-6206/","markdown":"## What problem does it solve?\n\nThe EVM Object Format (EOF) introduces real functions: code is split into sections, `CALLF` calls a section and `RETF` returns ([EIP-4750](/eip-4750/)). That leaves two inefficiencies:\n\n1. **Tail calls.** A function that ends by calling another function and immediately returning still pays for a `CALLF` + `RETF` round trip and a return-stack frame.\n2. **Error helpers.** Shared helpers that always end in `REVERT` are common. Because stack validation ([EIP-5450](/eip-5450/)) requires exact stack heights on return, callers would have to clean up extra stack items before calling them, even though control never comes back.\n\nEIP-6206 solves both with one new instruction and a \"non-returning\" flag.\n\n## How it works\n\n**`JUMPF` (opcode `0xe5`)** takes a 2-byte immediate `target_section_index`. It sets the current section to the target and `PC` to 0 **without** pushing a return frame. It costs 5 gas and does not touch the operand stack. Before jumping, it checks that the target's declared `max_stack_increase` cannot overflow the 1024-item stack limit.\n\n**Non-returning sections.** In the EOF type section, a code section's `outputs` value can be `0x80`, meaning it never returns to its caller. A section must be marked non-returning if and only if it contains no `RETF` and no `JUMPF` into a returning section. The first code section must have 0 inputs and be non-returning.\n\n**Validation rules (at deploy time):**\n\n- `JUMPF` into a returning section: the stack height must be exactly `current.outputs - target.outputs + target.inputs`, and `current.outputs \u003e= target.outputs`. A section with more outputs can reuse a helper with fewer outputs if it leaves the difference on the stack.\n- `JUMPF` into a non-returning section: the stack only needs at least `target.inputs` items. Extra items can be left behind.\n- `CALLF` into a non-returning section is invalid; use `JUMPF`.\n- `JUMPF` is a terminating instruction, like `RETF` or `STOP`.\n\nIn legacy (non-EOF) bytecode, `0xe5` remains invalid.\n\n## Sample code\n\nEOF assembly pseudocode: two functions share one non-returning error helper.\n\n```text\n; type section: section 0 -\u003e inputs 0, outputs 0x80 (non-returning)\n;               section 1 -\u003e inputs 1, outputs 1\n;               section 2 -\u003e inputs 0, outputs 0x80 (non-returning: revert helper)\n\ncode_section_1:            ; f(x) -\u003e y\n    DUP1\n    ISZERO\n    RJUMPI @bad            ; if x == 0, jump to error path\n    PUSH1 2\n    MUL\n    RETF\nbad:\n    JUMPF 2                ; tail-jump to helper; leftover x on stack is fine\n\ncode_section_2:            ; revert helper, never returns\n    PUSH0\n    PUSH0\n    REVERT\n```\n\n## Things to know\n\n- **Status: Stagnant.** EOF as a whole ([EIP-3540](/eip-3540/) and the [EIP-7692](/eip-7692/) meta list) is Stagnant and is not active on Ethereum mainnet; `JUMPF` only exists in an EOF context.\n- Because EOF rejects unknown opcodes at deploy time, adding `JUMPF` cannot change any existing EOF contract's behavior.\n- `RJUMP*` offsets ([EIP-4200](/eip-4200/)) may not point into `JUMPF`'s 2-byte immediate.\n- The main beneficiaries are compiler authors: smaller bytecode and lower gas for shared code paths, not new capabilities for contract developers.\n"},"ja":{"lang":"ja","tldr":"リターンフレームなしで別の関数へジャンプする（末尾呼び出し）EOF 命令 JUMPF を追加し、関数を「戻らない」と指定できるようにして、コードをより小さく安くする。","tags":["evm","eof","opcodes","compilers","core"],"related":[4750,5450,4200,3540,7692],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-6206/","markdown":"## 何を解決するのか\n\nEVM Object Format（EOF）は本物の関数を導入します。コードはセクションに分割され、`CALLF` がセクションを呼び出し、`RETF` が戻ります（[EIP-4750](/eip-4750/)）。これには 2 つの非効率が残ります。\n\n1. **末尾呼び出し。** 別の関数を呼んですぐに戻る形で終わる関数は、`CALLF` + `RETF` の往復とリターンスタックのフレームのコストを払うことになります。\n2. **エラーヘルパー。** 必ず `REVERT` で終わる共有ヘルパーはよくあります。スタック検証（[EIP-5450](/eip-5450/)）は戻る際に正確なスタックの高さを要求するため、制御が戻らないにもかかわらず、呼び出し側はヘルパーを呼ぶ前に余分なスタック項目を片付けなければなりません。\n\nEIP-6206 は、新しい命令 1 つと「戻らない」フラグで、この両方を解決します。\n\n## 仕組み\n\n**`JUMPF`（オペコード `0xe5`）** は 2 バイトの即値 `target_section_index` を取ります。リターンフレームを積まずに、現在のセクションをターゲットに、`PC` を 0 に設定します。コストは 5 ガスで、オペランドスタックには触れません。ジャンプの前に、ターゲットが宣言する `max_stack_increase` が 1024 項目のスタック上限をオーバーフローしないことを確認します。\n\n**戻らないセクション。** EOF のタイプセクションでは、コードセクションの `outputs` の値を `0x80` にでき、これは呼び出し元に決して戻らないことを意味します。セクションは、`RETF` を含まず、かつ戻るセクションへの `JUMPF` を含まない場合に限り、戻らないものとしてマークされなければなりません。最初のコードセクションは入力が 0 で、戻らないものでなければなりません。\n\n**検証ルール（デプロイ時）:**\n\n- 戻るセクションへの `JUMPF`: スタックの高さはちょうど `current.outputs - target.outputs + target.inputs` でなければならず、かつ `current.outputs \u003e= target.outputs` でなければならない。出力がより多いセクションは、その差をスタックに残しておけば、出力がより少ないヘルパーを再利用できる。\n- 戻らないセクションへの `JUMPF`: スタックには少なくとも `target.inputs` 個の項目があればよい。余分な項目は残してもよい。\n- 戻らないセクションへの `CALLF` は無効。`JUMPF` を使う。\n- `JUMPF` は、`RETF` や `STOP` と同様に終端命令である。\n\nレガシー（EOF でない）バイトコードでは、`0xe5` は引き続き無効です。\n\n## サンプルコード\n\nEOF アセンブリの疑似コード: 2 つの関数が、戻らない 1 つのエラーヘルパーを共有します。\n\n```text\n; type section: section 0 -\u003e inputs 0, outputs 0x80 (non-returning)\n;               section 1 -\u003e inputs 1, outputs 1\n;               section 2 -\u003e inputs 0, outputs 0x80 (non-returning: revert helper)\n\ncode_section_1:            ; f(x) -\u003e y\n    DUP1\n    ISZERO\n    RJUMPI @bad            ; if x == 0, jump to error path\n    PUSH1 2\n    MUL\n    RETF\nbad:\n    JUMPF 2                ; tail-jump to helper; leftover x on stack is fine\n\ncode_section_2:            ; revert helper, never returns\n    PUSH0\n    PUSH0\n    REVERT\n```\n\n## 知っておくべきこと\n\n- **ステータス: Stagnant。** EOF 全体（[EIP-3540](/eip-3540/) と [EIP-7692](/eip-7692/) のメタリスト）が Stagnant で、Ethereum メインネットでは有効ではありません。`JUMPF` は EOF のコンテキストにしか存在しません。\n- EOF はデプロイ時に未知のオペコードを拒否するため、`JUMPF` を追加しても既存の EOF コントラクトの挙動は変わりえません。\n- `RJUMP*` のオフセット（[EIP-4200](/eip-4200/)）は、`JUMPF` の 2 バイトの即値の中を指してはなりません。\n- 主な受益者はコンパイラの作者です。共有コードパスのバイトコードが小さくなりガスが減りますが、コントラクト開発者に新しい能力が加わるわけではありません。\n"},"ko":{"lang":"ko","tldr":"리턴 프레임 없이 다른 함수로 점프하는(꼬리 호출) EOF 명령 JUMPF를 추가하고, 함수를 반환하지 않는 것으로 표시할 수 있게 해 더 작고 저렴한 코드를 만든다.","tags":["evm","eof","opcodes","compilers","core"],"related":[4750,5450,4200,3540,7692],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-6206/","markdown":"## 어떤 문제를 해결하나요?\n\nEVM Object Format(EOF)은 진짜 함수를 도입합니다. 코드는 섹션으로 나뉘고, `CALLF`가 섹션을 호출하며, `RETF`가 반환합니다([EIP-4750](/eip-4750/)). 여기에는 두 가지 비효율이 남습니다.\n\n1. **꼬리 호출.** 다른 함수를 호출하고 곧바로 반환하는 것으로 끝나는 함수도 `CALLF` + `RETF` 왕복과 리턴 스택 프레임의 비용을 치릅니다.\n2. **에러 헬퍼.** 항상 `REVERT`로 끝나는 공유 헬퍼는 흔합니다. 스택 검증([EIP-5450](/eip-5450/))은 반환 시 정확한 스택 높이를 요구하므로, 제어가 돌아오지 않는데도 호출자는 헬퍼를 호출하기 전에 남는 스택 항목을 정리해야 합니다.\n\nEIP-6206은 새 명령 하나와 \"반환하지 않음\" 플래그로 둘 다 해결합니다.\n\n## 어떻게 동작하나요?\n\n**`JUMPF`(오피코드 `0xe5`)**는 2바이트 즉값 `target_section_index`를 받습니다. 리턴 프레임을 쌓지 **않고** 현재 섹션을 대상 섹션으로, `PC`를 0으로 설정합니다. 비용은 5 가스이며 오퍼랜드 스택은 건드리지 않습니다. 점프하기 전에 대상이 선언한 `max_stack_increase`가 1024개 항목의 스택 한도를 넘지 않는지 확인합니다.\n\n**반환하지 않는 섹션.** EOF 타입 섹션에서 코드 섹션의 `outputs` 값은 `0x80`일 수 있으며, 이는 호출자에게 절대 반환하지 않음을 뜻합니다. 섹션은 `RETF`를 포함하지 않고 반환하는 섹션으로의 `JUMPF`도 포함하지 않는 경우에 한해서만 반환하지 않는 것으로 표시되어야 합니다. 첫 번째 코드 섹션은 입력이 0이고 반환하지 않아야 합니다.\n\n**검증 규칙(배포 시):**\n\n- 반환하는 섹션으로의 `JUMPF`: 스택 높이는 정확히 `current.outputs - target.outputs + target.inputs`여야 하고, `current.outputs \u003e= target.outputs`여야 합니다. 출력이 더 많은 섹션은 그 차이를 스택에 남겨 두면 출력이 더 적은 헬퍼를 재사용할 수 있습니다.\n- 반환하지 않는 섹션으로의 `JUMPF`: 스택에 최소 `target.inputs`개의 항목만 있으면 됩니다. 남는 항목은 그대로 두어도 됩니다.\n- 반환하지 않는 섹션으로의 `CALLF`는 무효입니다. `JUMPF`를 사용하세요.\n- `JUMPF`는 `RETF`나 `STOP`처럼 종료 명령입니다.\n\n레거시(EOF가 아닌) 바이트코드에서 `0xe5`는 계속 무효입니다.\n\n## 샘플 코드\n\nEOF 어셈블리 의사 코드: 두 함수가 반환하지 않는 에러 헬퍼 하나를 공유합니다.\n\n```text\n; type section: section 0 -\u003e inputs 0, outputs 0x80 (non-returning)\n;               section 1 -\u003e inputs 1, outputs 1\n;               section 2 -\u003e inputs 0, outputs 0x80 (non-returning: revert helper)\n\ncode_section_1:            ; f(x) -\u003e y\n    DUP1\n    ISZERO\n    RJUMPI @bad            ; if x == 0, jump to error path\n    PUSH1 2\n    MUL\n    RETF\nbad:\n    JUMPF 2                ; tail-jump to helper; leftover x on stack is fine\n\ncode_section_2:            ; revert helper, never returns\n    PUSH0\n    PUSH0\n    REVERT\n```\n\n## 알아둘 점\n\n- **상태: Stagnant.** EOF 전체([EIP-3540](/eip-3540/)와 [EIP-7692](/eip-7692/) 메타 목록)가 Stagnant이며 이더리움 메인넷에서 활성화되어 있지 않습니다. `JUMPF`는 EOF 컨텍스트에서만 존재합니다.\n- EOF는 배포 시 알 수 없는 오피코드를 거부하므로, `JUMPF`를 추가해도 기존 EOF 컨트랙트의 동작은 바뀔 수 없습니다.\n- `RJUMP*` 오프셋([EIP-4200](/eip-4200/))은 `JUMPF`의 2바이트 즉값 내부를 가리켜서는 안 됩니다.\n- 주된 수혜자는 컴파일러 작성자입니다. 공유 코드 경로의 바이트코드가 작아지고 가스가 줄어들 뿐, 컨트랙트 개발자에게 새로운 기능이 생기는 것은 아닙니다.\n"},"zh":{"lang":"zh","tldr":"新增 JUMPF，一条无需返回帧即可跳转到另一个函数的 EOF 指令（尾调用），并允许将函数标记为不返回，以获得更小、更便宜的代码。","tags":["evm","eof","opcodes","compilers","core"],"related":[4750,5450,4200,3540,7692],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-6206/","markdown":"## 它解决什么问题？\n\nEVM 对象格式（EOF）引入了真正的函数：代码被拆分成多个段，`CALLF` 调用某个段，`RETF` 返回（[EIP-4750](/eip-4750/)）。这留下了两处低效：\n\n1. **尾调用。** 一个以调用另一个函数并立即返回结尾的函数，仍然要为一次 `CALLF` + `RETF` 往返和一个返回栈帧付出代价。\n2. **错误辅助函数。** 总是以 `REVERT` 结尾的共享辅助函数很常见。由于栈验证（[EIP-5450](/eip-5450/)）要求返回时栈高度精确，调用者必须在调用它们之前清理多余的栈项，尽管控制流永远不会回来。\n\nEIP-6206 用一条新指令和一个“不返回”标志解决了这两个问题。\n\n## 它如何运作\n\n**`JUMPF`（操作码 `0xe5`）**接受一个 2 字节的立即数 `target_section_index`。它把当前段设为目标段，并把 `PC` 设为 0，**不**压入返回帧。它花费 5 gas，不触碰操作数栈。跳转之前，它会检查目标声明的 `max_stack_increase` 不会溢出 1024 项的栈上限。\n\n**不返回的段。** 在 EOF 的类型段中，代码段的 `outputs` 值可以是 `0x80`，表示它永远不会返回给调用者。一个段必须被标记为不返回，当且仅当它不包含 `RETF`，也不包含跳转到会返回的段的 `JUMPF`。第一个代码段必须有 0 个输入，并且是不返回的。\n\n**验证规则（在部署时）：**\n\n- `JUMPF` 跳到会返回的段：栈高度必须恰好是 `current.outputs - target.outputs + target.inputs`，并且 `current.outputs \u003e= target.outputs`。输出更多的段可以复用输出更少的辅助函数，只要把差值留在栈上。\n- `JUMPF` 跳到不返回的段：栈上只需至少有 `target.inputs` 项。多余的项可以留下。\n- `CALLF` 到不返回的段是无效的；请使用 `JUMPF`。\n- `JUMPF` 是终止指令，与 `RETF` 或 `STOP` 相同。\n\n在旧式（非 EOF）字节码中，`0xe5` 仍然无效。\n\n## 示例代码\n\nEOF 汇编伪代码：两个函数共享一个不返回的错误辅助函数。\n\n```text\n; type section: section 0 -\u003e inputs 0, outputs 0x80 (non-returning)\n;               section 1 -\u003e inputs 1, outputs 1\n;               section 2 -\u003e inputs 0, outputs 0x80 (non-returning: revert helper)\n\ncode_section_1:            ; f(x) -\u003e y\n    DUP1\n    ISZERO\n    RJUMPI @bad            ; if x == 0, jump to error path\n    PUSH1 2\n    MUL\n    RETF\nbad:\n    JUMPF 2                ; tail-jump to helper; leftover x on stack is fine\n\ncode_section_2:            ; revert helper, never returns\n    PUSH0\n    PUSH0\n    REVERT\n```\n\n## 需要注意\n\n- **状态：Stagnant。** EOF 整体（[EIP-3540](/eip-3540/) 和 [EIP-7692](/eip-7692/) 元列表）处于 Stagnant，并未在以太坊主网上激活；`JUMPF` 只存在于 EOF 环境中。\n- 由于 EOF 在部署时拒绝未知操作码，添加 `JUMPF` 不会改变任何现有 EOF 合约的行为。\n- `RJUMP*` 的偏移量（[EIP-4200](/eip-4200/)）不得指向 `JUMPF` 的 2 字节立即数内部。\n- 主要受益者是编译器作者：共享代码路径的字节码更小、gas 更低，而不是为合约开发者带来新能力。\n"}},"requiredBy":[7692]}
