You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2013/03/25 20:32:49 UTC

[1/2] git commit: TS-1742: use __sync_val_compare_and_swap for atomic 16 byte reads

Updated Branches:
  refs/heads/master 630983580 -> 70e108885


TS-1742: use __sync_val_compare_and_swap for atomic 16 byte reads

clang correctly emits cmpxchg16b for __sync_val_compare_and_swap(),
so let's use that instead of __sync_fetch_and_add().


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/18aadb0c
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/18aadb0c
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/18aadb0c

Branch: refs/heads/master
Commit: 18aadb0c7b1a7f74935107764696bba702608635
Parents: 6309835
Author: James Peach <jp...@apache.org>
Authored: Mon Mar 25 12:30:58 2013 -0700
Committer: James Peach <jp...@apache.org>
Committed: Mon Mar 25 12:30:58 2013 -0700

----------------------------------------------------------------------
 lib/ts/ink_queue.h |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/18aadb0c/lib/ts/ink_queue.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_queue.h b/lib/ts/ink_queue.h
index 20fbf9a..8cd1cc9 100644
--- a/lib/ts/ink_queue.h
+++ b/lib/ts/ink_queue.h
@@ -72,7 +72,9 @@ extern "C"
 #endif
 
 #if TS_HAS_128BIT_CAS
-#define INK_QUEUE_LD(dst,src) *(__int128_t*)&(dst) = __sync_fetch_and_add((__int128_t*)&(src), 0)
+#define INK_QUEUE_LD(dst, src) do { \
+  *(__int128_t*)&(dst) = __sync_val_compare_and_swap((__int128_t*)&(src), 0, 0); \
+} while (0)
 #else
 #define INK_QUEUE_LD(dst,src) INK_QUEUE_LD64(dst,src)
 #endif


[2/2] git commit: TS-1742: Re-enable 16 byte compare and swap by default

Posted by jp...@apache.org.
TS-1742: Re-enable 16 byte compare and swap by default


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/70e10888
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/70e10888
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/70e10888

Branch: refs/heads/master
Commit: 70e10888506cdd41fa8eae86a2878cfb8a71f0fa
Parents: 18aadb0
Author: James Peach <jp...@apache.org>
Authored: Mon Mar 25 12:32:31 2013 -0700
Committer: James Peach <jp...@apache.org>
Committed: Mon Mar 25 12:32:31 2013 -0700

----------------------------------------------------------------------
 configure.ac |   52 +++++++++++++++++++++++++---------------------------
 1 files changed, 25 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/70e10888/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index 4561409..fe1648a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1108,33 +1108,31 @@ AC_SUBST(need_union_semun)
 AC_MSG_CHECKING(for 128bit CAS support)
 AC_LANG_PUSH([C++])
 
-dnl TS_TRY_COMPILE_NO_WARNING([],[
-dnl     __int128_t x = 0;
-dnl     __sync_bool_compare_and_swap(&x,0,10);
-dnl   ], [
-dnl     AC_MSG_RESULT(yes)
-dnl     has_128bit_cas=1
-dnl   ], [
-dnl       dnl If 128bit CAS fails, try again with the -mcx16 option. GCC needs this;
-dnl       dnl clang doesn't; icc is unknown but presumed sane.
-dnl     __saved_CXXFLAGS="${CXXFLAGS}"
-dnl     TS_ADDTO(CXXFLAGS, [-mcx16])
-dnl     TS_TRY_COMPILE_NO_WARNING([],[
-dnl         __int128_t x = 0;
-dnl         __sync_bool_compare_and_swap(&x,0,10);
-dnl       ], [
-dnl         AC_MSG_RESULT(yes)
-dnl         has_128bit_cas=1
-dnl         dnl Keep CFLAGS and CXXFLAGS in sync.
-dnl         TS_ADDTO(CFLAGS, [-mcx16])
-dnl       ], [
-dnl         AC_MSG_RESULT(no)
-dnl         has_128bit_cas=0
-dnl         CXXFLAGS="${__saved_CXXFLAGS}"
-dnl     ])
-dnl ])
-
-has_128bit_cas=0
+TS_TRY_COMPILE_NO_WARNING([],[
+    __int128_t x = 0;
+    __sync_bool_compare_and_swap(&x,0,10);
+  ], [
+    AC_MSG_RESULT(yes)
+    has_128bit_cas=1
+  ], [
+      dnl If 128bit CAS fails, try again with the -mcx16 option. GCC needs this;
+      dnl clang doesn't; icc is unknown but presumed sane.
+    __saved_CXXFLAGS="${CXXFLAGS}"
+    TS_ADDTO(CXXFLAGS, [-mcx16])
+    TS_TRY_COMPILE_NO_WARNING([],[
+        __int128_t x = 0;
+        __sync_bool_compare_and_swap(&x,0,10);
+      ], [
+        AC_MSG_RESULT(yes)
+        has_128bit_cas=1
+        dnl Keep CFLAGS and CXXFLAGS in sync.
+        TS_ADDTO(CFLAGS, [-mcx16])
+      ], [
+        AC_MSG_RESULT(no)
+        has_128bit_cas=0
+        CXXFLAGS="${__saved_CXXFLAGS}"
+    ])
+])
 
 AC_LANG_POP
 AC_SUBST(has_128bit_cas)