[erlang-questions] Design of the Erlang VM
Wed Aug 8 07:26:37 CEST 2007
Tony Finch <> writes:
> On Tue, 7 Aug 2007, Bjorn Gustavsson wrote:
> > It is not stack-based; it is register-based.
> I get the impression from a quick look at Joe's HOPL paper that the
> registers are special-purpose and implicit, and the instruction format is
> suitable for a threaded code interpreter. This implies to me that it isn't
> like a CPU instruction set in the way that Lua 5 VM instructions are (see
> http://www.tecgraf.puc-rio.br/~lhf/ftp/doc/jucs05.pdf). This is a guess so
> I'm probably wrong...
Yes, but Joe described the original JAM (Joe Armstrong Machine) virtual machine.
JAM has been replaced by BEAM.
The BEAM instructions actually are executed by a threaded code interpreter,
but BEAM does not the stack in the way that FORTH does; instead it uses registers,
only putting values that need to survive function calls into a stack frame.
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. The operands can be constants such as atoms or integers, or the number
of the registers to operate on.
Björn Gustavsson, Erlang/OTP, Ericsson AB
More information about the erlang-questions