[libcxx-dev] Is a compiler-rt shared spinlock implementation of any use to libcxx?

JF Bastien via libcxx-dev libcxx-dev at lists.llvm.org
Fri May 17 16:38:04 PDT 2019


I think it makes sense for libc++ to have a version of mutex which has the same API as the standard one, but for “freestanding” platforms such as yours. A flavor which mostly just spins and yields as in your review.

I’m not sure how to best turn it on, though. Should it be controlled by a macro, and otherwise it just looks like you’re using <mutex>?


> On May 17, 2019, at 1:49 PM, Mitch Phillips via libcxx-dev <libcxx-dev at lists.llvm.org> wrote:
> 
> Hi all,
> 
> In a recent discussion <https://reviews.llvm.org/D61923#1503272> from the reviews of GWP-ASan <https://reviews.llvm.org/D60593>, it was mentioned that I should probably consult with cxx-dev to see whether they'd be interested in a common spinlock implementation.
> 
> The problem is:
>  - Scudo hardened allocator (compiler-rt/lib/scudo) requires its own spinlock as it can't use the C++ standard library due to Fuchsia requirements.
>  - GWP-ASan (as it's packaged into Scudo) also requires a spinlock.
>  - Compiler-rt sanitizer_common also can't use c++ stdlib, and has its own spinlock. We can't reuse the sanitizer_common spinlock for Scudo/GWP-ASan as it's currently tightly coupled into sanitizer_common, and Scudo+Fuchsia can't afford the code size overhead of pulling the entire sanitizer_common library.
> 
> The plan was to basically write a small standalone spinlock implementation that can be used by all three of these requirements. Would libcxx benefit by us making this an llvm-common spinlock rather than compiler-rt-common? If so, are there any requirements that we need to be aware of?
> 
> Cheers,
> Mitch.
> _______________________________________________
> libcxx-dev mailing list
> libcxx-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/libcxx-dev/attachments/20190517/9ee15cf9/attachment.html>


More information about the libcxx-dev mailing list