[eeps] Re: Line numbers in exceptions

Björn Gustavsson <>
Thu Mar 31 21:45:15 CEST 2011


2011/3/31 Richard Carlsson <>:

>> So what would the advantage be to eliminate the
>> 'line' instructions and use the DWARF format?
>
> No change in the external bytecode format. A standard, compact
> representation of debug info (that might possibly be picked up by other
> tools), which can easily be discarded from a file without touching the
> bytecode.
>
> Even if you don't use DWARF 4 specifically, I think I'd prefer the mapping
> to be precomputed on bytecode offsets and stored as a separate chunk rather
> than having the interspersed line instructions.
>

The actual line information is already stored in a separate "Line"
chunk in the BEAM file. The 'line' instruction just gives an index
to an entry in the "Line" chunk. The "Line" chunk can be discarded
from the BEAM file and the BEAM file can still be loaded (the
'line' instructions will be ignored entirely if there is no "Line"
chunk in the BEAM file).

I will consider eliminating the 'line' instructions. One advantage
of doing that is that the following transformations
in ops.tab will no longer be needed:

https://github.com/bjorng/otp/commit/37ad94c7322d1a056871301936ba226c9f0e58d1#diff-2

(In general, I wouldn't have to worry about 'line' instructions
preventing peep-hole optimizations at load-time.)

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB


More information about the eeps mailing list