[lld] r286100 - [ELF] Make InputSection<ELFT>::writeTo virtual

Eugene Leviant via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 8 04:00:15 PST 2016


VMTs themselves are not allocated (AFAIK they're stored in .rodata),
so I guess the problem is in extra 4/8 bytes of VMT pointer size and
overhead
for initialization, correct? For dyn_cast you have extra 4 bytes for
Kind + function call + compare-and-branch. Can you provide some
proofs, that it is faster?
(like you did in your previous letter).


2016-11-08 14:27 GMT+03:00 Rafael EspĂ­ndola <rafael.espindola at gmail.com>:
> On 8 November 2016 at 06:16, Eugene Leviant <evgeny.leviant at gmail.com> wrote:
>> SyntheticInput is not enough, because synthetic sections are written
>> on behalf of OutputSection<ELFT>, which maintains a list
>> of InputSection<ELFT> objects.
>>
>> To my understanding an alternative is a check for section kind in
>> InputSection<ELFT>::writeTo, which is also a slow-down.
>> Will it be faster than virtual function call?
>
> I don't think the problem is the call. The problem is the vtable
> pointer in lots of allocations. So yes, checking Kind should help, and
> it is probably ok to have just a SyntheticKind and for writing do
>
> if (auto *S = dyn_cast<SyntheticSection<ELFT>>(this)) {
>   S->writeSynthetic(); // only virtual method in the hierarchy.
>   return;
> }
>
> Cheers,
> Rafael


More information about the llvm-commits mailing list