Skip to content

Commit

Permalink
Fix PR65538.
Browse files Browse the repository at this point in the history
	PR tree-optimization/65538
	* symbol-summary.h (function_summary::~function_summary):
	Relese memory for allocated summaries.
	(function_summary::release): New function.



git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@221658 138bc75d-0d04-0410-961f-82ee72b054a4
  • Loading branch information
marxin committed Mar 25, 2015
1 parent b07e936 commit 5039921
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
7 changes: 7 additions & 0 deletions gcc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2015-03-25 Martin Liska <mliska@suse.cz>

PR tree-optimization/65538
* symbol-summary.h (function_summary::~function_summary):
Relese memory for allocated summaries.
(function_summary::release): New function.

2015-03-25 Jakub Jelinek <jakub@redhat.com>

PR lto/65515
Expand Down
17 changes: 17 additions & 0 deletions gcc/symbol-summary.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ class GTY((user)) function_summary <T *>
m_symtab_insertion_hook = NULL;
m_symtab_removal_hook = NULL;
m_symtab_duplication_hook = NULL;

/* Release all summaries. */
typedef typename hash_map <int, T *, summary_hashmap_traits>::iterator map_iterator;
for (map_iterator it = m_map.begin (); it != m_map.end (); ++it)
release ((*it).second);
}

/* Traverses all summarys with a function F called with
Expand All @@ -106,6 +111,18 @@ class GTY((user)) function_summary <T *>
return m_ggc ? new (ggc_alloc <T> ()) T() : new T () ;
}

/* Release an item that is stored within map. */
void release (T *item)
{
if (m_ggc)
{
item->~T ();
ggc_free (item);
}
else
delete item;
}

/* Getter for summary callgraph node pointer. */
T* get (cgraph_node *node)
{
Expand Down

0 comments on commit 5039921

Please sign in to comment.