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]

Re: [PATCH 28/35] Change use to type-based pool allocator in ipa-profile.c.


On 05/27/2015 08:15 PM, Jeff Law wrote:
On 05/27/2015 07:56 AM, mliska wrote:
gcc/ChangeLog:

2015-04-30  Martin Liska  <mliska@suse.cz>

    * ipa-profile.c (account_time_size): Use new type-based pool allocator.
    (ipa_profile_generate_summary): Likewise.
    (ipa_profile_read_summary): Likewise.
    (ipa_profile): Likewise.
OK.
jeff


v2
>From 25e42b4ede0c9d2d6a2ba015166805611957fc53 Mon Sep 17 00:00:00 2001
From: mliska <mliska@suse.cz>
Date: Wed, 27 May 2015 15:56:54 +0200
Subject: [PATCH 27/32] Change use to type-based pool allocator in
 ipa-profile.c.

gcc/ChangeLog:

2015-04-30  Martin Liska  <mliska@suse.cz>

	* ipa-profile.c (account_time_size): Use new type-based pool allocator.
	(ipa_profile_generate_summary): Likewise.
	(ipa_profile_read_summary): Likewise.
	(ipa_profile): Likewise.
---
 gcc/ipa-profile.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/gcc/ipa-profile.c b/gcc/ipa-profile.c
index e0d4266..7c967f9 100644
--- a/gcc/ipa-profile.c
+++ b/gcc/ipa-profile.c
@@ -107,7 +107,8 @@ struct histogram_entry
    duplicate entries.  */
 
 vec<histogram_entry *> histogram;
-static alloc_pool histogram_pool;
+static pool_allocator<histogram_entry> histogram_pool
+  ("IPA histogram", 10);
 
 /* Hashtable support for storing SSA names hashed by their SSA_NAME_VAR.  */
 
@@ -144,7 +145,7 @@ account_time_size (hash_table<histogram_hash> *hashtable,
 
   if (!*val)
     {
-      *val = (histogram_entry *) pool_alloc (histogram_pool);
+      *val = histogram_pool.allocate ();
       **val = key;
       histogram.safe_push (*val);
     }
@@ -205,8 +206,6 @@ ipa_profile_generate_summary (void)
   basic_block bb;
 
   hash_table<histogram_hash> hashtable (10);
-  histogram_pool = create_alloc_pool ("IPA histogram", sizeof (struct histogram_entry),
-				      10);
   
   FOR_EACH_FUNCTION_WITH_GIMPLE_BODY (node)
     FOR_EACH_BB_FN (bb, DECL_STRUCT_FUNCTION (node->decl))
@@ -287,8 +286,6 @@ ipa_profile_read_summary (void)
   int j = 0;
 
   hash_table<histogram_hash> hashtable (10);
-  histogram_pool = create_alloc_pool ("IPA histogram", sizeof (struct histogram_entry),
-				      10);
 
   while ((file_data = file_data_vec[j++]))
     {
@@ -593,7 +590,7 @@ ipa_profile (void)
 	}
     }
   histogram.release ();
-  free_alloc_pool (histogram_pool);
+  histogram_pool.release ();
 
   /* Produce speculative calls: we saved common traget from porfiling into
      e->common_target_id.  Now, at link time, we can look up corresponding
-- 
2.1.4


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