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]: Remove its int cache


Hi,
I've installed this obvious patch which removes c++'s cache of shared
integers.

built & 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

2004-08-19  Nathan Sidwell  <nathan@codesourcery.com>

	* cp-tree.h (build_shared_int_cst): Remove.
	* tree.c (shared_int_cache): Remove.
	(build_shared_int_cst): Remove.
	* class.c (finish_struct_1): Use build_int_cst.

Index: cp/class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/class.c,v
retrieving revision 1.654
diff -c -3 -p -r1.654 class.c
*** cp/class.c	16 Aug 2004 02:07:47 -0000	1.654
--- cp/class.c	19 Aug 2004 10:44:10 -0000
*************** finish_struct_1 (tree t)
*** 5085,5091 ****
  	       thunk base function.  */
  	    DECL_VINDEX (fndecl) = NULL_TREE;
  	  else if (TREE_CODE (DECL_VINDEX (fndecl)) != INTEGER_CST)
! 	    DECL_VINDEX (fndecl) = build_shared_int_cst (vindex);
  	}
      }
  
--- 5085,5091 ----
  	       thunk base function.  */
  	    DECL_VINDEX (fndecl) = NULL_TREE;
  	  else if (TREE_CODE (DECL_VINDEX (fndecl)) != INTEGER_CST)
! 	    DECL_VINDEX (fndecl) = build_int_cst (NULL_TREE, vindex, 0);
  	}
      }
  
Index: cp/cp-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-tree.h,v
retrieving revision 1.1031
diff -c -3 -p -r1.1031 cp-tree.h
*** cp/cp-tree.h	17 Aug 2004 17:32:32 -0000	1.1031
--- cp/cp-tree.h	19 Aug 2004 10:44:22 -0000
*************** extern tree cp_build_type_attribute_vari
*** 4246,4252 ****
  extern tree cp_build_qualified_type_real        (tree, int, tsubst_flags_t);
  #define cp_build_qualified_type(TYPE, QUALS) \
    cp_build_qualified_type_real ((TYPE), (QUALS), tf_error | tf_warning)
- extern tree build_shared_int_cst                (int);
  extern special_function_kind special_function_p (tree);
  extern bool name_p                              (tree);
  extern int count_trees                          (tree);
--- 4246,4251 ----
Index: cp/tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/tree.c,v
retrieving revision 1.401
diff -c -3 -p -r1.401 tree.c
*** cp/tree.c	16 Aug 2004 02:08:04 -0000	1.401
--- cp/tree.c	19 Aug 2004 10:44:27 -0000
*************** build_min_non_dep (enum tree_code code, 
*** 1366,1390 ****
    return t;
  }
  
- /* Returns an INTEGER_CST (of type `int') corresponding to I.
-    Multiple calls with the same value of I may or may not yield the
-    same node; therefore, callers should never modify the node
-    returned.  */
- 
- static GTY(()) tree shared_int_cache[256];
- 
- tree
- build_shared_int_cst (int i)
- {
-   if (i >= 256)
-     return build_int_cst (NULL_TREE, i, 0);
- 
-   if (!shared_int_cache[i])
-     shared_int_cache[i] = build_int_cst (NULL_TREE, i, 0);
- 
-   return shared_int_cache[i];
- }
- 
  tree
  get_type_decl (tree t)
  {
--- 1366,1371 ----

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