List:Commits« Previous MessageNext Message »
From:marko.makela Date:April 6 2011 6:22am
Subject:bzr commit into mysql-5.5-innodb branch (marko.makela:3360)
View as plain text  
#At file:///home/marko/innobase/dev/mysql2a/5.5-innodb/ based on revid:marko.makela@strippedmsl3dzr530ue

 3360 Marko Mäkelä	2011-04-06
      Enable __attribute__((cold)) only for GCC 4.3 and later.
      This attribute was introduced in bzr revision-id
      marko.makela@stripped
      and caused older GCC versions to emit warnings.

    modified:
      storage/innobase/include/os0thread.h
      storage/innobase/include/univ.i
      storage/innobase/include/ut0dbg.h
      storage/innobase/include/ut0ut.h
=== modified file 'storage/innobase/include/os0thread.h'
--- a/storage/innobase/include/os0thread.h	revid:marko.makela@stripped
+++ b/storage/innobase/include/os0thread.h	revid:marko.makela@oracle.com-20110406062236-y11o0ddrwgxnvw8i
@@ -109,7 +109,7 @@ os_thread_exit(
 /*===========*/
 	void*	exit_value)	/*!< in: exit value; in Windows this void*
 				is cast as a DWORD */
-	__attribute__((cold, noreturn));
+	UNIV_COLD __attribute__((noreturn));
 /*****************************************************************//**
 Returns the thread identifier of current thread.
 @return	current thread identifier */

=== modified file 'storage/innobase/include/univ.i'
--- a/storage/innobase/include/univ.i	revid:marko.makela@stripped
+++ b/storage/innobase/include/univ.i	revid:marko.makela@oracle.com-20110406062236-y11o0ddrwgxnvw8i
@@ -255,6 +255,19 @@ easy way to get it to work. See http://b
 #else
 # define UNIV_INTERN
 #endif
+#if defined __GNUC__ && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+/** Starting with GCC 4.3, the "cold" attribute is used to inform the
+compiler that a function is unlikely executed.  The function is
+optimized for size rather than speed and on many targets it is placed
+into special subsection of the text section so all cold functions
+appears close together improving code locality of non-cold parts of
+program.  The paths leading to call of cold functions within code are
+marked as unlikely by the branch prediction mechanism.  optimize a
+rarely invoked function for size instead for speed. */
+# define UNIV_COLD __attribute__((cold))
+#else
+# define UNIV_COLD /* empty */
+#endif
 
 #ifndef UNIV_MUST_NOT_INLINE
 /* Definition for inline version */

=== modified file 'storage/innobase/include/ut0dbg.h'
--- a/storage/innobase/include/ut0dbg.h	revid:marko.makela@stripped
+++ b/storage/innobase/include/ut0dbg.h	revid:marko.makela@strippedom-20110406062236-y11o0ddrwgxnvw8i
@@ -53,7 +53,7 @@ ut_dbg_assertion_failed(
 	const char*	expr,	/*!< in: the failed assertion */
 	const char*	file,	/*!< in: source file containing the assertion */
 	ulint		line)	/*!< in: line number of the assertion */
-	__attribute__((nonnull(2), cold));
+	UNIV_COLD __attribute__((nonnull(2)));
 
 #if defined(__WIN__) || defined(__INTEL_COMPILER)
 # undef UT_DBG_USE_ABORT

=== modified file 'storage/innobase/include/ut0ut.h'
--- a/storage/innobase/include/ut0ut.h	revid:marko.makela@stripped
+++ b/storage/innobase/include/ut0ut.h	revid:marko.makela@oracle.com-20110406062236-y11o0ddrwgxnvw8i
@@ -276,7 +276,7 @@ void
 ut_print_timestamp(
 /*===============*/
 	FILE*	file)	/*!< in: file where to print */
-	__attribute__((nonnull, cold));
+	UNIV_COLD __attribute__((nonnull));
 /**********************************************************//**
 Sprintfs a timestamp to a buffer, 13..14 chars plus terminating NUL. */
 UNIV_INTERN

Attachment: [text/bzr-bundle] bzr/marko.makela@oracle.com-20110406062236-y11o0ddrwgxnvw8i.bundle
Thread
bzr commit into mysql-5.5-innodb branch (marko.makela:3360) marko.makela6 Apr