summaryrefslogtreecommitdiff
path: root/gcc/et-forest.h
diff options
context:
space:
mode:
authormarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2015-06-01 12:33:23 +0000
committermarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2015-06-01 12:33:23 +0000
commit63c440ebac842bed8fcdd0b606ba93a04184ea4c (patch)
tree9c91e4bc61bf147a2acbfd03313bc35e37f68adb /gcc/et-forest.h
parent419f2d6236f6a4d83ccaf82a14610bfe532065e6 (diff)
downloadgcc-63c440ebac842bed8fcdd0b606ba93a04184ea4c.tar.gz
Change use to type-based pool allocator in et-forest.c.
* et-forest.c (et_new_occ): Use new type-based pool allocator. (et_new_tree): Likewise. (et_free_tree): Likewise. (et_free_tree_force): Likewise. (et_free_pools): Likewise. (et_split): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223943 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/et-forest.h')
-rw-r--r--gcc/et-forest.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/et-forest.h b/gcc/et-forest.h
index b507c646e33..15c582d7ff3 100644
--- a/gcc/et-forest.h
+++ b/gcc/et-forest.h
@@ -66,6 +66,21 @@ struct et_node
struct et_occ *rightmost_occ; /* The rightmost occurrence. */
struct et_occ *parent_occ; /* The occurrence of the parent node. */
+
+ /* Pool allocation new operator. */
+ inline void *operator new (size_t)
+ {
+ return pool.allocate ();
+ }
+
+ /* Delete operator utilizing pool allocation. */
+ inline void operator delete (void *ptr)
+ {
+ pool.remove ((et_node *) ptr);
+ }
+
+ /* Memory allocation pool. */
+ static pool_allocator<et_node> pool;
};
struct et_node *et_new_tree (void *data);