This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] C++ thunk section names
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Xinliang David Li <davidxl at google dot com>
- Cc: Sriraman Tallam <tmsriram at google dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Jan Hubicka <hubicka at ucw dot cz>, Teresa Johnson <tejohnson at google dot com>
- Date: Mon, 7 Jul 2014 20:48:43 +0200
- Subject: Re: [PATCH] C++ thunk section names
- Authentication-results: sourceware.org; auth=none
- References: <CAAs8HmyUpsQTfEhWpCXRtq1JU81JxFXUtW7vtoWv5XKS_cQFxw at mail dot gmail dot com> <CAAs8Hmxjv5jNdt3jKiocjWP8nfYFGJntSxZe=W0gfLmh4RTCOg at mail dot gmail dot com> <CAAs8HmxZppw=CCdwGh-WDqGAzMskATLDNC3Z+Vm=m_XZ=4-w=w at mail dot gmail dot com> <CAAs8HmyxpgZhKzKP=DDopg8bEcz-4-W95WiBQa8rXsSvr+Z3OQ at mail dot gmail dot com> <CAAs8Hmy8nO4dA+ezq2mfW=LuFDXNjZ8hJ+YRA_Hz30+KE_cY8A at mail dot gmail dot com> <CAAs8HmyRJ0ir-h219jp5wjKPNFQnY=xQgjtzwGkh2e+qkBr6dw at mail dot gmail dot com> <CAAkRFZ+_Jiv51T6LaajwRv4mp77Rodix0bJb5ciE_Dj9TFESeg at mail dot gmail dot com>
Hello,
I apologize for taking so long to get into this patch. I ad busy time (wedding
and teaching), should be back in regular schedule now.
> Sri, can you provide examples to show why putting thunks into the same
> section as the target function when function reorder is on can be bad
> ?
C++ ABI specify that they are in the same section, but I can't think of the
case where this would break.
Hmm, I suppose it is the TARGET_USE_LOCAL_THUNK_ALIAS_P code that breaks -
you end up with code in two sections where one is accessing local comdat
of the toher. I would also like to see testcase that breaks and is fixed by
your patch. I would expect that here, by not copying the section name,
you actually make things wose.
I think we need to deal with this later; use_tunk is done long before
profiling is read and before we decide whether code is hot/cold. I suppose
the function reordering code may need to always walk whole comdat group and
ensure that sections are same?
I.e. pick the highest profile of a function in the group, resolve unique section
on it and then copy section names? I had verifier checking that section names
within one comdat groups are same, perhaps it was part of the reverted patch
for AIX. I will try to get that one back in now.
Jan
>
> Thanks,
>
> David
>
> On Thu, Jun 26, 2014 at 10:29 AM, Sriraman Tallam <tmsriram@google.com> wrote:
> > Hi Honza,
> >
> > Could you review this patch when you find time?
> >
> > Thanks
> > Sri
> >
> > On Tue, Jun 17, 2014 at 10:42 AM, Sriraman Tallam <tmsriram@google.com> wrote:
> >> Ping.
> >>
> >> On Mon, Jun 9, 2014 at 3:54 PM, Sriraman Tallam <tmsriram@google.com> wrote:
> >>> Ping.
> >>>
> >>> On Mon, May 19, 2014 at 11:25 AM, Sriraman Tallam <tmsriram@google.com> wrote:
> >>>> Ping.
> >>>>
> >>>> On Thu, Apr 17, 2014 at 10:41 AM, Sriraman Tallam <tmsriram@google.com> wrote:
> >>>>> Ping.
> >>>>>
> >>>>> On Wed, Feb 5, 2014 at 4:31 PM, Sriraman Tallam <tmsriram@google.com> wrote:
> >>>>>> Hi,
> >>>>>>
> >>>>>> I would like this patch reviewed and considered for commit when
> >>>>>> Stage 1 is active again.
> >>>>>>
> >>>>>> Patch Description:
> >>>>>>
> >>>>>> A C++ thunk's section name is set to be the same as the original function's
> >>>>>> section name for which the thunk was created in order to place the two
> >>>>>> together. This is done in cp/method.c in function use_thunk.
> >>>>>> However, with function reordering turned on, the original function's section
> >>>>>> name can change to something like ".text.hot.<orginal>" or
> >>>>>> ".text.unlikely.<original>" in function default_function_section in varasm.c
> >>>>>> based on the node count of that function. The thunk function's section name
> >>>>>> is not updated to be the same as the original here and also is not always
> >>>>>> correct to do it as the original function can be hotter than the thunk.
> >>>>>>
> >>>>>> I have created a patch to not name the thunk function's section to be the same
> >>>>>> as the original function when function reordering is enabled.
> >>>>>>
> >>>>>> Thanks
> >>>>>> Sri