On Mon, Dec 17, 2018 at 2:26 PM H.J. Lu <hjl.to...@gmail.com> wrote:
>
> On Mon, Dec 17, 2018 at 2:00 AM Richard Biener
> <richard.guent...@gmail.com> wrote:
> >
> > On Sun, Dec 16, 2018 at 9:33 PM H.J. Lu <hjl.to...@gmail.com> wrote:
> > >
> > > find_slot_with_hash has
> > >
> > >  if (insert == INSERT && m_size * 3 <= m_n_elements * 4)
> > >     expand ();
> > >
> > > which may expand hash table even if no insert 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, we
> > > shouldn't expand index string hash table.  Otherwise find_slot_with_hash
> > > will expand hash table when hash table has the right size.
> >
> > So the point is that output_macinfo_op is called from code traversing the
> > hashtable?  I didn't really manage to quickly spot that.
> >
> > > Tested on i686 and x86-64.  OK for trunk?
> >
> > OK if called from htab traverse (please clarify that in the comment you 
> > add).
> >
> > Richard.
>
> 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.
>
> This is the updated patch I am checking in.

Thanks for tracking this down.

Richard.

> --
> H.J.

Reply via email to