From: Richard Biener Date: Mon, 1 Feb 2021 14:41:19 +0000 (+0100) Subject: Fix statistic accounting for auto_vec and auto_bitmap X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d7bd009ab00412eaa60719d38b947d3df5c69b02;p=gcc.git Fix statistic accounting for auto_vec and auto_bitmap This fixes accounting issues with using auto_vec and auto_bitmap for -fmem-report. 2021-02-01 Richard Biener * vec.h (auto_vec::auto_vec): Add memory stat parameters and pass them on. * bitmap.h (auto_bitmap::auto_bitmap): Likewise. --- diff --git a/gcc/bitmap.h b/gcc/bitmap.h index f9d6f4a39db..84632af7009 100644 --- a/gcc/bitmap.h +++ b/gcc/bitmap.h @@ -939,8 +939,10 @@ bmp_iter_and_compl (bitmap_iterator *bi, unsigned *bit_no) class auto_bitmap { public: - auto_bitmap () { bitmap_initialize (&m_bits, &bitmap_default_obstack); } - explicit auto_bitmap (bitmap_obstack *o) { bitmap_initialize (&m_bits, o); } + auto_bitmap (ALONE_CXX_MEM_STAT_INFO) + { bitmap_initialize (&m_bits, &bitmap_default_obstack PASS_MEM_STAT); } + explicit auto_bitmap (bitmap_obstack *o CXX_MEM_STAT_INFO) + { bitmap_initialize (&m_bits, o PASS_MEM_STAT); } ~auto_bitmap () { bitmap_clear (&m_bits); } // Allow calling bitmap functions on our bitmap. operator bitmap () { return &m_bits; } diff --git a/gcc/vec.h b/gcc/vec.h index bc32299779e..24df2db0eeb 100644 --- a/gcc/vec.h +++ b/gcc/vec.h @@ -1519,11 +1519,11 @@ public: this->m_vec = &m_auto; } - auto_vec (size_t s) + auto_vec (size_t s CXX_MEM_STAT_INFO) { if (s > N) { - this->create (s); + this->create (s PASS_MEM_STAT); return; } @@ -1548,7 +1548,7 @@ class auto_vec : public vec { public: auto_vec () { this->m_vec = NULL; } - auto_vec (size_t n) { this->create (n); } + auto_vec (size_t n CXX_MEM_STAT_INFO) { this->create (n PASS_MEM_STAT); } ~auto_vec () { this->release (); } auto_vec (vec&& r)