[erlang-questions] Design of the Erlang VM

Bjorn Gustavsson <>
Thu Aug 9 07:50:16 CEST 2007


Joel Reymont <> writes:

> On Aug 8, 2007, at 6:26 AM, Bjorn Gustavsson wrote:
> 
> > The first word in each instruction points to the executable C code
> > for the instruction. That first instruction word is followed by
> > zero or more operand words.
> 
> Would it be right to say that Erlang VM instructions are C function
> calls? This is my understanding of the above.

No.

We use the "first-class label" in feature in GCC. All instructions
are in the same huge function (process_main()). The addresses are
address to labels within that function. Each instruction is responsible
for picking up the address for the C code for the next instruction and
*jump* to it.

We use an old plain switch statement if the emulator is compiled with a C compiler
that doesn't support first-class labels.

/Bjorn
-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list