Bug 575620: Update NSPR to NSPR_4_8_6_BETA3. Includes patches for
bug 415563.
--- a/nsprpub/TAG-INFO
+++ b/nsprpub/TAG-INFO
@@ -1,1 +1,1 @@
-NSPR_4_8_6_BETA2
+NSPR_4_8_6_BETA3
--- a/nsprpub/config/prdepend.h
+++ b/nsprpub/config/prdepend.h
@@ -37,9 +37,8 @@
/*
* A dummy header file that is a dependency for all the object files.
* Used to force a full recompilation of NSPR in Mozilla's Tinderbox
* depend builds. See comments in rules.mk.
*/
#error "Do not include this header file."
-
--- a/nsprpub/pr/include/pratom.h
+++ b/nsprpub/pr/include/pratom.h
@@ -129,19 +129,21 @@ long __cdecl _InterlockedExchangeAdd(lon
#define PR_ATOMIC_DECREMENT(val) _InterlockedDecrement((long volatile *)(val))
#define PR_ATOMIC_SET(val, newval) \
_InterlockedExchange((long volatile *)(val), (long)(newval))
#define PR_ATOMIC_ADD(ptr, val) \
(_InterlockedExchangeAdd((long volatile *)(ptr), (long)(val)) + (val))
#elif ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && \
((defined(DARWIN) && \
- (defined(__ppc__) || defined(__i386__))) || \
+ (defined(__ppc__) || defined(__i386__) || defined(__x86_64__))) || \
(defined(LINUX) && \
- (defined(__i386__) || defined(__ia64__) || defined(__x86_64__) || \
+ ((defined(__i386__) && \
+ defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)) || \
+ defined(__ia64__) || defined(__x86_64__) || \
(defined(__powerpc__) && !defined(__powerpc64__)) || \
defined(__alpha))))
/*
* Because the GCC manual warns that some processors may support
* reduced functionality of __sync_lock_test_and_set, we test for the
* processors that we believe support a full atomic exchange operation.
*/
--- a/nsprpub/pr/include/prinit.h
+++ b/nsprpub/pr/include/prinit.h
@@ -58,17 +58,17 @@ PR_BEGIN_EXTERN_C
/*
** NSPR's version is used to determine the likelihood that the version you
** used to build your component is anywhere close to being compatible with
** what is in the underlying library.
**
** The format of the version string is
** "<major version>.<minor version>[.<patch level>] [<Beta>]"
*/
-#define PR_VERSION "4.8.6 Beta 2"
+#define PR_VERSION "4.8.6 Beta 3"
#define PR_VMAJOR 4
#define PR_VMINOR 8
#define PR_VPATCH 6
#define PR_BETA PR_TRUE
/*
** PRVersionCheck
**
--- a/nsprpub/pr/src/misc/prinit.c
+++ b/nsprpub/pr/src/misc/prinit.c
@@ -798,17 +798,17 @@ void _PR_CleanupCallOnce()
PR_IMPLEMENT(PRStatus) PR_CallOnce(
PRCallOnceType *once,
PRCallOnceFN func)
{
if (!_pr_initialized) _PR_ImplicitInitialization();
if (!once->initialized) {
- if (PR_AtomicSet(&once->inProgress, 1) == 0) {
+ if (PR_ATOMIC_SET(&once->inProgress, 1) == 0) {
once->status = (*func)();
PR_Lock(mod_init.ml);
once->initialized = 1;
PR_NotifyAllCondVar(mod_init.cv);
PR_Unlock(mod_init.ml);
} else {
PR_Lock(mod_init.ml);
while (!once->initialized) {
@@ -827,17 +827,17 @@ PR_IMPLEMENT(PRStatus) PR_CallOnce(
PR_IMPLEMENT(PRStatus) PR_CallOnceWithArg(
PRCallOnceType *once,
PRCallOnceWithArgFN func,
void *arg)
{
if (!_pr_initialized) _PR_ImplicitInitialization();
if (!once->initialized) {
- if (PR_AtomicSet(&once->inProgress, 1) == 0) {
+ if (PR_ATOMIC_SET(&once->inProgress, 1) == 0) {
once->status = (*func)(arg);
PR_Lock(mod_init.ml);
once->initialized = 1;
PR_NotifyAllCondVar(mod_init.cv);
PR_Unlock(mod_init.ml);
} else {
PR_Lock(mod_init.ml);
while (!once->initialized) {
--- a/nsprpub/pr/src/pthreads/ptsynch.c
+++ b/nsprpub/pr/src/pthreads/ptsynch.c
@@ -143,23 +143,23 @@ static void pt_PostNotifies(PRLock *lock
while (notified->cv[index].times-- > 0)
{
rv = pthread_cond_signal(&cv->cv);
PR_ASSERT(0 == rv);
}
}
#if defined(DEBUG)
pt_debug.cvars_notified += 1;
- if (0 > PR_AtomicDecrement(&cv->notify_pending))
+ if (0 > PR_ATOMIC_DECREMENT(&cv->notify_pending))
{
pt_debug.delayed_cv_deletes += 1;
PR_DestroyCondVar(cv);
}
#else /* defined(DEBUG) */
- if (0 > PR_AtomicDecrement(&cv->notify_pending))
+ if (0 > PR_ATOMIC_DECREMENT(&cv->notify_pending))
PR_DestroyCondVar(cv);
#endif /* defined(DEBUG) */
}
prev = notified;
notified = notified->link;
if (&post != prev) PR_DELETE(prev);
} while (NULL != notified);
} /* pt_PostNotifies */
@@ -333,17 +333,17 @@ static void pt_PostNotifyToCvar(PRCondVa
/* if there's no link, create an empty array and link it */
if (NULL == notified->link)
notified->link = PR_NEWZAP(_PT_Notified);
notified = notified->link;
}
/* A brand new entry in the array */
- (void)PR_AtomicIncrement(&cvar->notify_pending);
+ (void)PR_ATOMIC_INCREMENT(&cvar->notify_pending);
notified->cv[index].times = (broadcast) ? -1 : 1;
notified->cv[index].cv = cvar;
notified->length += 1;
finished:
PR_ASSERT(PR_TRUE == cvar->lock->locked);
PR_ASSERT(pthread_equal(cvar->lock->owner, pthread_self()));
} /* pt_PostNotifyToCvar */
@@ -362,17 +362,17 @@ PR_IMPLEMENT(PRCondVar*) PR_NewCondVar(P
pt_debug.cvars_created += 1;
#endif
}
return cv;
} /* PR_NewCondVar */
PR_IMPLEMENT(void) PR_DestroyCondVar(PRCondVar *cvar)
{
- if (0 > PR_AtomicDecrement(&cvar->notify_pending))
+ if (0 > PR_ATOMIC_DECREMENT(&cvar->notify_pending))
{
PRIntn rv = pthread_cond_destroy(&cvar->cv); PR_ASSERT(0 == rv);
#if defined(DEBUG)
memset(cvar, 0xaf, sizeof(PRCondVar));
pt_debug.cvars_destroyed += 1;
#endif
PR_Free(cvar);
}
--- a/nsprpub/pr/src/pthreads/ptthread.c
+++ b/nsprpub/pr/src/pthreads/ptthread.c
@@ -747,20 +747,20 @@ PR_IMPLEMENT(PRStatus) PR_Interrupt(PRTh
if (NULL == thred) return PR_FAILURE;
thred->state |= PT_THREAD_ABORTED;
cv = thred->waiting;
if ((NULL != cv) && !thred->interrupt_blocked)
{
PRIntn rv;
- (void)PR_AtomicIncrement(&cv->notify_pending);
+ (void)PR_ATOMIC_INCREMENT(&cv->notify_pending);
rv = pthread_cond_broadcast(&cv->cv);
PR_ASSERT(0 == rv);
- if (0 > PR_AtomicDecrement(&cv->notify_pending))
+ if (0 > PR_ATOMIC_DECREMENT(&cv->notify_pending))
PR_DestroyCondVar(cv);
}
return PR_SUCCESS;
} /* PR_Interrupt */
PR_IMPLEMENT(void) PR_ClearInterrupt(void)
{
PRThread *me = PR_GetCurrentThread();
--- a/nsprpub/pr/src/threads/combined/pruthr.c
+++ b/nsprpub/pr/src/threads/combined/pruthr.c
@@ -1160,19 +1160,19 @@ PR_IMPLEMENT(PRThread*) _PR_CreateThread
_PR_InitializeRecycledThread(thread);
thread->startFunc = start;
thread->arg = arg;
thread->flags = (flags | _PR_GLOBAL_SCOPE);
if (type == PR_SYSTEM_THREAD)
{
thread->flags |= _PR_SYSTEM;
- PR_AtomicIncrement(&_pr_systemActive);
+ PR_ATOMIC_INCREMENT(&_pr_systemActive);
}
- else PR_AtomicIncrement(&_pr_userActive);
+ else PR_ATOMIC_INCREMENT(&_pr_userActive);
if (state == PR_JOINABLE_THREAD) {
if (!thread->term)
thread->term = PR_NewCondVar(_pr_terminationCVLock);
}
else {
if(thread->term) {
PR_DestroyCondVar(thread->term);
--- a/nsprpub/pr/src/threads/prtpd.c
+++ b/nsprpub/pr/src/threads/prtpd.c
@@ -132,17 +132,17 @@ PR_IMPLEMENT(PRStatus) PR_NewThreadPriva
PRStatus rv;
PRInt32 index;
if (!_pr_initialized) _PR_ImplicitInitialization();
PR_ASSERT(NULL != newIndex);
PR_ASSERT(NULL != _pr_tpd_destructors);
- index = PR_AtomicIncrement(&_pr_tpd_highwater) - 1; /* allocate index */
+ index = PR_ATOMIC_INCREMENT(&_pr_tpd_highwater) - 1; /* allocate index */
if (_PR_TPD_LIMIT <= index)
{
PR_SetError(PR_TPD_RANGE_ERROR, 0);
rv = PR_FAILURE; /* that's just wrong */
}
else
{
_pr_tpd_destructors[index] = dtor; /* record destructor @index */