https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79342

--- Comment #14 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> ---
Author: hjl
Date: Mon Dec 17 13:49:16 2018
New Revision: 267202

URL: https://gcc.gnu.org/viewcvs?rev=267202&root=gcc&view=rev
Log:
DWARF: Don't expand hash table when no insertion is needed

dwarf2out_finish performs:

1. save_macinfo_strings
2. hash table traverse of index_string
3. output_macinfo -> output_macinfo_op
4. output_indirect_strings -> hash table traverse of output_index_string

find_slot_with_hash has

 if (insert == INSERT && m_size * 3 <= m_n_elements * 4)
    expand ();

which may expand hash table even if no insertion is neeed and change hash
table traverse order.  When output_macinfo_op is called, all index strings
have been added to hash table by save_macinfo_strings and we shouldn't
expand index string hash table.  Otherwise find_slot_with_hash will expand
hash table when hash table has the right size and hash table traverse of
output_index_string will have a different traverse order from index_string.

        PR debug/79342
        * dwarf2out.c (find_AT_string_in_table): Add insert argument
        defaulting to INSERT and replace INSERT.
        (find_AT_string): Likewise.
        (output_macinfo_op): Pass NO_INSERT to find_AT_string.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/dwarf2out.c

Reply via email to