Commit e2e20a04 authored by Vasil Dimov's avatar Vasil Dimov

Fix the PAUSE instruction handling in InnoDB

Previously HAVE_IB_PAUSE_INSTRUCTION was never defined and thus InnoDB
never used the PAUSE instruction on non-windows even if it was available.
Probably the check was never migrated from autotools'
storage/innobase/plug.in to storage/innobase/CMakeLists.txt.

Since the check for PAUSE is done at top-level configure.cmake we can
use the result from there (HAVE_PAUSE_INSTRUCTION) instead of rolling
InnoDB's own HAVE_IB_PAUSE_INSTRUCTION (the check is identical anyway).
parent 59e81249
...@@ -189,7 +189,7 @@ IF(SIZEOF_PTHREAD_T) ...@@ -189,7 +189,7 @@ IF(SIZEOF_PTHREAD_T)
ENDIF() ENDIF()
IF(MSVC) IF(MSVC)
ADD_DEFINITIONS(-DHAVE_WINDOWS_ATOMICS -DHAVE_IB_PAUSE_INSTRUCTION) ADD_DEFINITIONS(-DHAVE_WINDOWS_ATOMICS)
ENDIF() ENDIF()
......
...@@ -55,24 +55,22 @@ Created 1/20/1994 Heikki Tuuri ...@@ -55,24 +55,22 @@ Created 1/20/1994 Heikki Tuuri
typedef time_t ib_time_t; typedef time_t ib_time_t;
#ifndef UNIV_HOTBACKUP #ifndef UNIV_HOTBACKUP
#if defined(HAVE_IB_PAUSE_INSTRUCTION) #if defined(HAVE_PAUSE_INSTRUCTION)
# ifdef WIN32
/* In the Win32 API, the x86 PAUSE instruction is executed by calling
the YieldProcessor macro defined in WinNT.h. It is a CPU architecture-
independent way by using YieldProcessor.*/
# define UT_RELAX_CPU() YieldProcessor()
# else
/* According to the gcc info page, asm volatile means that the /* According to the gcc info page, asm volatile means that the
instruction has important side-effects and must not be removed. instruction has important side-effects and must not be removed.
Also asm volatile may trigger a memory barrier (spilling all registers Also asm volatile may trigger a memory barrier (spilling all registers
to memory). */ to memory). */
# define UT_RELAX_CPU() __asm__ __volatile__ ("pause") # define UT_RELAX_CPU() __asm__ __volatile__ ("pause")
# endif
#elif defined(HAVE_ATOMIC_BUILTINS) #elif defined(HAVE_ATOMIC_BUILTINS)
# define UT_RELAX_CPU() do { \ # define UT_RELAX_CPU() do { \
volatile lint volatile_var; \ volatile lint volatile_var; \
os_compare_and_swap_lint(&volatile_var, 0, 1); \ os_compare_and_swap_lint(&volatile_var, 0, 1); \
} while (0) } while (0)
#elif defined(HAVE_WINDOWS_ATOMICS)
/* In the Win32 API, the x86 PAUSE instruction is executed by calling
the YieldProcessor macro defined in WinNT.h. It is a CPU architecture-
independent way by using YieldProcessor. */
# define UT_RELAX_CPU() YieldProcessor()
#else #else
# define UT_RELAX_CPU() ((void)0) /* avoid warning for an empty statement */ # define UT_RELAX_CPU() ((void)0) /* avoid warning for an empty statement */
#endif #endif
......
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