Erlang bytecodes and/or VM description?

Serge Aleynikov serge@REDACTED
Thu Jun 1 12:54:37 CEST 2006


Thomas,

Which compiler version supports "+S" switch?  On R10B-11 I get:

$ erlc +S test.erl
bad term: S
Runtime error: {{nocatch,error},
                 [{erl_compile,make_term,1},
                  {erl_compile,compile1,3},
                  {erl_compile,compiler_runner,1}]}

=ERROR REPORT==== 1-Jun-2006::06:45:19 ===
Error in process <0.20.0> with exit value: 
{{nocatch,error},[{erl_compile,make_term,1},{erl_compile,compile1,3},{erl_compile,compiler_runner,1}]}

Serge

Thomas Lindgren wrote:
> 
> --- Andrew Lentvorski <bsder@REDACTED> wrote:
> 
> 
>>Is there a concise reference of the Erlang
>>bytescodes and/or VM 
>>description somewhere?
>>
>>It seems like I have to go back to about R7B to look
>>at an emulator that 
>>is clean (as opposed to having lots of HiPE stuff
>>scattered inside).
> 
> 
> It depends on what you want to do. There used to be a
> BEAM bytecode reference, but I think the format and
> instructions change mildly every now and then, both
> with new releases and with different targets. 
> 
> For example, I believe some instruction sequences can
> be merged into superinstructions by the loader, and/or
> otherwise specialized or optimized. This can lead to
> hundreds of nearly identical instruction variants, so
> some patience and experience is needed to decipher
> them.
> 
> If you just want to learn the high level BEAM
> instruction set, then that is more straightforward. To
> see what code compiles to, use "erlc +S mod.erl",
> which emits a file "mod.S" with symbolic BEAM code in
> it.
> 
> Historically, the BEAM instruction set has its root in
> the elegant and subtle Warren Abstract Machine (for
> Prolog). Bogdan Hausman, the original designer, has
> his roots in the Prolog world, and started from a
> simplification of the WAM instruction set. Here is one
> of the original documents:
> 
> http://www.erlang.se/publications/Erlang_to_C.pdf
> 
> But basically it's not so hard: the VM is register
> based, and there are two kinds of temporaries,
> "registers" (x-regs) and "stack slots" (y-regs). There
> are instructions to dispatch on register value or
> type, to speed up clause selection. There are function
> calls, including last calls (jumps with arguments).
> There are instructions to take apart and put together
> terms. And maybe a few more that I've forgotten about.
> 
> If you want to learn about the ancestral WAM, Hassan
> Ait-Kaci wrote a good tutorial (MIT Press, 1991),
> which can be found here:
> 
> http://archive.bibalex.org/web/*/http://www.isg.sfu.ca/~hak/documents/wambook.pdf
> 
> Best,
> Thomas
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 




More information about the erlang-questions mailing list