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
This commit is contained in:
Martin Liska 2015-06-01 14:45:14 +02:00 committed by Martin Liska
parent 5c7337c58f
commit 973004cbce
2 changed files with 21 additions and 11 deletions

View File

@ -1,3 +1,12 @@
2015-06-01 Martin Liska <mliska@suse.cz>
* 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 <mliska@suse.cz>
* regcprop.c (free_debug_insn_changes): Use new type-based pool allocator.

View File

@ -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;