backout bug 415563 because a gcc4.3 bug causes it to break our 32bit linux builders r=ted
authorBrad Lassey <blassey@mozilla.com>
Sat, 05 Jun 2010 13:15:50 -0400
changeset 43126 8bc975526c0fb0912701477a79f0b94789dce9c2
parent 43125 b5b016bb7c91740a438ecc24d1cbc41fb61a9302
child 43127 098cf0d0c599fdcfedbc6ee5aadf01259e9dcd09
push idunknown
push userunknown
push dateunknown
reviewersted
bugs415563
milestone1.9.3a5pre
backout bug 415563 because a gcc4.3 bug causes it to break our 32bit linux builders r=ted
nsprpub/pr/include/pratom.h
nsprpub/pr/src/misc/prinit.c
nsprpub/pr/src/pthreads/ptsynch.c
nsprpub/pr/src/pthreads/ptthread.c
nsprpub/pr/src/threads/combined/pruthr.c
nsprpub/pr/src/threads/prtpd.c
--- a/nsprpub/pr/include/pratom.h
+++ b/nsprpub/pr/include/pratom.h
@@ -120,22 +120,20 @@ long __cdecl _InterlockedDecrement(long 
 #pragma intrinsic(_InterlockedDecrement)
 
 long __cdecl _InterlockedExchange(long volatile *Target, long Value);
 #pragma intrinsic(_InterlockedExchange)
 
 long __cdecl _InterlockedExchangeAdd(long volatile *Addend, long Value);
 #pragma intrinsic(_InterlockedExchangeAdd)
 
-#define PR_ATOMIC_INCREMENT(val)   _InterlockedIncrement((long volatile *)val)
-#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))
+#define PR_ATOMIC_INCREMENT(val) _InterlockedIncrement(val)
+#define PR_ATOMIC_DECREMENT(val) _InterlockedDecrement(val)
+#define PR_ATOMIC_SET(val, newval) _InterlockedExchange(val, newval)
+#define PR_ATOMIC_ADD(ptr, val) (_InterlockedExchangeAdd(ptr, val) + (val))
 
 #elif ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && \
       ((defined(DARWIN) && \
            (defined(__ppc__) || defined(__i386__))) || \
        (defined(LINUX) && \
            (defined(__i386__) || defined(__ia64__) || defined(__x86_64__) || \
            (defined(__powerpc__) && !defined(__powerpc64__)) || \
            defined(__alpha))))
--- 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_ATOMIC_SET(&once->inProgress, 1) == 0) {
+	if (PR_AtomicSet(&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_ATOMIC_SET(&once->inProgress, 1) == 0) {
+	if (PR_AtomicSet(&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_ATOMIC_DECREMENT(&cv->notify_pending))
+            if (0 > PR_AtomicDecrement(&cv->notify_pending))
             {
                 pt_debug.delayed_cv_deletes += 1;
                 PR_DestroyCondVar(cv);
             }
 #else  /* defined(DEBUG) */
-            if (0 > PR_ATOMIC_DECREMENT(&cv->notify_pending))
+            if (0 > PR_AtomicDecrement(&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_ATOMIC_INCREMENT(&cvar->notify_pending);
+    (void)PR_AtomicIncrement(&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_ATOMIC_DECREMENT(&cvar->notify_pending))
+    if (0 > PR_AtomicDecrement(&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_ATOMIC_INCREMENT(&cv->notify_pending);
+        (void)PR_AtomicIncrement(&cv->notify_pending);
         rv = pthread_cond_broadcast(&cv->cv);
         PR_ASSERT(0 == rv);
-        if (0 > PR_ATOMIC_DECREMENT(&cv->notify_pending))
+        if (0 > PR_AtomicDecrement(&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_ATOMIC_INCREMENT(&_pr_systemActive);
+                PR_AtomicIncrement(&_pr_systemActive);
             }
-            else PR_ATOMIC_INCREMENT(&_pr_userActive);
+            else PR_AtomicIncrement(&_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_ATOMIC_INCREMENT(&_pr_tpd_highwater) - 1;  /* allocate index */
+    index = PR_AtomicIncrement(&_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 */