ZadeNor AI
Back to Blog
Web3 & Blockchain

Go Ethereum’s JIT-EVM

December 19, 2025
5 min
2,153 views
By ZadeNor AI Team
Go Ethereum’s JIT-EVM

Go Ethereum’s JIT-EVM

The Evolution of the Ethereum Virtual Machine: A Deep Dive into Go-Ethereum's JIT-EVM

The Ethereum Virtual Machine (EVM) is a cornerstone of the Ethereum ecosystem, enabling the execution of smart contracts and decentralized applications (dApps) on the blockchain. At its core, the EVM is a simple yet powerful, Turing-complete 256-bit virtual machine that allows anyone to execute arbitrary EVM byte code. However, beneath its straightforward facade lies a complex and evolving architecture, with two distinct implementations: the byte-code VM and the JIT-EVM. In this article, we'll delve into the world of Go-Ethereum's JIT-EVM, exploring its differences, characteristics, and implications for the future of smart contract execution.

The Byte-Code VM: A Simple yet Dumb Execution Model

The EVM's internals are surprisingly simple, consisting of a single run loop that attempts to execute the instruction at the current program counter (PC). Within this loop, gas is calculated for each instruction, memory is expanded if necessary, and the instruction is executed if the preamble succeeds. This process continues until the VM either finishes gracefully or returns with an error by throwing an exception, such as out-of-gas.

for op = contract[pc] {
    if !sufficientGas(op) {
        return error("insufficient gas for op:", op)
    }
    switch op {
    case ...:
        /* execute */
    case RETURN:
        return memory[stack[-1], stack[-2]]
    }
    pc++
}

The EVM also features jump instructions (JUMP and JUMPI), which allow the program counter to change its course. However, these jumps must always land on a jump destination, and the VM iterates over the code to find all possible jump destinations before execution.

Welcome to the JIT-EVM: A Smarter, Faster Execution Model

The JIT-EVM takes a different approach to running EVM byte code, compiling it into components that can be understood by the JIT VM. This compilation process occurs in three steps:

  1. Check for existing JIT program: The JIT VM checks whether a JIT program is already available for the given code hash (H(C)).
  2. Run existing JIT program: If a JIT program is found, the JIT VM runs it and returns the result.
  3. Compile and run byte-code: If no JIT program is found, the JIT VM compiles the byte code in the background and runs it.

Initially, the JIT VM's compilation and execution process occurred within the same loop, using Go's atomic package. However, this approach proved to be slower than letting the byte-code VM run and using the JIT program for every sequential call after compilation.

Optimizations and Improvements

The JIT-EVM's compilation process allows for more precise analysis and optimization of the code. For example, the JIT-EVM can compile multiple push operations into a single instruction, significantly reducing execution time. This optimization is particularly effective for static values, which are common in smart contract code.

// Optimized CALL instruction
// Instead of looping through 7 push instructions, execute a single instruction
// that appends the static slice to the VM stack

The JIT-EVM also optimizes static jump instructions by pre-checking whether a jump is valid and lies within the bounds of the contract. If so, it creates a new instruction that replaces both the push and jump instructions, preventing the VM from having to perform two instructions and look up the jump destination in the hash map.

Next Steps and Future Directions

The JIT-EVM is a significant improvement over the byte-code VM, but there are still opportunities for further optimization and improvement. Some potential next steps include:

  • Full stack and memory analysis: Analyzing large chunks of code to identify potential optimizations and improvements.
  • Symbolic execution: Using symbolic execution to identify potential vulnerabilities and improve the overall security of the JIT-EVM.
  • Turning the JIT into a proper JIT-VM: Improving the JIT-EVM's compilation and execution process to make it more efficient and effective.

Conclusion

The JIT-EVM is a significant improvement over the byte-code VM, offering faster execution times and more precise analysis and optimization of smart contract code. While there are still opportunities for further improvement, the JIT-EVM represents a major step forward in the evolution of the Ethereum Virtual Machine. As the Ethereum ecosystem continues to grow and evolve, the JIT-EVM will play an increasingly important role in enabling the execution of complex and secure smart contracts.


Source: https://blog.ethereum.org/en/2016/06/02/go-ethereums-jit-evm

About the Author

ZadeNor AI Team is a leading expert in WEB3 & BLOCKCHAIN, contributing to cutting-edge research and development in the field.