From: Mikael Ronstrom Date: May 3 2011 11:18am Subject: bzr commit into mysql-5.5 branch (mikael.ronstrom:3140) List-Archive: http://lists.mysql.com/commits/136561 Message-Id: <201105031119.p43BJN8a004549@dator6> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5870024211892750500==" --===============5870024211892750500== MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline #At file:///home/mikael/mysql_clones/mysql-5.5-wl5136_community/ based on revid:mikael.ronstrom@stripped 3140 Mikael Ronstrom 2011-05-03 Introduced possibility to cache line alignment of variables in portable manner modified: include/my_global.h === modified file 'include/my_global.h' --- a/include/my_global.h revid:mikael.ronstrom@stripped +++ b/include/my_global.h revid:mikael.ronstrom@stripped @@ -1464,6 +1464,41 @@ static inline double rint(double x) #endif #endif +/* Define for cache aligned data declaration */ +#define CACHE_LINE_SIZE 128 +#ifdef _MSC_VER +/* Aligned declarations are available since Visual C++ .Net 2003 == _MSC_VER=1310 */ +# if (_MSC_VER >= 1310) +# define CACHE_ALIGNED_DECLARE(declare, var_name) __declspec( align (CACHE_LINE_SIZE)) declare +# else +# define CACHE_ALIGNED_DECLARE(declare) declare +# endif +#elif (defined(__GNUC__)) +/* Aligned declarations are available since GCC 3.0 == __GNUC__ >= 3 */ +# if (__GNUC__ >= 3) +# define CACHE_ALIGNED_DECLARE(declare, varname) declare __attribute__ ((aligned (CACHE_LINE_SIZE))) +# else +# define CACHE_ALIGNED_DECLARE(declare) declare +# endif +#elif (defined(__SUNPRO_C) || defined(__SUNPRO_CC)) +/* + Aligned declarations are available at least as of Sun Studio 11. However + didn't manage to discover what __SUNPRO_C is set to for Sun Studio 11 so + used 0x590 instead which is Sun Studio 12. + + Note that within a namespace the varname must be mangled name of the variable. +*/ +# if (defined(__SUNPRO_C) && __SUNPRO_C >= 0x590) || (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x590) +# define CACHE_ALIGNED_DECLARE(declare, varname) \ + pragma align CACHE_LINE_SIZE(varname) \ + declare +# else +# define CACHE_ALIGNED_DECLARE(declare) declare +# endif +#else +#define CACHE_ALIGNED_DECLARE(declare) declare +#endif + /* Defines that are unique to the embedded version of MySQL */ #ifdef EMBEDDED_LIBRARY --===============5870024211892750500== MIME-Version: 1.0 Content-Type: text/bzr-bundle; charset="us-ascii"; name="bzr/mikael.ronstrom@stripped" Content-Transfer-Encoding: 7bit Content-Disposition: inline # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: mikael.ronstrom@stripped\ # a61w98bpfzmfjp1k # target_branch: file:///home/mikael/mysql_clones/mysql-5.5-\ # wl5136_community/ # testament_sha1: b85342744bab03100e1c75b4f48889fe93605088 # timestamp: 2011-05-03 13:18:23 +0200 # base_revision_id: mikael.ronstrom@stripped\ # 4yslf502qltlu46z # # Begin bundle IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWRK/Ek8AAjzfgGAQWf//937n 2xS////0UAWhvbOiLxce1WVb172O9CSUGgJkk/TEaTTJqMaZEZqZPKM1NMnqNA9QZTQJqbI0owI9 I00AAAAAADQJIQmgaTQEKZqeyp6J6gDIxDTQAPUAbUkNRP1T0j2pA00aGgNBoNBkGgMnqbUMJIVB kZCfqmanop7Sm0yCZoAgDI9QDCHwNtODkibz7/qZHd5VHvj8FWmZgxJmoT0tEJ8cuQogyXgORz2Z NnsAVwn0MgaM2+nj7EcKaKXZ8u6FmYgk0n2PV0uNa3nQFbnztjc7qN999xjwGHlN+YCp97LDDCs9 3rFxj9RpraGGPq0QEiieBpbsbmUgstMLCjebR/oFFNb+MNr2ZU52rKek9bnKUPLA/BrNfb6ImzmO FNx222d23dXqTsjWJGUxGTU6LqM2pKENeNOJez1FShkW4htN00hIUtzukWA5hD1Zas72gVd1eQl5 OnTPnxYZ3VdMSRfQvAOIT1zp3b7UF4ZwMRsXT0O2zUgRcyvkiTCkG1xxX7xpxR3JVTqGbBJmcr52 9MCMaG85cbxgIoBeC1z3KF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