[libcxx-commits] [PATCH] D68480: Implementation of C++20's P1135R6 for libcxx

Olivier Giroux via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Oct 29 16:36:25 PDT 2019


__simt__ updated this revision to Diff 226990.
__simt__ added a comment.

This revision enables cross-ABI compatibility for building the dylib and the user application with different combinations of these options:

- _LIBCPP_HAS_NO_PLATFORM_WAIT
- _LIBCPP_HAS_NO_PLATFORM_WAIT_TABLE
- _LIBCPP_HAS_NO_PLATFORM_WAIT_STATE

When the ABIs are mixed, the total application still gets the best performance available for the facilities actually available in common. This is somewhat gnarly (apologies for the several void*...) but was requested offline, to allow for a platform to progress from not having Futex support (say, today) to having Futex (eventually, later).

What this ABI hardening does not include is support for changing the type of "__libcpp_platform_contention_t" from a uint32_t to a uint64_t, later. Once a platform chooses to expose Futex, it's an ABI break to change the size of that, so it's worth pondering whether the platform should be held back until it can support uint64_t Futex.

This revision also introduces an internal-only abstraction layer called "__atomic_positive_ptrdiff_t" which centralizes a lot of turning concerns for both latches and semaphores, when layered on top of atomics, for different configurations.

In this revision the __APPLE__ configuration is a bit quirky: 1) the headers build as if Futex is enabled and is a uint64_t, but 2) the dylib builds as if Futex is disabled and leans on the cross-ABI compatibility to fall-back to mutexes and condvars. Also, this is not quirky but my new recommendation, on __APPLE__ it no longer uses dispatch semaphores.


Repository:
  rCXX libc++

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68480/new/

https://reviews.llvm.org/D68480

Files:
  libcxx/include/CMakeLists.txt
  libcxx/include/__threading_support
  libcxx/include/atomic
  libcxx/include/barrier
  libcxx/include/chrono
  libcxx/include/cstddef
  libcxx/include/latch
  libcxx/include/module.modulemap
  libcxx/include/semaphore
  libcxx/include/stdexcept
  libcxx/include/type_traits
  libcxx/src/CMakeLists.txt
  libcxx/src/atomic.cpp
  libcxx/src/barrier.cpp
  libcxx/src/semaphore.cpp
  libcxx/test/libcxx/double_include.sh.cpp
  libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.wait/atomic_wait.pass.cpp
  libcxx/test/std/thread/thread.barrier/arrive.pass.cpp
  libcxx/test/std/thread/thread.barrier/arrive_and_drop.pass.cpp
  libcxx/test/std/thread/thread.barrier/arrive_and_wait.pass.cpp
  libcxx/test/std/thread/thread.barrier/completion.pass.cpp
  libcxx/test/std/thread/thread.barrier/version.pass.cpp
  libcxx/test/std/thread/thread.latch/arrive_and_wait.pass.cpp
  libcxx/test/std/thread/thread.latch/count_down.pass.cpp
  libcxx/test/std/thread/thread.latch/try_wait.pass.cpp
  libcxx/test/std/thread/thread.latch/version.pass.cpp
  libcxx/test/std/thread/thread.semaphore/acquire.pass.cpp
  libcxx/test/std/thread/thread.semaphore/binary.pass.cpp
  libcxx/test/std/thread/thread.semaphore/max.pass.cpp
  libcxx/test/std/thread/thread.semaphore/release.pass.cpp
  libcxx/test/std/thread/thread.semaphore/timed.pass.cpp
  libcxx/test/std/thread/thread.semaphore/try_acquire.pass.cpp
  libcxx/test/std/thread/thread.semaphore/version.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68480.226990.patch
Type: text/x-patch
Size: 89052 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20191029/bb4d0081/attachment-0001.bin>


More information about the libcxx-commits mailing list