* [PATCH] Do not gather mem stats in run_exit_handles (PR middle-end/69919)
@ 2016-02-25 11:07 Martin Liška
2016-02-25 14:35 ` Richard Biener
2016-02-25 18:02 ` David Malcolm
0 siblings, 2 replies; 4+ messages in thread
From: Martin Liška @ 2016-02-25 11:07 UTC (permalink / raw)
To: gcc-patches; +Cc: Richard Biener
Hello.
As discussed in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69919#c3, following patch
guards usage of memory statistics infrastructure after a mem_alloc_description is already
destructed.
Patch can lto-bootstrap on x86_64-linux-gnu with --enable-gather-detailed-mem-stats and
survives bootstrap®tests with --enable-gather-detailed-mem-stats on x86_64-linux-gnu with.
Ready to be installed?
Martin
gcc/ChangeLog:
2016-02-25 Martin Liska <mliska@suse.cz>
PR middle-end/69919
* alloc-pool.c (after_memory_report): New variable.
* alloc-pool.h (base_pool_allocator ::release): Do not use
the infrastructure if after_memory_report.
* toplev.c (toplev::main): Mark after memory report.
---
gcc/alloc-pool.c | 1 +
gcc/alloc-pool.h | 5 ++++-
gcc/toplev.c | 3 +++
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/gcc/alloc-pool.c b/gcc/alloc-pool.c
index ae5e232..43d06f6 100644
--- a/gcc/alloc-pool.c
+++ b/gcc/alloc-pool.c
@@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see
ALLOC_POOL_ID_TYPE last_id;
mem_alloc_description<pool_usage> pool_allocator_usage;
+bool after_memory_report = false;
/* Output per-alloc_pool memory usage statistics. */
void
diff --git a/gcc/alloc-pool.h b/gcc/alloc-pool.h
index 8ccf089..3ead101 100644
--- a/gcc/alloc-pool.h
+++ b/gcc/alloc-pool.h
@@ -25,6 +25,9 @@ along with GCC; see the file COPYING3. If not see
extern void dump_alloc_pool_statistics (void);
+/* Flag indicates whether memory statistics are gathered any longer. */
+extern bool after_memory_report;
+
typedef unsigned long ALLOC_POOL_ID_TYPE;
/* Last used ID. */
@@ -306,7 +309,7 @@ base_pool_allocator <TBlockAllocator>::release ()
TBlockAllocator::release (block);
}
- if (GATHER_STATISTICS)
+ if (GATHER_STATISTICS && !after_memory_report)
{
pool_allocator_usage.release_instance_overhead
(this, (m_elts_allocated - m_elts_free) * m_elt_size);
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 28c115d..c480bfc 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -2107,6 +2107,9 @@ toplev::main (int argc, char **argv)
finalize_plugins ();
location_adhoc_data_fini (line_table);
+
+ after_memory_report = true;
+
if (seen_error () || werrorcount)
return (FATAL_EXIT_CODE);
--
2.7.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Do not gather mem stats in run_exit_handles (PR middle-end/69919)
2016-02-25 11:07 [PATCH] Do not gather mem stats in run_exit_handles (PR middle-end/69919) Martin Liška
@ 2016-02-25 14:35 ` Richard Biener
2016-02-25 18:02 ` David Malcolm
1 sibling, 0 replies; 4+ messages in thread
From: Richard Biener @ 2016-02-25 14:35 UTC (permalink / raw)
To: Martin Liška; +Cc: GCC Patches
On Thu, Feb 25, 2016 at 12:07 PM, Martin Liška <mliska@suse.cz> wrote:
> Hello.
>
> As discussed in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69919#c3, following patch
> guards usage of memory statistics infrastructure after a mem_alloc_description is already
> destructed.
>
> Patch can lto-bootstrap on x86_64-linux-gnu with --enable-gather-detailed-mem-stats and
> survives bootstrap®tests with --enable-gather-detailed-mem-stats on x86_64-linux-gnu with.
>
> Ready to be installed?
Ok.
Richard.
> Martin
>
> gcc/ChangeLog:
>
> 2016-02-25 Martin Liska <mliska@suse.cz>
>
> PR middle-end/69919
> * alloc-pool.c (after_memory_report): New variable.
> * alloc-pool.h (base_pool_allocator ::release): Do not use
> the infrastructure if after_memory_report.
> * toplev.c (toplev::main): Mark after memory report.
> ---
> gcc/alloc-pool.c | 1 +
> gcc/alloc-pool.h | 5 ++++-
> gcc/toplev.c | 3 +++
> 3 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/alloc-pool.c b/gcc/alloc-pool.c
> index ae5e232..43d06f6 100644
> --- a/gcc/alloc-pool.c
> +++ b/gcc/alloc-pool.c
> @@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see
>
> ALLOC_POOL_ID_TYPE last_id;
> mem_alloc_description<pool_usage> pool_allocator_usage;
> +bool after_memory_report = false;
>
> /* Output per-alloc_pool memory usage statistics. */
> void
> diff --git a/gcc/alloc-pool.h b/gcc/alloc-pool.h
> index 8ccf089..3ead101 100644
> --- a/gcc/alloc-pool.h
> +++ b/gcc/alloc-pool.h
> @@ -25,6 +25,9 @@ along with GCC; see the file COPYING3. If not see
>
> extern void dump_alloc_pool_statistics (void);
>
> +/* Flag indicates whether memory statistics are gathered any longer. */
> +extern bool after_memory_report;
> +
> typedef unsigned long ALLOC_POOL_ID_TYPE;
>
> /* Last used ID. */
> @@ -306,7 +309,7 @@ base_pool_allocator <TBlockAllocator>::release ()
> TBlockAllocator::release (block);
> }
>
> - if (GATHER_STATISTICS)
> + if (GATHER_STATISTICS && !after_memory_report)
> {
> pool_allocator_usage.release_instance_overhead
> (this, (m_elts_allocated - m_elts_free) * m_elt_size);
> diff --git a/gcc/toplev.c b/gcc/toplev.c
> index 28c115d..c480bfc 100644
> --- a/gcc/toplev.c
> +++ b/gcc/toplev.c
> @@ -2107,6 +2107,9 @@ toplev::main (int argc, char **argv)
>
> finalize_plugins ();
> location_adhoc_data_fini (line_table);
> +
> + after_memory_report = true;
> +
> if (seen_error () || werrorcount)
> return (FATAL_EXIT_CODE);
>
> --
> 2.7.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Do not gather mem stats in run_exit_handles (PR middle-end/69919)
2016-02-25 11:07 [PATCH] Do not gather mem stats in run_exit_handles (PR middle-end/69919) Martin Liška
2016-02-25 14:35 ` Richard Biener
@ 2016-02-25 18:02 ` David Malcolm
2016-02-26 10:40 ` Martin Liška
1 sibling, 1 reply; 4+ messages in thread
From: David Malcolm @ 2016-02-25 18:02 UTC (permalink / raw)
To: Martin Liška, gcc-patches; +Cc: Richard Biener
On Thu, 2016-02-25 at 12:07 +0100, Martin Liška wrote:
> Hello.
>
> As discussed in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69919#c3
> , following patch
> guards usage of memory statistics infrastructure after a
> mem_alloc_description is already
> destructed.
>
> Patch can lto-bootstrap on x86_64-linux-gnu with --enable-gather
> -detailed-mem-stats and
> survives bootstrap®tests with --enable-gather-detailed-mem-stats
> on x86_64-linux-gnu with.
>
> Ready to be installed?
> Martin
>
> gcc/ChangeLog:
>
> 2016-02-25 Martin Liska <mliska@suse.cz>
>
> PR middle-end/69919
> * alloc-pool.c (after_memory_report): New variable.
> * alloc-pool.h (base_pool_allocator ::release): Do not use
> the infrastructure if after_memory_report.
> * toplev.c (toplev::main): Mark after memory report.
> ---
> gcc/alloc-pool.c | 1 +
> gcc/alloc-pool.h | 5 ++++-
> gcc/toplev.c | 3 +++
> 3 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/alloc-pool.c b/gcc/alloc-pool.c
> index ae5e232..43d06f6 100644
> --- a/gcc/alloc-pool.c
> +++ b/gcc/alloc-pool.c
> @@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see
>
> ALLOC_POOL_ID_TYPE last_id;
> mem_alloc_description<pool_usage> pool_allocator_usage;
> +bool after_memory_report = false;
>
> /* Output per-alloc_pool memory usage statistics. */
> void
> diff --git a/gcc/alloc-pool.h b/gcc/alloc-pool.h
> index 8ccf089..3ead101 100644
> --- a/gcc/alloc-pool.h
> +++ b/gcc/alloc-pool.h
> @@ -25,6 +25,9 @@ along with GCC; see the file COPYING3. If not see
>
> extern void dump_alloc_pool_statistics (void);
>
> +/* Flag indicates whether memory statistics are gathered any longer.
> */
> +extern bool after_memory_report;
> +
> typedef unsigned long ALLOC_POOL_ID_TYPE;
>
> /* Last used ID. */
> @@ -306,7 +309,7 @@ base_pool_allocator <TBlockAllocator>::release ()
> TBlockAllocator::release (block);
> }
>
> - if (GATHER_STATISTICS)
> + if (GATHER_STATISTICS && !after_memory_report)
> {
> pool_allocator_usage.release_instance_overhead
> (this, (m_elts_allocated - m_elts_free) * m_elt_size);
> diff --git a/gcc/toplev.c b/gcc/toplev.c
> index 28c115d..c480bfc 100644
> --- a/gcc/toplev.c
> +++ b/gcc/toplev.c
> @@ -2107,6 +2107,9 @@ toplev::main (int argc, char **argv)
>
> finalize_plugins ();
> location_adhoc_data_fini (line_table);
> +
> + after_memory_report = true;
> +
> if (seen_error () || werrorcount)
> return (FATAL_EXIT_CODE);
Was this tested with "jit" in --enable-languages? I ask because
toplev::main can be run repeatedly by libgccjit, and it looks like
nothing can reset after_memory_report. (Though I don't typically build
with --enable-gather-detailed-mem-stats, and the jit docs don't mention
it).
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Do not gather mem stats in run_exit_handles (PR middle-end/69919)
2016-02-25 18:02 ` David Malcolm
@ 2016-02-26 10:40 ` Martin Liška
0 siblings, 0 replies; 4+ messages in thread
From: Martin Liška @ 2016-02-26 10:40 UTC (permalink / raw)
To: David Malcolm, gcc-patches; +Cc: Richard Biener
On 02/25/2016 07:02 PM, David Malcolm wrote:
> Was this tested with "jit" in --enable-languages? I ask because
> toplev::main can be run repeatedly by libgccjit, and it looks like
> nothing can reset after_memory_report. (Though I don't typically build
> with --enable-gather-detailed-mem-stats, and the jit docs don't mention
> it).
Wasn't, however as I've just retested that with jit in --enable-languages it works.
However, you are right that it's not reset anywhere. I will try to come up with
a better solution for GCC 7.
Martin
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-02-26 10:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-25 11:07 [PATCH] Do not gather mem stats in run_exit_handles (PR middle-end/69919) Martin Liška
2016-02-25 14:35 ` Richard Biener
2016-02-25 18:02 ` David Malcolm
2016-02-26 10:40 ` Martin Liška
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).