Below is the list of changes that have just been committed into a local
5.1 repository of serg. When serg does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2223 06/06/29 15:39:53 serg@stripped +5 -0
support for xadd emulation, workaround for Darwin
mysys/my_atomic.c
1.2 06/06/29 15:39:32 serg@stripped +1 -0
assert
include/my_atomic.h
1.3 06/06/29 15:39:32 serg@stripped +20 -6
support for xadd emulation, cleanup
include/atomic/x86-msvc.h
1.3 06/06/29 15:39:32 serg@stripped +1 -1
syntax error
include/atomic/x86-gcc.h
1.4 06/06/29 15:39:32 serg@stripped +12 -6
support for xadd emulation, workaround for Darwin
include/atomic/nolock.h
1.3 06/06/29 15:39:32 serg@stripped +4 -2
support for xadd emulation
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: serg
# Host: serg.mylan
# Root: /usr/home/serg/Abk/mysql-5.1
--- 1.2/include/atomic/nolock.h Sat Jun 17 16:19:50 2006
+++ 1.3/include/atomic/nolock.h Thu Jun 29 15:39:32 2006
@@ -15,11 +15,13 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#if defined(__i386__) || defined(_M_IX86)
+
#ifdef MY_ATOMIC_MODE_DUMMY
# define LOCK ""
#else
-# define LOCK "lock "
+# define LOCK "lock"
#endif
+
#ifdef __GNUC__
#include "x86-gcc.h"
#elif defined(_MSC_VER)
@@ -27,7 +29,7 @@
#endif
#endif
-#ifdef make_atomic_add_body
+#ifdef make_atomic_cas_body
typedef struct { } my_atomic_rwlock_t;
#define my_atomic_rwlock_destroy(name)
--- 1.3/include/atomic/x86-gcc.h Sat Jun 17 16:19:51 2006
+++ 1.4/include/atomic/x86-gcc.h Thu Jun 29 15:39:32 2006
@@ -20,19 +20,25 @@
architectures support double-word (128-bit) cas.
*/
-#define MY_ATOMIC_MODE "gcc-x86" ## LOCK
+#ifdef MY_ATOMIC_NO_XADD
+#define MY_ATOMIC_MODE "gcc-x86" LOCK "-no-xadd"
+#else
+#define MY_ATOMIC_MODE "gcc-x86" LOCK
+#endif
/* fix -ansi errors while maintaining readability */
#ifndef asm
#define asm __asm__
#endif
+#ifndef MY_ATOMIC_NO_XADD
#define make_atomic_add_body(S) \
- asm volatile (LOCK "xadd %0, %1;" : "+r" (v) , "+m" (*a))
+ asm volatile (LOCK "; xadd %0, %1;" : "+r" (v) , "+m" (*a))
+#endif
#define make_atomic_swap_body(S) \
- asm volatile ("xchg %0, %1;" : "+r" (v) , "+m" (*a))
+ asm volatile ("; xchg %0, %1;" : "+r" (v) , "+m" (*a))
#define make_atomic_cas_body(S) \
- asm volatile (LOCK "cmpxchg %3, %0; setz %2;" \
+ asm volatile (LOCK "; cmpxchg %3, %0; setz %2;" \
: "+m" (*a), "+a" (*cmp), "=q" (ret): "r" (set))
#ifdef MY_ATOMIC_MODE_DUMMY
@@ -45,9 +51,9 @@
*/
#define make_atomic_load_body(S) \
ret=0; \
- asm volatile (LOCK "cmpxchg %2, %0" \
+ asm volatile (LOCK "; cmpxchg %2, %0" \
: "+m" (*a), "+a" (ret): "r" (ret))
#define make_atomic_store_body(S) \
- asm volatile ("xchg %0, %1;" : "+m" (*a) : "r" (v))
+ asm volatile ("; xchg %0, %1;" : "+m" (*a) : "r" (v))
#endif
--- 1.2/include/atomic/x86-msvc.h Sat Jun 17 16:19:51 2006
+++ 1.3/include/atomic/x86-msvc.h Thu Jun 29 15:39:32 2006
@@ -26,7 +26,7 @@
#ifndef _atomic_h_cleanup_
#define _atomic_h_cleanup_ "atomic/x86-msvc.h"
-#define MY_ATOMIC_MODE "msvc-x86" ## LOCK
+#define MY_ATOMIC_MODE "msvc-x86" LOCK
#define make_atomic_add_body(S) \
_asm { \
--- 1.2/include/my_atomic.h Sat Jun 17 16:19:51 2006
+++ 1.3/include/my_atomic.h Thu Jun 29 15:39:32 2006
@@ -22,10 +22,17 @@
#include "atomic/nolock.h"
#endif
-#ifndef my_atomic_rwlock_init
+#ifndef make_atomic_cas_body
#include "atomic/rwlock.h"
#endif
+#ifndef make_atomic_add_body
+#define make_atomic_add_body(S) \
+ int ## S tmp=*a; \
+ while (!my_atomic_cas ## S(a, &tmp, tmp+v)); \
+ v=tmp;
+#endif
+
#ifdef HAVE_INLINE
#define make_atomic_add(S) \
@@ -87,15 +94,15 @@ extern void my_atomic_store ## S(int ##
#endif
-make_atomic_add( 8)
-make_atomic_add(16)
-make_atomic_add(32)
-
make_atomic_cas( 8)
make_atomic_cas(16)
make_atomic_cas(32)
make_atomic_cas(ptr)
+make_atomic_add( 8)
+make_atomic_add(16)
+make_atomic_add(32)
+
make_atomic_load( 8)
make_atomic_load(16)
make_atomic_load(32)
@@ -116,12 +123,19 @@ make_atomic_swap(ptr)
#undef make_atomic_load
#undef make_atomic_store
#undef make_atomic_swap
-#undef intaptr
+#undef make_atomic_add_body
+#undef make_atomic_cas_body
+#undef make_atomic_load_body
+#undef make_atomic_store_body
+#undef make_atomic_swap_body
+#undef intptr
#ifdef _atomic_h_cleanup_
#include _atomic_h_cleanup_
#undef _atomic_h_cleanup_
#endif
+
+typedef int32 intptr; /* TODO configure check */
#define MY_ATOMIC_OK 0
#define MY_ATOMIC_NOT_1CPU 1
--- 1.1/mysys/my_atomic.c Wed May 31 18:43:42 2006
+++ 1.2/mysys/my_atomic.c Thu Jun 29 15:39:32 2006
@@ -36,6 +36,7 @@
*/
int my_atomic_initialize()
{
+ DBUG_ASSERT(sizeof(intptr) == sizeof(void *));
/* currently the only thing worth checking is SMP/UP issue */
#ifdef MY_ATOMIC_MODE_DUMMY
return my_getncpus() == 1 ? MY_ATOMIC_OK : MY_ATOMIC_NOT_1CPU;
| Thread |
|---|
| • bk commit into 5.1 tree (serg:1.2223) | Sergei Golubchik | 29 Jun |