Title: [139553] trunk/Source/WTF
Revision
139553
Author
[email protected]
Date
2013-01-12 12:23:21 -0800 (Sat, 12 Jan 2013)

Log Message

Use __sync_add_and_fetch instead of __gnu_cxx::__exchange_and_add
https://bugs.webkit.org/show_bug.cgi?id=106729

After r139514 we need atomicIncrement(int64_t volatile*) for all platform. Now the
GCC implementation of atomicIncrement() is based on __gnu_cxx::__exchange_and_add,
which doesn't support int64_t type, but __sync_add_and_fetch does.

Reviewed by Benjamin Poulain.

* wtf/Atomics.h:
(WTF::atomicIncrement):
(WTF::atomicDecrement):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (139552 => 139553)


--- trunk/Source/WTF/ChangeLog	2013-01-12 20:16:16 UTC (rev 139552)
+++ trunk/Source/WTF/ChangeLog	2013-01-12 20:23:21 UTC (rev 139553)
@@ -1,3 +1,18 @@
+2013-01-12  Csaba Osztrogonác  <[email protected]>
+
+        Use __sync_add_and_fetch instead of __gnu_cxx::__exchange_and_add
+        https://bugs.webkit.org/show_bug.cgi?id=106729
+
+        After r139514 we need atomicIncrement(int64_t volatile*) for all platform. Now the
+        GCC implementation of atomicIncrement() is based on __gnu_cxx::__exchange_and_add,
+        which doesn't support int64_t type, but __sync_add_and_fetch does.
+
+        Reviewed by Benjamin Poulain.
+
+        * wtf/Atomics.h:
+        (WTF::atomicIncrement):
+        (WTF::atomicDecrement):
+
 2013-01-11  Filip Pizlo  <[email protected]>
 
         Add WTF_EXPORT_PRIVATE to printInternal() methods of PrintStream.h

Modified: trunk/Source/WTF/wtf/Atomics.h (139552 => 139553)


--- trunk/Source/WTF/wtf/Atomics.h	2013-01-12 20:16:16 UTC (rev 139552)
+++ trunk/Source/WTF/wtf/Atomics.h	2013-01-12 20:23:21 UTC (rev 139553)
@@ -118,9 +118,12 @@
 #elif COMPILER(GCC) && !CPU(SPARC64) // sizeof(_Atomic_word) != sizeof(int) on sparc64 gcc
 #define WTF_USE_LOCKFREE_THREADSAFEREFCOUNTED 1
 
-inline int atomicIncrement(int volatile* addend) { return __gnu_cxx::__exchange_and_add(addend, 1) + 1; }
-inline int atomicDecrement(int volatile* addend) { return __gnu_cxx::__exchange_and_add(addend, -1) - 1; }
+inline int atomicIncrement(int volatile* addend) { return __sync_add_and_fetch(addend, 1); }
+inline int atomicDecrement(int volatile* addend) { return __sync_sub_and_fetch(addend, 1); }
 
+inline int64_t atomicIncrement(int64_t volatile* addend) { return __sync_add_and_fetch(addend, 1); }
+inline int64_t atomicDecrement(int64_t volatile* addend) { return __sync_sub_and_fetch(addend, 1); }
+
 #endif
 
 #if OS(WINDOWS)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to