Below is the list of changes that have just been committed into a local
5.0 repository of marko. When marko does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.1871 05/06/10 12:29:35 marko@stripped +1 -0
innobase/include/univ.i: Added some comments.
innobase/include/univ.i
1.42 05/06/10 12:29:27 marko@stripped +15 -5
Replace PRULINT with ULINTPF in a comment.
Document the macros based on __builtin_expect()
and __builtin_prefetch().
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: marko
# Host: hundin.mysql.fi
# Root: /home/marko/mysql-5.0
--- 1.41/innobase/include/univ.i Thu Apr 21 14:23:17 2005
+++ 1.42/innobase/include/univ.i Fri Jun 10 12:29:27 2005
@@ -181,7 +181,7 @@
/* Another basic type we use is unsigned long integer which should be equal to
the word size of the machine, that is on a 32-bit platform 32 bits, and on a
64-bit platform 64 bits. We also give the printf format for the type as a
-macro PRULINT. */
+macro ULINTPF. */
#ifdef _WIN64
typedef unsigned __int64 ulint;
@@ -243,19 +243,29 @@
#define UNIV_EXTERN_STORAGE_FIELD (UNIV_SQL_NULL - UNIV_PAGE_SIZE)
+/* Some macros to improve branch prediction and reduce cache misses */
#if defined(__GNUC__) && (__GNUC__ > 2)
-# define UNIV_EXPECT(expr,value) __builtin_expect(expr, value)
-# define UNIV_LIKELY_NULL(expr) __builtin_expect((ulint) expr, 0)
+/* Tell the compiler that 'expr' probably evaluates to 'constant'. */
+# define UNIV_EXPECT(expr,constant) __builtin_expect(expr, constant)
+/* Tell the compiler that a pointer is likely to be NULL */
+# define UNIV_LIKELY_NULL(ptr) __builtin_expect((ulint) ptr, 0)
+/* Minimize cache-miss latency by moving data at addr into a cache before
+it is read. */
# define UNIV_PREFETCH_R(addr) __builtin_prefetch(addr, 0, 3)
+/* Minimize cache-miss latency by moving data at addr into a cache before
+it is read or written. */
# define UNIV_PREFETCH_RW(addr) __builtin_prefetch(addr, 1, 3)
#else
+/* Dummy versions of the macros */
# define UNIV_EXPECT(expr,value) (expr)
# define UNIV_LIKELY_NULL(expr) (expr)
# define UNIV_PREFETCH_R(addr) ((void) 0)
# define UNIV_PREFETCH_RW(addr) ((void) 0)
#endif
-#define UNIV_LIKELY(expr) UNIV_EXPECT(expr, TRUE)
-#define UNIV_UNLIKELY(expr) UNIV_EXPECT(expr, FALSE)
+/* Tell the compiler that cond is likely to hold */
+#define UNIV_LIKELY(cond) UNIV_EXPECT(cond, TRUE)
+/* Tell the compiler that cond is unlikely to hold */
+#define UNIV_UNLIKELY(cond) UNIV_EXPECT(cond, FALSE)
#include <stdio.h>
#include "ut0dbg.h"
| Thread |
|---|
| • bk commit into 5.0 tree (marko:1.1871) | Marko Mäkelä | 10 Jun |