Commit c546b5f3 authored by unknown's avatar unknown

InnoDB: Make branch prediction assume that assertions do not fail.


innobase/include/ut0dbg.h:
  Remove ut_dbg_zero.
  Use the UNIV_UNLIKELY() macro in assertions in order to assist branch
  prediction.
innobase/ut/ut0dbg.c:
  Remove ut_dbg_zero.
parent 87c4f37a
...@@ -13,8 +13,6 @@ Created 1/30/1994 Heikki Tuuri ...@@ -13,8 +13,6 @@ Created 1/30/1994 Heikki Tuuri
#include <stdlib.h> #include <stdlib.h>
#include "os0thread.h" #include "os0thread.h"
extern ulint ut_dbg_zero; /* This is used to eliminate
compiler warnings */
extern ibool ut_dbg_stop_threads; extern ibool ut_dbg_stop_threads;
extern ulint* ut_dbg_null_ptr; extern ulint* ut_dbg_null_ptr;
...@@ -26,7 +24,7 @@ extern const char* ut_dbg_msg_stop; ...@@ -26,7 +24,7 @@ extern const char* ut_dbg_msg_stop;
#ifdef __NETWARE__ #ifdef __NETWARE__
extern ibool panic_shutdown; extern ibool panic_shutdown;
#define ut_a(EXPR) do {\ #define ut_a(EXPR) do {\
if (!((ulint)(EXPR) + ut_dbg_zero)) {\ if (UNIV_UNLIKELY(!((ulint)(EXPR)))) {\
ut_print_timestamp(stderr);\ ut_print_timestamp(stderr);\
fprintf(stderr, ut_dbg_msg_assert_fail,\ fprintf(stderr, ut_dbg_msg_assert_fail,\
os_thread_pf(os_thread_get_curr_id()), __FILE__,\ os_thread_pf(os_thread_get_curr_id()), __FILE__,\
...@@ -55,7 +53,7 @@ extern ibool panic_shutdown; ...@@ -55,7 +53,7 @@ extern ibool panic_shutdown;
} while (0) } while (0)
#else #else
#define ut_a(EXPR) do {\ #define ut_a(EXPR) do {\
if (!((ulint)(EXPR) + ut_dbg_zero)) {\ if (UNIV_UNLIKELY(!((ulint)(EXPR)))) {\
ut_print_timestamp(stderr);\ ut_print_timestamp(stderr);\
fprintf(stderr, ut_dbg_msg_assert_fail,\ fprintf(stderr, ut_dbg_msg_assert_fail,\
os_thread_pf(os_thread_get_curr_id()), __FILE__,\ os_thread_pf(os_thread_get_curr_id()), __FILE__,\
......
...@@ -8,9 +8,6 @@ Created 1/30/1994 Heikki Tuuri ...@@ -8,9 +8,6 @@ Created 1/30/1994 Heikki Tuuri
#include "univ.i" #include "univ.i"
/* This is used to eliminate compiler warnings */
ulint ut_dbg_zero = 0;
/* If this is set to TRUE all threads will stop into the next assertion /* If this is set to TRUE all threads will stop into the next assertion
and assert */ and assert */
ibool ut_dbg_stop_threads = FALSE; ibool ut_dbg_stop_threads = FALSE;
......
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