List:Commits« Previous MessageNext Message »
From:John David Duncan Date:September 27 2011 8:08pm
Subject:bzr push into mysql-5.5-cluster branch (john.duncan:3557 to 3559)
View as plain text  
 3559 John David Duncan	2011-09-27
      part(2) of previous change; use gcc atomics if available

    modified:
      storage/ndb/memcache/atomics.cmake
      storage/ndb/memcache/include/atomics.h
      storage/ndb/memcache/include/ndbmemcache_config.in
 3558 John David Duncan	2011-09-27
      storage/ndb/memcache: try "-march=pentium" with GCC atomic builtins.

    modified:
      storage/ndb/memcache/atomics.cmake
 3557 John David Duncan	2011-09-27
      Fix misuse of "const"

    modified:
      storage/ndb/memcache/src/Record.cc
=== modified file 'storage/ndb/memcache/atomics.cmake'
--- a/storage/ndb/memcache/atomics.cmake	2011-09-22 19:01:58 +0000
+++ b/storage/ndb/memcache/atomics.cmake	2011-09-27 19:36:26 +0000
@@ -16,7 +16,35 @@
 # Identify support for atomic operations
 IF(NOT MSVC)
 
-# HAVE_GCC_ATOMIC_BUILTINS is already checked by CMake somewhere else
+# HAVE_GCC_ATOMIC_BUILTINS is already checked by CMake, but if it's not defined
+# we're going to retest using "-march=pentium"
+
+
+  if(${CMAKE_COMPILER_IS_GNUCC} AND NOT ${HAVE_GCC_ATOMIC_BUILTINS})
+     set(OLD_FLAGS ${CMAKE_REQUIRED_FLAGS})
+     set(CMAKE_REQUIRED_FLAGS ${OLD_FLAGS} -march=pentium)
+     CHECK_C_SOURCE_RUNS(
+         "int main() {
+          volatile int foo= -10; 
+          volatile int bar= 10;
+          /* operation returns 0 and foo should be 0 */
+          if (!__sync_fetch_and_add(&foo, bar) || foo)
+            return -1;
+          bar= __sync_lock_test_and_set(&foo, bar);
+          /* Now bar is the return value 0 and foo is set to 10 */
+          if (bar || foo != 10)
+            return -1;
+          __sync_val_compare_and_swap(&bar, foo, 15);
+          /* CAS should have failed and bar is still 0 */
+          if (bar)
+            return -1;
+          return 0;
+        }"
+        HAVE_GCC_ATOMICS_WITH_ARCH_FLAG
+      )
+      set(CMAKE_REQUIRED_FLAGS ${OLD_FLAGS})
+  endif()
+
 
   CHECK_C_SOURCE_RUNS(
     "#include <libkern/OSAtomic.h>
@@ -39,7 +67,11 @@ IF(NOT MSVC)
   )
 ENDIF()
 
-IF(HAVE_GCC_ATOMIC_BUILTINS)
+IF(HAVE_GCC_ATOMICS_WITH_ARCH_FLAG)
+  add_definitions(-march=pentium)
+ENDIF()
+
+IF(HAVE_GCC_ATOMIC_BUILTINS OR HAVE_GCC_ATOMICS_WITH_ARCH_FLAG)
   MESSAGE(STATUS "Using gcc atomic builtins") 
 ELSEIF(HAVE_DARWIN_ATOMICS) 
   MESSAGE(STATUS "Using Darwin OSAtomic") 

=== modified file 'storage/ndb/memcache/include/atomics.h'
--- a/storage/ndb/memcache/include/atomics.h	2011-09-22 04:40:21 +0000
+++ b/storage/ndb/memcache/include/atomics.h	2011-09-27 19:36:26 +0000
@@ -31,7 +31,7 @@
 #define USE_SOLARIS_ATOMICS
 #elif defined HAVE_DARWIN_ATOMICS
 #define USE_DARWIN_ATOMICS 
-#elif defined HAVE_GCC_ATOMIC_BUILTINS
+#elif defined HAVE_GCC_ATOMIC_BUILTINS || defined HAVE_GCC_ATOMICS_WITH_ARCH_FLAG
 #define USE_GCC_ATOMICS
 #else 
 #error No atomic functions available.

=== modified file 'storage/ndb/memcache/include/ndbmemcache_config.in'
--- a/storage/ndb/memcache/include/ndbmemcache_config.in	2011-09-22 03:37:05 +0000
+++ b/storage/ndb/memcache/include/ndbmemcache_config.in	2011-09-27 19:36:26 +0000
@@ -33,6 +33,7 @@
 
 #cmakedefine HAVE_SOLARIS_ATOMICS
 #cmakedefine HAVE_DARWIN_ATOMICS
+#cmakedefine HAVE_GCC_ATOMICS_WITH_ARCH_FLAG
 
 #ifndef HAVE_INTTYPES_H
 #define PRIu64 "llu"

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.5-cluster branch (john.duncan:3557 to 3559) John David Duncan2 Oct