<div class="gmail_quote">I began writing about the instruction set and possibly binary format at some point, but got sidetracked by trying to explain "why isn't this documented, and is that a good or a bad thing?"</div>

<div class="gmail_quote">(I have a bit of text and graphics, though, which perhaps I ought to publish.)</div>
<div class="gmail_quote"> </div>
<div class="gmail_quote">One interesting thing came out of that effort, though: I noticed that</div>
<div class="gmail_quote">- there is no tail-call version of the call_fun (function object application) instruction</div>
<div class="gmail_quote">- even so, TCO still works in beam as it should</div>
<div class="gmail_quote">- the reason for this is that a tail-call version exists in the *internal* version of the instruction set, which is introduced by rewriting the sequence "call_fun; deallocate; return" (iirc)</div>

<div class="gmail_quote">- Erjang had, of course, missed this the first time around, so I corrected it once I'd found out.</div>
<div class="gmail_quote"> </div>
<div class="gmail_quote">I've been wondering whether this special case was caught in your description of beam...</div>
<div class="gmail_quote">Of course, what I should have been wondering is whether the JS interpreter had got it right :-)</div>
<div class="gmail_quote"> </div>
<div class="gmail_quote">That kind of irregularity is probably not unrelated to the unpublishedness of the format.</div>
<div class="gmail_quote">On the other hand, this is one gotcha that affects not only would-be producers of beam code (which is probably the harder part to get right, when you don't know which invariants you have to maintain in the produced code), but it also affects beam consumers (which is in some ways easier, at least when you can ignore everything GC-related as it was the case with Erjang) which have to do the same kind of rewrite.</div>

<div class="gmail_quote"> </div>
<div class="gmail_quote">2012/5/7 Joe Armstrong <span dir="ltr"><<a href="mailto:erlang@gmail.com" target="_blank">erlang@gmail.com</a>></span><br>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">---------- Forwarded message ----------<br>From: Joe Armstrong <<a href="mailto:erlang@gmail.com">erlang@gmail.com</a>><br>
Date: Mon, May 7, 2012 at 10:46 AM<br>Subject: Re: [erlang-questions] Is there a good source for<br>documentation on BEAM?<br>To: Jonathan Coveney <<a href="mailto:jcoveney@gmail.com">jcoveney@gmail.com</a>><br><br>
<br>Hi,<br><br>I did start writing a description but it's not very complete.<br><br>This is on my list of things-to-do-one-day-when-you-get-time<br><br>  See <a href="http://dl.dropbox.com/u/4764922/beam.pdf" target="_blank">http://dl.dropbox.com/u/4764922/beam.pdf</a><br>
<br>If there is any interest I could up the priority :-)<br></blockquote>
<div> </div></div>