Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Gary Benson <gbenson@redhat.com>
Cc: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Shrink size of dwarf2_per_cu_data
Date: Wed, 21 Apr 2021 17:04:07 -0600	[thread overview]
Message-ID: <871rb3gryw.fsf@tromey.com> (raw)
In-Reply-To: <20201104105933.GA16965@blade.nx> (Gary Benson's message of "Wed,  4 Nov 2020 10:59:33 +0000")

>>>>> "Gary" == Gary Benson <gbenson@redhat.com> writes:

Gary> Tom Tromey wrote:
>> I noticed some holes in struct dwarf2_per_cu_data.  This patch
>> rearranges the type slightly, and shrinks the size of some fields.
>> This reduces it from 136 bytes to 112 bytes (on x86-64).

Gary> Nice.  Though I'd assumed the compiler would do this.

C and C++ compilers can't generally do this, though other languages like
Rust and Ada do allow it.

>> I also reduced the size of the DWARF "version" fields in a couple of
>> spots.  It seemed needless to use a short to hold a value that
>> ranges from 2 to 5, and this also helped the goal of shrinking
>> dwarf2_per_cu_data.

Gary> There's other things in there if you were going that way, e.g.:

Gary>   unsigned char addr_size;
Gary>   unsigned char signed_addr_p;
Gary>   sect_offset abbrev_sect_off;

Gary>   /* Size of file offsets; either 4 or 8.  */
Gary>   unsigned int offset_size;

Gary>   /* Size of the length field; either 4 or 12.  */
Gary>   unsigned int initial_length_size;

Gary> I presume you'd need to lose 8 whole bytes to shrink the struct
Gary> further, so marking these as <8bit values probably wouldn't help
Gary> any, but maybe it's worth it?

I looked at this, and it doesn't remove enough space to help.
Might still be worth doing for clarity, I dunno.

Gary> How many CUs does something big
Gary> have?

gdb has 1197 as of today, but IMO it is moderately-sized at best.
I don't have anything really big that's convenient to check.

Tom

  reply	other threads:[~2021-04-21 23:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-03 22:13 Tom Tromey
2020-11-04 10:59 ` Gary Benson via Gdb-patches
2021-04-21 23:04   ` Tom Tromey [this message]
2021-04-22 21:39     ` Christian Biesinger via Gdb-patches
2021-04-23 12:55       ` Tom Tromey

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=871rb3gryw.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gbenson@redhat.com \
    --cc=gdb-patches@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