C++ PATCH for minor memory savings

Mark Mitchell mark@codesourcery.com
Wed Sep 1 14:58:00 GMT 1999


This patch saves four bytes per class type by tightening up the
definition of lang_type.  I also fixed a bogus comment while wandering
in that part of the source.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

1999-09-01  Mark Mitchell  <mark@codesourcery.com>

	* cp-tree.h (lang_type): Move align into type_flags.
	(CLASSTYPE_ALIGN): Adjust accordingly.
	* call.c (direct_reference_binding): Remove misleading comment.

Index: call.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/call.c,v
retrieving revision 1.164
diff -c -p -r1.164 call.c
*** call.c	1999/08/24 21:23:55	1.164
--- call.c	1999/09/01 21:54:52
*************** direct_reference_binding (type, conv)
*** 987,996 ****
  
  /* Returns the conversion path from type FROM to reference type TO for
     purposes of reference binding.  For lvalue binding, either pass a
!    reference type to FROM or an lvalue expression to EXPR.
! 
!    Currently does not distinguish in the generated trees between binding to
!    an lvalue and a temporary.  Should it?  */
  
  static tree
  reference_binding (rto, rfrom, expr, flags)
--- 987,995 ----
  
  /* Returns the conversion path from type FROM to reference type TO for
     purposes of reference binding.  For lvalue binding, either pass a
!    reference type to FROM or an lvalue expression to EXPR.  If the
!    reference will be bound to a temporary, NEED_TEMPORARY_P is set for
!    the conversion returned.  */
  
  static tree
  reference_binding (rto, rfrom, expr, flags)
Index: cp-tree.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/cp-tree.h,v
retrieving revision 1.280
diff -c -p -r1.280 cp-tree.h
*** cp-tree.h	1999/08/30 19:14:01	1.280
--- cp-tree.h	1999/09/01 21:54:54
*************** struct lang_type
*** 809,815 ****
        /* The MIPS compiler gets it wrong if this struct also
  	 does not fill out to a multiple of 4 bytes.  Add a
  	 member `dummy' with new bits if you go over the edge.  */
!       unsigned dummy : 14;
      } type_flags;
  
    int vsize;
--- 809,817 ----
        /* The MIPS compiler gets it wrong if this struct also
  	 does not fill out to a multiple of 4 bytes.  Add a
  	 member `dummy' with new bits if you go over the edge.  */
!       unsigned dummy : 6;
!       
!       unsigned char align;
      } type_flags;
  
    int vsize;
*************** struct lang_type
*** 822,830 ****
  
    union tree_node *search_slot;
  
-   unsigned char align;
-   /* Room for another three unsigned chars.  */
- 
    union tree_node *size;
  
    union tree_node *abstract_virtuals;
--- 824,829 ----
*************** struct lang_type
*** 999,1005 ****
  /* These are the size, mode and alignment of the type without its
     virtual base classes, for when we use this type as a base itself.  */
  #define CLASSTYPE_SIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->size)
! #define CLASSTYPE_ALIGN(NODE) (TYPE_LANG_SPECIFIC(NODE)->align)
  
  /* A cons list of virtual functions which cannot be inherited by
     derived classes.  When deriving from this type, the derived
--- 998,1004 ----
  /* These are the size, mode and alignment of the type without its
     virtual base classes, for when we use this type as a base itself.  */
  #define CLASSTYPE_SIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->size)
! #define CLASSTYPE_ALIGN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.align)
  
  /* A cons list of virtual functions which cannot be inherited by
     derived classes.  When deriving from this type, the derived


More information about the Gcc-patches mailing list