Erlang bytecodes and/or VM description?

Andrew Lentvorski <>
Tue Jun 6 23:37:45 CEST 2006


Richard A. O'Keefe wrote:

> 	You're probably underestimating your abilities. It just takes
> 	imagination and dedication.
> 	
> What it takes is *BACKGROUND*.  If you have a reasonably good idea of
> how something like this OUGHT to work, then you can probably figure
> things out.  But while you do so, you will curse the author for not
> having the decency to *TELL* you what he knew and you have to rediscover.

Ayup.  Sure, I can read code, but that shows me the trees, not the 
forest.  It's easy to see bits, its hard to see the overview.

I'm not even talking a gigantic amount of information.  A couple pages 
on the structure of how the BEAM code is executed would be enough.  ie. 
four simple functions, the "assembly" code listing, a hex dump and 
comments per line would be enough.  Glossing over the issues of 
instruction scheduling, garbage collection, and message queuing would be 
fine since they will vary implementation to implementation anyhow.

Here's the current file that produces the BEAM code I am trying to dig 
through.  It's not complicated, but even this covers enough ground to be 
difficult to penetrate (how do the tags on the arguments work when 
things are bytes, how do you handle labels when there are more than 16, 
is there anything which signifies the end of function code without 
actually decoding the code?, etc.)

-module(arith).
-export([three/0, four/0]).

one() ->
     1.

two() ->
     2.

three() ->
     one() + two().

four() ->
     two() + two().


Sure, I'll eventually get it, but it would help to have the basics.

-a





More information about the erlang-questions mailing list