diff --git a/port/port_posix.h b/port/port_posix.h index efcd1aa8e..74c42f31b 100644 --- a/port/port_posix.h +++ b/port/port_posix.h @@ -16,6 +16,8 @@ // in fact, we could use that one #define ROCKSDB_PRIszt "zu" +#define __declspec(S) + #define ROCKSDB_NOEXCEPT noexcept #undef PLATFORM_IS_LITTLE_ENDIAN diff --git a/port/win/port_win.h b/port/win/port_win.h index 9ee7d96be..d901c40bf 100644 --- a/port/win/port_win.h +++ b/port/win/port_win.h @@ -245,7 +245,7 @@ extern void InitOnce(OnceType* once, void (*initializer)()); static inline void AsmVolatilePause() { #if defined(_M_IX86) || defined(_M_X64) - ::_mm_pause(); + YieldProcessor(); #endif // it would be nice to get "wfe" on ARM here } diff --git a/util/statistics.h b/util/statistics.h index 55914f59e..b42fb43a5 100644 --- a/util/statistics.h +++ b/util/statistics.h @@ -61,7 +61,13 @@ class StatisticsImpl : public Statistics { char padding[64 - sizeof(std::atomic_uint_fast64_t)]; }; - Ticker tickers_[INTERNAL_TICKER_ENUM_MAX] __attribute__((aligned(64))); + static_assert(sizeof(Ticker) == 64, "Expecting to fit into 64 bytes"); + + // Attributes expand to nothing depending on the platform + __declspec(align(64)) + Ticker tickers_[INTERNAL_TICKER_ENUM_MAX] + __attribute__((aligned(64))); + __declspec(align(64)) HistogramImpl histograms_[INTERNAL_HISTOGRAM_ENUM_MAX] __attribute__((aligned(64))); };