Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] small size reduction to struct die_info
@ 2008-09-14  1:26 Doug Evans
  2008-09-14  2:22 ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Doug Evans @ 2008-09-14  1:26 UTC (permalink / raw)
  To: GDB Patches

This reduces the size of struct die_info for 32 bit hosts.

Ok to check in?

2008-09-13  Doug Evans  <dje@sebabeach.org>

        * dwarf2read.c (struct die_info): Make members tag, num_attrs 16 bits.

Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.281
diff -u -p -r1.281 dwarf2read.c
--- dwarf2read.c        13 Sep 2008 22:19:50 -0000      1.281
+++ dwarf2read.c        14 Sep 2008 01:22:52 -0000
@@ -536,10 +536,17 @@ struct attribute
 /* This data structure holds a complete die structure. */
 struct die_info
   {
-    enum dwarf_tag tag;                /* Tag indicating type of die */
-    unsigned int abbrev;       /* Abbrev number */
-    unsigned int offset;       /* Offset in .debug_info section */
-    unsigned int num_attrs;    /* Number of attributes */
+    /* DWARF-2 tag for this DIE.  */
+    ENUM_BITFIELD(dwarf_tag) tag : 16;
+
+    /* Number of attributes */
+    unsigned int num_attrs : 16;
+
+    /* Abbrev number */
+    unsigned int abbrev;
+
+    /* Offset in .debug_info section */
+    unsigned int offset;

     /* The dies in a compilation unit form an n-ary tree.  PARENT
        points to this die's parent; CHILD points to the first child of


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFA] small size reduction to struct die_info
  2008-09-14  1:26 [RFA] small size reduction to struct die_info Doug Evans
@ 2008-09-14  2:22 ` Daniel Jacobowitz
  2008-09-15  2:50   ` Doug Evans
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2008-09-14  2:22 UTC (permalink / raw)
  To: Doug Evans; +Cc: GDB Patches

On Sat, Sep 13, 2008 at 06:25:36PM -0700, Doug Evans wrote:
> This reduces the size of struct die_info for 32 bit hosts.
> 
> Ok to check in?
> 
> 2008-09-13  Doug Evans  <dje@sebabeach.org>
> 
>         * dwarf2read.c (struct die_info): Make members tag, num_attrs 16 bits.

OK, though I wonder if GCC generates better code for short than int :
16?

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFA] small size reduction to struct die_info
  2008-09-14  2:22 ` Daniel Jacobowitz
@ 2008-09-15  2:50   ` Doug Evans
  2008-09-15  3:19     ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Doug Evans @ 2008-09-15  2:50 UTC (permalink / raw)
  To: GDB Patches

On Sat, Sep 13, 2008 at 7:21 PM, Daniel Jacobowitz <drow@false.org> wrote:
> On Sat, Sep 13, 2008 at 06:25:36PM -0700, Doug Evans wrote:
>> This reduces the size of struct die_info for 32 bit hosts.
>>
>> Ok to check in?
>>
>> 2008-09-13  Doug Evans  <dje@sebabeach.org>
>>
>>         * dwarf2read.c (struct die_info): Make members tag, num_attrs 16 bits.
>
> OK, though I wonder if GCC generates better code for short than int :
> 16?

There's no difference in generated code. I went with short just in
case some other compiler had issues.

This patch does the same thing for structs attr_abbrev, attribute.  Ok
to check in?

2008-09-14  Doug Evans  <dje@sebabeach.org>

        * dwarf2read.c (struct abbrev_info): Make members name, form 16 bits.
        (struct attribute): Ditto.

Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.282
diff -u -p -r1.282 dwarf2read.c
--- dwarf2read.c        15 Sep 2008 01:22:02 -0000      1.282
+++ dwarf2read.c        15 Sep 2008 02:19:52 -0000
@@ -513,15 +513,15 @@ struct abbrev_info

 struct attr_abbrev
   {
-    enum dwarf_attribute name;
-    enum dwarf_form form;
+    ENUM_BITFIELD(dwarf_attribute) name : 16;
+    ENUM_BITFIELD(dwarf_form) form : 16;
   };

 /* Attributes have a name and a value */
 struct attribute
   {
-    enum dwarf_attribute name;
-    enum dwarf_form form;
+    ENUM_BITFIELD(dwarf_attribute) name : 16;
+    ENUM_BITFIELD(dwarf_form) form : 16;
     union
       {
        char *str;


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFA] small size reduction to struct die_info
  2008-09-15  2:50   ` Doug Evans
@ 2008-09-15  3:19     ` Daniel Jacobowitz
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2008-09-15  3:19 UTC (permalink / raw)
  To: Doug Evans; +Cc: GDB Patches

On Sun, Sep 14, 2008 at 07:49:18PM -0700, Doug Evans wrote:
> This patch does the same thing for structs attr_abbrev, attribute.  Ok
> to check in?
> 
> 2008-09-14  Doug Evans  <dje@sebabeach.org>
> 
>         * dwarf2read.c (struct abbrev_info): Make members name, form 16 bits.
>         (struct attribute): Ditto.

OK.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-09-15  3:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-14  1:26 [RFA] small size reduction to struct die_info Doug Evans
2008-09-14  2:22 ` Daniel Jacobowitz
2008-09-15  2:50   ` Doug Evans
2008-09-15  3:19     ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox