Hi!
"knielsen" == knielsen <knielsen@knielsen-hq.org> writes:
knielsen> #At lp:maria knielsen> 2703 knielsen@knielsen-hq.org 2009-06-10 knielsen> Fix XtraDB to build with atomic operations, for good performance. knielsen> The root of the problem is that ./configure mixed together two different things. One is the knielsen> availability of GCC atomic operation intrinsics. The other is the selection of which knielsen> primitives to use for my_atomic implementation. knielsen> Then at some point a hack was made to not use GCC intrinsics in my_atomic to work around knielsen> some test failures. But because the two things are mixed in ./configure, this as a side knielsen> effect also makes GCC intrinsics unavailable for XtraDB. knielsen> Fixed by splitting this in two in configure, so that we have HAVE_GCC_ATOMIC_BUILTINS for knielsen> GCC intrinsics availability and MY_ATOMIC_MODE_GCC_BUILTINS for use in my_atomic. knielsen> modified: knielsen> configure.in knielsen> include/atomic/nolock.h knielsen> === modified file 'configure.in' knielsen> --- a/configure.in 2009-04-23 13:06:16 +0000 knielsen> +++ b/configure.in 2009-06-10 09:13:53 +0000 knielsen> @@ -1726,6 +1726,30 @@ then knielsen> fi knielsen> fi knielsen> +AC_CACHE_CHECK([whether the compiler provides atomic builtins], knielsen> + [mysql_cv_gcc_atomic_builtins], [AC_TRY_RUN([ knielsen> + int main() knielsen> + { knielsen> + int foo= -10; int bar= 10; knielsen> + if (!__sync_fetch_and_add(&foo, bar) || foo) knielsen> + return -1; knielsen> + bar= __sync_lock_test_and_set(&foo, bar); knielsen> + if (bar || foo != 10) knielsen> + return -1; knielsen> + bar= __sync_val_compare_and_swap(&bar, foo, 15); knielsen> + if (bar) knielsen> + return -1; knielsen> + return 0; knielsen> + } knielsen> +], [mysql_cv_gcc_atomic_builtins=yes], knielsen> + [mysql_cv_gcc_atomic_builtins=no], knielsen> + [mysql_cv_gcc_atomic_builtins=no])]) knielsen> + knielsen> +if test "x$mysql_cv_gcc_atomic_builtins" = xyes; then knielsen> + AC_DEFINE(HAVE_GCC_ATOMIC_BUILTINS, 1, knielsen> + [Define to 1 if compiler provides atomic builtins.]) knielsen> +fi knielsen> + knielsen> AC_ARG_WITH([atomic-ops], knielsen> AC_HELP_STRING([--with-atomic-ops=rwlocks|smp|up], knielsen> [Implement atomic operations using pthread rwlocks or atomic CPU knielsen> @@ -1739,28 +1763,9 @@ case "$with_atomic_ops" in knielsen> [Use pthread rwlocks for atomic ops]) ;; knielsen> "smp") ;; knielsen> "") knielsen> - AC_CACHE_CHECK([whether the compiler provides atomic builtins], knielsen> - [mysql_cv_gcc_atomic_builtins], [AC_TRY_RUN([ knielsen> - int main() knielsen> - { knielsen> - int foo= -10; int bar= 10; knielsen> - if (!__sync_fetch_and_add(&foo, bar) || foo) knielsen> - return -1; knielsen> - bar= __sync_lock_test_and_set(&foo, bar); knielsen> - if (bar || foo != 10) knielsen> - return -1; knielsen> - bar= __sync_val_compare_and_swap(&bar, foo, 15); knielsen> - if (bar) knielsen> - return -1; knielsen> - return 0; knielsen> - } knielsen> - ], [mysql_cv_gcc_atomic_builtins=yes_but_disabled], knielsen> - [mysql_cv_gcc_atomic_builtins=no], knielsen> - [mysql_cv_gcc_atomic_builtins=no])]) knielsen> - knielsen> - if test "x$mysql_cv_gcc_atomic_builtins" = xyes; then knielsen> - AC_DEFINE(HAVE_GCC_ATOMIC_BUILTINS, 1, knielsen> - [Define to 1 if compiler provides atomic builtins.]) knielsen> + if test "x$mysql_cv_gcc_atomic_builtins" = xyes_but_disabled; then knielsen> + AC_DEFINE([MY_ATOMIC_MODE_GCC_BUILTINS], [1], knielsen> + [Use GCC atomic builtins for atomic ops]) <cut> Under which circumstances could the last 'if' be true? The new code don't seem to be able to set mysql_cv_gcc_atomic_builtins to yes_but_disabled which makes the last if always false and we never define MY_ATOMIC_MODE_GCC_BUILTINS as 1. Regards, Monty