[Glibc-bsd-commits] r6157 - in trunk/glibc-ports-2.25/fbtl: . sysdeps/pthread
aurel32 at alioth.debian.org
aurel32 at alioth.debian.org
Fri Aug 4 13:35:49 UTC 2017
Author: aurel32
Date: 2017-08-04 13:35:49 +0000 (Fri, 04 Aug 2017)
New Revision: 6157
Modified:
trunk/glibc-ports-2.25/fbtl/allocatestack.c
trunk/glibc-ports-2.25/fbtl/cancellation.c
trunk/glibc-ports-2.25/fbtl/cleanup_defer.c
trunk/glibc-ports-2.25/fbtl/cleanup_defer_compat.c
trunk/glibc-ports-2.25/fbtl/cond-perf.c
trunk/glibc-ports-2.25/fbtl/nptl-init.c
trunk/glibc-ports-2.25/fbtl/perf.c
trunk/glibc-ports-2.25/fbtl/pthread_barrier_destroy.c
trunk/glibc-ports-2.25/fbtl/pthread_barrier_init.c
trunk/glibc-ports-2.25/fbtl/pthread_cond_timedwait.c
trunk/glibc-ports-2.25/fbtl/pthread_cond_wait.c
trunk/glibc-ports-2.25/fbtl/pthread_create.c
trunk/glibc-ports-2.25/fbtl/pthread_getattr_np.c
trunk/glibc-ports-2.25/fbtl/pthread_getspecific.c
trunk/glibc-ports-2.25/fbtl/pthread_join.c
trunk/glibc-ports-2.25/fbtl/pthread_key_delete.c
trunk/glibc-ports-2.25/fbtl/pthread_mutex_init.c
trunk/glibc-ports-2.25/fbtl/pthread_mutex_lock.c
trunk/glibc-ports-2.25/fbtl/pthread_mutex_timedlock.c
trunk/glibc-ports-2.25/fbtl/pthread_mutex_trylock.c
trunk/glibc-ports-2.25/fbtl/pthread_rwlock_rdlock.c
trunk/glibc-ports-2.25/fbtl/pthread_rwlock_timedrdlock.c
trunk/glibc-ports-2.25/fbtl/pthread_rwlock_timedwrlock.c
trunk/glibc-ports-2.25/fbtl/pthread_rwlock_tryrdlock.c
trunk/glibc-ports-2.25/fbtl/pthread_setcancelstate.c
trunk/glibc-ports-2.25/fbtl/pthread_setcanceltype.c
trunk/glibc-ports-2.25/fbtl/pthread_setschedprio.c
trunk/glibc-ports-2.25/fbtl/pthread_setspecific.c
trunk/glibc-ports-2.25/fbtl/sem_init.c
trunk/glibc-ports-2.25/fbtl/sigaction.c
trunk/glibc-ports-2.25/fbtl/sockperf.c
trunk/glibc-ports-2.25/fbtl/sysdeps/pthread/createthread.c
trunk/glibc-ports-2.25/fbtl/sysdeps/pthread/setxid.h
trunk/glibc-ports-2.25/fbtl/sysdeps/pthread/timer_create.c
trunk/glibc-ports-2.25/fbtl/sysdeps/pthread/unwind-forcedunwind.c
trunk/glibc-ports-2.25/fbtl/unwind.c
Log:
Use glibc_likely instead of __builtin_expect
Modified: trunk/glibc-ports-2.25/fbtl/allocatestack.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/allocatestack.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/allocatestack.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -315,7 +315,7 @@
stack_list_add (&stack->list, &stack_cache);
stack_cache_actsize += stack->stackblock_size;
- if (__builtin_expect (stack_cache_actsize > stack_cache_maxsize, 0))
+ if (__glibc_unlikely (stack_cache_actsize > stack_cache_maxsize))
__free_stacks (stack_cache_maxsize);
}
@@ -377,7 +377,7 @@
}
/* Get memory for the stack. */
- if (__builtin_expect (attr->flags & ATTR_FLAG_STACKADDR, 0))
+ if (__glibc_unlikely (attr->flags & ATTR_FLAG_STACKADDR))
{
uintptr_t adj;
@@ -513,7 +513,7 @@
mem = mmap (NULL, size, prot,
MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK, -1, 0);
- if (__builtin_expect (mem == MAP_FAILED, 0))
+ if (__glibc_unlikely (mem == MAP_FAILED))
return errno;
/* SIZE is guaranteed to be greater than zero.
@@ -534,7 +534,7 @@
/* Make sure the coloring offsets does not disturb the alignment
of the TCB and static TLS block. */
- if (__builtin_expect ((coloring & __static_tls_align_m1) != 0, 0))
+ if (__glibc_unlikely ((coloring & __static_tls_align_m1) != 0))
coloring = (((coloring + __static_tls_align_m1)
& ~(__static_tls_align_m1))
& ~pagesize_m1);
@@ -638,7 +638,7 @@
}
/* Create or resize the guard area if necessary. */
- if (__builtin_expect (guardsize > pd->guardsize, 0))
+ if (__glibc_unlikely (guardsize > pd->guardsize))
{
#ifdef NEED_SEPARATE_REGISTER_STACK
char *guard = mem + (((size - guardsize) / 2) & ~pagesize_m1);
@@ -761,7 +761,7 @@
not reset the 'used' flag in the 'tid' field. This is done by
the kernel. If no thread has been created yet this field is
still zero. */
- if (__builtin_expect (! pd->user_stack, 1))
+ if (__glibc_likely (! pd->user_stack))
(void) queue_stack (pd);
else
/* Free the memory associated with the ELF TLS. */
@@ -925,7 +925,7 @@
INIT_LIST_HEAD (&stack_used);
INIT_LIST_HEAD (&__stack_user);
- if (__builtin_expect (THREAD_GETMEM (self, user_stack), 0))
+ if (__glibc_unlikely (THREAD_GETMEM (self, user_stack)))
list_add (&self->list, &__stack_user);
else
list_add (&self->list, &stack_used);
Modified: trunk/glibc-ports-2.25/fbtl/cancellation.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/cancellation.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/cancellation.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -40,7 +40,7 @@
int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling, newval,
oldval);
- if (__builtin_expect (curval == oldval, 1))
+ if (__glibc_likely (curval == oldval))
{
if (CANCEL_ENABLED_AND_CANCELED_AND_ASYNCHRONOUS (newval))
{
@@ -79,7 +79,7 @@
int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling, newval,
oldval);
- if (__builtin_expect (curval == oldval, 1))
+ if (__glibc_likely (curval == oldval))
break;
/* Prepare the next round. */
Modified: trunk/glibc-ports-2.25/fbtl/cleanup_defer.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/cleanup_defer.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/cleanup_defer.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -34,14 +34,14 @@
int cancelhandling = THREAD_GETMEM (self, cancelhandling);
/* Disable asynchronous cancellation for now. */
- if (__builtin_expect (cancelhandling & CANCELTYPE_BITMASK, 0))
+ if (__glibc_unlikely (cancelhandling & CANCELTYPE_BITMASK))
while (1)
{
int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling,
cancelhandling
& ~CANCELTYPE_BITMASK,
cancelhandling);
- if (__builtin_expect (curval == cancelhandling, 1))
+ if (__glibc_likely (curval == cancelhandling))
/* Successfully replaced the value. */
break;
@@ -78,7 +78,7 @@
cancelhandling
| CANCELTYPE_BITMASK,
cancelhandling);
- if (__builtin_expect (curval == cancelhandling, 1))
+ if (__glibc_likely (curval == cancelhandling))
/* Successfully replaced the value. */
break;
Modified: trunk/glibc-ports-2.25/fbtl/cleanup_defer_compat.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/cleanup_defer_compat.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/cleanup_defer_compat.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -32,14 +32,14 @@
int cancelhandling = THREAD_GETMEM (self, cancelhandling);
/* Disable asynchronous cancellation for now. */
- if (__builtin_expect (cancelhandling & CANCELTYPE_BITMASK, 0))
+ if (__glibc_unlikely (cancelhandling & CANCELTYPE_BITMASK))
while (1)
{
int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling,
cancelhandling
& ~CANCELTYPE_BITMASK,
cancelhandling);
- if (__builtin_expect (curval == cancelhandling, 1))
+ if (__glibc_likely (curval == cancelhandling))
/* Successfully replaced the value. */
break;
@@ -75,7 +75,7 @@
cancelhandling
| CANCELTYPE_BITMASK,
cancelhandling);
- if (__builtin_expect (curval == cancelhandling, 1))
+ if (__glibc_likely (curval == cancelhandling))
/* Successfully replaced the value. */
break;
Modified: trunk/glibc-ports-2.25/fbtl/cond-perf.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/cond-perf.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/cond-perf.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -70,7 +70,7 @@
pthread_t th[nthreads];
int i;
for (i = 0; __builtin_expect (i < nthreads, 1); ++i)
- if (__builtin_expect ((err = pthread_create (&th[i], NULL, cons, (void *) (long) i)) != 0, 0))
+ if (__glibc_unlikely ((err = pthread_create (&th[i], NULL, cons, (void *) (long) i)) != 0))
printf ("pthread_create: %s\n", strerror (err));
for (i = 0; __builtin_expect (i < nrounds, 1); ++i)
Modified: trunk/glibc-ports-2.25/fbtl/nptl-init.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/nptl-init.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/nptl-init.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -178,7 +178,7 @@
/* Determine the process ID. It might be negative if the thread is
in the middle of a fork() call. */
pid_t pid = THREAD_GETMEM (THREAD_SELF, pid);
- if (__builtin_expect (pid < 0, 0))
+ if (__glibc_unlikely (pid < 0))
pid = -pid;
/* Safety check. It would be possible to call this function for
@@ -239,7 +239,7 @@
/* Determine the process ID. It might be negative if the thread is
in the middle of a fork() call. */
pid_t pid = THREAD_GETMEM (THREAD_SELF, pid);
- if (__builtin_expect (pid < 0, 0))
+ if (__glibc_unlikely (pid < 0))
pid = -pid;
#if 0
Modified: trunk/glibc-ports-2.25/fbtl/perf.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/perf.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/perf.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -633,7 +633,7 @@
return result;
fd = open ("/proc/cpuinfo", O_RDONLY);
- if (__builtin_expect (fd != -1, 1))
+ if (__glibc_likely (fd != -1))
{
/* XXX AFAIK the /proc filesystem can generate "files" only up
to a size of 4096 bytes. */
@@ -645,7 +645,7 @@
{
char *mhz = memmem (buf, n, "cpu MHz", 7);
- if (__builtin_expect (mhz != NULL, 1))
+ if (__glibc_likely (mhz != NULL))
{
char *endp = buf + n;
int seen_decpoint = 0;
Modified: trunk/glibc-ports-2.25/fbtl/pthread_barrier_destroy.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/pthread_barrier_destroy.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/pthread_barrier_destroy.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -31,7 +31,7 @@
lll_lock (ibarrier->lock, ibarrier->private ^ FUTEX_PRIVATE_FLAG);
- if (__builtin_expect (ibarrier->left == ibarrier->init_count, 1))
+ if (__glibc_likely (ibarrier->left == ibarrier->init_count))
/* The barrier is not used anymore. */
result = 0;
else
Modified: trunk/glibc-ports-2.25/fbtl/pthread_barrier_init.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/pthread_barrier_init.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/pthread_barrier_init.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -35,7 +35,7 @@
{
struct pthread_barrier *ibarrier;
- if (__builtin_expect (count == 0, 0))
+ if (__glibc_unlikely (count == 0))
return EINVAL;
const struct pthread_barrierattr *iattr
Modified: trunk/glibc-ports-2.25/fbtl/pthread_cond_timedwait.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/pthread_cond_timedwait.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/pthread_cond_timedwait.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -85,7 +85,7 @@
/* Work around the fact that the kernel rejects negative timeout values
despite them being valid. */
- if (__builtin_expect (abstime->tv_sec < 0, 0))
+ if (__glibc_unlikely (abstime->tv_sec < 0))
goto timeout;
/* Remember the mutex we are using here. If there is already a
@@ -141,7 +141,7 @@
--rt.tv_sec;
}
/* Did we already time out? */
- if (__builtin_expect (rt.tv_sec < 0, 0))
+ if (__glibc_unlikely (rt.tv_sec < 0))
{
if (cbuffer.bc_seq != cond->__data.__broadcast_seq)
goto bc_out;
@@ -215,7 +215,7 @@
break;
/* Not woken yet. Maybe the time expired? */
- if (__builtin_expect (err == -ETIMEDOUT, 0))
+ if (__glibc_unlikely (err == -ETIMEDOUT))
{
timeout:
/* Yep. Adjust the counters. */
Modified: trunk/glibc-ports-2.25/fbtl/pthread_cond_wait.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/pthread_cond_wait.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/pthread_cond_wait.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -117,7 +117,7 @@
/* Now we can release the mutex. */
err = __pthread_mutex_unlock_usercnt (mutex, 0);
- if (__builtin_expect (err, 0))
+ if (__glibc_unlikely (err))
{
lll_unlock (cond->__data.__lock, pshared);
return err;
Modified: trunk/glibc-ports-2.25/fbtl/pthread_create.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/pthread_create.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/pthread_create.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -211,7 +211,7 @@
abort ();
/* Free TPP data. */
- if (__builtin_expect (pd->tpp != NULL, 0))
+ if (__glibc_unlikely (pd->tpp != NULL))
{
struct priority_protection_data *tpp = pd->tpp;
@@ -250,7 +250,7 @@
__ctype_init ();
/* Allow setxid from now onwards. */
- if (__builtin_expect (atomic_exchange_acq (&pd->setxid_futex, 0) == -2, 0))
+ if (__glibc_unlikely (atomic_exchange_acq (&pd->setxid_futex, 0) == -2))
lll_futex_wake (&pd->setxid_futex, 1, LLL_PRIVATE);
#ifdef __NR_set_robust_list
@@ -269,7 +269,7 @@
/* If the parent was running cancellation handlers while creating
the thread the new thread inherited the signal mask. Reset the
cancellation signal mask. */
- if (__builtin_expect (pd->parent_cancelhandling & CANCELING_BITMASK, 0))
+ if (__glibc_unlikely (pd->parent_cancelhandling & CANCELING_BITMASK))
{
sigset_t mask;
__sigemptyset (&mask);
@@ -287,12 +287,12 @@
int not_first_call;
not_first_call = setjmp ((struct __jmp_buf_tag *) unwind_buf.cancel_jmp_buf);
- if (__builtin_expect (! not_first_call, 1))
+ if (__glibc_likely (! not_first_call))
{
/* Store the new cleanup handler info. */
THREAD_SETMEM (pd, cleanup_jmp_buf, &unwind_buf);
- if (__builtin_expect (pd->stopped_start, 0))
+ if (__glibc_unlikely (pd->stopped_start))
{
int oldtype = CANCEL_ASYNC ();
@@ -329,12 +329,12 @@
/* If this is the last thread we terminate the process now. We
do not notify the debugger, it might just irritate it if there
is no thread left. */
- if (__builtin_expect (atomic_decrement_and_test (&__nptl_nthreads), 0))
+ if (__glibc_unlikely (atomic_decrement_and_test (&__nptl_nthreads)))
/* This was the last thread. */
exit (0);
/* Report the death of the thread if this is wanted. */
- if (__builtin_expect (pd->report_events, 0))
+ if (__glibc_unlikely (pd->report_events))
{
/* See whether TD_DEATH is in any of the mask. */
const int idx = __td_eventword (TD_DEATH);
@@ -417,7 +417,7 @@
if (IS_DETACHED (pd))
/* Free the TCB. */
__free_tcb (pd);
- else if (__builtin_expect (pd->cancelhandling & SETXID_BITMASK, 0))
+ else if (__glibc_unlikely (pd->cancelhandling & SETXID_BITMASK))
{
/* Some other thread might call any of the setXid functions and expect
us to reply. In this case wait until we did that. */
@@ -484,7 +484,7 @@
int err = ALLOCATE_STACK (iattr, &pd);
int retval = 0;
- if (__builtin_expect (err != 0, 0))
+ if (__glibc_unlikely (err != 0))
/* Something went wrong. Maybe a parameter of the attributes is
invalid or we could not allocate memory. Note we have to
translate error codes. */
Modified: trunk/glibc-ports-2.25/fbtl/pthread_getattr_np.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/pthread_getattr_np.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/pthread_getattr_np.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -55,7 +55,7 @@
iattr->guardsize = thread->reported_guardsize;
/* The sizes are subject to alignment. */
- if (__builtin_expect (thread->stackblock != NULL, 1))
+ if (__glibc_likely (thread->stackblock != NULL))
{
iattr->stacksize = thread->stackblock_size;
iattr->stackaddr = (char *) thread->stackblock + iattr->stacksize;
Modified: trunk/glibc-ports-2.25/fbtl/pthread_getspecific.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/pthread_getspecific.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/pthread_getspecific.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -27,7 +27,7 @@
/* Special case access to the first 2nd-level block. This is the
usual case. */
- if (__builtin_expect (key < PTHREAD_KEY_2NDLEVEL_SIZE, 1))
+ if (__glibc_likely (key < PTHREAD_KEY_2NDLEVEL_SIZE))
data = &THREAD_SELF->specific_1stblock[key];
else
{
@@ -57,7 +57,7 @@
{
uintptr_t seq = data->seq;
- if (__builtin_expect (seq != __pthread_keys[key].seq, 0))
+ if (__glibc_unlikely (seq != __pthread_keys[key].seq))
result = data->data = NULL;
}
Modified: trunk/glibc-ports-2.25/fbtl/pthread_join.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/pthread_join.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/pthread_join.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -97,7 +97,7 @@
pthread_cleanup_pop (0);
- if (__builtin_expect (result == 0, 1))
+ if (__glibc_likely (result == 0))
{
/* We mark the thread as terminated and as joined. */
pd->tid = -1;
Modified: trunk/glibc-ports-2.25/fbtl/pthread_key_delete.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/pthread_key_delete.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/pthread_key_delete.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -26,7 +26,7 @@
{
int result = EINVAL;
- if (__builtin_expect (key < PTHREAD_KEYS_MAX, 1))
+ if (__glibc_likely (key < PTHREAD_KEYS_MAX))
{
unsigned int seq = __pthread_keys[key].seq;
Modified: trunk/glibc-ports-2.25/fbtl/pthread_mutex_init.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/pthread_mutex_init.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/pthread_mutex_init.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -58,7 +58,7 @@
#if 0
case PTHREAD_PRIO_INHERIT << PTHREAD_MUTEXATTR_PROTOCOL_SHIFT:
#ifndef __ASSUME_FUTEX_LOCK_PI
- if (__builtin_expect (tpi_supported == 0, 0))
+ if (__glibc_unlikely (tpi_supported == 0))
{
int lock = 0;
INTERNAL_SYSCALL_DECL (err);
@@ -67,7 +67,7 @@
assert (INTERNAL_SYSCALL_ERROR_P (ret, err));
tpi_supported = INTERNAL_SYSCALL_ERRNO (ret, err) == ENOSYS ? -1 : 1;
}
- if (__builtin_expect (tpi_supported < 0, 0))
+ if (__glibc_unlikely (tpi_supported < 0))
return ENOTSUP;
#endif
break;
Modified: trunk/glibc-ports-2.25/fbtl/pthread_mutex_lock.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/pthread_mutex_lock.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/pthread_mutex_lock.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -71,7 +71,7 @@
if (mutex->__data.__owner == id)
{
/* Just bump the counter. */
- if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
+ if (__glibc_unlikely (mutex->__data.__count + 1 == 0))
/* Overflow of the counter. */
return EAGAIN;
@@ -118,7 +118,7 @@
{
assert (type == PTHREAD_MUTEX_ERRORCHECK_NP);
/* Check whether we already hold the mutex. */
- if (__builtin_expect (mutex->__data.__owner == id, 0))
+ if (__glibc_unlikely (mutex->__data.__owner == id))
return EDEADLK;
goto simple;
}
@@ -198,7 +198,7 @@
}
/* Check whether we already hold the mutex. */
- if (__builtin_expect ((oldval & FUTEX_TID_MASK) == id, 0))
+ if (__glibc_unlikely ((oldval & FUTEX_TID_MASK) == id))
{
int kind = PTHREAD_MUTEX_TYPE (mutex);
if (kind == PTHREAD_MUTEX_ROBUST_ERRORCHECK_NP)
@@ -214,7 +214,7 @@
NULL);
/* Just bump the counter. */
- if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
+ if (__glibc_unlikely (mutex->__data.__count + 1 == 0))
/* Overflow of the counter. */
return EAGAIN;
@@ -265,7 +265,7 @@
oldval = mutex->__data.__lock;
/* Check whether we already hold the mutex. */
- if (__builtin_expect ((oldval & FUTEX_TID_MASK) == id, 0))
+ if (__glibc_unlikely ((oldval & FUTEX_TID_MASK) == id))
{
if (kind == PTHREAD_MUTEX_ERRORCHECK_NP)
{
@@ -278,7 +278,7 @@
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
/* Just bump the counter. */
- if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
+ if (__glibc_unlikely (mutex->__data.__count + 1 == 0))
/* Overflow of the counter. */
return EAGAIN;
@@ -328,7 +328,7 @@
assert (robust || (oldval & FUTEX_OWNER_DIED) == 0);
}
- if (__builtin_expect (oldval & FUTEX_OWNER_DIED, 0))
+ if (__glibc_unlikely (oldval & FUTEX_OWNER_DIED))
{
atomic_and (&mutex->__data.__lock, ~FUTEX_OWNER_DIED);
@@ -396,7 +396,7 @@
if (kind == PTHREAD_MUTEX_RECURSIVE_NP)
{
/* Just bump the counter. */
- if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
+ if (__glibc_unlikely (mutex->__data.__count + 1 == 0))
/* Overflow of the counter. */
return EAGAIN;
Modified: trunk/glibc-ports-2.25/fbtl/pthread_mutex_timedlock.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/pthread_mutex_timedlock.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/pthread_mutex_timedlock.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -48,7 +48,7 @@
if (mutex->__data.__owner == id)
{
/* Just bump the counter. */
- if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
+ if (__glibc_unlikely (mutex->__data.__count + 1 == 0))
/* Overflow of the counter. */
return EAGAIN;
@@ -71,7 +71,7 @@
/* Error checking mutex. */
case PTHREAD_MUTEX_ERRORCHECK_NP:
/* Check whether we already hold the mutex. */
- if (__builtin_expect (mutex->__data.__owner == id, 0))
+ if (__glibc_unlikely (mutex->__data.__owner == id))
return EDEADLK;
/* FALLTHROUGH */
@@ -153,7 +153,7 @@
}
/* Check whether we already hold the mutex. */
- if (__builtin_expect ((oldval & FUTEX_TID_MASK) == id, 0))
+ if (__glibc_unlikely ((oldval & FUTEX_TID_MASK) == id))
{
int kind = PTHREAD_MUTEX_TYPE (mutex);
if (kind == PTHREAD_MUTEX_ROBUST_ERRORCHECK_NP)
@@ -169,7 +169,7 @@
NULL);
/* Just bump the counter. */
- if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
+ if (__glibc_unlikely (mutex->__data.__count + 1 == 0))
/* Overflow of the counter. */
return EAGAIN;
@@ -228,7 +228,7 @@
oldval = mutex->__data.__lock;
/* Check whether we already hold the mutex. */
- if (__builtin_expect ((oldval & FUTEX_TID_MASK) == id, 0))
+ if (__glibc_unlikely ((oldval & FUTEX_TID_MASK) == id))
{
if (kind == PTHREAD_MUTEX_ERRORCHECK_NP)
{
@@ -241,7 +241,7 @@
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
/* Just bump the counter. */
- if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
+ if (__glibc_unlikely (mutex->__data.__count + 1 == 0))
/* Overflow of the counter. */
return EAGAIN;
@@ -315,7 +315,7 @@
assert (robust || (oldval & FUTEX_OWNER_DIED) == 0);
}
- if (__builtin_expect (oldval & FUTEX_OWNER_DIED, 0))
+ if (__glibc_unlikely (oldval & FUTEX_OWNER_DIED))
{
atomic_and (&mutex->__data.__lock, ~FUTEX_OWNER_DIED);
@@ -378,7 +378,7 @@
if (kind == PTHREAD_MUTEX_RECURSIVE_NP)
{
/* Just bump the counter. */
- if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
+ if (__glibc_unlikely (mutex->__data.__count + 1 == 0))
/* Overflow of the counter. */
return EAGAIN;
Modified: trunk/glibc-ports-2.25/fbtl/pthread_mutex_trylock.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/pthread_mutex_trylock.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/pthread_mutex_trylock.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -38,7 +38,7 @@
if (mutex->__data.__owner == id)
{
/* Just bump the counter. */
- if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
+ if (__glibc_unlikely (mutex->__data.__count + 1 == 0))
/* Overflow of the counter. */
return EAGAIN;
@@ -111,7 +111,7 @@
}
/* Check whether we already hold the mutex. */
- if (__builtin_expect ((oldval & FUTEX_TID_MASK) == id, 0))
+ if (__glibc_unlikely ((oldval & FUTEX_TID_MASK) == id))
{
int kind = PTHREAD_MUTEX_TYPE (mutex);
if (kind == PTHREAD_MUTEX_ROBUST_ERRORCHECK_NP)
@@ -127,7 +127,7 @@
NULL);
/* Just bump the counter. */
- if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
+ if (__glibc_unlikely (mutex->__data.__count + 1 == 0))
/* Overflow of the counter. */
return EAGAIN;
@@ -189,7 +189,7 @@
oldval = mutex->__data.__lock;
/* Check whether we already hold the mutex. */
- if (__builtin_expect ((oldval & FUTEX_TID_MASK) == id, 0))
+ if (__glibc_unlikely ((oldval & FUTEX_TID_MASK) == id))
{
if (kind == PTHREAD_MUTEX_ERRORCHECK_NP)
{
@@ -202,7 +202,7 @@
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
/* Just bump the counter. */
- if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
+ if (__glibc_unlikely (mutex->__data.__count + 1 == 0))
/* Overflow of the counter. */
return EAGAIN;
@@ -248,7 +248,7 @@
oldval = mutex->__data.__lock;
}
- if (__builtin_expect (oldval & FUTEX_OWNER_DIED, 0))
+ if (__glibc_unlikely (oldval & FUTEX_OWNER_DIED))
{
atomic_and (&mutex->__data.__lock, ~FUTEX_OWNER_DIED);
@@ -315,7 +315,7 @@
if (kind == PTHREAD_MUTEX_RECURSIVE_NP)
{
/* Just bump the counter. */
- if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
+ if (__glibc_unlikely (mutex->__data.__count + 1 == 0))
/* Overflow of the counter. */
return EAGAIN;
Modified: trunk/glibc-ports-2.25/fbtl/pthread_rwlock_rdlock.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/pthread_rwlock_rdlock.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/pthread_rwlock_rdlock.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -44,7 +44,7 @@
|| PTHREAD_RWLOCK_PREFER_READER_P (rwlock)))
{
/* Increment the reader counter. Avoid overflow. */
- if (__builtin_expect (++rwlock->__data.__nr_readers == 0, 0))
+ if (__glibc_unlikely (++rwlock->__data.__nr_readers == 0))
{
/* Overflow on number of readers. */
--rwlock->__data.__nr_readers;
@@ -66,7 +66,7 @@
}
/* Remember that we are a reader. */
- if (__builtin_expect (++rwlock->__data.__nr_readers_queued == 0, 0))
+ if (__glibc_unlikely (++rwlock->__data.__nr_readers_queued == 0))
{
/* Overflow on number of queued readers. */
--rwlock->__data.__nr_readers_queued;
Modified: trunk/glibc-ports-2.25/fbtl/pthread_rwlock_timedrdlock.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/pthread_rwlock_timedrdlock.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/pthread_rwlock_timedrdlock.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -77,7 +77,7 @@
/* Work around the fact that the kernel rejects negative timeout values
despite them being valid. */
- if (__builtin_expect (abstime->tv_sec < 0, 0))
+ if (__glibc_unlikely (abstime->tv_sec < 0))
{
result = ETIMEDOUT;
break;
Modified: trunk/glibc-ports-2.25/fbtl/pthread_rwlock_timedwrlock.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/pthread_rwlock_timedwrlock.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/pthread_rwlock_timedwrlock.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -69,7 +69,7 @@
/* Work around the fact that the kernel rejects negative timeout values
despite them being valid. */
- if (__builtin_expect (abstime->tv_sec < 0, 0))
+ if (__glibc_unlikely (abstime->tv_sec < 0))
{
result = ETIMEDOUT;
break;
Modified: trunk/glibc-ports-2.25/fbtl/pthread_rwlock_tryrdlock.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/pthread_rwlock_tryrdlock.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/pthread_rwlock_tryrdlock.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -32,7 +32,7 @@
&& (rwlock->__data.__nr_writers_queued == 0
|| PTHREAD_RWLOCK_PREFER_READER_P (rwlock)))
{
- if (__builtin_expect (++rwlock->__data.__nr_readers == 0, 0))
+ if (__glibc_unlikely (++rwlock->__data.__nr_readers == 0))
{
--rwlock->__data.__nr_readers;
result = EAGAIN;
Modified: trunk/glibc-ports-2.25/fbtl/pthread_setcancelstate.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/pthread_setcancelstate.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/pthread_setcancelstate.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -53,7 +53,7 @@
atomically since other bits could be modified as well. */
int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling, newval,
oldval);
- if (__builtin_expect (curval == oldval, 1))
+ if (__glibc_likely (curval == oldval))
{
if (CANCEL_ENABLED_AND_CANCELED_AND_ASYNCHRONOUS (newval))
__do_cancel ();
Modified: trunk/glibc-ports-2.25/fbtl/pthread_setcanceltype.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/pthread_setcanceltype.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/pthread_setcanceltype.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -53,7 +53,7 @@
atomically since other bits could be modified as well. */
int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling, newval,
oldval);
- if (__builtin_expect (curval == oldval, 1))
+ if (__glibc_likely (curval == oldval))
{
if (CANCEL_ENABLED_AND_CANCELED_AND_ASYNCHRONOUS (newval))
{
Modified: trunk/glibc-ports-2.25/fbtl/pthread_setschedprio.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/pthread_setschedprio.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/pthread_setschedprio.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -46,7 +46,7 @@
param.sched_priority = pd->tpp->priomax;
/* Try to set the scheduler information. */
- if (__builtin_expect (sched_setparam (pd->tid, ¶m) == -1, 0))
+ if (__glibc_unlikely (sched_setparam (pd->tid, ¶m) == -1))
result = errno;
else
{
Modified: trunk/glibc-ports-2.25/fbtl/pthread_setspecific.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/pthread_setspecific.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/pthread_setspecific.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -34,7 +34,7 @@
/* Special case access to the first 2nd-level block. This is the
usual case. */
- if (__builtin_expect (key < PTHREAD_KEY_2NDLEVEL_SIZE, 1))
+ if (__glibc_likely (key < PTHREAD_KEY_2NDLEVEL_SIZE))
{
/* Verify the key is sane. */
if (KEY_UNUSED ((seq = __pthread_keys[key].seq)))
Modified: trunk/glibc-ports-2.25/fbtl/sem_init.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/sem_init.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/sem_init.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -28,7 +28,7 @@
__new_sem_init (sem_t *sem, int pshared, unsigned int value)
{
/* Parameter sanity check. */
- if (__builtin_expect (value > SEM_VALUE_MAX, 0))
+ if (__glibc_unlikely (value > SEM_VALUE_MAX))
{
__set_errno (EINVAL);
return -1;
@@ -60,7 +60,7 @@
__old_sem_init (sem_t *sem, int pshared, unsigned int value)
{
/* Parameter sanity check. */
- if (__builtin_expect (value > SEM_VALUE_MAX, 0))
+ if (__glibc_unlikely (value > SEM_VALUE_MAX))
{
__set_errno (EINVAL);
return -1;
Modified: trunk/glibc-ports-2.25/fbtl/sigaction.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/sigaction.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/sigaction.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -31,7 +31,7 @@
int
__sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
{
- if (__builtin_expect (sig == SIGCANCEL || sig == SIGSETXID, 0))
+ if (__glibc_unlikely (sig == SIGCANCEL || sig == SIGSETXID))
{
__set_errno (EINVAL);
return -1;
Modified: trunk/glibc-ports-2.25/fbtl/sockperf.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/sockperf.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/sockperf.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -479,7 +479,7 @@
return result;
fd = open ("/proc/cpuinfo", O_RDONLY);
- if (__builtin_expect (fd != -1, 1))
+ if (__glibc_likely (fd != -1))
{
/* XXX AFAIK the /proc filesystem can generate "files" only up
to a size of 4096 bytes. */
@@ -491,7 +491,7 @@
{
char *mhz = memmem (buf, n, "cpu MHz", 7);
- if (__builtin_expect (mhz != NULL, 1))
+ if (__glibc_likely (mhz != NULL))
{
char *endp = buf + n;
int seen_decpoint = 0;
Modified: trunk/glibc-ports-2.25/fbtl/sysdeps/pthread/createthread.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/sysdeps/pthread/createthread.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/sysdeps/pthread/createthread.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -74,7 +74,7 @@
struct thr_param p;
- if (__builtin_expect (stopped != 0, 0))
+ if (__glibc_unlikely (stopped != 0))
/* We make sure the thread does not run far by forcing it to get a
lock. We lock it here too so that the new thread cannot continue
until we tell it to. */
@@ -112,7 +112,7 @@
#endif
- if (__builtin_expect (rc == -1, 0))
+ if (__glibc_unlikely (rc == -1))
{
atomic_decrement (&__nptl_nthreads); /* Oops, we lied for a second. */
pd->ktid = 0;
@@ -132,7 +132,7 @@
#warning set scheduling parameters
#if 0
/* Now we have the possibility to set scheduling parameters etc. */
- if (__builtin_expect (stopped != 0, 0))
+ if (__glibc_unlikely (stopped != 0))
{
INTERNAL_SYSCALL_DECL (err);
int res = 0;
@@ -143,7 +143,7 @@
res = INTERNAL_SYSCALL (sched_setaffinity, err, 3, pd->tid,
attr->cpusetsize, attr->cpuset);
- if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (res, err), 0))
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res, err)))
{
/* The operation failed. We have to kill the thread. First
send it the cancellation signal. */
@@ -168,7 +168,7 @@
res = INTERNAL_SYSCALL (sched_setscheduler, err, 3, pd->tid,
pd->schedpolicy, &pd->schedparam);
- if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (res, err), 0))
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res, err)))
goto err_out;
}
}
@@ -228,7 +228,7 @@
| 0);
#endif
- if (__builtin_expect (THREAD_GETMEM (THREAD_SELF, report_events), 0))
+ if (__glibc_unlikely (THREAD_GETMEM (THREAD_SELF, report_events)))
{
/* The parent thread is supposed to report events. Check whether
the TD_CREATE event is needed, too. */
Modified: trunk/glibc-ports-2.25/fbtl/sysdeps/pthread/setxid.h
===================================================================
--- trunk/glibc-ports-2.25/fbtl/sysdeps/pthread/setxid.h 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/sysdeps/pthread/setxid.h 2017-08-04 13:35:49 UTC (rev 6157)
@@ -48,7 +48,7 @@
({ \
extern __typeof (__nptl_setxid) __nptl_setxid __attribute__((weak));\
int __result; \
- if (__builtin_expect (__nptl_setxid != NULL, 0)) \
+ if (__glibc_unlikely (__nptl_setxid != NULL)) \
{ \
struct xid_command __cmd; \
__cmd.syscall_no = __NR_##name; \
Modified: trunk/glibc-ports-2.25/fbtl/sysdeps/pthread/timer_create.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/sysdeps/pthread/timer_create.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/sysdeps/pthread/timer_create.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -68,7 +68,7 @@
pthread_mutex_lock (&__timer_mutex);
newtimer = __timer_alloc ();
- if (__builtin_expect (newtimer == NULL, 0))
+ if (__glibc_unlikely (newtimer == NULL))
{
__set_errno (EAGAIN);
goto unlock_bail;
@@ -123,7 +123,7 @@
thread = __timer_thread_alloc (&newtimer->attr, clock_id);
/* Out of luck; no threads are available. */
- if (__builtin_expect (thread == NULL, 0))
+ if (__glibc_unlikely (thread == NULL))
{
__set_errno (EAGAIN);
goto unlock_bail;
Modified: trunk/glibc-ports-2.25/fbtl/sysdeps/pthread/unwind-forcedunwind.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/sysdeps/pthread/unwind-forcedunwind.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/sysdeps/pthread/unwind-forcedunwind.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -42,7 +42,7 @@
void *getcfa;
void *handle;
- if (__builtin_expect (libgcc_s_handle != NULL, 1))
+ if (__glibc_likely (libgcc_s_handle != NULL))
{
/* Force gcc to reload all values. */
asm volatile ("" ::: "memory");
@@ -93,7 +93,7 @@
void
_Unwind_Resume (struct _Unwind_Exception *exc)
{
- if (__builtin_expect (libgcc_s_handle == NULL, 0))
+ if (__glibc_unlikely (libgcc_s_handle == NULL))
pthread_cancel_init ();
else
atomic_read_barrier ();
@@ -109,7 +109,7 @@
struct _Unwind_Exception *ue_header,
struct _Unwind_Context *context)
{
- if (__builtin_expect (libgcc_s_handle == NULL, 0))
+ if (__glibc_unlikely (libgcc_s_handle == NULL))
pthread_cancel_init ();
else
atomic_read_barrier ();
@@ -125,7 +125,7 @@
_Unwind_ForcedUnwind (struct _Unwind_Exception *exc, _Unwind_Stop_Fn stop,
void *stop_argument)
{
- if (__builtin_expect (libgcc_s_handle == NULL, 0))
+ if (__glibc_unlikely (libgcc_s_handle == NULL))
pthread_cancel_init ();
else
atomic_read_barrier ();
@@ -140,7 +140,7 @@
_Unwind_Word
_Unwind_GetCFA (struct _Unwind_Context *context)
{
- if (__builtin_expect (libgcc_s_handle == NULL, 0))
+ if (__glibc_unlikely (libgcc_s_handle == NULL))
pthread_cancel_init ();
else
atomic_read_barrier ();
Modified: trunk/glibc-ports-2.25/fbtl/unwind.c
===================================================================
--- trunk/glibc-ports-2.25/fbtl/unwind.c 2017-08-04 11:46:31 UTC (rev 6156)
+++ trunk/glibc-ports-2.25/fbtl/unwind.c 2017-08-04 13:35:49 UTC (rev 6157)
@@ -60,7 +60,7 @@
adj))
do_longjump = 1;
- if (__builtin_expect (curp != NULL, 0))
+ if (__glibc_unlikely (curp != NULL))
{
/* Handle the compatibility stuff. Execute all handlers
registered with the old method which would be unwound by this
More information about the Glibc-bsd-commits
mailing list