Re: [rfa] ENUM BITFIELD, here it comes again

Michael Elizabeth Chastain
2003-08-21T17:42:38Z

Okay. Andrew, how is this?

Michael C

2003-08-21 Micahel Chastain <mec@shout.net>

* symtab.h: Add comments about space usage. Identify
the space-critical structures.

Index: symtab.h
===================================================================
RCS file: /cvs/src/src/gdb/symtab.h,v
retrieving revision 1.78
diff -c -3 -p -r1.78 symtab.h
*** symtab.h 20 Aug 2003 17:39:18 -0000 1.78
--- symtab.h 21 Aug 2003 17:40:00 -0000
*************** struct blockvector;
*** 35,47 ****
struct axs_value;
struct agent_expr;

/* Define a structure for the information that is common to all symbol types,
including minimal symbols, partial symbols, and full symbols. In a
multilanguage environment, some language specific information may need to
! be recorded along with each symbol.

! These fields are ordered to encourage good packing, since we frequently
! have tens or hundreds of thousands of these. */

struct general_symbol_info
{
--- 35,70 ----
struct axs_value;
struct agent_expr;

+ /* Some of the structures in this file are space critical.
+ The space-critical structures are:
+
+ struct general_symbol_info
+ struct symbol
+ struct partial_symbol
+
+ These structures are layed out to encourage good packing.
+ They use ENUM_BITFIELD and short int fields, and they order the
+ structure members so that fields less than a word are next
+ to each other so they can be packed together. */
+
+ /* Rearranged: used ENUM_BITFIELD and rearranged field order in
+ all the space critical structures (plus struct minimal_symbol).
+ Memory usage dropped from 99360768 bytes to 90001408 bytes.
+ I measured this with before-and-after tests of
+ "HEAD-old-gdb -readnow HEAD-old-gdb" and
+ "HEAD-new-gdb -readnow HEAD-old-gdb" on native i686-pc-linux-gnu,
+ red hat linux 8, with LD_LIBRARY_PATH=/usr/lib/debug,
+ typing "maint space 1" at the first command prompt.
+ --chastain 2003-08-21 */
+
+
+
/* Define a structure for the information that is common to all symbol types,
including minimal symbols, partial symbols, and full symbols. In a
multilanguage environment, some language specific information may need to
! be recorded along with each symbol. */

! /* This structure is space critical. See space comments at the top. */

struct general_symbol_info
{
*************** struct alias_list
*** 557,562 ****
--- 580,587 ----
struct alias_list *next;
};

+ /* This structure is space critical. See space comments at the top. */
+
struct symbol
{

*************** struct symbol
*** 637,642 ****
--- 662,669 ----
Each partial_symbol sits in a partial_symtab, all of which are chained
on a partial symtab list and which points to the corresponding
normal symtab once the partial_symtab has been referenced. */
+
+ /* This structure is space critical. See space comments at the top. */

struct partial_symbol
{