What does the beam '%live' instruction do?

Raimo Niskanen <>
Tue Mar 29 08:49:49 CEST 2005


It does nothing. It is an internal instruction that tells subsequent
compiler passes that there in this case are 1 X registers that 
contain valid values. The presence of this instruction facilitates
optimization. It does not need to be around in the assembly listing,
but is there anyway. The beam code validator (the last compiler
pass) checks that there are as many valid X registers as this 
instruction states; if it were not, somthing would be wrong.
The instruction is not stored in .beam code, so it is not
present in a disassembly listing.

 (James Hague) writes:

> Erlang:
> 
>    sum(A,B) -> A + B.
> 
> BEAM:
> 
>     {bif,'+',{f,0},[{x,0},{x,1}],{x,0}}.
>     {'%live',1}.  <-- What does this do?
>     return.

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list