This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFA: shrink macro_definition


This patch shrinks struct macro_definition on 32-bit machines.
It has no size effect on 64-bit machines.

I compiled cc1 with -g3.  Then I ran "gdb -readnow cc1" and "maint
space 1".

Before the change, gdb used 209219584 bytes.
After the change, gdb used  201326592 bytes.

That is a savings of 7 megabytes, or 3.77% of memory.

Built & regtested on x86-64 (compile farm).
Ok?

Tom

:ADDPATCH macros:

2008-08-23  Tom Tromey  <tromey@redhat.com>

	* macrotab.h (struct macro_definition) <kind>: Shrink to one bit.
	(argc): Now 31 bits.

diff --git a/gdb/macrotab.h b/gdb/macrotab.h
index 5ff36ea..71f1d3e 100644
--- a/gdb/macrotab.h
+++ b/gdb/macrotab.h
@@ -269,12 +269,12 @@ struct macro_definition
   struct macro_table *table;
 
   /* What kind of macro it is.  */
-  enum macro_kind kind;
+  ENUM_BITFIELD (macro_kind) kind : 1;
 
   /* If `kind' is `macro_function_like', the number of arguments it
      takes, and their names.  The names, and the array of pointers to
      them, are in the table's bcache, if it has one.  */
-  int argc;
+  int argc : 31;
   const char * const *argv;
 
   /* The replacement string (body) of the macro.  This is in the


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]