[llvm-dev] [lld] We call SymbolBody::getVA redundantly a lot...

Sean Silva via llvm-dev llvm-dev at lists.llvm.org
Wed Mar 1 14:33:53 PST 2017


On Tue, Feb 28, 2017 at 9:47 AM, Rafael Avila de Espindola <
rafael.espindola at gmail.com> wrote:

> Sean Silva <chisophugis at gmail.com> writes:
>
> > tl;dr: it looks like we call SymbolBody::getVA about 5x more times than
> we
> > need to
> >
> > Should we cache it  or something? (careful with threads).
>
> Maybe. It might be the case that there are multiple relocations to the
> same symbol. It can also be the case that we look for it to find the
> value to put in a symbol table.
>
> The cost of the call is very different depending on what section the
> symbol is in. One thing I think we can do is move the symbols out in the
> section merge hierarchy.
>
> For example, a symbol initially points to a MergeInputSection, but we
> could then change it to point to a SyntheticSection or even an output
> section.
>

You mean, redirect the symbol to point to the finalized string table? I
kind of like that idea.
One issue with that though is the section symbol semantics. It's not
possible to correctly handle that just by redirecting the symbol. (I really
don't like the semantics of that)

-- Sean Silva


>
> Cheers,
> Rafael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170301/daf83202/attachment.html>


More information about the llvm-dev mailing list