This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

[C++ PATCH]: Shrink struct lang_decl


This patch shrinks lang_decl from 40 to 32 bytes (on an ILP32 machine).

You'll notice that this limits the size of objects that can be thunked
to 262144 bytes, that is the largest object the standard says a system
need support.  Mark, Jason, if you think this should be made larger
let me know.  There are still some spare bits, but I do have plans
for them :)

booted & tested on i686-pc-linux-gnu.

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

Index: cp-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-tree.h,v
retrieving revision 1.1055
diff -c -3 -p -r1.1055 cp-tree.h
*** cp-tree.h	28 Sep 2004 02:56:06 -0000	1.1055
--- cp-tree.h	30 Sep 2004 12:23:16 -0000
*************** struct lang_decl GTY(())
*** 1530,1535 ****
--- 1530,1549 ----
      {
        struct full_lang_decl
        {
+ 	/* In an overloaded operator, this is the value of
+ 	   DECL_OVERLOADED_OPERATOR_P.  */
+ 	ENUM_BITFIELD (tree_code) operator_code : 8;
+ 
+ 	unsigned u3sel : 1;
+ 	unsigned u4sel : 1;
+ 	unsigned pending_inline_p : 1;
+ 	unsigned spare : 2;
+ 	
+ 	/* In a FUNCTION_DECL for which THUNK_P holds, this is
+ 	   THUNK_FIXED_OFFSET.  The largest object that can be thunked
+ 	   is thus 262144, which is what is required [limits].  */
+ 	int fixed_offset : 19;
+ 
  	/* For a non-thunk function decl, this is a tree list of
    	   friendly classes. For a thunk function decl, it is the
    	   thunked to function decl.  */
*************** struct lang_decl GTY(())
*** 1543,1561 ****
  	   will be chained on the return pointer thunk.  */
  	tree context;
  
! 	/* In a FUNCTION_DECL, this is DECL_CLONED_FUNCTION.  */
! 	tree cloned_function;
! 
! 	/* In a FUNCTION_DECL for which THUNK_P holds, this is
! 	   THUNK_FIXED_OFFSET.  */
! 	HOST_WIDE_INT fixed_offset;
! 
! 	/* In an overloaded operator, this is the value of
! 	   DECL_OVERLOADED_OPERATOR_P.  */
! 	enum tree_code operator_code;
! 
! 	unsigned u3sel : 1;
! 	unsigned pending_inline_p : 1;
  
  	union lang_decl_u3
  	{
--- 1557,1569 ----
  	   will be chained on the return pointer thunk.  */
  	tree context;
  
! 	/* In a FUNCTION_DECL, this is DECL_CLONED_FUNCTION.  For
! 	   a TEMPLATE_DECL, this is DECL_TEMPLATE_INSTANTIATIONS.  */
! 	union lang_decl_u4
! 	{
! 	  tree GTY ((tag ("0"))) cloned_function;
! 	  tree GTY ((tag ("1"))) instantiations;
! 	} GTY ((desc ("%1.u4sel"))) u4;
  
  	union lang_decl_u3
  	{

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