[erlang-questions] Design of the Erlang VM

Richard Carlsson <>
Thu Sep 6 12:10:44 CEST 2007


Damien Morton wrote:
> It turns out that there are some sequences of bytecodes that occur more 
> frequently than others, and that you can structure the main interpreter 
> loop so that common traces will result in straight through execution, 
> that is, you test to see if the next instruction is the same as for the 
> following code block, and either fall through or jump to the appropriate 
> label.

The Erlang bytecode loader does a large amount of work rewriting the 
generic "transport format" bytecode in the object files into the
concrete internal bytecode operations that are actually executed.
This recognizes common sequences and replaces them with optimized
single-opcode versions. (I don't know if the fallthrough trick is
also used, but it wouldn't surprise me.)

     /Richard




More information about the erlang-questions mailing list