On 11/12/19 11:29 PM, Strager Neds wrote: > Several parts of GCC need to copy a section name from one tree (or > symtab_node) to another. Currently, this is implemented naively: > > 1. Query the source's section name > 2. Hash the section name string > 3. Find the section_hash_entry in the symbol table > 4. Increment the section_hash_entry's reference count > 5. Assign the destination's section to the section_hash_entry > > Since we have the source's section_hash_entry, we can copy the section > name from one symtab_node to another efficiently with the following > algorithm: > > 1. Query the source's section_hash_entry > 2. Increment the section_hash_entry's reference count > 3. Assign the destination's section to the section_hash_entry > > Implement this algorithm in the overload of symtab_node::set_section > which takes an existing symtab_node. > > I did not measure the performance impact of this patch. In > particular, I do not know if this patch actually improves performance. > > This patch should not change behavior. > > Testing: Bootstrap on x86_64-linux-gnu with --disable-multilib > --enable-checking=release --enable-languages=c,c++. Observe no change in > test results. > > 2019-11-12 Matthew Glazar <strager....@gmail.com> > > * gcc/cgraph.h (symtab_node::set_section_for_node): Declare new > overload. > (symtab_node::set_section_from_string): Rename from set_section. > (symtab_node::set_section_from_node): Declare. > * gcc/symtab.c (symtab_node::set_section_for_node): Define new > overload. > (symtab_node::set_section_from_string): Rename from set_section. > (symtab_node::set_section_from_node): Define. > (symtab_node::set_section): Call renamed set_section_from_string. > (symtab_node::set_section): Call new set_section_from_node.
I've fixed up the ChangeLog, re-tested and pushed this patch to the trunk. Thanks again for your patience, jeff