[PATCH] Speculatively instantiate archive members

Rui Ueyama ruiu at google.com
Fri Jan 16 11:21:56 PST 2015


On Fri, Jan 16, 2015 at 11:14 AM, Shankar Kalpathi Easwaran <
shankarke at gmail.com> wrote:

> ================
> Comment at: lib/Core/Resolver.cpp:285
> @@ +284,3 @@
> +        for (StringRef sym : archive->getDefinedSymbols())
> +          _archiveMap[sym] = archive;
> +}
> ----------------
> If there is more than one archive having the same symbol name, the last
> file with the same symbol would be parsed. The archive library file which
> appears in link order should be the first one to get picked.
>

That's not correct. Because _archiveMap is constructed from the last input
file to the first input file (see makePreloadArchiveMap, specifically
rbegin and rend), the first input file takes precedence over the second
file. If two or more library files contain the same symbol, the first one
will be instantiated.

Weak symbols and common symbols have the same name across different
> archives. This doesnot appear to handle the case where the right weak
> symbol need to be chosen or the right common symbol be chosen.
>

The logic we use here doesn't have to be accurate. As long as it makes a
reasonable guess, that's fine. It does something having no side effect
speculatively for possible performance improvement. And because we've seen
some performance improvements, I'd say the logic is not at least bad.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150116/ad81faad/attachment.html>


More information about the llvm-commits mailing list