[eeps] Re: Line numbers in exceptions

Björn Gustavsson <>
Thu Mar 31 16:17:49 CEST 2011

On Wed, Mar 30, 2011 at 1:38 PM, Richard Carlsson
<> wrote:
> On 03/30/2011 12:10 PM, Björn Gustavsson wrote:
>> Here is a new EEP for line number information in exceptions.
> I approve, with one exception: rather than keeping the 'line' instructions
> in the generated Beam code, and strip them out at load time to build lookup
> tables, I think that the line information should be packed into a separate
> chunk in the .beam file using the standard DWARF format, which can be
> quickly loaded. No new Beam instruction should be needed. (It can exist as a
> dummy instruction within the compiler, but the assembler should strip it
> out.).

It is somewhat tricky to eliminate the 'line' instructions. The
compiler does not know how many words each instruction will
need when loaded (it depends on the type of the operands, the
word size, and possibly the instruction(s) preceding and following
it). That means that the DWARF chunk would have to contain
instructions offsets that refer to the byte code in the BEAM
file, and the loader would have to translate the offset to
an instruction offset of the loaded code. Basically that would
mean an extra 'if' statement for each instruction that is loaded.

Using the DWARF format would probably increase the size
of the BEAM files (I am pretty sure that my specialized format
of the Line chunk is more compact than the line number
table in DWARF), and the code to load it would be more

So what would the advantage be to eliminate the
'line' instructions and use the DWARF format?

Björn Gustavsson, Erlang/OTP, Ericsson AB

More information about the eeps mailing list