On Fri, Sep 7, 2018 at 12:38 PM Jason Merrill <ja...@redhat.com> wrote:
>
> Turning on --enable-gather-detailed-mem-stats was producing for me a
> compiler that crashed before main() because initializing the
> hash_table sem_item::m_type_hash_cache was trying to add to
> hash_table_usage before the latter had been initialized.  This patch
> fixes this by changing hash_table_usage to be a function, so that it
> is initialized on demand.
>
> Tested x86_64-pc-linux-gnu.  OK for trunk?

Ah, nice idea - IIRC in the past this forced us to use pointers for
all global hashes.  I wonder if we inline the function, esp. at places
like

   for (unsigned i = HASH_TABLE_ORIGIN; i <= HASH_SET_ORIGIN; i++)
     {
       mem_alloc_origin origin = (mem_alloc_origin) i;
-      hash_table_usage.dump (origin);
+      hash_table_usage ().dump (origin);
     }
?

OK.

Richard.

Reply via email to