summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2015-05-11 14:29:14 +0300
committerJan Lindström <jan.lindstrom@mariadb.com>2015-05-11 14:31:42 +0300
commit58e8db2eb398a812e2894d28db4173a4f67fea06 (patch)
treed46891529e0cd7db1eb36acae5d099035d95c7b0 /storage
parent6e4920164426543082d02cde4c60bd29cbd54f99 (diff)
downloadmariadb-git-58e8db2eb398a812e2894d28db4173a4f67fea06.tar.gz
MDEV-7942: InnoDB: abuse of UNIV_LIKELY()/UNIV_UNLIKELY()
UNIV_LIKELY()/UNIV_UNLIKELY() hints are supposed to improve branch prediction. Currently, they're expected to work only if cond evaluates to TRUE or FALSE. However there're a few conditions that may evaluate to different values, e.g.: page/page0zip.cc: if (UNIV_LIKELY(c_stream->avail_in)) { page/page0zip.cc: if (UNIV_LIKELY(c_stream->avail_in)) { dict/dict0mem.cc: if (UNIV_LIKELY(i) && UNIV_UNLIKELY(!table->col_names)) { Fixed these conditions so that they evaluate TRUE/FALSE.
Diffstat (limited to 'storage')
-rw-r--r--storage/innobase/dict/dict0mem.cc2
-rw-r--r--storage/innobase/page/page0zip.cc4
-rw-r--r--storage/xtradb/dict/dict0mem.cc2
-rw-r--r--storage/xtradb/page/page0zip.cc4
4 files changed, 6 insertions, 6 deletions
diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc
index f0ea15d9513..6684b75c9f2 100644
--- a/storage/innobase/dict/dict0mem.cc
+++ b/storage/innobase/dict/dict0mem.cc
@@ -285,7 +285,7 @@ dict_mem_table_add_col(
if (UNIV_UNLIKELY(table->n_def == table->n_cols)) {
heap = table->heap;
}
- if (UNIV_LIKELY(i) && UNIV_UNLIKELY(!table->col_names)) {
+ if (UNIV_LIKELY(i != 0) && UNIV_UNLIKELY(table->col_names == NULL)) {
/* All preceding column names are empty. */
char* s = static_cast<char*>(
mem_heap_zalloc(heap, table->n_def));
diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc
index 93f63ab15ac..f518746e21d 100644
--- a/storage/innobase/page/page0zip.cc
+++ b/storage/innobase/page/page0zip.cc
@@ -923,7 +923,7 @@ page_zip_compress_sec(
rec - REC_N_NEW_EXTRA_BYTES
- c_stream->next_in);
- if (UNIV_LIKELY(c_stream->avail_in)) {
+ if (UNIV_LIKELY(c_stream->avail_in != 0)) {
UNIV_MEM_ASSERT_RW(c_stream->next_in,
c_stream->avail_in);
err = deflate(c_stream, Z_NO_FLUSH);
@@ -1018,7 +1018,7 @@ page_zip_compress_clust_ext(
c_stream->avail_in = static_cast<uInt>(
src - c_stream->next_in);
- if (UNIV_LIKELY(c_stream->avail_in)) {
+ if (UNIV_LIKELY(c_stream->avail_in != 0)) {
err = deflate(c_stream, Z_NO_FLUSH);
if (UNIV_UNLIKELY(err != Z_OK)) {
diff --git a/storage/xtradb/dict/dict0mem.cc b/storage/xtradb/dict/dict0mem.cc
index 997e630dd15..3c23b55374c 100644
--- a/storage/xtradb/dict/dict0mem.cc
+++ b/storage/xtradb/dict/dict0mem.cc
@@ -301,7 +301,7 @@ dict_mem_table_add_col(
if (UNIV_UNLIKELY(table->n_def == table->n_cols)) {
heap = table->heap;
}
- if (UNIV_LIKELY(i) && UNIV_UNLIKELY(!table->col_names)) {
+ if (UNIV_LIKELY(i != 0) && UNIV_UNLIKELY(table->col_names == NULL)) {
/* All preceding column names are empty. */
char* s = static_cast<char*>(
mem_heap_zalloc(heap, table->n_def));
diff --git a/storage/xtradb/page/page0zip.cc b/storage/xtradb/page/page0zip.cc
index 9ad39147d0d..86c33ab5efb 100644
--- a/storage/xtradb/page/page0zip.cc
+++ b/storage/xtradb/page/page0zip.cc
@@ -912,7 +912,7 @@ page_zip_compress_sec(
rec - REC_N_NEW_EXTRA_BYTES
- c_stream->next_in);
- if (UNIV_LIKELY(c_stream->avail_in)) {
+ if (UNIV_LIKELY(c_stream->avail_in != 0)) {
UNIV_MEM_ASSERT_RW(c_stream->next_in,
c_stream->avail_in);
err = deflate(c_stream, Z_NO_FLUSH);
@@ -1007,7 +1007,7 @@ page_zip_compress_clust_ext(
c_stream->avail_in = static_cast<uInt>(
src - c_stream->next_in);
- if (UNIV_LIKELY(c_stream->avail_in)) {
+ if (UNIV_LIKELY(c_stream->avail_in != 0)) {
err = deflate(c_stream, Z_NO_FLUSH);
if (UNIV_UNLIKELY(err != Z_OK)) {