From: Martin Liska Date: Mon, 1 Jun 2015 12:45:14 +0000 (+0200) Subject: Change use to type-based pool allocator in X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=973004cbce925b39f2f6953e36afd2202b9868dc;p=gcc.git Change use to type-based pool allocator in * sched-deps.c (create_dep_node): Use new type-based pool allocator. (delete_dep_node): Likewise. (create_deps_list): Likewise. (free_deps_list): Likewise. (sched_deps_init): Likewise. (sched_deps_finish): Likewise. From-SVN: r223962 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 678157e49e9..4dbe44c293e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2015-06-01 Martin Liska + + * sched-deps.c (create_dep_node): Use new type-based pool allocator. + (delete_dep_node): Likewise. + (create_deps_list): Likewise. + (free_deps_list): Likewise. + (sched_deps_init): Likewise. + (sched_deps_finish): Likewise. + 2015-06-01 Martin Liska * regcprop.c (free_debug_insn_changes): Use new type-based pool allocator. diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c index ac41d529814..f65431116f1 100644 --- a/gcc/sched-deps.c +++ b/gcc/sched-deps.c @@ -334,7 +334,7 @@ dep_link_is_detached_p (dep_link_t link) } /* Pool to hold all dependency nodes (dep_node_t). */ -static alloc_pool dn_pool; +static pool_allocator<_dep_node> *dn_pool; /* Number of dep_nodes out there. */ static int dn_pool_diff = 0; @@ -343,7 +343,7 @@ static int dn_pool_diff = 0; static dep_node_t create_dep_node (void) { - dep_node_t n = (dep_node_t) pool_alloc (dn_pool); + dep_node_t n = dn_pool->allocate (); dep_link_t back = DEP_NODE_BACK (n); dep_link_t forw = DEP_NODE_FORW (n); @@ -371,11 +371,11 @@ delete_dep_node (dep_node_t n) --dn_pool_diff; - pool_free (dn_pool, n); + dn_pool->remove (n); } /* Pool to hold dependencies lists (deps_list_t). */ -static alloc_pool dl_pool; +static pool_allocator<_deps_list> *dl_pool; /* Number of deps_lists out there. */ static int dl_pool_diff = 0; @@ -393,7 +393,7 @@ deps_list_empty_p (deps_list_t l) static deps_list_t create_deps_list (void) { - deps_list_t l = (deps_list_t) pool_alloc (dl_pool); + deps_list_t l = dl_pool->allocate (); DEPS_LIST_FIRST (l) = NULL; DEPS_LIST_N_LINKS (l) = 0; @@ -410,7 +410,7 @@ free_deps_list (deps_list_t l) --dl_pool_diff; - pool_free (dl_pool, l); + dl_pool->remove (l); } /* Return true if there is no dep_nodes and deps_lists out there. @@ -4075,10 +4075,10 @@ sched_deps_init (bool global_p) if (global_p) { - dl_pool = create_alloc_pool ("deps_list", sizeof (struct _deps_list), + dl_pool = new pool_allocator<_deps_list> ("deps_list", /* Allocate lists for one block at a time. */ insns_in_block); - dn_pool = create_alloc_pool ("dep_node", sizeof (struct _dep_node), + dn_pool = new pool_allocator<_dep_node> ("dep_node", /* Allocate nodes for one block at a time. We assume that average insn has 5 producers. */ @@ -4128,9 +4128,10 @@ void sched_deps_finish (void) { gcc_assert (deps_pools_are_empty_p ()); - free_alloc_pool_if_empty (&dn_pool); - free_alloc_pool_if_empty (&dl_pool); - gcc_assert (dn_pool == NULL && dl_pool == NULL); + dn_pool->release_if_empty (); + dn_pool = NULL; + dl_pool->release_if_empty (); + dl_pool = NULL; h_d_i_d.release (); cache_size = 0;