This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [patch][gold] Remove empty Merge_map class
- From: Rafael EspÃndola <rafael dot espindola at gmail dot com>
- To: Binutils <binutils at sourceware dot org>
- Cc: Cary Coutant <ccoutant at google dot com>
- Date: Fri, 20 Feb 2015 09:19:57 -0500
- Subject: Re: [patch][gold] Remove empty Merge_map class
- Authentication-results: sourceware.org; auth=none
- References: <CAG3jReJM-x=kpdPfb=KswWrZ+hRa3AiaN4Tv_MjqFi7rqxd58Q at mail dot gmail dot com> <CAG3jReLo1fAieCU-5wNVFUrvRy5-AujvBm+96eDQLBJ2n5mSLA at mail dot gmail dot com>
ping. This is just deleting dead code.
On 17 February 2015 at 10:56, Rafael EspÃndola
<rafael.espindola@gmail.com> wrote:
> Ping. A rebased patch is attached.
>
> On 6 February 2015 at 18:32, Rafael EspÃndola
> <rafael.espindola@gmail.com> wrote:
>> When looking at the constant merging code to see if the
>> mapping could be reused for gc, the most confusing part for
>> me was the empty Merge_map class.
>>
>> It is only used as a key to implement is_merge_section_for (which is
>> only used by find_starting_output_address).
>>
>> Since it is just a key, we can use the Output_section_data as a key
>> instead. This patch does that. IMHO removing the indirection makes
>> things a bit easier to understand. It also removes the need for the
>> virtual do_is_merge_section_for.
>>
>> Last but not least, it makes some inefficiencies easier to spot. For
>> example, Output_merge_data::do_add_input_section handles only one
>> input section and therefore only one merge map, but it does
>>
>> object->add_merge_mapping(this, shndx, i, entsize, k);
>>
>> in a loop. It could extract Input_merge_map* before the loop.
>>
>> Cheers,
>> Rafael