public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: "fche at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: elfutils-devel@sourceware.org
Subject: [Bug libdw/30967] Discriminator in Dwarf_Line_s may exceed 24 bits
Date: Thu, 26 Oct 2023 15:30:14 +0000	[thread overview]
Message-ID: <bug-30967-10460-o6RDHFT4Sd@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-30967-10460@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=30967

--- Comment #8 from Frank Ch. Eigler <fche at redhat dot com> ---
> The issue here is that we create (very) large arrays of struct Dwarf_Line_s
> and we do that eagerly, see bug #27405
> So we would like to keep that struct as small as possible.

Do we have an estimate about the numbers we're talking about here?  The current
Dwarf_Line_s object is 40 bytes long (on x86-64).  Even if packing becomes less
efficient, it could cost us say 2 bytes more per record.  These records are
packed together in allocation via realloc() et al.  How many records do we see
in programs of interest?  readelf -wL /bin/emacs indicates about 800 thousand;
libxul.so about 8 million.  Is this about single digit megabytes more RAM in
grand total?

Note that bug #27405 was a request for optimization, not in order to save a few
percent of memory for used data, but to save ALL the related memory & time for
totally unused data.


struct Dwarf_Line_s {
        Dwarf_Files *              files;                /*     0     8 */
        Dwarf_Addr                 addr;                 /*     8     8 */
        unsigned int               file;                 /*    16     4 */
        int                        line;                 /*    20     4 */
        short unsigned int         column;               /*    24     2 */

        /* Bitfield combined with previous fields */

        unsigned int               is_stmt:1;            /*    24:16  4 */
        unsigned int               basic_block:1;        /*    24:17  4 */
        unsigned int               end_sequence:1;       /*    24:18  4 */
        unsigned int               prologue_end:1;       /*    24:19  4 */
        unsigned int               epilogue_begin:1;     /*    24:20  4 */
        unsigned int               op_index:8;           /*    24:21  4 */

        /* XXX 3 bits hole, try to pack */

        /* Force alignment to the next boundary: */
        unsigned int               :0;

        unsigned int               isa:8;                /*    28: 0  4 */
        unsigned int               discriminator:24;     /*    28: 8  4 */
        unsigned int               context;              /*    32     4 */
        unsigned int               function_name;        /*    36     4 */

        /* size: 40, cachelines: 1, members: 15 */
        /* sum members: 34 */
        /* sum bitfield members: 45 bits, bit holes: 1, sum bit holes: 3 bits
*/
        /* last cacheline: 40 bytes */
};

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2023-10-26 15:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-12 13:30 [Bug libdw/30967] New: " vvvvvv at google dot com
2023-10-12 14:12 ` [Bug libdw/30967] " vvvvvv at google dot com
2023-10-12 14:30 ` mark at klomp dot org
2023-10-25 15:47 ` fche at redhat dot com
2023-10-26 11:19 ` vvvvvv at google dot com
2023-10-26 11:32 ` mark at klomp dot org
2023-10-26 14:55 ` mark at klomp dot org
2023-10-26 15:12 ` fche at redhat dot com
2023-10-26 15:30 ` fche at redhat dot com [this message]
2023-10-26 15:37 ` vvvvvv at google dot com
2023-10-26 15:46 ` mark at klomp dot org
2023-10-26 15:47 ` fche at redhat dot com
2023-10-31 16:57 ` vvvvvv at google dot com
2023-10-31 23:19 ` mark at klomp dot org
2023-10-31 23:19 ` mark at klomp dot org
2023-11-07 19:01 ` vvvvvv at google dot com
2023-11-07 19:11 ` vvvvvv at google dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-30967-10460-o6RDHFT4Sd@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=elfutils-devel@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).