rocksdb/port/win
Koby Kahane 3e745053b7 Fix MSVC-related build issues (#7439)
Summary:
This PR addresses some build and functional issues on MSVC targets, as a step towards an eventual goal of having RocksDB build successfully for Windows on ARM64.

Addressed issues include:
- BitsSetToOne and CountTrailingZeroBits do not compile on non-x64 MSVC targets. A fallback implementation of BitsSetToOne when Intel intrinsics are not available is added, based on the C++20 `<bit>` popcount implementation in Microsoft's STL.
- The implementation of FloorLog2 for MSVC targets (including x64) gives incorrect results. The unit test easily detects this, but CircleCI is currently configured to only run a specific set of tests for Windows CMake builds, so this seems to have been unnoticed.
- AsmVolatilePause does not use YieldProcessor on Windows ARM64 targets, even though it is available.
- When CondVar::TimedWait calls Microsoft STL's condition_variable::wait_for, it can potentially trigger a bug (just recently fixed in the upcoming VS 16.8's STL) that deadlocks various tests that wait for a timer to execute, since `Timer::Run` doesn't get a chance to execute before being blocked by the test function acquiring the mutex.
- In c_test, `GetTempDir` assumes a POSIX-style temp path.
- `NormalizePath` did not eliminate consecutive POSIX-style path separators on Windows, resulting in test failures in e.g., wal_manager_test.
- Various other test failures.

In a followup PR I hope to modify CircleCI's config.yml to invoke all RocksDB unit tests in Windows CMake builds with CTest, instead of the current use of `run_ci_db_test.ps1` which requires individual tests to be specified and is missing many of the existing tests.

Notes from peterd: FloorLog2 is not yet used in production code (it's for something in progress). I also added a few more inexpensive platform-dependent tests to Windows CircleCI runs. And included facebook/folly#1461 as requested

Pull Request resolved: https://github.com/facebook/rocksdb/pull/7439

Reviewed By: jay-zhuang

Differential Revision: D24021563

Pulled By: pdillinger

fbshipit-source-id: 0ec2027c0d6a494d8a0fe38d9667fc2f7e29f7e7
2020-10-01 09:23:04 -07:00
..
env_default.cc build: make it compile with @mode/win (#7406) 2020-09-23 12:55:54 -07:00
env_win.cc build: make it compile with @mode/win (#7406) 2020-09-23 12:55:54 -07:00
env_win.h build: make it compile with @mode/win (#7406) 2020-09-23 12:55:54 -07:00
io_win.cc build: make it compile with @mode/win (#7406) 2020-09-23 12:55:54 -07:00
io_win.h build: make it compile with @mode/win (#7406) 2020-09-23 12:55:54 -07:00
port_win.cc Fix MSVC-related build issues (#7439) 2020-10-01 09:23:04 -07:00
port_win.h Fix MSVC-related build issues (#7439) 2020-10-01 09:23:04 -07:00
win_jemalloc.cc build: make it compile with @mode/win (#7406) 2020-09-23 12:55:54 -07:00
win_logger.cc build: make it compile with @mode/win (#7406) 2020-09-23 12:55:54 -07:00
win_logger.h Replace namespace name "rocksdb" with ROCKSDB_NAMESPACE (#6433) 2020-02-20 12:09:57 -08:00
win_thread.cc build: make it compile with @mode/win (#7406) 2020-09-23 12:55:54 -07:00
win_thread.h Replace namespace name "rocksdb" with ROCKSDB_NAMESPACE (#6433) 2020-02-20 12:09:57 -08:00
xpress_win.cc Introduce a helper method UncompressData (#7434) 2020-09-25 09:01:45 -07:00
xpress_win.h Introduce a helper method UncompressData (#7434) 2020-09-25 09:01:45 -07:00