__libc_single_threaded variable for optimizing std::shared_ptr (was: [PATCH, AArch64 00/11] LSE atomics out-of-line)

Jonathan Wakely jwakely@redhat.com
Mon Feb 4 12:15:00 GMT 2019


On 04/02/19 12:13 +0100, Florian Weimer wrote:
>* Richard Henderson:
>
>> Therefore, I've created small out-of-line helpers that are directly
>> linked into every library or executable that requires them.  There
>> will be two direct branches, both of which will be well-predicted.
>
>This work inspired me to put together something that provides a similar
>hidden variable, comparable to __aa64_have_atomics, to libc_nonshared.a
>in glibc:
>
>  <https://sourceware.org/ml/libc-alpha/2019-02/msg00073.html>
>
>I hope it can be eventually be used to dynamically optimize the use of
>atomics in the std::shared_ptr implementation in libstdc++.

This makes me very happy. Thanks, Florian!

>For a generic optimization of all atomics, this is not suitable because
>even a single-threaded process can have MAP_SHARED mappings and will
>have to use atomics there.
>
>Thanks,
>Florian



More information about the Libstdc++ mailing list