public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Pass memory statistics for {symbol,call}_summary.
@ 2019-10-29 13:33 Martin Liška
  2019-10-29 14:25 ` Jan Hubicka
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Liška @ 2019-10-29 13:33 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jan Hubicka

[-- Attachment #1: Type: text/plain, Size: 524 bytes --]

Hi.

The pass passes memory allocation location to underlying
hash_map (and vec).

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin

gcc/ChangeLog:

2019-10-29  Martin Liska  <mliska@suse.cz>

	* symbol-summary.h (function_summary): Pass memory location
	to underlaying hash_map (or vec).
	(V>::fast_function_summary): Likewise.
---
 gcc/symbol-summary.h | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)



[-- Attachment #2: 0001-Pass-memory-statistics-for-symbol-call-_summary.patch --]
[-- Type: text/x-patch, Size: 3112 bytes --]

diff --git a/gcc/symbol-summary.h b/gcc/symbol-summary.h
index a0bacadb63b..cc28b409e32 100644
--- a/gcc/symbol-summary.h
+++ b/gcc/symbol-summary.h
@@ -131,7 +131,7 @@ class GTY((user)) function_summary <T *>: public function_summary_base<T>
 {
 public:
   /* Default construction takes SYMTAB as an argument.  */
-  function_summary (symbol_table *symtab, bool ggc = false);
+  function_summary (symbol_table *symtab, bool ggc = false CXX_MEM_STAT_INFO);
 
   /* Destructor.  */
   virtual ~function_summary ()
@@ -222,8 +222,11 @@ private:
 };
 
 template <typename T>
-function_summary<T *>::function_summary (symbol_table *symtab, bool ggc):
-  function_summary_base<T> (symtab), m_ggc (ggc), m_map (13, ggc)
+function_summary<T *>::function_summary (symbol_table *symtab, bool ggc
+					 MEM_STAT_DECL):
+  function_summary_base<T> (symtab), m_ggc (ggc), m_map (13, ggc, true,
+							 GATHER_STATISTICS
+							 PASS_MEM_STAT)
 {
   this->m_symtab_insertion_hook
     = this->m_symtab->add_cgraph_insertion_hook (function_summary::symtab_insertion,
@@ -340,7 +343,7 @@ class GTY((user)) fast_function_summary <T *, V>
 {
 public:
   /* Default construction takes SYMTAB as an argument.  */
-  fast_function_summary (symbol_table *symtab);
+  fast_function_summary (symbol_table *symtab CXX_MEM_STAT_INFO);
 
   /* Destructor.  */
   virtual ~fast_function_summary ()
@@ -429,10 +432,10 @@ private:
 };
 
 template <typename T, typename V>
-fast_function_summary<T *, V>::fast_function_summary (symbol_table *symtab):
+fast_function_summary<T *, V>::fast_function_summary (symbol_table *symtab MEM_STAT_DECL):
   function_summary_base<T> (symtab), m_vector (NULL)
 {
-  vec_alloc (m_vector, 13);
+  vec_alloc (m_vector, 13 PASS_MEM_STAT);
   this->m_symtab_insertion_hook
     = this->m_symtab->add_cgraph_insertion_hook (fast_function_summary::symtab_insertion,
 						 this);
@@ -633,8 +636,11 @@ class GTY((user)) call_summary <T *>: public call_summary_base<T>
 {
 public:
   /* Default construction takes SYMTAB as an argument.  */
-  call_summary (symbol_table *symtab, bool ggc = false)
-  : call_summary_base<T> (symtab), m_ggc (ggc), m_map (13, ggc)
+  call_summary (symbol_table *symtab, bool ggc = false
+		CXX_MEM_STAT_INFO)
+  : call_summary_base<T> (symtab), m_ggc (ggc), m_map (13, ggc, true,
+						       GATHER_STATISTICS
+						       PASS_MEM_STAT)
   {
     this->m_symtab_removal_hook
       = this->m_symtab->add_edge_removal_hook (call_summary::symtab_removal,
@@ -812,10 +818,10 @@ class GTY((user)) fast_call_summary <T *, V>: public call_summary_base<T>
 {
 public:
   /* Default construction takes SYMTAB as an argument.  */
-  fast_call_summary (symbol_table *symtab)
+  fast_call_summary (symbol_table *symtab CXX_MEM_STAT_INFO)
   : call_summary_base<T> (symtab), m_vector (NULL)
   {
-    vec_alloc (m_vector, 13);
+    vec_alloc (m_vector, 13 PASS_MEM_STAT);
     this->m_symtab_removal_hook
       = this->m_symtab->add_edge_removal_hook (fast_call_summary::symtab_removal,
 					       this);


[-- Attachment #3: pEpkey.asc --]
[-- Type: application/pgp-keys, Size: 1787 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Pass memory statistics for {symbol,call}_summary.
  2019-10-29 13:33 [PATCH] Pass memory statistics for {symbol,call}_summary Martin Liška
@ 2019-10-29 14:25 ` Jan Hubicka
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Hubicka @ 2019-10-29 14:25 UTC (permalink / raw)
  To: Martin Liška; +Cc: gcc-patches

> Hi.
> 
> The pass passes memory allocation location to underlying
> hash_map (and vec).
> 
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
> 
> Ready to be installed?
OK,
thanks!
Honza
> Thanks,
> Martin
> 
> gcc/ChangeLog:
> 
> 2019-10-29  Martin Liska  <mliska@suse.cz>
> 
> 	* symbol-summary.h (function_summary): Pass memory location
> 	to underlaying hash_map (or vec).
> 	(V>::fast_function_summary): Likewise.
> ---
>  gcc/symbol-summary.h | 26 ++++++++++++++++----------
>  1 file changed, 16 insertions(+), 10 deletions(-)
> 
> 

> diff --git a/gcc/symbol-summary.h b/gcc/symbol-summary.h
> index a0bacadb63b..cc28b409e32 100644
> --- a/gcc/symbol-summary.h
> +++ b/gcc/symbol-summary.h
> @@ -131,7 +131,7 @@ class GTY((user)) function_summary <T *>: public function_summary_base<T>
>  {
>  public:
>    /* Default construction takes SYMTAB as an argument.  */
> -  function_summary (symbol_table *symtab, bool ggc = false);
> +  function_summary (symbol_table *symtab, bool ggc = false CXX_MEM_STAT_INFO);
>  
>    /* Destructor.  */
>    virtual ~function_summary ()
> @@ -222,8 +222,11 @@ private:
>  };
>  
>  template <typename T>
> -function_summary<T *>::function_summary (symbol_table *symtab, bool ggc):
> -  function_summary_base<T> (symtab), m_ggc (ggc), m_map (13, ggc)
> +function_summary<T *>::function_summary (symbol_table *symtab, bool ggc
> +					 MEM_STAT_DECL):
> +  function_summary_base<T> (symtab), m_ggc (ggc), m_map (13, ggc, true,
> +							 GATHER_STATISTICS
> +							 PASS_MEM_STAT)
>  {
>    this->m_symtab_insertion_hook
>      = this->m_symtab->add_cgraph_insertion_hook (function_summary::symtab_insertion,
> @@ -340,7 +343,7 @@ class GTY((user)) fast_function_summary <T *, V>
>  {
>  public:
>    /* Default construction takes SYMTAB as an argument.  */
> -  fast_function_summary (symbol_table *symtab);
> +  fast_function_summary (symbol_table *symtab CXX_MEM_STAT_INFO);
>  
>    /* Destructor.  */
>    virtual ~fast_function_summary ()
> @@ -429,10 +432,10 @@ private:
>  };
>  
>  template <typename T, typename V>
> -fast_function_summary<T *, V>::fast_function_summary (symbol_table *symtab):
> +fast_function_summary<T *, V>::fast_function_summary (symbol_table *symtab MEM_STAT_DECL):
>    function_summary_base<T> (symtab), m_vector (NULL)
>  {
> -  vec_alloc (m_vector, 13);
> +  vec_alloc (m_vector, 13 PASS_MEM_STAT);
>    this->m_symtab_insertion_hook
>      = this->m_symtab->add_cgraph_insertion_hook (fast_function_summary::symtab_insertion,
>  						 this);
> @@ -633,8 +636,11 @@ class GTY((user)) call_summary <T *>: public call_summary_base<T>
>  {
>  public:
>    /* Default construction takes SYMTAB as an argument.  */
> -  call_summary (symbol_table *symtab, bool ggc = false)
> -  : call_summary_base<T> (symtab), m_ggc (ggc), m_map (13, ggc)
> +  call_summary (symbol_table *symtab, bool ggc = false
> +		CXX_MEM_STAT_INFO)
> +  : call_summary_base<T> (symtab), m_ggc (ggc), m_map (13, ggc, true,
> +						       GATHER_STATISTICS
> +						       PASS_MEM_STAT)
>    {
>      this->m_symtab_removal_hook
>        = this->m_symtab->add_edge_removal_hook (call_summary::symtab_removal,
> @@ -812,10 +818,10 @@ class GTY((user)) fast_call_summary <T *, V>: public call_summary_base<T>
>  {
>  public:
>    /* Default construction takes SYMTAB as an argument.  */
> -  fast_call_summary (symbol_table *symtab)
> +  fast_call_summary (symbol_table *symtab CXX_MEM_STAT_INFO)
>    : call_summary_base<T> (symtab), m_vector (NULL)
>    {
> -    vec_alloc (m_vector, 13);
> +    vec_alloc (m_vector, 13 PASS_MEM_STAT);
>      this->m_symtab_removal_hook
>        = this->m_symtab->add_edge_removal_hook (fast_call_summary::symtab_removal,
>  					       this);
> 

pub   RSA 2048/A22D152C 2019-10-29 Martin Liška <mliska@suse.cz>
> sub   RSA 2048/1C617839 2019-10-29
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-29 13:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-29 13:33 [PATCH] Pass memory statistics for {symbol,call}_summary Martin Liška
2019-10-29 14:25 ` Jan Hubicka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).