This is an archive of the discontinued LLVM Phabricator instance.

Rearrange DWARFDebugLine::Row fields for smaller struct size
ClosedPublic

Authored by sque on Dec 19 2016, 5:05 PM.

Details

Summary

On a 64-bit system, the DWARFDebugLine::Row struct is 32 bytes. Each field has the following byte offsets:

0-7: Address
8-11: Line
12-13: Column
14-15: File
16-19: Isa
20-23: Discriminator
24+: bit fields

The packing is fine until the "Isa" field, which is an 8-bit int that occupies 4 bytes. We can instead move Discriminator into the 16-19 slot, and pack Isa into the 20-23 range along with the bit fields:

0-7: Address
8-11: Line
12-13: Column
14-15: File
16-19: Discriminator
20-23: Isa + bit fields

This layout is only 24 bytes. This 25% reduction in size may seem small but a large binary can have line tables with thousands of rows stored in a vector.

Diff Detail

Repository
rL LLVM

Event Timeline

sque updated this revision to Diff 82044.Dec 19 2016, 5:05 PM
sque retitled this revision from to Rearrange DWARFDebugLine::Row fields for smaller struct size.
sque updated this object.
sque added a reviewer: echristo.
sque added a subscriber: llvm-commits.
aprantl accepted this revision.Dec 19 2016, 5:20 PM
aprantl added a reviewer: aprantl.
aprantl added a subscriber: aprantl.

LGTM. Thanks!

While you're in there, could you (in a separate commit) doxygen-ify the comments in this header?

This revision is now accepted and ready to land.Dec 19 2016, 5:20 PM
sque added a comment.Dec 19 2016, 5:26 PM

Sure, is there a script or command line tool that is typically used to doxygen-ify?

No, it's a manual process. But pretty much the only thing that is really needed is to turn // in front of declarations into ///. For more details you can check out
http://llvm.org/docs/CodingStandards.html#doxygen-use-in-documentation-comments

sque added a comment.Dec 21 2016, 1:52 PM

@aprantl I don't have commit access. Can you commit this for me?

This revision was automatically updated to reflect the committed changes.
echristo edited edge metadata.Jan 3 2017, 6:45 PM

echristo@dzur ~/s/llvm> git svn dcommit
Committing to https://llvm.org/svn/llvm-project/llvm/trunk ...

M       include/llvm/DebugInfo/DWARF/DWARFDebugLine.h

Committed r290931