Business Insights
  • Home
  • Crypto
  • Finance Expert
  • Business
  • Invest News
  • Investing
  • Trading
  • Forex
  • Videos
  • Economy
  • Tech
  • Contact

Archives

  • March 2026
  • February 2026
  • January 2026
  • December 2025
  • November 2025
  • October 2025
  • September 2025
  • August 2025
  • July 2025
  • June 2025
  • May 2025
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • July 2024
  • June 2024
  • May 2024
  • April 2024
  • March 2024
  • February 2024
  • August 2023
  • January 2023
  • December 2021
  • July 2021
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • July 2019
  • June 2019
  • May 2019
  • April 2019
  • March 2019
  • February 2019
  • January 2019

Categories

  • Business
  • Crypto
  • Economy
  • Finance Expert
  • Forex
  • Invest News
  • Investing
  • Tech
  • Trading
  • Uncategorized
  • Videos
Apply Loan
Money Visa
Advertise Us
Money Visa
  • Home
  • Crypto
  • Finance Expert
  • Business
  • Invest News
  • Investing
  • Trading
  • Forex
  • Videos
  • Economy
  • Tech
  • Contact
Announcing the Trillion Dollar Security Initiative
  • Forex

Go Ethereum’s JIT-EVM | Ethereum Foundation Blog

  • September 7, 2025
  • Roubens Andy King
Total
0
Shares
0
0
0
Total
0
Shares
Share 0
Tweet 0
Pin it 0

The Ethereum Virtual machine is kind of different than most other Virtual Machines out there. In my previous post I already explained how it’s used and described some of its characteristics.

The Ethereum Virtual Machine (EVM) is a simple but powerful, Turing complete 256bit Virtual Machine that allows anyone to execute arbitrary EVM Byte Code.

The go-ethereum project contains two implementations of the EVM. A simple and straightforward byte-code VM and a more sophisticated JIT-VM. In this post I’m going to explain some of the differences between the two implementations and describe some of the characteristics of the JIT EVM and why it can be so much faster than the byte-code EVM.

Go-ethereum’s Byte Code Virtual Machine

The EVM’s internals are pretty simple; it has a single run loop which will attempt to execute the instruction at the current Program Counter (PC in short). Within this loop the Gas is calculated for each instruction, memory is expanded if necessary and executes the instruction if the preamble succeeds. This will continue on until the VM either finishes gracefully or returns with an error by throwing an exception (e.g. out-of-gas).

for op = contract[pc] {

    if !sufficientGas(op) {

        return error("insufficient gas for op:", or)

    }
    switch op {

    case ...:

        /* execute */

    case RETURN:

        return memory[stack[-1], stack[-2]]

    }

    pc++

}

At the end of the execution loop the program-counter gets increment to run the next instruction and continues to do so until it has finished.

The EVM has another way to change the program-counter through something called jump-instructions (JUMP & JUMPI). Instead of letting the program-counter increment (pc++) the EVM can also jump to arbitrary positions in the contract code. The EVM knows two jump instructions, a normal jump that reads as “jump to position X” and a conditional jump that read as “jump to position X if condition Y is true”. When either such a jump occurs it must always land on a jump-destination. If the program lands on an instruction other than a jump destination the program fails — in other words, for a jump to be valid it must always be followed by a jump-destination instruction if the condition yielded true.

Prior to running any Ethereum program the EVM iterates over the code and finds all possible jump-destinations, it then puts them in a map that can be referenced by the program-counter to find them. Each and every time the EVM encounters a jump-instructions the jump validity is checked.

As you can see the executing code is relatively easy and simply interpreted by the byte-code VM, we may conclude even that through its sheer simplicity it’s actually pretty dumb.

Welcome JIT VM

The JIT-EVM takes a different approach to running EVM byte-code and is by definition initially slower than the byte-code VM. Before the VM can run any code it must first compile the byte-code in to components that can be understood by the JIT VM.

The initialisation- and execution procedure is done in 3-steps:

  1. We check whether there’s a JIT program ready to be run using the hash of the code — H(C) is used as an identifier to identify the program;
  2. if a program was found we run the program and return the result;
  3. if no program was found we run the byte-code and we compile a JIT program in the background.

Initially I tried to check whether the JIT program had finished compiling and move the execution over to the JIT — this all happened during runtime in the same loop using Go’s atomic package — unfortunately it turned out to be slower than letting the byte-code VM run and use the JIT program for every sequential call after the compilation of the program had finished.

By compiling the byte-code in to logical pieces the JIT has the ability to analyse the code more precisely and optimise where and whenever necessary.

For example an incredible simple optimisation that I did was compiling several push operation in to a single instruction. Let’s take the CALL instruction; call requires 7 push instructions — i.e. gas, address, value, input-offset, input-size, return-offset and return-size — prior to executing it, and what I did instead of looping through these 7 instructions, executing them one by one, I’ve optimised this away by taking the 7 instructions and append the 7 values in to a single slice. Now, whenever the start of the 7 push instructions is executed, it instead executes the one optimised instruction by immediately appending the static slice to the VM stack. Now of course this only works for static values (i.e. push 0x10), but these are present in the code quite a lot.

I’ve also optimised the static jump instructions. Static jumps are jumps who always jump to the same position (i.e. push 0x1, jump) and never change under any circumstance. By determining which jumps are static we can pre-check whether a jump is valid and lies within the bounds of the contract and if so we create a new instructions that replaces both the push and jumpinstruction and is flagged as valid. This prevents the VM from having to do two instructions and it prevents it from having to check whether the jump is valid and doing an expensive hash-map lookup for valid jump position.

Next steps

Full stack and memory analysis would also fit nicely in this model where large chunks of code could fit in to single instructions. Further I’d like to add symbolic-execution and turn the JIT in to a proper JIT-VM. I think this would be a logical next step once programs get large enough to take advantage of these optimisations.

Conclusion

Our JIT-VM is a whole lot smarter than the byte-code VM, but is far from being completely done (if ever). There are many more clever tricks we could add with this structure, but simply aren’t realistic for the moment. The runtime is within the bounds of being “reasonable” speedy. May the need arise to further optimise the VM we have the tools to do so.

Further code-reading


Cross posted from – https://medium.com/@jeff.ethereum/go-ethereums-jit-evm-27ef88277520#.1ed9lj7dz

Total
0
Shares
Share 0
Tweet 0
Pin it 0
Roubens Andy King

Previous Article
Dow, S&P 500, Nasdaq futures gain after weak jobs report with key inflation data on deck
  • Investing

Dow, S&P 500, Nasdaq futures gain after weak jobs report with key inflation data on deck

  • September 7, 2025
  • Roubens Andy King
Read More
Next Article
Trump Family’s Collective Wealth Grows by .3 Billion Thanks to Crypto
  • Crypto

Trump Family’s Collective Wealth Grows by $1.3 Billion Thanks to Crypto

  • September 7, 2025
  • Roubens Andy King
Read More
You May Also Like
Vitalik Buterin Slams EU’s ‘Chat Control’ Bill, Warns of Privacy Threat
Read More
  • Forex

Vitalik Buterin Slams EU’s ‘Chat Control’ Bill, Warns of Privacy Threat

  • Roubens Andy King
  • September 27, 2025
Advanced Contract Programming Example: SchellingCoin
Read More
  • Forex

Advanced Contract Programming Example: SchellingCoin

  • Roubens Andy King
  • September 27, 2025
8 Years In Hiding—Now  Billion In Ether Comes Alive
Read More
  • Forex

8 Years In Hiding—Now $3 Billion In Ether Comes Alive

  • Roubens Andy King
  • September 27, 2025
BTC Drops Under 0K But October Trend May Revive Bulls
Read More
  • Forex

BTC Drops Under $110K But October Trend May Revive Bulls

  • Roubens Andy King
  • September 27, 2025
Demand For XRP On CME Explodes As Reports Show Over  Billion
Read More
  • Forex

Demand For XRP On CME Explodes As Reports Show Over $18 Billion

  • Roubens Andy King
  • September 27, 2025
Spot Ether ETFs Post Straight Week Of Outflows
Read More
  • Forex

Spot Ether ETFs Post Straight Week Of Outflows

  • Roubens Andy King
  • September 27, 2025
Background on the mechanics of the ether pre-sale
Read More
  • Forex

Background on the mechanics of the ether pre-sale

  • Roubens Andy King
  • September 27, 2025
70% Decline In Corporate Crypto Treasury Buying: What’s Going On?
Read More
  • Forex

70% Decline In Corporate Crypto Treasury Buying: What’s Going On?

  • Roubens Andy King
  • September 27, 2025

Recent Posts

  • Federal Reserve Board – Federal Reserve Board issues enforcement actions with former employee of Equity Bank and former employee of First State Bank of Dongola
  • Sirf 1 Ghante ka bajar #business #vegitablemarket #minivlog #chanduthevillager
  • Federal Reserve Board – Federal Reserve Board announces approval of application by Home BancShares
  • 10 Terrifying Sci-Fi Short Films You Can’t Miss
  • Federal Reserve Board – Federal Reserve Board announces approval of application by Associated Banc-Corp
Featured Posts
  • Federal Reserve Board – Federal Reserve Board issues enforcement actions with former employee of Equity Bank and former employee of First State Bank of Dongola 1
    Federal Reserve Board – Federal Reserve Board issues enforcement actions with former employee of Equity Bank and former employee of First State Bank of Dongola
    • March 13, 2026
  • Sirf 1 Ghante ka bajar #business #vegitablemarket #minivlog #chanduthevillager 2
    Sirf 1 Ghante ka bajar #business #vegitablemarket #minivlog #chanduthevillager
    • March 12, 2026
  • Federal Reserve Board – Federal Reserve Board announces approval of application by Home BancShares 3
    Federal Reserve Board – Federal Reserve Board announces approval of application by Home BancShares
    • March 12, 2026
  • 10 Terrifying Sci-Fi Short Films You Can’t Miss 4
    10 Terrifying Sci-Fi Short Films You Can’t Miss
    • March 12, 2026
  • Federal Reserve Board – Federal Reserve Board announces approval of application by Associated Banc-Corp 5
    Federal Reserve Board – Federal Reserve Board announces approval of application by Associated Banc-Corp
    • March 11, 2026
Recent Posts
  • Your birthdate decides the year your luck turns.#birthday #wealth #finance #money #work #energy
    Your birthdate decides the year your luck turns.#birthday #wealth #finance #money #work #energy
    • March 11, 2026
  • Federal Reserve Board – Federal Reserve Board announces approval of application by FirstSun Capital Bancorp
    Federal Reserve Board – Federal Reserve Board announces approval of application by FirstSun Capital Bancorp
    • March 11, 2026
  • Ray Dalio: We’re Heading Into Very, Very Dark Times! America & The UK’s Decline Is Coming!
    Ray Dalio: We’re Heading Into Very, Very Dark Times! America & The UK’s Decline Is Coming!
    • March 10, 2026
Categories
  • Business (2,057)
  • Crypto (2,023)
  • Economy (231)
  • Finance Expert (1,687)
  • Forex (2,016)
  • Invest News (2,445)
  • Investing (2,040)
  • Tech (2,056)
  • Trading (2,024)
  • Uncategorized (2)
  • Videos (998)

Subscribe

Subscribe now to our newsletter

Money Visa
  • Privacy Policy
  • DMCA
  • Terms of Use
Money & Invest Advices

Input your search keywords and press Enter.