From: Date: July 10 2008 11:30am Subject: bzr push into mysql-6.0-falcon branch (olav:2742 to 2743) Bug#37622 List-Archive: http://lists.mysql.com/commits/49409 X-Bug: 37622 Message-Id: <20080710093011.27595.qmail@khepri11> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 2743 Olav Sandstaa 2008-07-10 Partial fix to Bug#37622 Falcon does not compile on Solaris 9 on SPARC using Sun Studio compiler Changes to Falcon's configure and build system in order to support Sun Studio's inline templates for assembly code. added: storage/falcon/CompareAndSwapSparc.il modified: storage/falcon/Interlock.h storage/falcon/Makefile.am storage/falcon/plug.in 2742 Hakan Kuecuekyilmaz 2008-07-10 Fixed falcon_bug_37344_A and falcon_bug_22150. modified: mysql-test/suite/falcon/r/falcon_bug_22150.result mysql-test/suite/falcon/r/falcon_bug_37344_A.result mysql-test/suite/falcon/t/falcon_bug_22150.test mysql-test/suite/falcon/t/falcon_bug_37344_A.test === added file 'storage/falcon/CompareAndSwapSparc.il' === added file 'storage/falcon/CompareAndSwapSparc.il' --- a/storage/falcon/CompareAndSwapSparc.il 1970-01-01 00:00:00 +0000 +++ b/storage/falcon/CompareAndSwapSparc.il 2008-07-10 09:27:51 +0000 @@ -0,0 +1,12 @@ + + +/* Implements inline_cas_uint - empty this far */ +.inline compareswap + nop +.end + + +/* Implements inline_cas_ptr - empty this far */ +.inline compareswapptr + nop +.end === modified file 'storage/falcon/Interlock.h' --- a/storage/falcon/Interlock.h 2008-06-26 22:04:56 +0000 +++ b/storage/falcon/Interlock.h 2008-07-10 09:27:51 +0000 @@ -18,6 +18,12 @@ #if defined(__sparcv8) || defined(__sparcv9) || defined(__sun) #include + +#if defined(__SunOS_5_9) +extern "C" int compareswap(volatile int *target, int compare, int exchange); +extern "C" char compareswapptr(volatile void **target, void *compare, void *exchange); +#endif /* __SunOS_5_9 */ + #endif #define INTERLOCKED_INCREMENT(variable) interlockedIncrement(&variable) @@ -147,6 +153,10 @@ return (compare == atomic_cas_uint((volatile uint_t *)target, compare, exchange)); #else # error cas not defined. We need >= Solaris 10 + /* Not implemented yet - just an example of how to call inline assembly */ + char ret = compareswap(target, compare, exchange); + + return ret; #endif #else @@ -257,6 +267,10 @@ return (char)(compare == atomic_cas_ptr(target, compare, exchange)); #else # error cas not defined. We need >= Solaris 10 + /* Not implemented yet - just an example for calling inline assembly */ + char ret = compareswapptr(target, compare, exchange); + + return ret; #endif #else === modified file 'storage/falcon/Makefile.am' --- a/storage/falcon/Makefile.am 2008-06-19 15:09:45 +0000 +++ b/storage/falcon/Makefile.am 2008-07-10 09:27:51 +0000 @@ -23,7 +23,8 @@ INCLUDES= -I$(top_srcdir)/include -I$(top_builddir)/include \ -I$(top_srcdir)/regex -I$(top_srcdir)/sql \ - -I$(srcdir) -I$(srcdir)/TransformLib @ZLIB_INCLUDES@ + -I$(srcdir) -I$(srcdir)/TransformLib @ZLIB_INCLUDES@ \ + @FALCON_SPARC_ASSEMBLY@ falcon_headers= Agent.h Alias.h Application.h \ AsciiBlob.h \ === modified file 'storage/falcon/plug.in' --- a/storage/falcon/plug.in 2008-04-23 17:45:42 +0000 +++ b/storage/falcon/plug.in 2008-07-10 09:27:51 +0000 @@ -94,4 +94,20 @@ esac AC_SUBST([FALCON_CXXFLAGS]) + + # When compiling with Sun Studio compiler on SPARC assembly code for + # Interlock operations needs to be included. This has been implemented + # as "inline templates" in a separate file + FALCON_SPARC_ASSEMBLY="" + case $host in + sparc-sun-solaris2.9) + case $CXX_VERSION in + *Sun*C++*) + FALCON_SPARC_ASSEMBLY="CompareAndSwapSparc.il" + ;; + esac + ;; + esac + + AC_SUBST([FALCON_SPARC_ASSEMBLY]) ])