Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: RFA: shrink main_type
Date: Mon, 18 Aug 2008 15:04:00 -0000	[thread overview]
Message-ID: <m3iqtyxt65.fsf@fleche.redhat.com> (raw)
In-Reply-To: <20080818130009.GM16894@adacore.com> (Joel Brobecker's message of "Mon\, 18 Aug 2008 17\:00\:09 +0400")

>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:

Joel> I'm not opposed to this sort of packing, particularly since this is
Joel> something that we already do for other fields of this type, but I'm
Joel> interested in the performance impact of such a change. A few hundred
Joel> K of memory for cc1 doesn't sound like a lot nowadays. I wonder what
Joel> it would cost and save for a program of the size of Mozilla...

I will find out.

I did not try to measure the performance impact.  Any suggestions for
a test case that would be measurably impacted by this change?  I am
not enough of a gdb expert to know what code would rely on access to
these fields in a time-critical way.

[ada]
Joel> Another good observation. I will try to find some time to fix...
Joel> I only saw a couple of instances (with TYPE_FIXED_INSTANCE). Did you
Joel> spot any other?

Yeah, there were just a couple, nothing major.

Joel> Do the upper/lower_bound_type fields still "pack nicely"?

Yes.

Joel> This is where my knowledge of C (or lack thereof) shows up, but
Joel> would the following declaration instead help the compiler?
Joel>   ENUM_BITFIELD(type_code) code : 6;
Joel>   ENUM_BITFIELD(type_flag_value) flags : 18;
Joel>   ENUM_BITFIELD(array_bound_type) upper_bound_type : 4;
Joel>   ENUM_BITFIELD(array_bound_type) lower_bound_type : 4;

It wouldn't hurt, but I don't think it would help.  Bit fields are
just packed in as tightly as possible.

If you have the "7 dwarves" installed you can easily see the layout by
running "pahole --class_name=main_type".  (FWIW it would be pretty
easy to change gdb to give this info -- which is pretty handy.)

Joel> Then, I don't understand why the two "short" fields have been
Joel> moved up just behind the "flags" field (sorry, like I said, there
Joel> are holes in my C knowledge).
  
No problem.  I moved these fields to preserve good packing on a 64-bit
machine.  Without this, there would be a hole between 'flags' and
'name', and another one where 'flags' used to be.

Tom


      parent reply	other threads:[~2008-08-18 15:04 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-17 18:50 Tom Tromey
2008-08-18 13:01 ` Joel Brobecker
2008-08-18 13:20   ` Daniel Jacobowitz
2008-08-18 13:30     ` Joel Brobecker
2008-08-18 15:19     ` Tom Tromey
2008-08-18 19:39       ` Tom Tromey
2008-08-18 22:17         ` Andreas Schwab
2008-08-18 22:32           ` Daniel Jacobowitz
2008-08-19  5:13         ` Joel Brobecker
2008-08-19 17:56           ` Tom Tromey
2008-08-24 10:12             ` Joel Brobecker
2008-08-24 16:41               ` Tom Tromey
2008-08-24 18:03                 ` Tom Tromey
2008-08-24 20:35                   ` Tom Tromey
2008-08-25 15:50                     ` Joel Brobecker
2008-08-25 19:12                       ` Tom Tromey
2010-09-15 19:23             ` Ken Werner
2010-09-25 14:38               ` Ken Werner
2010-09-30 18:56               ` Joel Brobecker
2010-10-01 13:23                 ` Ken Werner
2010-10-01 15:34                 ` [patch] move the nottext flag to the instance_flags Ken Werner
2010-10-01 16:15                   ` Joel Brobecker
2010-10-05 21:50                     ` Tom Tromey
2010-10-06  8:45                       ` Ken Werner
2008-08-18 15:04   ` Tom Tromey [this message]

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=m3iqtyxt65.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=brobecker@adacore.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