From bd545bcf1c351c0460a3e9b6185dc1065baf002f Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Thu, 25 Feb 2016 17:57:39 +0100 Subject: [PATCH] Do not gather mem stats in run_exit_handles (PR 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. From-SVN: r233722 --- gcc/ChangeLog | 8 ++++++++ gcc/alloc-pool.c | 1 + gcc/alloc-pool.h | 5 ++++- gcc/toplev.c | 3 +++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3a13f5fa564..0414e097013 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2016-02-25 Martin Liska + + 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. + 2016-02-25 Richard Biener PR tree-optimization/48795 diff --git a/gcc/alloc-pool.c b/gcc/alloc-pool.c index ae5e232d40d..43d06f62153 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_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 8ccf089d60c..3ead1015d71 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 ::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 28c115d71c4..c480bfc8bd2 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.30.2