[libc++] Mark a few functions in the dylib as noexcept (#94098)
This avoids generating landing pads in some of the `atomic` functions that will never be used, since these functions never throw exceptions.
This commit is contained in:
parent
7e5bc71514
commit
4748b494e1
@ -71,19 +71,21 @@ struct __atomic_wait_poll_impl {
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
|
||||
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(void const volatile*);
|
||||
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(void const volatile*);
|
||||
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t __libcpp_atomic_monitor(void const volatile*);
|
||||
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __libcpp_atomic_wait(void const volatile*, __cxx_contention_t);
|
||||
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(void const volatile*) _NOEXCEPT;
|
||||
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(void const volatile*) _NOEXCEPT;
|
||||
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t
|
||||
__libcpp_atomic_monitor(void const volatile*) _NOEXCEPT;
|
||||
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void
|
||||
__libcpp_atomic_wait(void const volatile*, __cxx_contention_t) _NOEXCEPT;
|
||||
|
||||
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void
|
||||
__cxx_atomic_notify_one(__cxx_atomic_contention_t const volatile*);
|
||||
__cxx_atomic_notify_one(__cxx_atomic_contention_t const volatile*) _NOEXCEPT;
|
||||
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void
|
||||
__cxx_atomic_notify_all(__cxx_atomic_contention_t const volatile*);
|
||||
__cxx_atomic_notify_all(__cxx_atomic_contention_t const volatile*) _NOEXCEPT;
|
||||
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t
|
||||
__libcpp_atomic_monitor(__cxx_atomic_contention_t const volatile*);
|
||||
__libcpp_atomic_monitor(__cxx_atomic_contention_t const volatile*) _NOEXCEPT;
|
||||
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void
|
||||
__libcpp_atomic_wait(__cxx_atomic_contention_t const volatile*, __cxx_contention_t);
|
||||
__libcpp_atomic_wait(__cxx_atomic_contention_t const volatile*, __cxx_contention_t) _NOEXCEPT;
|
||||
|
||||
template <class _AtomicWaitable, class _Poll>
|
||||
struct __atomic_wait_backoff_impl {
|
||||
|
||||
@ -102,10 +102,10 @@ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI __barrier_algorithm_base*
|
||||
__construct_barrier_algorithm_base(ptrdiff_t& __expected);
|
||||
|
||||
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI bool
|
||||
__arrive_barrier_algorithm_base(__barrier_algorithm_base* __barrier, __barrier_phase_t __old_phase);
|
||||
__arrive_barrier_algorithm_base(__barrier_algorithm_base* __barrier, __barrier_phase_t __old_phase) noexcept;
|
||||
|
||||
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void
|
||||
__destroy_barrier_algorithm_base(__barrier_algorithm_base* __barrier);
|
||||
__destroy_barrier_algorithm_base(__barrier_algorithm_base* __barrier) noexcept;
|
||||
|
||||
template <class _CompletionF>
|
||||
class __barrier_base {
|
||||
|
||||
@ -169,17 +169,18 @@ static void __libcpp_atomic_notify(void const volatile* __location) {
|
||||
&__entry->__platform_state,
|
||||
false /* when laundering, we can't handle notify_one */);
|
||||
}
|
||||
_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(void const volatile* __location) {
|
||||
_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(void const volatile* __location) noexcept {
|
||||
__libcpp_atomic_notify(__location);
|
||||
}
|
||||
_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(void const volatile* __location) {
|
||||
_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(void const volatile* __location) noexcept {
|
||||
__libcpp_atomic_notify(__location);
|
||||
}
|
||||
_LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t __libcpp_atomic_monitor(void const volatile* __location) {
|
||||
_LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t __libcpp_atomic_monitor(void const volatile* __location) noexcept {
|
||||
auto const __entry = __libcpp_contention_state(__location);
|
||||
return __libcpp_contention_monitor_for_wait(&__entry->__contention_state, &__entry->__platform_state);
|
||||
}
|
||||
_LIBCPP_EXPORTED_FROM_ABI void __libcpp_atomic_wait(void const volatile* __location, __cxx_contention_t __old_value) {
|
||||
_LIBCPP_EXPORTED_FROM_ABI void
|
||||
__libcpp_atomic_wait(void const volatile* __location, __cxx_contention_t __old_value) noexcept {
|
||||
auto const __entry = __libcpp_contention_state(__location);
|
||||
__libcpp_contention_wait(&__entry->__contention_state, &__entry->__platform_state, __old_value);
|
||||
}
|
||||
@ -187,19 +188,19 @@ _LIBCPP_EXPORTED_FROM_ABI void __libcpp_atomic_wait(void const volatile* __locat
|
||||
/* When the incoming atomic happens to be the platform wait size, we still need to use the
|
||||
table for the contention detection, but we can use the atomic directly for the wait. */
|
||||
|
||||
_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(__cxx_atomic_contention_t const volatile* __location) {
|
||||
_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(__cxx_atomic_contention_t const volatile* __location) noexcept {
|
||||
__libcpp_contention_notify(&__libcpp_contention_state(__location)->__contention_state, __location, true);
|
||||
}
|
||||
_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(__cxx_atomic_contention_t const volatile* __location) {
|
||||
_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(__cxx_atomic_contention_t const volatile* __location) noexcept {
|
||||
__libcpp_contention_notify(&__libcpp_contention_state(__location)->__contention_state, __location, false);
|
||||
}
|
||||
// This function is never used, but still exported for ABI compatibility.
|
||||
_LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t
|
||||
__libcpp_atomic_monitor(__cxx_atomic_contention_t const volatile* __location) {
|
||||
__libcpp_atomic_monitor(__cxx_atomic_contention_t const volatile* __location) noexcept {
|
||||
return __libcpp_contention_monitor_for_wait(&__libcpp_contention_state(__location)->__contention_state, __location);
|
||||
}
|
||||
_LIBCPP_EXPORTED_FROM_ABI void
|
||||
__libcpp_atomic_wait(__cxx_atomic_contention_t const volatile* __location, __cxx_contention_t __old_value) {
|
||||
__libcpp_atomic_wait(__cxx_atomic_contention_t const volatile* __location, __cxx_contention_t __old_value) noexcept {
|
||||
__libcpp_contention_wait(&__libcpp_contention_state(__location)->__contention_state, __location, __old_value);
|
||||
}
|
||||
|
||||
|
||||
@ -63,10 +63,10 @@ _LIBCPP_EXPORTED_FROM_ABI __barrier_algorithm_base* __construct_barrier_algorith
|
||||
return new __barrier_algorithm_base(__expected);
|
||||
}
|
||||
_LIBCPP_EXPORTED_FROM_ABI bool
|
||||
__arrive_barrier_algorithm_base(__barrier_algorithm_base* __barrier, __barrier_phase_t __old_phase) {
|
||||
__arrive_barrier_algorithm_base(__barrier_algorithm_base* __barrier, __barrier_phase_t __old_phase) noexcept {
|
||||
return __barrier->__arrive(__old_phase);
|
||||
}
|
||||
_LIBCPP_EXPORTED_FROM_ABI void __destroy_barrier_algorithm_base(__barrier_algorithm_base* __barrier) {
|
||||
_LIBCPP_EXPORTED_FROM_ABI void __destroy_barrier_algorithm_base(__barrier_algorithm_base* __barrier) noexcept {
|
||||
delete __barrier;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user