mirror of
https://github.com/MariaDB/server.git
synced 2026-05-10 00:54:30 +02:00
InnoDB: Define some macros around GCC's __builtin_expect()
and __builtin_prefetch(). Add UNIV_LIKELY_NULL to if (heap) mem_free_heap(heap) tests. innobase/btr/btr0btr.c: Add UNIV_LIKELY_NULL to if (heap) mem_free_heap(heap) tests. innobase/btr/btr0cur.c: Add UNIV_LIKELY_NULL to if (heap) mem_free_heap(heap) tests. innobase/btr/btr0sea.c: Add UNIV_LIKELY_NULL to if (heap) mem_free_heap(heap) tests. innobase/include/univ.i: Define UNIV_EXPECT(), UNIV_LIKELY(), UNIV_UNLIKELY(), UNIV_LIKELY_NULL(), UNIV_PREFETCH_R() and UNIV_PREFETCH_RW(). innobase/lock/lock0lock.c: Add UNIV_LIKELY_NULL to if (heap) mem_free_heap(heap) tests. innobase/page/page0cur.c: Add UNIV_LIKELY_NULL to if (heap) mem_free_heap(heap) tests. innobase/page/page0page.c: Add UNIV_LIKELY_NULL to if (heap) mem_free_heap(heap) tests. innobase/rem/rem0rec.c: Add UNIV_LIKELY_NULL to if (heap) mem_free_heap(heap) tests. innobase/row/row0ins.c: Add UNIV_LIKELY_NULL to if (heap) mem_free_heap(heap) tests. innobase/row/row0mysql.c: Add UNIV_LIKELY_NULL to if (heap) mem_free_heap(heap) tests. innobase/row/row0purge.c: Add UNIV_LIKELY_NULL to if (heap) mem_free_heap(heap) tests. innobase/row/row0row.c: Add UNIV_LIKELY_NULL to if (heap) mem_free_heap(heap) tests. innobase/row/row0sel.c: Add UNIV_LIKELY_NULL to if (heap) mem_free_heap(heap) tests. innobase/row/row0undo.c: Add UNIV_LIKELY_NULL to if (heap) mem_free_heap(heap) tests. innobase/row/row0upd.c: Add UNIV_LIKELY_NULL to if (heap) mem_free_heap(heap) tests. innobase/trx/trx0rec.c: Add UNIV_LIKELY_NULL to if (heap) mem_free_heap(heap) tests.
This commit is contained in:
parent
ea5c2a148a
commit
4e0e9a3bae
16 changed files with 82 additions and 68 deletions
|
|
@ -243,6 +243,20 @@ contains the sum of the following flag and the locally stored len. */
|
|||
|
||||
#define UNIV_EXTERN_STORAGE_FIELD (UNIV_SQL_NULL - UNIV_PAGE_SIZE)
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ > 2)
|
||||
# define UNIV_EXPECT(expr,value) __builtin_expect(expr, value)
|
||||
# define UNIV_LIKELY_NULL(expr) __builtin_expect((ulint) expr, 0)
|
||||
# define UNIV_PREFETCH_R(addr) __builtin_prefetch(addr, 0, 3)
|
||||
# define UNIV_PREFETCH_RW(addr) __builtin_prefetch(addr, 1, 3)
|
||||
#else
|
||||
# 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)
|
||||
|
||||
#include <stdio.h>
|
||||
#include "ut0dbg.h"
|
||||
#include "ut0ut.h"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue