Overview: The Go-Ethereum (Geth) client implements the Ethereum Virtual Machine (EVM) as an interpreter that executes contract bytecode. This analysis focuses on the legacy (pre-EOF) execution path in Geth’s core/vm package, highlighting how the interpreter loop works, how the stack/memory are managed, gas accounting, execution context setup, and performance-oriented design choices. Geth’s interpreter is a classic stack-based virtual machine, maintaining a program counter (PC), operand stack, memory, and gas meter during execution. We will walk through the interpreter’s structure and internals with references to Geth’s source code.
At the heart of Geth’s EVM is the EVMInterpreter.Run loop, which sequentially fetches and executes opcodes until termination. On each iteration, the interpreter reads the next opcode from the contract’s code using the program counter (pc) and dispatches to the corresponding implem