Commit 17a555bf authored by calvin's avatar calvin

branches/zip: Support inlining of functions and prefetch with

Sun Studio

Those changes are contributed by Sun/MySQL. Two sets of changes
in this patch when Sun Studio is used:
- Explicit inlining of functions
- Prefetch Support

This patch has been tested by Sunny with the plugin statically
built in. Since we've never built the plugin as a dynamically
loaded module on Solaris, it is a separate task to change
plug.in.

rb://142
Approved by: Heikki
parent 1935ee33
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved. Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 2008, Google Inc. Copyright (c) 2008, Google Inc.
Copyright (c) 2009, Sun Microsystems, Inc.
Portions of this file contain modifications contributed and copyrighted by Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described Google, Inc. Those modifications are gratefully acknowledged and are described
...@@ -9,6 +10,12 @@ briefly in the InnoDB documentation. The contributions by Google are ...@@ -9,6 +10,12 @@ briefly in the InnoDB documentation. The contributions by Google are
incorporated with their permission, and subject to the conditions contained in incorporated with their permission, and subject to the conditions contained in
the file COPYING.Google. the file COPYING.Google.
Portions of this file contain modifications contributed and copyrighted by
Sun Microsystems, Inc. Those modifications are gratefully acknowledged and
are described briefly in the InnoDB documentation. The contributions by
Sun Microsystems are incorporated with their permission, and subject to the
conditions contained in the file COPYING.Sun_Microsystems.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License. Foundation; version 2 of the License.
...@@ -136,9 +143,9 @@ from Makefile.in->ut0auxconf.h */ ...@@ -136,9 +143,9 @@ from Makefile.in->ut0auxconf.h */
#endif /* HAVE_ATOMIC_BUILTINS */ #endif /* HAVE_ATOMIC_BUILTINS */
/* We only try to do explicit inlining of functions with gcc and /* We only try to do explicit inlining of functions with gcc and
Microsoft Visual C++ */ Sun Studio */
# if !defined(__GNUC__) # if !defined(__GNUC__) && !(defined(__SUNPRO_C) || defined(__SUNPRO_CC))
# undef UNIV_MUST_NOT_INLINE /* Remove compiler warning */ # undef UNIV_MUST_NOT_INLINE /* Remove compiler warning */
# define UNIV_MUST_NOT_INLINE # define UNIV_MUST_NOT_INLINE
# endif # endif
...@@ -238,8 +245,6 @@ by one. */ ...@@ -238,8 +245,6 @@ by one. */
that are only referenced from within InnoDB, not from MySQL */ that are only referenced from within InnoDB, not from MySQL */
#if defined(__GNUC__) && (__GNUC__ >= 4) #if defined(__GNUC__) && (__GNUC__ >= 4)
# define UNIV_INTERN __attribute__((visibility ("hidden"))) # define UNIV_INTERN __attribute__((visibility ("hidden")))
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
# define UNIV_INTERN __hidden
#else #else
# define UNIV_INTERN # define UNIV_INTERN
#endif #endif
...@@ -248,9 +253,11 @@ that are only referenced from within InnoDB, not from MySQL */ ...@@ -248,9 +253,11 @@ that are only referenced from within InnoDB, not from MySQL */
/* Definition for inline version */ /* Definition for inline version */
#ifdef __WIN__ #ifdef __WIN__
#define UNIV_INLINE __inline # define UNIV_INLINE __inline
#elif defined(__SUNPRO_CC) || defined(__SUNPRO_C)
# define UNIV_INLINE static inline
#else #else
#define UNIV_INLINE static __inline__ # define UNIV_INLINE static __inline__
#endif #endif
#else #else
...@@ -391,6 +398,17 @@ it is read. */ ...@@ -391,6 +398,17 @@ it is read. */
/* Minimize cache-miss latency by moving data at addr into a cache before /* Minimize cache-miss latency by moving data at addr into a cache before
it is read or written. */ it is read or written. */
# define UNIV_PREFETCH_RW(addr) __builtin_prefetch(addr, 1, 3) # define UNIV_PREFETCH_RW(addr) __builtin_prefetch(addr, 1, 3)
#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
# include <sun_prefetch.h>
#if __SUNPRO_C >= 0x550
# undef UNIV_INTERN
# define UNIV_INTERN __hidden
#endif /* __SUNPRO_C >= 0x550 */
/* Use sun_prefetch when compile with Sun Studio */
# define UNIV_EXPECT(expr,value) (expr)
# define UNIV_LIKELY_NULL(expr) (expr)
# define UNIV_PREFETCH_R(addr) sun_prefetch_read_many(addr)
# define UNIV_PREFETCH_RW(addr) sun_prefetch_write_many(addr)
#else #else
/* Dummy versions of the macros */ /* Dummy versions of the macros */
# define UNIV_EXPECT(expr,value) (expr) # define UNIV_EXPECT(expr,value) (expr)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment