react-native-windows 0.85.0-preview.1 → 0.85.0-preview.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Directory.Build.props +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +28 -46
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +0 -3
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +19 -13
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +107 -0
- package/Microsoft.ReactNative/Fabric/Composition/SelectionItemAutomationEvent.h +73 -0
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +105 -32
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +7 -2
- package/PropertySheets/CIBuildOptimizations.props +2 -2
- package/PropertySheets/Generated/PackageVersion.g.props +2 -2
- package/PropertySheets/JSEngine.props +1 -1
- package/PropertySheets/NuGet.LockFile.props +2 -9
- package/Scripts/NuGetRestoreForceEvaluateAllSolutions.ps1 +54 -5
- package/Scripts/UpdateNightlyDependencies.ps1 +47 -0
- package/Scripts/creaternwapp.cmd +29 -9
- package/Scripts/creaternwlib.cmd +31 -15
- package/external/.clang-format +1 -0
- package/external/External.vcxitems +10 -0
- package/external/fast-float/.syncignore +10 -0
- package/external/fast-float/LICENSE-APACHE +190 -0
- package/external/fast-float/LICENSE-BOOST +23 -0
- package/external/fast-float/LICENSE-MIT +27 -0
- package/external/fast-float/README.md +545 -0
- package/external/fast-float/cgmanifest.json +15 -0
- package/external/fast-float/fast-float.vcxitems +14 -0
- package/external/fast-float/include/fast_float/ascii_number.h +588 -0
- package/external/fast-float/include/fast_float/bigint.h +638 -0
- package/external/fast-float/include/fast_float/constexpr_feature_detect.h +46 -0
- package/external/fast-float/include/fast_float/decimal_to_binary.h +212 -0
- package/external/fast-float/include/fast_float/digit_comparison.h +457 -0
- package/external/fast-float/include/fast_float/fast_float.h +59 -0
- package/external/fast-float/include/fast_float/fast_table.h +708 -0
- package/external/fast-float/include/fast_float/float_common.h +1240 -0
- package/external/fast-float/include/fast_float/parse_number.h +399 -0
- package/external/fast-float/sync-config.json +8 -0
- package/external/fmt/.syncignore +10 -0
- package/external/fmt/CONTRIBUTING.md +20 -0
- package/external/fmt/LICENSE +27 -0
- package/external/fmt/README.md +484 -0
- package/external/fmt/cgmanifest.json +15 -0
- package/external/fmt/doc/ChangeLog-old.md +3290 -0
- package/external/fmt/doc/api.md +650 -0
- package/external/fmt/doc/fmt.css +61 -0
- package/external/fmt/doc/fmt.js +4 -0
- package/external/fmt/doc/get-started.md +222 -0
- package/external/fmt/doc/index.md +151 -0
- package/external/fmt/doc/perf.svg +1 -0
- package/external/fmt/doc/python-license.txt +290 -0
- package/external/fmt/doc/syntax.md +887 -0
- package/external/fmt/fmt.vcxitems +28 -0
- package/external/fmt/include/fmt/args.h +228 -0
- package/external/fmt/include/fmt/base.h +3077 -0
- package/external/fmt/include/fmt/chrono.h +2432 -0
- package/external/fmt/include/fmt/color.h +612 -0
- package/external/fmt/include/fmt/compile.h +529 -0
- package/external/fmt/include/fmt/core.h +5 -0
- package/external/fmt/include/fmt/format-inl.h +1928 -0
- package/external/fmt/include/fmt/format.h +4427 -0
- package/external/fmt/include/fmt/os.h +439 -0
- package/external/fmt/include/fmt/ostream.h +211 -0
- package/external/fmt/include/fmt/printf.h +656 -0
- package/external/fmt/include/fmt/ranges.h +882 -0
- package/external/fmt/include/fmt/std.h +699 -0
- package/external/fmt/include/fmt/xchar.h +322 -0
- package/external/fmt/src/fmt.cc +135 -0
- package/external/fmt/src/format.cc +43 -0
- package/external/fmt/src/os.cc +403 -0
- package/external/fmt/sync-config.json +8 -0
- package/external/folly/.syncignore +60 -0
- package/external/folly/Folly.natvis +25 -0
- package/external/folly/LICENSE +200 -0
- package/external/folly/README.md +263 -0
- package/external/folly/cgmanifest.json +25 -0
- package/external/folly/folly/.clang-format +1 -0
- package/external/folly/folly/AtomicHashArray-inl.h +546 -0
- package/external/folly/folly/AtomicHashArray.h +431 -0
- package/external/folly/folly/AtomicHashMap-inl.h +653 -0
- package/external/folly/folly/AtomicHashMap.h +484 -0
- package/external/folly/folly/AtomicIntrusiveLinkedList.h +206 -0
- package/external/folly/folly/AtomicLinkedList.h +110 -0
- package/external/folly/folly/AtomicUnorderedMap.h +522 -0
- package/external/folly/folly/BUCK +1631 -0
- package/external/folly/folly/BUILD_MODE.bzl +72 -0
- package/external/folly/folly/Benchmark.cpp +986 -0
- package/external/folly/folly/Benchmark.h +680 -0
- package/external/folly/folly/BenchmarkUtil.h +47 -0
- package/external/folly/folly/Bits.h +17 -0
- package/external/folly/folly/CMakeLists.txt +110 -0
- package/external/folly/folly/CPortability.h +338 -0
- package/external/folly/folly/CancellationToken-inl.h +449 -0
- package/external/folly/folly/CancellationToken.cpp +250 -0
- package/external/folly/folly/CancellationToken.h +365 -0
- package/external/folly/folly/Chrono.h +132 -0
- package/external/folly/folly/ClockGettimeWrappers.cpp +93 -0
- package/external/folly/folly/ClockGettimeWrappers.h +29 -0
- package/external/folly/folly/ConcurrentBitSet.h +157 -0
- package/external/folly/folly/ConcurrentLazy.h +74 -0
- package/external/folly/folly/ConcurrentSkipList-inl.h +341 -0
- package/external/folly/folly/ConcurrentSkipList.h +824 -0
- package/external/folly/folly/ConstexprMath.h +978 -0
- package/external/folly/folly/ConstructorCallbackList.h +158 -0
- package/external/folly/folly/Conv.cpp +1205 -0
- package/external/folly/folly/Conv.h +2026 -0
- package/external/folly/folly/CppAttributes.h +170 -0
- package/external/folly/folly/CpuId.h +297 -0
- package/external/folly/folly/DefaultKeepAliveExecutor.h +172 -0
- package/external/folly/folly/Demangle.cpp +255 -0
- package/external/folly/folly/Demangle.h +73 -0
- package/external/folly/folly/DiscriminatedPtr.h +236 -0
- package/external/folly/folly/DynamicConverter.h +17 -0
- package/external/folly/folly/Exception.h +150 -0
- package/external/folly/folly/ExceptionString.cpp +51 -0
- package/external/folly/folly/ExceptionString.h +33 -0
- package/external/folly/folly/ExceptionWrapper-inl.h +264 -0
- package/external/folly/folly/ExceptionWrapper.cpp +37 -0
- package/external/folly/folly/ExceptionWrapper.h +377 -0
- package/external/folly/folly/Executor.cpp +111 -0
- package/external/folly/folly/Executor.h +351 -0
- package/external/folly/folly/Expected.h +1725 -0
- package/external/folly/folly/FBString.h +2888 -0
- package/external/folly/folly/FBVector.h +17 -0
- package/external/folly/folly/File.cpp +180 -0
- package/external/folly/folly/File.h +177 -0
- package/external/folly/folly/FileUtil.cpp +378 -0
- package/external/folly/folly/FileUtil.h +332 -0
- package/external/folly/folly/Fingerprint.cpp +135 -0
- package/external/folly/folly/Fingerprint.h +289 -0
- package/external/folly/folly/FixedString.h +2965 -0
- package/external/folly/folly/FollyMemcpy.cpp +30 -0
- package/external/folly/folly/FollyMemcpy.h +23 -0
- package/external/folly/folly/FollyMemset.cpp +29 -0
- package/external/folly/folly/FollyMemset.h +25 -0
- package/external/folly/folly/Format-inl.h +1152 -0
- package/external/folly/folly/Format.cpp +429 -0
- package/external/folly/folly/Format.h +463 -0
- package/external/folly/folly/FormatArg.h +285 -0
- package/external/folly/folly/FormatTraits.h +65 -0
- package/external/folly/folly/Function.h +1159 -0
- package/external/folly/folly/GLog.h +85 -0
- package/external/folly/folly/GroupVarint.cpp +153 -0
- package/external/folly/folly/GroupVarint.h +630 -0
- package/external/folly/folly/Hash.h +20 -0
- package/external/folly/folly/IPAddress.cpp +490 -0
- package/external/folly/folly/IPAddress.h +667 -0
- package/external/folly/folly/IPAddressException.h +82 -0
- package/external/folly/folly/IPAddressV4.cpp +305 -0
- package/external/folly/folly/IPAddressV4.h +495 -0
- package/external/folly/folly/IPAddressV6.cpp +541 -0
- package/external/folly/folly/IPAddressV6.h +627 -0
- package/external/folly/folly/Indestructible.h +164 -0
- package/external/folly/folly/IndexedMemPool.h +550 -0
- package/external/folly/folly/IntrusiveList.h +17 -0
- package/external/folly/folly/Lazy.h +142 -0
- package/external/folly/folly/Likely.h +76 -0
- package/external/folly/folly/MPMCPipeline.h +280 -0
- package/external/folly/folly/MPMCQueue.h +1556 -0
- package/external/folly/folly/MacAddress.cpp +188 -0
- package/external/folly/folly/MacAddress.h +260 -0
- package/external/folly/folly/MapUtil.h +17 -0
- package/external/folly/folly/Math.h +258 -0
- package/external/folly/folly/MaybeManagedPtr.h +120 -0
- package/external/folly/folly/Memory.h +900 -0
- package/external/folly/folly/MicroLock.cpp +76 -0
- package/external/folly/folly/MicroLock.h +354 -0
- package/external/folly/folly/MicroSpinLock.h +17 -0
- package/external/folly/folly/MoveWrapper.h +76 -0
- package/external/folly/folly/ObserverContainer.h +1026 -0
- package/external/folly/folly/Optional.h +743 -0
- package/external/folly/folly/Overload.h +325 -0
- package/external/folly/folly/PackedSyncPtr.h +147 -0
- package/external/folly/folly/Padded.h +464 -0
- package/external/folly/folly/Poly-inl.h +230 -0
- package/external/folly/folly/Poly.h +1095 -0
- package/external/folly/folly/PolyException.h +43 -0
- package/external/folly/folly/Portability.h +644 -0
- package/external/folly/folly/Preprocessor.h +236 -0
- package/external/folly/folly/ProducerConsumerQueue.h +182 -0
- package/external/folly/folly/RWSpinLock.h +17 -0
- package/external/folly/folly/Random-inl.h +86 -0
- package/external/folly/folly/Random.cpp +184 -0
- package/external/folly/folly/Random.h +434 -0
- package/external/folly/folly/Range.h +1772 -0
- package/external/folly/folly/Replaceable.h +636 -0
- package/external/folly/folly/ScopeGuard.cpp +29 -0
- package/external/folly/folly/ScopeGuard.h +420 -0
- package/external/folly/folly/SharedMutex.cpp +81 -0
- package/external/folly/folly/SharedMutex.h +1751 -0
- package/external/folly/folly/Singleton-inl.h +332 -0
- package/external/folly/folly/Singleton.cpp +512 -0
- package/external/folly/folly/Singleton.h +891 -0
- package/external/folly/folly/SingletonThreadLocal.cpp +53 -0
- package/external/folly/folly/SingletonThreadLocal.h +263 -0
- package/external/folly/folly/SocketAddress.cpp +786 -0
- package/external/folly/folly/SocketAddress.h +768 -0
- package/external/folly/folly/SpinLock.h +55 -0
- package/external/folly/folly/String-inl.h +668 -0
- package/external/folly/folly/String.cpp +777 -0
- package/external/folly/folly/String.h +767 -0
- package/external/folly/folly/Subprocess.cpp +1142 -0
- package/external/folly/folly/Subprocess.h +1055 -0
- package/external/folly/folly/Synchronized.h +1833 -0
- package/external/folly/folly/SynchronizedPtr.h +106 -0
- package/external/folly/folly/ThreadCachedInt.h +175 -0
- package/external/folly/folly/ThreadLocal.h +478 -0
- package/external/folly/folly/TimeoutQueue.cpp +78 -0
- package/external/folly/folly/TimeoutQueue.h +123 -0
- package/external/folly/folly/TokenBucket.h +673 -0
- package/external/folly/folly/Traits.h +1442 -0
- package/external/folly/folly/Try-inl.h +372 -0
- package/external/folly/folly/Try.cpp +23 -0
- package/external/folly/folly/Try.h +728 -0
- package/external/folly/folly/UTF8String.h +56 -0
- package/external/folly/folly/Unicode.cpp +201 -0
- package/external/folly/folly/Unicode.h +94 -0
- package/external/folly/folly/Unit.h +65 -0
- package/external/folly/folly/Uri-inl.h +101 -0
- package/external/folly/folly/Uri.cpp +190 -0
- package/external/folly/folly/Uri.h +142 -0
- package/external/folly/folly/Utility.h +932 -0
- package/external/folly/folly/VERSION +1 -0
- package/external/folly/folly/Varint.h +230 -0
- package/external/folly/folly/VirtualExecutor.h +17 -0
- package/external/folly/folly/algorithm/simd/BUCK +47 -0
- package/external/folly/folly/algorithm/simd/Contains.cpp +42 -0
- package/external/folly/folly/algorithm/simd/Contains.h +116 -0
- package/external/folly/folly/algorithm/simd/FindFixed.h +301 -0
- package/external/folly/folly/algorithm/simd/Ignore.h +52 -0
- package/external/folly/folly/algorithm/simd/Movemask.h +207 -0
- package/external/folly/folly/algorithm/simd/detail/BUCK +70 -0
- package/external/folly/folly/algorithm/simd/detail/ContainsImpl.h +91 -0
- package/external/folly/folly/algorithm/simd/detail/SimdAnyOf.h +83 -0
- package/external/folly/folly/algorithm/simd/detail/SimdForEach.h +209 -0
- package/external/folly/folly/algorithm/simd/detail/SimdPlatform.h +445 -0
- package/external/folly/folly/algorithm/simd/detail/Traits.h +125 -0
- package/external/folly/folly/algorithm/simd/detail/UnrollUtils.h +126 -0
- package/external/folly/folly/base64.h +264 -0
- package/external/folly/folly/chrono/BUCK +29 -0
- package/external/folly/folly/chrono/Clock.h +65 -0
- package/external/folly/folly/chrono/Conv.h +712 -0
- package/external/folly/folly/chrono/Hardware.h +155 -0
- package/external/folly/folly/chrono/test/BUCK +26 -0
- package/external/folly/folly/chrono/test/ClockTest.cpp +68 -0
- package/external/folly/folly/chrono/test/ConvTest.cpp +652 -0
- package/external/folly/folly/concurrency/AtomicSharedPtr.h +387 -0
- package/external/folly/folly/concurrency/BUCK +170 -0
- package/external/folly/folly/concurrency/CacheLocality.cpp +633 -0
- package/external/folly/folly/concurrency/CacheLocality.h +460 -0
- package/external/folly/folly/concurrency/ConcurrentHashMap.h +822 -0
- package/external/folly/folly/concurrency/CoreCachedSharedPtr.h +232 -0
- package/external/folly/folly/concurrency/DeadlockDetector.cpp +27 -0
- package/external/folly/folly/concurrency/DeadlockDetector.h +44 -0
- package/external/folly/folly/concurrency/DynamicBoundedQueue.h +751 -0
- package/external/folly/folly/concurrency/PriorityUnboundedQueueSet.h +207 -0
- package/external/folly/folly/concurrency/ProcessLocalUniqueId.cpp +46 -0
- package/external/folly/folly/concurrency/ProcessLocalUniqueId.h +38 -0
- package/external/folly/folly/concurrency/SingletonRelaxedCounter.h +325 -0
- package/external/folly/folly/concurrency/ThreadCachedSynchronized.h +227 -0
- package/external/folly/folly/concurrency/UnboundedQueue.h +891 -0
- package/external/folly/folly/concurrency/container/BUCK +77 -0
- package/external/folly/folly/concurrency/container/FlatCombiningPriorityQueue.h +426 -0
- package/external/folly/folly/concurrency/container/LockFreeRingBuffer.h +306 -0
- package/external/folly/folly/concurrency/container/RelaxedConcurrentPriorityQueue.h +1212 -0
- package/external/folly/folly/concurrency/container/SingleWriterFixedHashMap.h +322 -0
- package/external/folly/folly/concurrency/container/atomic_grow_array.h +564 -0
- package/external/folly/folly/concurrency/container/test/BUCK +75 -0
- package/external/folly/folly/concurrency/container/test/FlatCombiningPriorityQueueTest.cpp +570 -0
- package/external/folly/folly/concurrency/container/test/LockFreeRingBufferTest.cpp +276 -0
- package/external/folly/folly/concurrency/container/test/RelaxedConcurrentPriorityQueueTest.cpp +1570 -0
- package/external/folly/folly/concurrency/container/test/SingleWriterFixedHashMapTest.cpp +401 -0
- package/external/folly/folly/concurrency/container/test/atomic_grow_array_test.cpp +187 -0
- package/external/folly/folly/concurrency/detail/AtomicSharedPtr-detail.h +212 -0
- package/external/folly/folly/concurrency/detail/ConcurrentHashMap-detail.h +1911 -0
- package/external/folly/folly/concurrency/memory/AtomicReadMostlyMainPtr.cpp +43 -0
- package/external/folly/folly/concurrency/memory/AtomicReadMostlyMainPtr.h +190 -0
- package/external/folly/folly/concurrency/memory/BUCK +53 -0
- package/external/folly/folly/concurrency/memory/PrimaryPtr.h +338 -0
- package/external/folly/folly/concurrency/memory/ReadMostlySharedPtr.h +511 -0
- package/external/folly/folly/concurrency/memory/TLRefCount.h +228 -0
- package/external/folly/folly/concurrency/memory/test/AtomicReadMostlyMainPtrBenchmark.cpp +56 -0
- package/external/folly/folly/concurrency/memory/test/AtomicReadMostlyMainPtrTest.cpp +454 -0
- package/external/folly/folly/concurrency/memory/test/BUCK +95 -0
- package/external/folly/folly/concurrency/memory/test/PrimaryPtrTest.cpp +303 -0
- package/external/folly/folly/concurrency/memory/test/ReadMostlySharedPtrBenchmark.cpp +138 -0
- package/external/folly/folly/concurrency/memory/test/ReadMostlySharedPtrStressTest.cpp +75 -0
- package/external/folly/folly/concurrency/memory/test/ReadMostlySharedPtrTest.cpp +378 -0
- package/external/folly/folly/concurrency/memory/test/RefCountBenchmark.cpp +90 -0
- package/external/folly/folly/concurrency/memory/test/RefCountTest.cpp +168 -0
- package/external/folly/folly/concurrency/test/AtomicSharedPtrCounted.h +156 -0
- package/external/folly/folly/concurrency/test/AtomicSharedPtrPerformance.cpp +255 -0
- package/external/folly/folly/concurrency/test/AtomicSharedPtrTest.cpp +257 -0
- package/external/folly/folly/concurrency/test/BUCK +229 -0
- package/external/folly/folly/concurrency/test/CacheLocalityBenchmark.cpp +392 -0
- package/external/folly/folly/concurrency/test/CacheLocalityTest.cpp +1229 -0
- package/external/folly/folly/concurrency/test/ConcurrentHashMapBench.cpp +260 -0
- package/external/folly/folly/concurrency/test/ConcurrentHashMapTest.cpp +1242 -0
- package/external/folly/folly/concurrency/test/CoreCachedSharedPtrTest.cpp +408 -0
- package/external/folly/folly/concurrency/test/DynamicBoundedQueueTest.cpp +984 -0
- package/external/folly/folly/concurrency/test/PriorityUnboundedQueueSetTest.cpp +73 -0
- package/external/folly/folly/concurrency/test/ProcessLocalUniqueIdTest.cpp +66 -0
- package/external/folly/folly/concurrency/test/SingletonRelaxedCounterBench.cpp +101 -0
- package/external/folly/folly/concurrency/test/SingletonRelaxedCounterTest.cpp +185 -0
- package/external/folly/folly/concurrency/test/ThreadCachedSynchronizedBench.cpp +76 -0
- package/external/folly/folly/concurrency/test/ThreadCachedSynchronizedTest.cpp +93 -0
- package/external/folly/folly/concurrency/test/UnboundedQueueTest.cpp +1302 -0
- package/external/folly/folly/container/Access.h +57 -0
- package/external/folly/folly/container/Array.h +87 -0
- package/external/folly/folly/container/BUCK +353 -0
- package/external/folly/folly/container/BitIterator.h +203 -0
- package/external/folly/folly/container/Enumerate.h +162 -0
- package/external/folly/folly/container/EvictingCacheMap.h +730 -0
- package/external/folly/folly/container/F14.md +300 -0
- package/external/folly/folly/container/F14Map-fwd.h +113 -0
- package/external/folly/folly/container/F14Map.h +2108 -0
- package/external/folly/folly/container/F14Set-fwd.h +95 -0
- package/external/folly/folly/container/F14Set.h +1603 -0
- package/external/folly/folly/container/FBVector.h +1711 -0
- package/external/folly/folly/container/Foreach-inl.h +316 -0
- package/external/folly/folly/container/Foreach.h +209 -0
- package/external/folly/folly/container/HeterogeneousAccess-fwd.h +33 -0
- package/external/folly/folly/container/HeterogeneousAccess.h +171 -0
- package/external/folly/folly/container/IntrusiveHeap.h +268 -0
- package/external/folly/folly/container/IntrusiveList.h +131 -0
- package/external/folly/folly/container/Iterator.h +843 -0
- package/external/folly/folly/container/MapUtil.h +376 -0
- package/external/folly/folly/container/Merge.h +90 -0
- package/external/folly/folly/container/RegexMatchCache.cpp +521 -0
- package/external/folly/folly/container/RegexMatchCache.h +699 -0
- package/external/folly/folly/container/Reserve.h +109 -0
- package/external/folly/folly/container/SparseByteSet.h +123 -0
- package/external/folly/folly/container/View.h +81 -0
- package/external/folly/folly/container/WeightedEvictingCacheMap.h +651 -0
- package/external/folly/folly/container/detail/BUCK +115 -0
- package/external/folly/folly/container/detail/BitIteratorDetail.h +87 -0
- package/external/folly/folly/container/detail/F14Defaults.h +34 -0
- package/external/folly/folly/container/detail/F14IntrinsicsAvailability.h +67 -0
- package/external/folly/folly/container/detail/F14MapFallback.h +717 -0
- package/external/folly/folly/container/detail/F14Mask.h +235 -0
- package/external/folly/folly/container/detail/F14Policy.h +1523 -0
- package/external/folly/folly/container/detail/F14SetFallback.h +528 -0
- package/external/folly/folly/container/detail/F14Table.cpp +71 -0
- package/external/folly/folly/container/detail/F14Table.h +2680 -0
- package/external/folly/folly/container/detail/Util.h +303 -0
- package/external/folly/folly/container/detail/tape_detail.h +135 -0
- package/external/folly/folly/container/detail/test/BUCK +14 -0
- package/external/folly/folly/container/detail/test/F14DetailTest.cpp +47 -0
- package/external/folly/folly/container/heap_vector_types.h +1683 -0
- package/external/folly/folly/container/range_traits.h +81 -0
- package/external/folly/folly/container/small_vector.h +1476 -0
- package/external/folly/folly/container/sorted_vector_types.h +1652 -0
- package/external/folly/folly/container/span.h +408 -0
- package/external/folly/folly/container/tape.h +608 -0
- package/external/folly/folly/container/test/.clang-tidy +12 -0
- package/external/folly/folly/container/test/AccessTest.cpp +138 -0
- package/external/folly/folly/container/test/ArrayTest.cpp +84 -0
- package/external/folly/folly/container/test/BUCK +568 -0
- package/external/folly/folly/container/test/BitIteratorBench.cpp +112 -0
- package/external/folly/folly/container/test/BitIteratorTest.cpp +109 -0
- package/external/folly/folly/container/test/EnumerateTest.cpp +294 -0
- package/external/folly/folly/container/test/EvictingCacheMapBench.cpp +80 -0
- package/external/folly/folly/container/test/EvictingCacheMapTest.cpp +842 -0
- package/external/folly/folly/container/test/F14AsanSupportTest.cpp +143 -0
- package/external/folly/folly/container/test/F14FwdTest.cpp +37 -0
- package/external/folly/folly/container/test/F14InterprocessTest.cpp +404 -0
- package/external/folly/folly/container/test/F14MapTest.cpp +2543 -0
- package/external/folly/folly/container/test/F14PolicyTest.cpp +49 -0
- package/external/folly/folly/container/test/F14SetTest.cpp +1738 -0
- package/external/folly/folly/container/test/F14SmallOverheads.cpp +215 -0
- package/external/folly/folly/container/test/F14TestUtil.h +117 -0
- package/external/folly/folly/container/test/FBVectorBenchmark.cpp +380 -0
- package/external/folly/folly/container/test/FBVectorBenchmarks.cpp.h +100 -0
- package/external/folly/folly/container/test/FBVectorTest.cpp +326 -0
- package/external/folly/folly/container/test/FBVectorTests.cpp.h +304 -0
- package/external/folly/folly/container/test/ForeachBenchmark.cpp +388 -0
- package/external/folly/folly/container/test/ForeachTest.cpp +338 -0
- package/external/folly/folly/container/test/HashMapsBench.cpp +458 -0
- package/external/folly/folly/container/test/HeterogeneousAccessTest.cpp +242 -0
- package/external/folly/folly/container/test/IntrusiveHeapTest.cpp +262 -0
- package/external/folly/folly/container/test/IteratorTest.cpp +989 -0
- package/external/folly/folly/container/test/MapUtilTest.cpp +365 -0
- package/external/folly/folly/container/test/MergeTest.cpp +66 -0
- package/external/folly/folly/container/test/RegexMatchCacheTest.cpp +634 -0
- package/external/folly/folly/container/test/ReserveTest.cpp +173 -0
- package/external/folly/folly/container/test/SparseByteSetBenchmark.cpp +153 -0
- package/external/folly/folly/container/test/SparseByteSetTest.cpp +117 -0
- package/external/folly/folly/container/test/TrackingTypes.h +584 -0
- package/external/folly/folly/container/test/UtilTest.cpp +609 -0
- package/external/folly/folly/container/test/WeightedEvictingCacheMapTest.cpp +800 -0
- package/external/folly/folly/container/test/heap_vector_types_test.cpp +1774 -0
- package/external/folly/folly/container/test/range_traits_test.cpp +59 -0
- package/external/folly/folly/container/test/small_vector_test.cpp +1571 -0
- package/external/folly/folly/container/test/sorted_vector_test.cpp +1589 -0
- package/external/folly/folly/container/test/span_test.cpp +520 -0
- package/external/folly/folly/container/test/tape_bench.cpp +200 -0
- package/external/folly/folly/container/test/tape_test.cpp +590 -0
- package/external/folly/folly/defs.bzl +238 -0
- package/external/folly/folly/detail/AsyncTrace.cpp +36 -0
- package/external/folly/folly/detail/AsyncTrace.h +44 -0
- package/external/folly/folly/detail/AtomicHashUtils.h +42 -0
- package/external/folly/folly/detail/AtomicUnorderedMapUtils.h +80 -0
- package/external/folly/folly/detail/BUCK +406 -0
- package/external/folly/folly/detail/DiscriminatedPtrDetail.h +172 -0
- package/external/folly/folly/detail/FileUtilDetail.cpp +63 -0
- package/external/folly/folly/detail/FileUtilDetail.h +85 -0
- package/external/folly/folly/detail/FileUtilVectorDetail.h +81 -0
- package/external/folly/folly/detail/FingerprintPolynomial.h +132 -0
- package/external/folly/folly/detail/Futex-inl.h +123 -0
- package/external/folly/folly/detail/Futex.cpp +273 -0
- package/external/folly/folly/detail/Futex.h +109 -0
- package/external/folly/folly/detail/GroupVarintDetail.h +101 -0
- package/external/folly/folly/detail/IPAddress.cpp +37 -0
- package/external/folly/folly/detail/IPAddress.h +57 -0
- package/external/folly/folly/detail/IPAddressSource.h +278 -0
- package/external/folly/folly/detail/Iterators.h +156 -0
- package/external/folly/folly/detail/MPMCPipelineDetail.h +122 -0
- package/external/folly/folly/detail/MemoryIdler.cpp +233 -0
- package/external/folly/folly/detail/MemoryIdler.h +216 -0
- package/external/folly/folly/detail/PerfScoped.cpp +112 -0
- package/external/folly/folly/detail/PerfScoped.h +70 -0
- package/external/folly/folly/detail/PolyDetail.h +921 -0
- package/external/folly/folly/detail/RangeCommon.cpp +55 -0
- package/external/folly/folly/detail/RangeCommon.h +93 -0
- package/external/folly/folly/detail/RangeSse42.cpp +198 -0
- package/external/folly/folly/detail/RangeSse42.h +30 -0
- package/external/folly/folly/detail/SimpleSimdStringUtils.cpp +31 -0
- package/external/folly/folly/detail/SimpleSimdStringUtils.h +27 -0
- package/external/folly/folly/detail/SimpleSimdStringUtilsImpl.h +63 -0
- package/external/folly/folly/detail/Singleton.h +34 -0
- package/external/folly/folly/detail/SlowFingerprint.h +90 -0
- package/external/folly/folly/detail/SocketFastOpen.cpp +175 -0
- package/external/folly/folly/detail/SocketFastOpen.h +89 -0
- package/external/folly/folly/detail/SplitStringSimd.cpp +84 -0
- package/external/folly/folly/detail/SplitStringSimd.h +151 -0
- package/external/folly/folly/detail/SplitStringSimdImpl.h +149 -0
- package/external/folly/folly/detail/Sse.cpp +35 -0
- package/external/folly/folly/detail/Sse.h +45 -0
- package/external/folly/folly/detail/StaticSingletonManager.cpp +119 -0
- package/external/folly/folly/detail/StaticSingletonManager.h +298 -0
- package/external/folly/folly/detail/ThreadLocalDetail.cpp +492 -0
- package/external/folly/folly/detail/ThreadLocalDetail.h +800 -0
- package/external/folly/folly/detail/TrapOnAvx512.cpp +41 -0
- package/external/folly/folly/detail/TrapOnAvx512.h +21 -0
- package/external/folly/folly/detail/TurnSequencer.h +295 -0
- package/external/folly/folly/detail/TypeList.h +551 -0
- package/external/folly/folly/detail/UniqueInstance.cpp +136 -0
- package/external/folly/folly/detail/UniqueInstance.h +68 -0
- package/external/folly/folly/detail/base64_detail/BUCK +102 -0
- package/external/folly/folly/detail/base64_detail/Base64Api.cpp +40 -0
- package/external/folly/folly/detail/base64_detail/Base64Api.h +101 -0
- package/external/folly/folly/detail/base64_detail/Base64Common.h +80 -0
- package/external/folly/folly/detail/base64_detail/Base64Constants.h +79 -0
- package/external/folly/folly/detail/base64_detail/Base64HiddenConstants.h +129 -0
- package/external/folly/folly/detail/base64_detail/Base64SWAR.cpp +161 -0
- package/external/folly/folly/detail/base64_detail/Base64SWAR.h +32 -0
- package/external/folly/folly/detail/base64_detail/Base64Scalar.h +262 -0
- package/external/folly/folly/detail/base64_detail/Base64Simd.h +102 -0
- package/external/folly/folly/detail/base64_detail/Base64_SSE4_2.cpp +42 -0
- package/external/folly/folly/detail/base64_detail/Base64_SSE4_2.h +33 -0
- package/external/folly/folly/detail/base64_detail/Base64_SSE4_2_Platform.h +167 -0
- package/external/folly/folly/detail/base64_detail/README.md +392 -0
- package/external/folly/folly/detail/base64_detail/tests/BUCK +36 -0
- package/external/folly/folly/detail/base64_detail/tests/Base64AgainstScalarTest.cpp +141 -0
- package/external/folly/folly/detail/base64_detail/tests/Base64PlatformTest.cpp +273 -0
- package/external/folly/folly/detail/base64_detail/tests/Base64SpecialCasesTest.cpp +555 -0
- package/external/folly/folly/detail/test/AsyncTraceTest.cpp +43 -0
- package/external/folly/folly/detail/test/BUCK +118 -0
- package/external/folly/folly/detail/test/FileUtilDetailTest.cpp +56 -0
- package/external/folly/folly/detail/test/PerfScopedTest.cpp +107 -0
- package/external/folly/folly/detail/test/SimpleSimdStringUtilsTest.cpp +92 -0
- package/external/folly/folly/detail/test/SplitStringSimdTest.cpp +242 -0
- package/external/folly/folly/detail/test/StaticSingletonManagerTest.cpp +121 -0
- package/external/folly/folly/detail/test/ThreadLocalBenchmark.cpp +116 -0
- package/external/folly/folly/detail/test/ThreadLocalDetailTest.cpp +194 -0
- package/external/folly/folly/detail/test/TrapOnAvx512TestNegative.cpp +29 -0
- package/external/folly/folly/detail/test/UniqueInstanceTest.cpp +60 -0
- package/external/folly/folly/detail/thread_local_globals.cpp +69 -0
- package/external/folly/folly/detail/thread_local_globals.h +36 -0
- package/external/folly/folly/docs/AtomicHashMap.md +134 -0
- package/external/folly/folly/docs/Benchmark.md +310 -0
- package/external/folly/folly/docs/Conv.md +291 -0
- package/external/folly/folly/docs/Dynamic.md +220 -0
- package/external/folly/folly/docs/DynamicConverter.md +71 -0
- package/external/folly/folly/docs/Executors.md +63 -0
- package/external/folly/folly/docs/FBString.md +46 -0
- package/external/folly/folly/docs/FBVector.md +200 -0
- package/external/folly/folly/docs/Fbvector--graphical_solutions.png +0 -0
- package/external/folly/folly/docs/Format.md +177 -0
- package/external/folly/folly/docs/Function.md +92 -0
- package/external/folly/folly/docs/Futures.md +263 -0
- package/external/folly/folly/docs/GroupVarint.md +46 -0
- package/external/folly/folly/docs/Histogram.md +104 -0
- package/external/folly/folly/docs/MapUtils.md +80 -0
- package/external/folly/folly/docs/Overview.md +263 -0
- package/external/folly/folly/docs/PackedSyncPtr.md +77 -0
- package/external/folly/folly/docs/Poly.md +500 -0
- package/external/folly/folly/docs/ProducerConsumerQueue.md +82 -0
- package/external/folly/folly/docs/Rcu.md +218 -0
- package/external/folly/folly/docs/SmallLocks.md +24 -0
- package/external/folly/folly/docs/Synchronized.md +793 -0
- package/external/folly/folly/docs/ThreadCachedInt.md +98 -0
- package/external/folly/folly/docs/ThreadLocal.md +105 -0
- package/external/folly/folly/docs/Traits.md +161 -0
- package/external/folly/folly/docs/small_vector.md +64 -0
- package/external/folly/folly/docs/style.css +23 -0
- package/external/folly/folly/dynamic-inl.h +17 -0
- package/external/folly/folly/dynamic.h +17 -0
- package/external/folly/folly/folly_extended_library.bzl +28 -0
- package/external/folly/folly/functional/ApplyTuple.h +204 -0
- package/external/folly/folly/functional/BUCK +57 -0
- package/external/folly/folly/functional/Invoke.h +880 -0
- package/external/folly/folly/functional/Partial.h +130 -0
- package/external/folly/folly/functional/protocol.h +203 -0
- package/external/folly/folly/functional/test/ApplyTupleTest.cpp +549 -0
- package/external/folly/folly/functional/test/BUCK +57 -0
- package/external/folly/folly/functional/test/InvokeTest.cpp +483 -0
- package/external/folly/folly/functional/test/PartialTest.cpp +141 -0
- package/external/folly/folly/functional/test/protocol_test.cpp +177 -0
- package/external/folly/folly/functional/test/traits_test.cpp +551 -0
- package/external/folly/folly/functional/traits.h +675 -0
- package/external/folly/folly/hash/BUCK +86 -0
- package/external/folly/folly/hash/Checksum.cpp +275 -0
- package/external/folly/folly/hash/Checksum.h +94 -0
- package/external/folly/folly/hash/FarmHash.h +46 -0
- package/external/folly/folly/hash/Hash.h +1045 -0
- package/external/folly/folly/hash/MurmurHash.h +86 -0
- package/external/folly/folly/hash/SpookyHashV1.cpp +391 -0
- package/external/folly/folly/hash/SpookyHashV1.h +307 -0
- package/external/folly/folly/hash/SpookyHashV2.cpp +392 -0
- package/external/folly/folly/hash/SpookyHashV2.h +339 -0
- package/external/folly/folly/hash/detail/BUCK +26 -0
- package/external/folly/folly/hash/detail/ChecksumDetail.cpp +296 -0
- package/external/folly/folly/hash/detail/ChecksumDetail.h +137 -0
- package/external/folly/folly/hash/detail/Crc32CombineDetail.cpp +191 -0
- package/external/folly/folly/hash/detail/Crc32cDetail.cpp +303 -0
- package/external/folly/folly/hash/test/BUCK +132 -0
- package/external/folly/folly/hash/test/ChecksumBenchmark.cpp +91 -0
- package/external/folly/folly/hash/test/ChecksumTest.cpp +587 -0
- package/external/folly/folly/hash/test/FarmHashTest.cpp +41 -0
- package/external/folly/folly/hash/test/HashBenchmark.cpp +238 -0
- package/external/folly/folly/hash/test/HashTest.cpp +997 -0
- package/external/folly/folly/hash/test/MurmurHashTest.cpp +76 -0
- package/external/folly/folly/hash/test/SpookyHashV1Test.cpp +559 -0
- package/external/folly/folly/hash/test/SpookyHashV2Test.cpp +549 -0
- package/external/folly/folly/hash/test/traits_test.cpp +69 -0
- package/external/folly/folly/hash/traits.h +115 -0
- package/external/folly/folly/json/BUCK +155 -0
- package/external/folly/folly/json/DynamicConverter.h +464 -0
- package/external/folly/folly/json/DynamicParser-inl.h +316 -0
- package/external/folly/folly/json/DynamicParser.cpp +198 -0
- package/external/folly/folly/json/DynamicParser.h +394 -0
- package/external/folly/folly/json/JSONSchema.cpp +1030 -0
- package/external/folly/folly/json/JSONSchema.h +73 -0
- package/external/folly/folly/json/JsonMockUtil.h +73 -0
- package/external/folly/folly/json/JsonTestUtil.cpp +167 -0
- package/external/folly/folly/json/JsonTestUtil.h +88 -0
- package/external/folly/folly/json/bser/BUCK +24 -0
- package/external/folly/folly/json/bser/Bser.h +107 -0
- package/external/folly/folly/json/bser/Dump.cpp +253 -0
- package/external/folly/folly/json/bser/Load.cpp +246 -0
- package/external/folly/folly/json/bser/test/BUCK +14 -0
- package/external/folly/folly/json/bser/test/BserTest.cpp +149 -0
- package/external/folly/folly/json/dynamic-inl.h +1438 -0
- package/external/folly/folly/json/dynamic.cpp +552 -0
- package/external/folly/folly/json/dynamic.h +1346 -0
- package/external/folly/folly/json/json.cpp +1118 -0
- package/external/folly/folly/json/json.h +238 -0
- package/external/folly/folly/json/json_patch.cpp +325 -0
- package/external/folly/folly/json/json_patch.h +126 -0
- package/external/folly/folly/json/json_pointer.cpp +114 -0
- package/external/folly/folly/json/json_pointer.h +87 -0
- package/external/folly/folly/json/test/BUCK +147 -0
- package/external/folly/folly/json/test/DynamicBenchmark.cpp +146 -0
- package/external/folly/folly/json/test/DynamicConverterTest.cpp +518 -0
- package/external/folly/folly/json/test/DynamicOtherTest.cpp +344 -0
- package/external/folly/folly/json/test/DynamicParserTest.cpp +443 -0
- package/external/folly/folly/json/test/DynamicTest.cpp +1647 -0
- package/external/folly/folly/json/test/JSONSchemaTest.cpp +450 -0
- package/external/folly/folly/json/test/JsonBenchmark.cpp +264 -0
- package/external/folly/folly/json/test/JsonOtherTest.cpp +51 -0
- package/external/folly/folly/json/test/JsonTest.cpp +1153 -0
- package/external/folly/folly/json/test/JsonTestUtilTest.cpp +97 -0
- package/external/folly/folly/json/test/json_patch_test.cpp +361 -0
- package/external/folly/folly/json/test/json_pointer_test.cpp +58 -0
- package/external/folly/folly/json/tool/BUCK +13 -0
- package/external/folly/folly/json/tool/JSONSchemaTester.cpp +58 -0
- package/external/folly/folly/json.h +17 -0
- package/external/folly/folly/json_patch.h +17 -0
- package/external/folly/folly/json_pointer.h +17 -0
- package/external/folly/folly/lang/Access.h +29 -0
- package/external/folly/folly/lang/Align.h +240 -0
- package/external/folly/folly/lang/Aligned.h +92 -0
- package/external/folly/folly/lang/Assume.h +82 -0
- package/external/folly/folly/lang/BUCK +287 -0
- package/external/folly/folly/lang/Badge.h +108 -0
- package/external/folly/folly/lang/Bits.h +570 -0
- package/external/folly/folly/lang/BitsClass.h +312 -0
- package/external/folly/folly/lang/Builtin.h +74 -0
- package/external/folly/folly/lang/CArray.h +34 -0
- package/external/folly/folly/lang/CString.cpp +86 -0
- package/external/folly/folly/lang/CString.h +55 -0
- package/external/folly/folly/lang/Cast.h +51 -0
- package/external/folly/folly/lang/CheckedMath.h +253 -0
- package/external/folly/folly/lang/CustomizationPoint.h +58 -0
- package/external/folly/folly/lang/Exception.cpp +822 -0
- package/external/folly/folly/lang/Exception.h +716 -0
- package/external/folly/folly/lang/Extern.h +55 -0
- package/external/folly/folly/lang/Hint-inl.h +144 -0
- package/external/folly/folly/lang/Hint.h +238 -0
- package/external/folly/folly/lang/Keep.h +98 -0
- package/external/folly/folly/lang/New.h +124 -0
- package/external/folly/folly/lang/Ordering.h +140 -0
- package/external/folly/folly/lang/Pretty.h +159 -0
- package/external/folly/folly/lang/PropagateConst.h +413 -0
- package/external/folly/folly/lang/RValueReferenceWrapper.h +152 -0
- package/external/folly/folly/lang/SafeAssert.cpp +589 -0
- package/external/folly/folly/lang/SafeAssert.h +188 -0
- package/external/folly/folly/lang/StaticConst.h +33 -0
- package/external/folly/folly/lang/Thunk.h +100 -0
- package/external/folly/folly/lang/ToAscii.cpp +348 -0
- package/external/folly/folly/lang/ToAscii.h +182 -0
- package/external/folly/folly/lang/TypeInfo.h +58 -0
- package/external/folly/folly/lang/UncaughtExceptions.cpp +17 -0
- package/external/folly/folly/lang/UncaughtExceptions.h +19 -0
- package/external/folly/folly/lang/test/AlignTest.cpp +87 -0
- package/external/folly/folly/lang/test/AlignedTest.cpp +130 -0
- package/external/folly/folly/lang/test/BUCK +258 -0
- package/external/folly/folly/lang/test/BadgeTest.cpp +89 -0
- package/external/folly/folly/lang/test/BitsBenchmark.cpp +164 -0
- package/external/folly/folly/lang/test/BitsClassBenchmark.cpp +122 -0
- package/external/folly/folly/lang/test/BitsClassTest.cpp +379 -0
- package/external/folly/folly/lang/test/BitsTest.cpp +577 -0
- package/external/folly/folly/lang/test/CStringTest.cpp +60 -0
- package/external/folly/folly/lang/test/CastTest.cpp +47 -0
- package/external/folly/folly/lang/test/CheckedMathTest.cpp +394 -0
- package/external/folly/folly/lang/test/ExceptionBench.cpp +427 -0
- package/external/folly/folly/lang/test/ExceptionTest.cpp +413 -0
- package/external/folly/folly/lang/test/ExternTest.cpp +39 -0
- package/external/folly/folly/lang/test/HintTest.cpp +100 -0
- package/external/folly/folly/lang/test/NewTest.cpp +38 -0
- package/external/folly/folly/lang/test/OrderingTest.cpp +105 -0
- package/external/folly/folly/lang/test/PrettyTest.cpp +44 -0
- package/external/folly/folly/lang/test/PropagateConstTest.cpp +356 -0
- package/external/folly/folly/lang/test/RValueReferenceWrapperTest.cpp +85 -0
- package/external/folly/folly/lang/test/SafeAssertTest.cpp +75 -0
- package/external/folly/folly/lang/test/ThunkTest.cpp +105 -0
- package/external/folly/folly/lang/test/ToAsciiBench.cpp +466 -0
- package/external/folly/folly/lang/test/ToAsciiTest.cpp +266 -0
- package/external/folly/folly/lang/test/TypeInfoTest.cpp +56 -0
- package/external/folly/folly/memcpy.S +292 -0
- package/external/folly/folly/memcpy_select_aarch64.cpp +145 -0
- package/external/folly/folly/memory/Arena-inl.h +83 -0
- package/external/folly/folly/memory/Arena.h +325 -0
- package/external/folly/folly/memory/BUCK +191 -0
- package/external/folly/folly/memory/JemallocHugePageAllocator.cpp +449 -0
- package/external/folly/folly/memory/JemallocHugePageAllocator.h +105 -0
- package/external/folly/folly/memory/JemallocHugePageAllocatorTest.cpp +341 -0
- package/external/folly/folly/memory/JemallocNodumpAllocator.cpp +176 -0
- package/external/folly/folly/memory/JemallocNodumpAllocator.h +119 -0
- package/external/folly/folly/memory/JemallocNodumpAllocatorTest.cpp +61 -0
- package/external/folly/folly/memory/MallctlHelper.cpp +37 -0
- package/external/folly/folly/memory/MallctlHelper.h +167 -0
- package/external/folly/folly/memory/Malloc.h +551 -0
- package/external/folly/folly/memory/MemoryResource.h +57 -0
- package/external/folly/folly/memory/ReentrantAllocator.cpp +162 -0
- package/external/folly/folly/memory/ReentrantAllocator.h +261 -0
- package/external/folly/folly/memory/SanitizeAddress.cpp +75 -0
- package/external/folly/folly/memory/SanitizeAddress.h +117 -0
- package/external/folly/folly/memory/SanitizeLeak.cpp +119 -0
- package/external/folly/folly/memory/SanitizeLeak.h +108 -0
- package/external/folly/folly/memory/ThreadCachedArena.cpp +53 -0
- package/external/folly/folly/memory/ThreadCachedArena.h +90 -0
- package/external/folly/folly/memory/UninitializedMemoryHacks.h +426 -0
- package/external/folly/folly/memory/detail/BUCK +10 -0
- package/external/folly/folly/memory/detail/MallocImpl.cpp +52 -0
- package/external/folly/folly/memory/detail/MallocImpl.h +97 -0
- package/external/folly/folly/memory/not_null-inl.h +522 -0
- package/external/folly/folly/memory/not_null.h +449 -0
- package/external/folly/folly/memory/test/ArenaTest.cpp +354 -0
- package/external/folly/folly/memory/test/BUCK +146 -0
- package/external/folly/folly/memory/test/MallctlHelperTest.cpp +169 -0
- package/external/folly/folly/memory/test/MallocBenchmark.cpp +91 -0
- package/external/folly/folly/memory/test/MallocTest.cpp +78 -0
- package/external/folly/folly/memory/test/MemoryResourceTest.cpp +31 -0
- package/external/folly/folly/memory/test/ReentrantAllocatorTest.cpp +144 -0
- package/external/folly/folly/memory/test/SanitizeAddressTest.cpp +67 -0
- package/external/folly/folly/memory/test/SanitizeLeakTest.cpp +139 -0
- package/external/folly/folly/memory/test/ThreadCachedArenaTest.cpp +276 -0
- package/external/folly/folly/memory/test/UninitializedMemoryHacksODR.cpp +21 -0
- package/external/folly/folly/memory/test/UninitializedMemoryHacksTest.cpp +327 -0
- package/external/folly/folly/memory/test/not_null_test.cpp +608 -0
- package/external/folly/folly/memset.S +245 -0
- package/external/folly/folly/memset_select_aarch64.cpp +72 -0
- package/external/folly/folly/portability/Asm.h +50 -0
- package/external/folly/folly/portability/Atomic.h +31 -0
- package/external/folly/folly/portability/BUCK +456 -0
- package/external/folly/folly/portability/Builtins.cpp +31 -0
- package/external/folly/folly/portability/Builtins.h +161 -0
- package/external/folly/folly/portability/Config.h +43 -0
- package/external/folly/folly/portability/Constexpr.h +145 -0
- package/external/folly/folly/portability/Dirent.cpp +140 -0
- package/external/folly/folly/portability/Dirent.h +41 -0
- package/external/folly/folly/portability/Event.h +44 -0
- package/external/folly/folly/portability/Fcntl.cpp +120 -0
- package/external/folly/folly/portability/Fcntl.h +67 -0
- package/external/folly/folly/portability/Filesystem.cpp +67 -0
- package/external/folly/folly/portability/Filesystem.h +114 -0
- package/external/folly/folly/portability/FmtCompile.h +40 -0
- package/external/folly/folly/portability/GFlags.h +139 -0
- package/external/folly/folly/portability/GMock.h +35 -0
- package/external/folly/folly/portability/GTest.h +35 -0
- package/external/folly/folly/portability/IOVec.h +34 -0
- package/external/folly/folly/portability/Libgen.cpp +59 -0
- package/external/folly/folly/portability/Libgen.h +29 -0
- package/external/folly/folly/portability/Libunwind.h +21 -0
- package/external/folly/folly/portability/Malloc.cpp +31 -0
- package/external/folly/folly/portability/Malloc.h +53 -0
- package/external/folly/folly/portability/Math.h +90 -0
- package/external/folly/folly/portability/Memory.h +26 -0
- package/external/folly/folly/portability/OpenSSL.cpp +17 -0
- package/external/folly/folly/portability/OpenSSL.h +102 -0
- package/external/folly/folly/portability/PThread.cpp +697 -0
- package/external/folly/folly/portability/PThread.h +148 -0
- package/external/folly/folly/portability/README.md +21 -0
- package/external/folly/folly/portability/Sched.cpp +41 -0
- package/external/folly/folly/portability/Sched.h +45 -0
- package/external/folly/folly/portability/Sockets.cpp +245 -0
- package/external/folly/folly/portability/Sockets.h +155 -0
- package/external/folly/folly/portability/SourceLocation.h +49 -0
- package/external/folly/folly/portability/Stdio.cpp +77 -0
- package/external/folly/folly/portability/Stdio.h +32 -0
- package/external/folly/folly/portability/Stdlib.cpp +172 -0
- package/external/folly/folly/portability/Stdlib.h +64 -0
- package/external/folly/folly/portability/String.cpp +53 -0
- package/external/folly/folly/portability/String.h +39 -0
- package/external/folly/folly/portability/SysFile.cpp +46 -0
- package/external/folly/folly/portability/SysFile.h +27 -0
- package/external/folly/folly/portability/SysMembarrier.cpp +104 -0
- package/external/folly/folly/portability/SysMembarrier.h +26 -0
- package/external/folly/folly/portability/SysMman.cpp +242 -0
- package/external/folly/folly/portability/SysMman.h +68 -0
- package/external/folly/folly/portability/SysResource.cpp +108 -0
- package/external/folly/folly/portability/SysResource.h +71 -0
- package/external/folly/folly/portability/SysStat.cpp +66 -0
- package/external/folly/folly/portability/SysStat.h +52 -0
- package/external/folly/folly/portability/SysSyscall.h +73 -0
- package/external/folly/folly/portability/SysTime.cpp +62 -0
- package/external/folly/folly/portability/SysTime.h +50 -0
- package/external/folly/folly/portability/SysTypes.h +44 -0
- package/external/folly/folly/portability/SysUio.cpp +179 -0
- package/external/folly/folly/portability/SysUio.h +51 -0
- package/external/folly/folly/portability/Syslog.h +39 -0
- package/external/folly/folly/portability/Time.cpp +357 -0
- package/external/folly/folly/portability/Time.h +74 -0
- package/external/folly/folly/portability/Unistd.cpp +33 -0
- package/external/folly/folly/portability/Unistd.h +111 -0
- package/external/folly/folly/portability/Windows.h +108 -0
- package/external/folly/folly/portability/openat2.c +30 -0
- package/external/folly/folly/portability/openat2.h +39 -0
- package/external/folly/folly/portability/test/BUCK +59 -0
- package/external/folly/folly/portability/test/ConstexprTest.cpp +102 -0
- package/external/folly/folly/portability/test/FilesystemTest.cpp +35 -0
- package/external/folly/folly/portability/test/LibgenTest.cpp +35 -0
- package/external/folly/folly/portability/test/OpenSSLPortabilityTest.cpp +108 -0
- package/external/folly/folly/portability/test/PThreadTest.cpp +80 -0
- package/external/folly/folly/portability/test/TimeTest.cpp +90 -0
- package/external/folly/folly/small_vector.h +17 -0
- package/external/folly/folly/somerge_defs.bzl +399 -0
- package/external/folly/folly/sorted_vector_types.h +17 -0
- package/external/folly/folly/stop_watch.h +317 -0
- package/external/folly/folly/synchronization/AsymmetricThreadFence.cpp +91 -0
- package/external/folly/folly/synchronization/AsymmetricThreadFence.h +60 -0
- package/external/folly/folly/synchronization/AtomicNotification-inl.h +146 -0
- package/external/folly/folly/synchronization/AtomicNotification.cpp +34 -0
- package/external/folly/folly/synchronization/AtomicNotification.h +117 -0
- package/external/folly/folly/synchronization/AtomicRef.h +181 -0
- package/external/folly/folly/synchronization/AtomicStruct.h +150 -0
- package/external/folly/folly/synchronization/AtomicUtil-inl.h +482 -0
- package/external/folly/folly/synchronization/AtomicUtil.h +179 -0
- package/external/folly/folly/synchronization/BUCK +418 -0
- package/external/folly/folly/synchronization/Baton.h +419 -0
- package/external/folly/folly/synchronization/CallOnce.h +263 -0
- package/external/folly/folly/synchronization/DelayedInit.h +179 -0
- package/external/folly/folly/synchronization/DistributedMutex-inl.h +1744 -0
- package/external/folly/folly/synchronization/DistributedMutex.cpp +27 -0
- package/external/folly/folly/synchronization/DistributedMutex.h +342 -0
- package/external/folly/folly/synchronization/EventCount.h +200 -0
- package/external/folly/folly/synchronization/FlatCombining.h +629 -0
- package/external/folly/folly/synchronization/Hazptr-fwd.h +217 -0
- package/external/folly/folly/synchronization/Hazptr.cpp +36 -0
- package/external/folly/folly/synchronization/Hazptr.h +209 -0
- package/external/folly/folly/synchronization/HazptrDomain.cpp +68 -0
- package/external/folly/folly/synchronization/HazptrDomain.h +832 -0
- package/external/folly/folly/synchronization/HazptrHolder.h +431 -0
- package/external/folly/folly/synchronization/HazptrObj.h +533 -0
- package/external/folly/folly/synchronization/HazptrObjLinked.h +315 -0
- package/external/folly/folly/synchronization/HazptrRec.h +68 -0
- package/external/folly/folly/synchronization/HazptrThrLocal.h +180 -0
- package/external/folly/folly/synchronization/HazptrThreadPoolExecutor.cpp +46 -0
- package/external/folly/folly/synchronization/HazptrThreadPoolExecutor.h +25 -0
- package/external/folly/folly/synchronization/Latch.h +160 -0
- package/external/folly/folly/synchronization/LifoSem.h +767 -0
- package/external/folly/folly/synchronization/Lock.h +887 -0
- package/external/folly/folly/synchronization/MicroSpinLock.h +154 -0
- package/external/folly/folly/synchronization/NativeSemaphore.h +187 -0
- package/external/folly/folly/synchronization/ParkingLot.cpp +37 -0
- package/external/folly/folly/synchronization/ParkingLot.h +330 -0
- package/external/folly/folly/synchronization/PicoSpinLock.h +167 -0
- package/external/folly/folly/synchronization/RWSpinLock.h +549 -0
- package/external/folly/folly/synchronization/Rcu.cpp +26 -0
- package/external/folly/folly/synchronization/Rcu.h +553 -0
- package/external/folly/folly/synchronization/RelaxedAtomic.h +336 -0
- package/external/folly/folly/synchronization/SanitizeThread.cpp +141 -0
- package/external/folly/folly/synchronization/SanitizeThread.h +166 -0
- package/external/folly/folly/synchronization/SaturatingSemaphore.h +324 -0
- package/external/folly/folly/synchronization/SmallLocks.h +36 -0
- package/external/folly/folly/synchronization/ThrottledLifoSem.h +362 -0
- package/external/folly/folly/synchronization/WaitOptions.cpp +25 -0
- package/external/folly/folly/synchronization/WaitOptions.h +75 -0
- package/external/folly/folly/synchronization/detail/AtomicUtils.h +59 -0
- package/external/folly/folly/synchronization/detail/BUCK +104 -0
- package/external/folly/folly/synchronization/detail/Hardware.cpp +192 -0
- package/external/folly/folly/synchronization/detail/Hardware.h +75 -0
- package/external/folly/folly/synchronization/detail/HazptrUtils.h +339 -0
- package/external/folly/folly/synchronization/detail/InlineFunctionRef.h +229 -0
- package/external/folly/folly/synchronization/detail/Sleeper.cpp +27 -0
- package/external/folly/folly/synchronization/detail/Sleeper.h +62 -0
- package/external/folly/folly/synchronization/detail/Spin.h +96 -0
- package/external/folly/folly/synchronization/detail/ThreadCachedLists.h +174 -0
- package/external/folly/folly/synchronization/detail/ThreadCachedReaders.h +189 -0
- package/external/folly/folly/synchronization/detail/ThreadCachedTag.h +26 -0
- package/external/folly/folly/synchronization/detail/test/BUCK +28 -0
- package/external/folly/folly/synchronization/detail/test/HardwareTest.cpp +74 -0
- package/external/folly/folly/synchronization/detail/test/InlineFunctionRefTest.cpp +286 -0
- package/external/folly/folly/synchronization/example/BUCK +27 -0
- package/external/folly/folly/synchronization/example/HazptrLockFreeLIFO.h +88 -0
- package/external/folly/folly/synchronization/example/HazptrSWMRSet.h +133 -0
- package/external/folly/folly/synchronization/example/HazptrWideCAS.h +62 -0
- package/external/folly/folly/synchronization/test/AtomicNotificationTest.cpp +236 -0
- package/external/folly/folly/synchronization/test/AtomicRefTest.cpp +170 -0
- package/external/folly/folly/synchronization/test/AtomicStructTest.cpp +65 -0
- package/external/folly/folly/synchronization/test/AtomicUtilBench.cpp +457 -0
- package/external/folly/folly/synchronization/test/AtomicUtilTest.cpp +650 -0
- package/external/folly/folly/synchronization/test/BUCK +495 -0
- package/external/folly/folly/synchronization/test/Barrier.h +52 -0
- package/external/folly/folly/synchronization/test/BarrierTest.cpp +56 -0
- package/external/folly/folly/synchronization/test/BatonBenchmark.cpp +77 -0
- package/external/folly/folly/synchronization/test/BatonTest.cpp +164 -0
- package/external/folly/folly/synchronization/test/BatonTestHelpers.h +118 -0
- package/external/folly/folly/synchronization/test/CallOnceBenchmark.cpp +72 -0
- package/external/folly/folly/synchronization/test/CallOnceTest.cpp +153 -0
- package/external/folly/folly/synchronization/test/DelayedInitTest.cpp +281 -0
- package/external/folly/folly/synchronization/test/DistributedMutexTest.cpp +2074 -0
- package/external/folly/folly/synchronization/test/EventCountTest.cpp +124 -0
- package/external/folly/folly/synchronization/test/FlatCombiningBenchmark.cpp +1789 -0
- package/external/folly/folly/synchronization/test/FlatCombiningExamples.h +222 -0
- package/external/folly/folly/synchronization/test/FlatCombiningTest.cpp +121 -0
- package/external/folly/folly/synchronization/test/FlatCombiningTestHelpers.h +227 -0
- package/external/folly/folly/synchronization/test/HazptrTest.cpp +1689 -0
- package/external/folly/folly/synchronization/test/LatchTest.cpp +224 -0
- package/external/folly/folly/synchronization/test/LifoSemBench.cpp +185 -0
- package/external/folly/folly/synchronization/test/LifoSemTests.cpp +353 -0
- package/external/folly/folly/synchronization/test/LockTest.cpp +1239 -0
- package/external/folly/folly/synchronization/test/NativeSemaphoreTest.cpp +37 -0
- package/external/folly/folly/synchronization/test/ParkingLotBenchmark.cpp +239 -0
- package/external/folly/folly/synchronization/test/ParkingLotTest.cpp +170 -0
- package/external/folly/folly/synchronization/test/RWSpinLockTest.cpp +235 -0
- package/external/folly/folly/synchronization/test/RcuBench.cpp +66 -0
- package/external/folly/folly/synchronization/test/RcuTest.cpp +330 -0
- package/external/folly/folly/synchronization/test/RelaxedAtomicTest.cpp +389 -0
- package/external/folly/folly/synchronization/test/SaturatingSemaphoreTest.cpp +166 -0
- package/external/folly/folly/synchronization/test/Semaphore.h +242 -0
- package/external/folly/folly/synchronization/test/SemaphoreTest.cpp +271 -0
- package/external/folly/folly/synchronization/test/SmallLocksBenchmark.cpp +1296 -0
- package/external/folly/folly/synchronization/test/SmallLocksTest.cpp +510 -0
- package/external/folly/folly/synchronization/test/ThreadCachedEpochBench.h +67 -0
- package/external/folly/folly/synchronization/test/ThreadCachedReadersBench.cpp +42 -0
- package/external/folly/folly/synchronization/test/ThreadCachedReadersTest.cpp +52 -0
- package/external/folly/folly/synchronization/test/ThrottledLifoSemTest.cpp +243 -0
- package/external/folly/folly/system/AtFork.cpp +205 -0
- package/external/folly/folly/system/AtFork.h +116 -0
- package/external/folly/folly/system/AuxVector.h +198 -0
- package/external/folly/folly/system/BUCK +144 -0
- package/external/folly/folly/system/EnvUtil.cpp +93 -0
- package/external/folly/folly/system/EnvUtil.h +113 -0
- package/external/folly/folly/system/HardwareConcurrency.cpp +39 -0
- package/external/folly/folly/system/HardwareConcurrency.h +23 -0
- package/external/folly/folly/system/MemoryMapping.cpp +477 -0
- package/external/folly/folly/system/MemoryMapping.h +287 -0
- package/external/folly/folly/system/Pid.cpp +87 -0
- package/external/folly/folly/system/Pid.h +34 -0
- package/external/folly/folly/system/Shell.cpp +33 -0
- package/external/folly/folly/system/Shell.h +93 -0
- package/external/folly/folly/system/ThreadId.cpp +89 -0
- package/external/folly/folly/system/ThreadId.h +62 -0
- package/external/folly/folly/system/ThreadName.cpp +330 -0
- package/external/folly/folly/system/ThreadName.h +72 -0
- package/external/folly/folly/system/test/AtForkTest.cpp +309 -0
- package/external/folly/folly/system/test/AuxVectorTest.cpp +55 -0
- package/external/folly/folly/system/test/BUCK +120 -0
- package/external/folly/folly/system/test/EnvUtilSubprocess.cpp +26 -0
- package/external/folly/folly/system/test/EnvUtilTest.cpp +197 -0
- package/external/folly/folly/system/test/MemoryMappingTest.cpp +179 -0
- package/external/folly/folly/system/test/PidTest.cpp +46 -0
- package/external/folly/folly/system/test/ShellTest.cpp +66 -0
- package/external/folly/folly/system/test/ThreadIdTest.cpp +114 -0
- package/external/folly/folly/system/test/ThreadNameTest.cpp +85 -0
- package/external/folly/folly.vcxitems +164 -0
- package/external/folly/static/logo.svg +1 -0
- package/external/folly/sync-config.json +8 -0
- package/package.json +3 -3
- package/templates/cpp-lib/example/metro.config.js +18 -2
|
@@ -0,0 +1,1242 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
#include <folly/concurrency/ConcurrentHashMap.h>
|
|
18
|
+
|
|
19
|
+
#include <atomic>
|
|
20
|
+
#include <limits>
|
|
21
|
+
#include <memory>
|
|
22
|
+
#include <thread>
|
|
23
|
+
#include <vector>
|
|
24
|
+
|
|
25
|
+
#include <folly/Traits.h>
|
|
26
|
+
#include <folly/container/test/TrackingTypes.h>
|
|
27
|
+
#include <folly/hash/Hash.h>
|
|
28
|
+
#include <folly/portability/GFlags.h>
|
|
29
|
+
#include <folly/portability/GTest.h>
|
|
30
|
+
#include <folly/synchronization/Latch.h>
|
|
31
|
+
#include <folly/test/DeterministicSchedule.h>
|
|
32
|
+
|
|
33
|
+
using namespace folly::test;
|
|
34
|
+
using namespace folly;
|
|
35
|
+
using namespace std;
|
|
36
|
+
|
|
37
|
+
DEFINE_int64(seed, 0, "Seed for random number generators");
|
|
38
|
+
|
|
39
|
+
template <typename T>
|
|
40
|
+
class ConcurrentHashMapTest : public ::testing::Test {};
|
|
41
|
+
TYPED_TEST_SUITE_P(ConcurrentHashMapTest);
|
|
42
|
+
|
|
43
|
+
template <template <
|
|
44
|
+
typename,
|
|
45
|
+
typename,
|
|
46
|
+
uint8_t,
|
|
47
|
+
typename,
|
|
48
|
+
typename,
|
|
49
|
+
typename,
|
|
50
|
+
template <typename>
|
|
51
|
+
class,
|
|
52
|
+
class>
|
|
53
|
+
class Impl>
|
|
54
|
+
struct MapFactory {
|
|
55
|
+
template <
|
|
56
|
+
typename KeyType,
|
|
57
|
+
typename ValueType,
|
|
58
|
+
typename HashFn = std::hash<KeyType>,
|
|
59
|
+
typename KeyEqual = std::equal_to<KeyType>,
|
|
60
|
+
typename Allocator = std::allocator<uint8_t>,
|
|
61
|
+
uint8_t ShardBits = 8,
|
|
62
|
+
template <typename> class Atom = std::atomic,
|
|
63
|
+
class Mutex = std::mutex>
|
|
64
|
+
using MapT = ConcurrentHashMap<
|
|
65
|
+
KeyType,
|
|
66
|
+
ValueType,
|
|
67
|
+
HashFn,
|
|
68
|
+
KeyEqual,
|
|
69
|
+
Allocator,
|
|
70
|
+
ShardBits,
|
|
71
|
+
Atom,
|
|
72
|
+
Mutex,
|
|
73
|
+
Impl>;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
#define CHM typename TypeParam::template MapT
|
|
77
|
+
|
|
78
|
+
TYPED_TEST_P(ConcurrentHashMapTest, MapTest) {
|
|
79
|
+
CHM<uint64_t, uint64_t> foomap(3);
|
|
80
|
+
EXPECT_TRUE(foomap.empty());
|
|
81
|
+
EXPECT_EQ(foomap.find(1), foomap.cend());
|
|
82
|
+
auto r = foomap.insert(1, 0);
|
|
83
|
+
EXPECT_TRUE(r.second);
|
|
84
|
+
auto r2 = foomap.insert(1, 0);
|
|
85
|
+
EXPECT_EQ(r.first->second, 0);
|
|
86
|
+
EXPECT_EQ(r.first->first, 1);
|
|
87
|
+
EXPECT_EQ(r2.first->second, 0);
|
|
88
|
+
EXPECT_EQ(r2.first->first, 1);
|
|
89
|
+
EXPECT_EQ(r.first, r2.first);
|
|
90
|
+
EXPECT_TRUE(r.second);
|
|
91
|
+
EXPECT_FALSE(r2.second);
|
|
92
|
+
EXPECT_FALSE(foomap.empty());
|
|
93
|
+
EXPECT_TRUE(foomap.insert(std::make_pair(2, 0)).second);
|
|
94
|
+
EXPECT_TRUE(foomap.insert_or_assign(2, 0).second);
|
|
95
|
+
EXPECT_EQ(foomap.size(), 2);
|
|
96
|
+
EXPECT_TRUE(foomap.assign_if_equal(2, 0, 3));
|
|
97
|
+
EXPECT_FALSE(foomap.assign_if(2, 4, [](auto&&) { return false; }));
|
|
98
|
+
EXPECT_TRUE(foomap.insert(3, 0).second);
|
|
99
|
+
EXPECT_FALSE(foomap.erase_if_equal(3, 1));
|
|
100
|
+
EXPECT_TRUE(foomap.erase_if_equal(3, 0));
|
|
101
|
+
EXPECT_TRUE(foomap.insert(3, 0).second);
|
|
102
|
+
EXPECT_NE(foomap.find(1), foomap.cend());
|
|
103
|
+
EXPECT_NE(foomap.find(2), foomap.cend());
|
|
104
|
+
EXPECT_EQ(foomap.find(2)->second, 3);
|
|
105
|
+
EXPECT_EQ(foomap[2], 3);
|
|
106
|
+
EXPECT_EQ(foomap[20], 0);
|
|
107
|
+
EXPECT_EQ(foomap.at(20), 0);
|
|
108
|
+
EXPECT_FALSE(foomap.insert(1, 0).second);
|
|
109
|
+
auto l = foomap.find(1);
|
|
110
|
+
foomap.erase(l);
|
|
111
|
+
EXPECT_FALSE(foomap.erase(1));
|
|
112
|
+
EXPECT_EQ(foomap.find(1), foomap.cend());
|
|
113
|
+
auto res = foomap.find(2);
|
|
114
|
+
EXPECT_NE(res, foomap.cend());
|
|
115
|
+
EXPECT_EQ(3, res->second);
|
|
116
|
+
EXPECT_FALSE(foomap.empty());
|
|
117
|
+
foomap.clear();
|
|
118
|
+
EXPECT_TRUE(foomap.empty());
|
|
119
|
+
EXPECT_TRUE(foomap.insert(3, 0).second);
|
|
120
|
+
EXPECT_FALSE(foomap.empty());
|
|
121
|
+
foomap.erase(3);
|
|
122
|
+
EXPECT_TRUE(foomap.empty());
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
TYPED_TEST_P(ConcurrentHashMapTest, MaxSizeTest) {
|
|
126
|
+
CHM<uint64_t, uint64_t> foomap(2, 16);
|
|
127
|
+
bool insert_failed = false;
|
|
128
|
+
for (int i = 0; i < 32; i++) {
|
|
129
|
+
auto res = foomap.insert(0, 0);
|
|
130
|
+
if (!res.second) {
|
|
131
|
+
insert_failed = true;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
EXPECT_TRUE(insert_failed);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
TYPED_TEST_P(ConcurrentHashMapTest, MoveTest) {
|
|
138
|
+
CHM<uint64_t, uint64_t> foomap(2, 16);
|
|
139
|
+
auto other = std::move(foomap);
|
|
140
|
+
auto other2 = std::move(other);
|
|
141
|
+
other = std::move(other2);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
struct foo {
|
|
145
|
+
static int moved;
|
|
146
|
+
static int copied;
|
|
147
|
+
foo(foo&&) noexcept { moved++; }
|
|
148
|
+
foo& operator=(foo&&) {
|
|
149
|
+
moved++;
|
|
150
|
+
return *this;
|
|
151
|
+
}
|
|
152
|
+
foo& operator=(const foo&) {
|
|
153
|
+
copied++;
|
|
154
|
+
return *this;
|
|
155
|
+
}
|
|
156
|
+
foo(const foo&) { copied++; }
|
|
157
|
+
foo() {}
|
|
158
|
+
};
|
|
159
|
+
int foo::moved{0};
|
|
160
|
+
int foo::copied{0};
|
|
161
|
+
|
|
162
|
+
TYPED_TEST_P(ConcurrentHashMapTest, EmplaceTest) {
|
|
163
|
+
CHM<uint64_t, foo> foomap(200);
|
|
164
|
+
foo bar; // Make sure to test copy
|
|
165
|
+
foomap.insert(1, bar);
|
|
166
|
+
EXPECT_EQ(foo::moved, 0);
|
|
167
|
+
EXPECT_EQ(foo::copied, 1);
|
|
168
|
+
foo::copied = 0;
|
|
169
|
+
// The difference between emplace and try_emplace:
|
|
170
|
+
// If insertion fails, try_emplace does not move its argument
|
|
171
|
+
foomap.try_emplace(1, foo());
|
|
172
|
+
EXPECT_EQ(foo::moved, 0);
|
|
173
|
+
EXPECT_EQ(foo::copied, 0);
|
|
174
|
+
foomap.emplace(1, foo());
|
|
175
|
+
EXPECT_EQ(foo::moved, 1);
|
|
176
|
+
EXPECT_EQ(foo::copied, 0);
|
|
177
|
+
// Reset the counters. Repeated tests are allowed
|
|
178
|
+
foo::moved = 0;
|
|
179
|
+
foo::copied = 0;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
TYPED_TEST_P(ConcurrentHashMapTest, MapInsertIteratorValueTest) {
|
|
183
|
+
CHM<uint64_t, uint64_t> foomap(2);
|
|
184
|
+
for (uint64_t i = 0; i < 1 << 16; i++) {
|
|
185
|
+
auto ret = foomap.insert(i, i + 1);
|
|
186
|
+
EXPECT_TRUE(ret.second);
|
|
187
|
+
EXPECT_EQ(ret.first->second, i + 1);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
TYPED_TEST_P(ConcurrentHashMapTest, MapResizeTest) {
|
|
192
|
+
CHM<uint64_t, uint64_t> foomap(2);
|
|
193
|
+
EXPECT_EQ(foomap.find(1), foomap.cend());
|
|
194
|
+
EXPECT_TRUE(foomap.insert(1, 0).second);
|
|
195
|
+
EXPECT_TRUE(foomap.insert(2, 0).second);
|
|
196
|
+
EXPECT_TRUE(foomap.insert(3, 0).second);
|
|
197
|
+
EXPECT_TRUE(foomap.insert(4, 0).second);
|
|
198
|
+
foomap.reserve(512);
|
|
199
|
+
EXPECT_NE(foomap.find(1), foomap.cend());
|
|
200
|
+
EXPECT_NE(foomap.find(2), foomap.cend());
|
|
201
|
+
EXPECT_FALSE(foomap.insert(1, 0).second);
|
|
202
|
+
EXPECT_TRUE(foomap.erase(1));
|
|
203
|
+
EXPECT_EQ(foomap.find(1), foomap.cend());
|
|
204
|
+
auto res = foomap.find(2);
|
|
205
|
+
EXPECT_NE(res, foomap.cend());
|
|
206
|
+
if (res != foomap.cend()) {
|
|
207
|
+
EXPECT_EQ(0, res->second);
|
|
208
|
+
}
|
|
209
|
+
foomap.reserve(0);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
TYPED_TEST_P(ConcurrentHashMapTest, ReserveTest) {
|
|
213
|
+
CHM<uint64_t, uint64_t> foomap;
|
|
214
|
+
int64_t insert_count = 0;
|
|
215
|
+
int64_t actual_count = 0;
|
|
216
|
+
|
|
217
|
+
for (int64_t i = 0; i < 1000; i++) {
|
|
218
|
+
if (i % 100 == 0) {
|
|
219
|
+
foomap.reserve(i + 100);
|
|
220
|
+
}
|
|
221
|
+
foomap.insert(std::make_pair(i, i));
|
|
222
|
+
insert_count++;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
for (auto it = foomap.begin(); it != foomap.cend(); ++it) {
|
|
226
|
+
actual_count++;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
EXPECT_EQ(insert_count, actual_count);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// Ensure we can insert objects without copy constructors.
|
|
233
|
+
TYPED_TEST_P(ConcurrentHashMapTest, MapNoCopiesTest) {
|
|
234
|
+
struct Uncopyable {
|
|
235
|
+
int i_;
|
|
236
|
+
Uncopyable(int i) { i_ = i; }
|
|
237
|
+
Uncopyable(const Uncopyable& that) = delete;
|
|
238
|
+
bool operator==(const Uncopyable& o) const { return i_ == o.i_; }
|
|
239
|
+
};
|
|
240
|
+
struct Hasher {
|
|
241
|
+
size_t operator()(const Uncopyable&) const { return 0; }
|
|
242
|
+
};
|
|
243
|
+
CHM<Uncopyable, Uncopyable, Hasher> foomap(2);
|
|
244
|
+
EXPECT_TRUE(foomap.try_emplace(1, 1).second);
|
|
245
|
+
EXPECT_TRUE(foomap.try_emplace(2, 2).second);
|
|
246
|
+
auto res = foomap.find(2);
|
|
247
|
+
EXPECT_NE(res, foomap.cend());
|
|
248
|
+
|
|
249
|
+
EXPECT_TRUE(foomap.try_emplace(3, 3).second);
|
|
250
|
+
|
|
251
|
+
auto res2 = foomap.find(2);
|
|
252
|
+
EXPECT_NE(res2, foomap.cend());
|
|
253
|
+
EXPECT_EQ(&(res->second), &(res2->second));
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
TYPED_TEST_P(ConcurrentHashMapTest, MapMovableKeysTest) {
|
|
257
|
+
struct Movable {
|
|
258
|
+
int i_;
|
|
259
|
+
Movable(int i) { i_ = i; }
|
|
260
|
+
Movable(const Movable&) = delete;
|
|
261
|
+
Movable(Movable&& o) {
|
|
262
|
+
i_ = o.i_;
|
|
263
|
+
o.i_ = 0;
|
|
264
|
+
}
|
|
265
|
+
bool operator==(const Movable& o) const { return i_ == o.i_; }
|
|
266
|
+
};
|
|
267
|
+
struct Hasher {
|
|
268
|
+
size_t operator()(const Movable&) const { return 0; }
|
|
269
|
+
};
|
|
270
|
+
CHM<Movable, Movable, Hasher> foomap(2);
|
|
271
|
+
EXPECT_TRUE(foomap.insert(std::make_pair(Movable(10), Movable(1))).second);
|
|
272
|
+
EXPECT_TRUE(foomap.assign(Movable(10), Movable(2)));
|
|
273
|
+
EXPECT_TRUE(foomap.insert(Movable(11), Movable(1)).second);
|
|
274
|
+
EXPECT_TRUE(foomap.emplace(Movable(12), Movable(1)).second);
|
|
275
|
+
EXPECT_TRUE(foomap.insert_or_assign(Movable(10), Movable(3)).second);
|
|
276
|
+
EXPECT_TRUE(foomap.assign_if_equal(Movable(10), Movable(3), Movable(4)));
|
|
277
|
+
EXPECT_TRUE(
|
|
278
|
+
foomap.assign_if(Movable(10), Movable(5), [](auto&&) { return true; }));
|
|
279
|
+
EXPECT_FALSE(foomap.try_emplace(Movable(10), Movable(3)).second);
|
|
280
|
+
EXPECT_TRUE(foomap.try_emplace(Movable(13), Movable(3)).second);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
TYPED_TEST_P(ConcurrentHashMapTest, MapUpdateTest) {
|
|
284
|
+
CHM<uint64_t, uint64_t> foomap(2);
|
|
285
|
+
EXPECT_TRUE(foomap.insert(1, 10).second);
|
|
286
|
+
EXPECT_TRUE(bool(foomap.assign(1, 11)));
|
|
287
|
+
auto res = foomap.find(1);
|
|
288
|
+
EXPECT_NE(res, foomap.cend());
|
|
289
|
+
EXPECT_EQ(11, res->second);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
TYPED_TEST_P(ConcurrentHashMapTest, MapIterateTest2) {
|
|
293
|
+
CHM<uint64_t, uint64_t> foomap(2);
|
|
294
|
+
auto begin = foomap.cbegin();
|
|
295
|
+
auto end = foomap.cend();
|
|
296
|
+
EXPECT_EQ(begin, end);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
TYPED_TEST_P(ConcurrentHashMapTest, MapIterateTest) {
|
|
300
|
+
CHM<uint64_t, uint64_t> foomap(2);
|
|
301
|
+
EXPECT_EQ(foomap.cbegin(), foomap.cend());
|
|
302
|
+
EXPECT_TRUE(foomap.insert(1, 1).second);
|
|
303
|
+
EXPECT_TRUE(foomap.insert(2, 2).second);
|
|
304
|
+
auto iter = foomap.cbegin();
|
|
305
|
+
EXPECT_NE(iter, foomap.cend());
|
|
306
|
+
EXPECT_EQ(iter->first, 1);
|
|
307
|
+
EXPECT_EQ(iter->second, 1);
|
|
308
|
+
++iter;
|
|
309
|
+
EXPECT_NE(iter, foomap.cend());
|
|
310
|
+
EXPECT_EQ(iter->first, 2);
|
|
311
|
+
EXPECT_EQ(iter->second, 2);
|
|
312
|
+
++iter;
|
|
313
|
+
EXPECT_EQ(iter, foomap.cend());
|
|
314
|
+
|
|
315
|
+
int count = 0;
|
|
316
|
+
for (auto it = foomap.cbegin(); it != foomap.cend(); ++it) {
|
|
317
|
+
count++;
|
|
318
|
+
}
|
|
319
|
+
EXPECT_EQ(count, 2);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
TYPED_TEST_P(ConcurrentHashMapTest, MoveIterateAssignIterate) {
|
|
323
|
+
using Map = CHM<int, int>;
|
|
324
|
+
Map tmp;
|
|
325
|
+
Map map{std::move(tmp)};
|
|
326
|
+
|
|
327
|
+
map.insert(0, 0);
|
|
328
|
+
++map.cbegin();
|
|
329
|
+
CHM<int, int> other;
|
|
330
|
+
other.insert(0, 0);
|
|
331
|
+
map = std::move(other);
|
|
332
|
+
++map.cbegin();
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
TYPED_TEST_P(ConcurrentHashMapTest, EraseTest) {
|
|
336
|
+
CHM<uint64_t, uint64_t> foomap(3);
|
|
337
|
+
foomap.insert(1, 0);
|
|
338
|
+
auto f1 = foomap.find(1);
|
|
339
|
+
EXPECT_EQ(1, foomap.erase(1));
|
|
340
|
+
foomap.erase(f1);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
TYPED_TEST_P(ConcurrentHashMapTest, EraseIfEqualTest) {
|
|
344
|
+
CHM<uint64_t, uint64_t> foomap(3);
|
|
345
|
+
foomap.insert(1, 0);
|
|
346
|
+
EXPECT_FALSE(foomap.erase_if_equal(1, 1));
|
|
347
|
+
auto f1 = foomap.find(1);
|
|
348
|
+
EXPECT_EQ(0, f1->second);
|
|
349
|
+
EXPECT_TRUE(foomap.erase_if_equal(1, 0));
|
|
350
|
+
EXPECT_EQ(foomap.find(1), foomap.cend());
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
TYPED_TEST_P(ConcurrentHashMapTest, EraseIfTest) {
|
|
354
|
+
CHM<uint64_t, uint64_t> foomap(3);
|
|
355
|
+
foomap.insert(1, 0);
|
|
356
|
+
EXPECT_FALSE(
|
|
357
|
+
foomap.erase_key_if(1, [](const uint64_t& value) { return value == 1; }));
|
|
358
|
+
auto f1 = foomap.find(1);
|
|
359
|
+
EXPECT_EQ(0, f1->second);
|
|
360
|
+
EXPECT_TRUE(
|
|
361
|
+
foomap.erase_key_if(1, [](const uint64_t& value) { return value == 0; }));
|
|
362
|
+
EXPECT_EQ(foomap.find(1), foomap.cend());
|
|
363
|
+
|
|
364
|
+
CHM<std::string, std::weak_ptr<uint64_t>> barmap(3);
|
|
365
|
+
auto shared = std::make_shared<uint64_t>(123);
|
|
366
|
+
barmap.insert("test", shared);
|
|
367
|
+
EXPECT_FALSE(barmap.erase_key_if(
|
|
368
|
+
"test",
|
|
369
|
+
[](const std::weak_ptr<uint64_t>& ptr) { return ptr.expired(); }));
|
|
370
|
+
EXPECT_EQ(*barmap.find("test")->second.lock(), 123);
|
|
371
|
+
shared.reset();
|
|
372
|
+
EXPECT_TRUE(barmap.erase_key_if(
|
|
373
|
+
"test",
|
|
374
|
+
[](const std::weak_ptr<uint64_t>& ptr) { return ptr.expired(); }));
|
|
375
|
+
EXPECT_EQ(barmap.find("test"), barmap.cend());
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
TYPED_TEST_P(ConcurrentHashMapTest, CopyIterator) {
|
|
379
|
+
CHM<int, int> map;
|
|
380
|
+
map.insert(0, 0);
|
|
381
|
+
for (auto cit = map.cbegin(); cit != map.cend(); ++cit) {
|
|
382
|
+
std::pair<int const, int> const ckv{0, 0};
|
|
383
|
+
EXPECT_EQ(*cit, ckv);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
TYPED_TEST_P(ConcurrentHashMapTest, EraseInIterateTest) {
|
|
388
|
+
CHM<uint64_t, uint64_t> foomap(3);
|
|
389
|
+
for (uint64_t k = 0; k < 10; ++k) {
|
|
390
|
+
foomap.insert(k, k);
|
|
391
|
+
}
|
|
392
|
+
EXPECT_EQ(10, foomap.size());
|
|
393
|
+
for (auto it = foomap.cbegin(); it != foomap.cend();) {
|
|
394
|
+
if (it->second > 3) {
|
|
395
|
+
it = foomap.erase(it);
|
|
396
|
+
} else {
|
|
397
|
+
++it;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
EXPECT_EQ(4, foomap.size());
|
|
401
|
+
for (auto it = foomap.cbegin(); it != foomap.cend(); ++it) {
|
|
402
|
+
EXPECT_GE(3, it->second);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
TYPED_TEST_P(ConcurrentHashMapTest, AssignIfTest) {
|
|
407
|
+
CHM<uint64_t, uint64_t> foomap(3);
|
|
408
|
+
foomap.insert(1, 0);
|
|
409
|
+
|
|
410
|
+
bool canAssignFlag = false;
|
|
411
|
+
EXPECT_FALSE(
|
|
412
|
+
foomap.assign_if(1, 1, [canAssignFlag](auto&&) { return canAssignFlag; })
|
|
413
|
+
.has_value());
|
|
414
|
+
|
|
415
|
+
canAssignFlag = true;
|
|
416
|
+
auto f1 =
|
|
417
|
+
foomap.assign_if(1, 2, [canAssignFlag](auto&&) { return canAssignFlag; });
|
|
418
|
+
EXPECT_TRUE(f1.has_value());
|
|
419
|
+
EXPECT_EQ(2, f1.value()->second);
|
|
420
|
+
|
|
421
|
+
// Assign based on the current value.
|
|
422
|
+
auto f2 = foomap.assign_if(1, 3, [](auto&& val) { return val == 2; });
|
|
423
|
+
EXPECT_TRUE(f2.has_value());
|
|
424
|
+
EXPECT_EQ(3, f2.value()->second);
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
// TODO: hazptrs must support DeterministicSchedule
|
|
428
|
+
|
|
429
|
+
#define Atom std::atomic // DeterministicAtomic
|
|
430
|
+
#define Mutex std::mutex // DeterministicMutex
|
|
431
|
+
#define lib std // DeterministicSchedule
|
|
432
|
+
#define join t.join() // DeterministicSchedule::join(t)
|
|
433
|
+
// #define Atom DeterministicAtomic
|
|
434
|
+
// #define Mutex DeterministicMutex
|
|
435
|
+
// #define lib DeterministicSchedule
|
|
436
|
+
// #define join DeterministicSchedule::join(t)
|
|
437
|
+
|
|
438
|
+
TYPED_TEST_P(ConcurrentHashMapTest, UpdateStressTest) {
|
|
439
|
+
DeterministicSchedule sched(DeterministicSchedule::uniform(FLAGS_seed));
|
|
440
|
+
|
|
441
|
+
// size must match iters for this test.
|
|
442
|
+
unsigned size = 128 * 128;
|
|
443
|
+
unsigned iters = size;
|
|
444
|
+
CHM<unsigned long,
|
|
445
|
+
unsigned long,
|
|
446
|
+
std::hash<unsigned long>,
|
|
447
|
+
std::equal_to<unsigned long>,
|
|
448
|
+
std::allocator<uint8_t>,
|
|
449
|
+
8,
|
|
450
|
+
Atom,
|
|
451
|
+
Mutex>
|
|
452
|
+
m(2);
|
|
453
|
+
|
|
454
|
+
for (uint32_t i = 0; i < size; i++) {
|
|
455
|
+
m.insert(i, i);
|
|
456
|
+
}
|
|
457
|
+
std::vector<std::thread> threads;
|
|
458
|
+
unsigned int num_threads = 32;
|
|
459
|
+
threads.reserve(num_threads);
|
|
460
|
+
for (uint32_t t = 0; t < num_threads; t++) {
|
|
461
|
+
threads.push_back(lib::thread([&, t]() {
|
|
462
|
+
int offset = (iters * t / num_threads);
|
|
463
|
+
for (uint32_t i = 0; i < iters / num_threads; i++) {
|
|
464
|
+
unsigned long k = folly::hash::jenkins_rev_mix32((i + offset));
|
|
465
|
+
k = k % (iters / num_threads) + offset;
|
|
466
|
+
unsigned long val = 3;
|
|
467
|
+
{
|
|
468
|
+
auto res = m.find(k);
|
|
469
|
+
EXPECT_NE(res, m.cend());
|
|
470
|
+
EXPECT_EQ(k, res->second);
|
|
471
|
+
auto r = m.assign(k, res->second);
|
|
472
|
+
EXPECT_TRUE(r);
|
|
473
|
+
}
|
|
474
|
+
{
|
|
475
|
+
auto res = m.find(k);
|
|
476
|
+
EXPECT_NE(res, m.cend());
|
|
477
|
+
EXPECT_EQ(k, res->second);
|
|
478
|
+
}
|
|
479
|
+
// Another random insertion to force table resizes
|
|
480
|
+
val = size + i + offset;
|
|
481
|
+
EXPECT_TRUE(m.insert(val, val).second);
|
|
482
|
+
}
|
|
483
|
+
}));
|
|
484
|
+
}
|
|
485
|
+
for (auto& t : threads) {
|
|
486
|
+
join;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
TYPED_TEST_P(ConcurrentHashMapTest, EraseStressTest) {
|
|
491
|
+
DeterministicSchedule sched(DeterministicSchedule::uniform(FLAGS_seed));
|
|
492
|
+
|
|
493
|
+
unsigned size = 2;
|
|
494
|
+
unsigned iters = size * 128 * 2;
|
|
495
|
+
CHM<unsigned long,
|
|
496
|
+
unsigned long,
|
|
497
|
+
std::hash<unsigned long>,
|
|
498
|
+
std::equal_to<unsigned long>,
|
|
499
|
+
std::allocator<uint8_t>,
|
|
500
|
+
8,
|
|
501
|
+
Atom,
|
|
502
|
+
Mutex>
|
|
503
|
+
m(2);
|
|
504
|
+
|
|
505
|
+
for (uint32_t i = 0; i < size; i++) {
|
|
506
|
+
unsigned long k = folly::hash::jenkins_rev_mix32(i);
|
|
507
|
+
m.insert(k, k);
|
|
508
|
+
}
|
|
509
|
+
std::vector<std::thread> threads;
|
|
510
|
+
unsigned int num_threads = 32;
|
|
511
|
+
threads.reserve(num_threads);
|
|
512
|
+
for (uint32_t t = 0; t < num_threads; t++) {
|
|
513
|
+
threads.push_back(lib::thread([&, t]() {
|
|
514
|
+
int offset = (iters * t / num_threads);
|
|
515
|
+
for (uint32_t i = 0; i < iters / num_threads; i++) {
|
|
516
|
+
unsigned long k = folly::hash::jenkins_rev_mix32((i + offset));
|
|
517
|
+
auto res = m.insert(k, k).second;
|
|
518
|
+
if (res) {
|
|
519
|
+
if (i % 2 == 0) {
|
|
520
|
+
res = m.erase(k);
|
|
521
|
+
} else {
|
|
522
|
+
res = m.erase_if_equal(k, k);
|
|
523
|
+
}
|
|
524
|
+
if (!res) {
|
|
525
|
+
printf("Faulre to erase thread %i val %li\n", t, k);
|
|
526
|
+
exit(0);
|
|
527
|
+
}
|
|
528
|
+
EXPECT_TRUE(res);
|
|
529
|
+
}
|
|
530
|
+
res = m.insert(k, k).second;
|
|
531
|
+
if (res) {
|
|
532
|
+
res = bool(m.assign(k, k));
|
|
533
|
+
if (!res) {
|
|
534
|
+
printf("Thread %i update fail %li res%i\n", t, k, res);
|
|
535
|
+
exit(0);
|
|
536
|
+
}
|
|
537
|
+
EXPECT_TRUE(res);
|
|
538
|
+
auto result = m.find(k);
|
|
539
|
+
if (result == m.cend()) {
|
|
540
|
+
printf("Thread %i lookup fail %li\n", t, k);
|
|
541
|
+
exit(0);
|
|
542
|
+
}
|
|
543
|
+
EXPECT_EQ(k, result->second);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
}));
|
|
547
|
+
}
|
|
548
|
+
for (auto& t : threads) {
|
|
549
|
+
join;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
TYPED_TEST_P(ConcurrentHashMapTest, TryEmplaceEraseStressTest) {
|
|
554
|
+
DeterministicSchedule sched(DeterministicSchedule::uniform(FLAGS_seed));
|
|
555
|
+
std::atomic<int> iterations{10000};
|
|
556
|
+
std::vector<std::thread> threads;
|
|
557
|
+
unsigned int num_threads = 32;
|
|
558
|
+
threads.reserve(num_threads);
|
|
559
|
+
CHM<int, int> map;
|
|
560
|
+
for (uint32_t t = 0; t < num_threads; t++) {
|
|
561
|
+
threads.push_back(lib::thread([&]() {
|
|
562
|
+
while (--iterations >= 0) {
|
|
563
|
+
auto it = map.try_emplace(1, 101);
|
|
564
|
+
map.erase(1);
|
|
565
|
+
EXPECT_EQ(it.first->second, 101);
|
|
566
|
+
}
|
|
567
|
+
}));
|
|
568
|
+
}
|
|
569
|
+
for (auto& t : threads) {
|
|
570
|
+
join;
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
TYPED_TEST_P(ConcurrentHashMapTest, InsertOrAssignStressTest) {
|
|
575
|
+
DeterministicSchedule sched(DeterministicSchedule::uniform(FLAGS_seed));
|
|
576
|
+
std::atomic<int> iterations{10000};
|
|
577
|
+
std::vector<std::thread> threads;
|
|
578
|
+
unsigned int num_threads = 32;
|
|
579
|
+
threads.reserve(num_threads);
|
|
580
|
+
CHM<int, int> map;
|
|
581
|
+
for (uint32_t t = 0; t < num_threads; t++) {
|
|
582
|
+
threads.push_back(lib::thread([&]() {
|
|
583
|
+
int i = 0;
|
|
584
|
+
while (--iterations >= 0) {
|
|
585
|
+
auto res = map.insert_or_assign(0, ++i);
|
|
586
|
+
ASSERT_TRUE(res.second);
|
|
587
|
+
auto v = res.first->second;
|
|
588
|
+
ASSERT_EQ(v, i);
|
|
589
|
+
}
|
|
590
|
+
}));
|
|
591
|
+
}
|
|
592
|
+
for (auto& t : threads) {
|
|
593
|
+
join;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
TYPED_TEST_P(ConcurrentHashMapTest, IterateStressTest) {
|
|
598
|
+
DeterministicSchedule sched(DeterministicSchedule::uniform(FLAGS_seed));
|
|
599
|
+
|
|
600
|
+
unsigned size = 2;
|
|
601
|
+
unsigned iters = size * 128 * 2;
|
|
602
|
+
CHM<unsigned long,
|
|
603
|
+
unsigned long,
|
|
604
|
+
std::hash<unsigned long>,
|
|
605
|
+
std::equal_to<unsigned long>,
|
|
606
|
+
std::allocator<uint8_t>,
|
|
607
|
+
8,
|
|
608
|
+
Atom,
|
|
609
|
+
Mutex>
|
|
610
|
+
m(2);
|
|
611
|
+
|
|
612
|
+
for (uint32_t i = 0; i < size; i++) {
|
|
613
|
+
unsigned long k = folly::hash::jenkins_rev_mix32(i);
|
|
614
|
+
m.insert(k, k);
|
|
615
|
+
}
|
|
616
|
+
for (uint32_t i = 0; i < 10; i++) {
|
|
617
|
+
m.insert(i, i);
|
|
618
|
+
}
|
|
619
|
+
std::vector<std::thread> threads;
|
|
620
|
+
unsigned int num_threads = 32;
|
|
621
|
+
for (uint32_t t = 0; t < num_threads; t++) {
|
|
622
|
+
threads.push_back(lib::thread([&, t]() {
|
|
623
|
+
int offset = (iters * t / num_threads);
|
|
624
|
+
for (uint32_t i = 0; i < iters / num_threads; i++) {
|
|
625
|
+
unsigned long k = folly::hash::jenkins_rev_mix32((i + offset));
|
|
626
|
+
auto res = m.insert(k, k).second;
|
|
627
|
+
if (res) {
|
|
628
|
+
if (i % 2 == 0) {
|
|
629
|
+
res = m.erase(k);
|
|
630
|
+
} else {
|
|
631
|
+
res = m.erase_if_equal(k, k);
|
|
632
|
+
}
|
|
633
|
+
if (!res) {
|
|
634
|
+
printf("Faulre to erase thread %i val %li\n", t, k);
|
|
635
|
+
exit(0);
|
|
636
|
+
}
|
|
637
|
+
EXPECT_TRUE(res);
|
|
638
|
+
}
|
|
639
|
+
int count = 0;
|
|
640
|
+
for (auto it = m.cbegin(); it != m.cend(); ++it) {
|
|
641
|
+
printf("Item is %li\n", it->first);
|
|
642
|
+
if (it->first < 10) {
|
|
643
|
+
count++;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
EXPECT_EQ(count, 10);
|
|
647
|
+
}
|
|
648
|
+
}));
|
|
649
|
+
}
|
|
650
|
+
for (auto& t : threads) {
|
|
651
|
+
join;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
TYPED_TEST_P(ConcurrentHashMapTest, insertStressTest) {
|
|
656
|
+
DeterministicSchedule sched(DeterministicSchedule::uniform(FLAGS_seed));
|
|
657
|
+
|
|
658
|
+
unsigned size = 2;
|
|
659
|
+
unsigned iters = size * 64 * 4;
|
|
660
|
+
CHM<unsigned long,
|
|
661
|
+
unsigned long,
|
|
662
|
+
std::hash<unsigned long>,
|
|
663
|
+
std::equal_to<unsigned long>,
|
|
664
|
+
std::allocator<uint8_t>,
|
|
665
|
+
8,
|
|
666
|
+
Atom,
|
|
667
|
+
Mutex>
|
|
668
|
+
m(2);
|
|
669
|
+
|
|
670
|
+
EXPECT_TRUE(m.insert(0, 0).second);
|
|
671
|
+
EXPECT_FALSE(m.insert(0, 0).second);
|
|
672
|
+
std::vector<std::thread> threads;
|
|
673
|
+
unsigned int num_threads = 32;
|
|
674
|
+
for (uint32_t t = 0; t < num_threads; t++) {
|
|
675
|
+
threads.push_back(lib::thread([&, t]() {
|
|
676
|
+
int offset = (iters * t / num_threads);
|
|
677
|
+
for (uint32_t i = 0; i < iters / num_threads; i++) {
|
|
678
|
+
auto var = offset + i + 1;
|
|
679
|
+
EXPECT_TRUE(m.insert(var, var).second);
|
|
680
|
+
EXPECT_FALSE(m.insert(0, 0).second);
|
|
681
|
+
}
|
|
682
|
+
}));
|
|
683
|
+
}
|
|
684
|
+
for (auto& t : threads) {
|
|
685
|
+
join;
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
TYPED_TEST_P(ConcurrentHashMapTest, assignStressTest) {
|
|
690
|
+
DeterministicSchedule sched(DeterministicSchedule::uniform(FLAGS_seed));
|
|
691
|
+
|
|
692
|
+
unsigned size = 2;
|
|
693
|
+
unsigned iters = size * 64 * 4;
|
|
694
|
+
struct big_value {
|
|
695
|
+
uint64_t v1;
|
|
696
|
+
uint64_t v2;
|
|
697
|
+
uint64_t v3;
|
|
698
|
+
uint64_t v4;
|
|
699
|
+
uint64_t v5;
|
|
700
|
+
uint64_t v6;
|
|
701
|
+
uint64_t v7;
|
|
702
|
+
uint64_t v8;
|
|
703
|
+
void set(uint64_t v) { v1 = v2 = v3 = v4 = v5 = v6 = v7 = v8 = v; }
|
|
704
|
+
void check() const {
|
|
705
|
+
auto v = v1;
|
|
706
|
+
EXPECT_EQ(v, v8);
|
|
707
|
+
EXPECT_EQ(v, v7);
|
|
708
|
+
EXPECT_EQ(v, v6);
|
|
709
|
+
EXPECT_EQ(v, v5);
|
|
710
|
+
EXPECT_EQ(v, v4);
|
|
711
|
+
EXPECT_EQ(v, v3);
|
|
712
|
+
EXPECT_EQ(v, v2);
|
|
713
|
+
}
|
|
714
|
+
};
|
|
715
|
+
CHM<unsigned long,
|
|
716
|
+
big_value,
|
|
717
|
+
std::hash<unsigned long>,
|
|
718
|
+
std::equal_to<unsigned long>,
|
|
719
|
+
std::allocator<uint8_t>,
|
|
720
|
+
8,
|
|
721
|
+
Atom,
|
|
722
|
+
Mutex>
|
|
723
|
+
m(2);
|
|
724
|
+
|
|
725
|
+
for (uint32_t i = 0; i < iters; i++) {
|
|
726
|
+
big_value a;
|
|
727
|
+
a.set(i);
|
|
728
|
+
m.insert(i, a);
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
std::vector<std::thread> threads;
|
|
732
|
+
unsigned int num_threads = 32;
|
|
733
|
+
for (uint32_t t = 0; t < num_threads; t++) {
|
|
734
|
+
threads.push_back(lib::thread([&]() {
|
|
735
|
+
for (uint32_t i = 0; i < iters; i++) {
|
|
736
|
+
auto res = m.find(i);
|
|
737
|
+
EXPECT_NE(res, m.cend());
|
|
738
|
+
res->second.check();
|
|
739
|
+
big_value b;
|
|
740
|
+
b.set(res->second.v1 + 1);
|
|
741
|
+
m.assign(i, b);
|
|
742
|
+
}
|
|
743
|
+
}));
|
|
744
|
+
}
|
|
745
|
+
for (auto& t : threads) {
|
|
746
|
+
join;
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
TYPED_TEST_P(ConcurrentHashMapTest, RefcountTest) {
|
|
751
|
+
struct badhash {
|
|
752
|
+
size_t operator()(uint64_t) const { return 0; }
|
|
753
|
+
};
|
|
754
|
+
CHM<uint64_t,
|
|
755
|
+
uint64_t,
|
|
756
|
+
badhash,
|
|
757
|
+
std::equal_to<uint64_t>,
|
|
758
|
+
std::allocator<uint8_t>,
|
|
759
|
+
0>
|
|
760
|
+
foomap(3);
|
|
761
|
+
foomap.insert(0, 0);
|
|
762
|
+
foomap.insert(1, 1);
|
|
763
|
+
foomap.insert(2, 2);
|
|
764
|
+
for (int32_t i = 0; i < 300; ++i) {
|
|
765
|
+
foomap.insert_or_assign(1, i);
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
struct Wrapper {
|
|
770
|
+
explicit Wrapper(bool& del_) : del(del_) {}
|
|
771
|
+
~Wrapper() { del = true; }
|
|
772
|
+
|
|
773
|
+
bool& del;
|
|
774
|
+
};
|
|
775
|
+
|
|
776
|
+
TYPED_TEST_P(ConcurrentHashMapTest, Deletion) {
|
|
777
|
+
bool del{false};
|
|
778
|
+
|
|
779
|
+
{
|
|
780
|
+
CHM<int, std::shared_ptr<Wrapper>> map;
|
|
781
|
+
|
|
782
|
+
map.insert(0, std::make_shared<Wrapper>(del));
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
folly::hazptr_cleanup();
|
|
786
|
+
|
|
787
|
+
EXPECT_TRUE(del);
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
TYPED_TEST_P(ConcurrentHashMapTest, DeletionWithErase) {
|
|
791
|
+
bool del{false};
|
|
792
|
+
|
|
793
|
+
{
|
|
794
|
+
CHM<int, std::shared_ptr<Wrapper>> map;
|
|
795
|
+
|
|
796
|
+
map.insert(0, std::make_shared<Wrapper>(del));
|
|
797
|
+
map.erase(0);
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
folly::hazptr_cleanup();
|
|
801
|
+
|
|
802
|
+
EXPECT_TRUE(del);
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
TYPED_TEST_P(ConcurrentHashMapTest, DeletionWithIterator) {
|
|
806
|
+
bool del{false};
|
|
807
|
+
|
|
808
|
+
{
|
|
809
|
+
CHM<int, std::shared_ptr<Wrapper>> map;
|
|
810
|
+
|
|
811
|
+
map.insert(0, std::make_shared<Wrapper>(del));
|
|
812
|
+
auto it = map.find(0);
|
|
813
|
+
map.erase(it);
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
folly::hazptr_cleanup();
|
|
817
|
+
|
|
818
|
+
EXPECT_TRUE(del);
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
TYPED_TEST_P(ConcurrentHashMapTest, DeletionWithForLoop) {
|
|
822
|
+
bool del{false};
|
|
823
|
+
|
|
824
|
+
{
|
|
825
|
+
CHM<int, std::shared_ptr<Wrapper>> map;
|
|
826
|
+
|
|
827
|
+
map.insert(0, std::make_shared<Wrapper>(del));
|
|
828
|
+
for (auto it = map.cbegin(); it != map.cend(); ++it) {
|
|
829
|
+
EXPECT_EQ(it->first, 0);
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
folly::hazptr_cleanup();
|
|
834
|
+
|
|
835
|
+
EXPECT_TRUE(del);
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
TYPED_TEST_P(ConcurrentHashMapTest, DeletionMultiple) {
|
|
839
|
+
bool del1{false}, del2{false};
|
|
840
|
+
|
|
841
|
+
{
|
|
842
|
+
CHM<int, std::shared_ptr<Wrapper>> map;
|
|
843
|
+
|
|
844
|
+
map.insert(0, std::make_shared<Wrapper>(del1));
|
|
845
|
+
map.insert(1, std::make_shared<Wrapper>(del2));
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
folly::hazptr_cleanup();
|
|
849
|
+
|
|
850
|
+
EXPECT_TRUE(del1);
|
|
851
|
+
EXPECT_TRUE(del2);
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
TYPED_TEST_P(ConcurrentHashMapTest, DeletionAssigned) {
|
|
855
|
+
bool del1{false}, del2{false};
|
|
856
|
+
|
|
857
|
+
{
|
|
858
|
+
CHM<int, std::shared_ptr<Wrapper>> map;
|
|
859
|
+
|
|
860
|
+
map.insert(0, std::make_shared<Wrapper>(del1));
|
|
861
|
+
map.insert_or_assign(0, std::make_shared<Wrapper>(del2));
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
folly::hazptr_cleanup();
|
|
865
|
+
|
|
866
|
+
EXPECT_TRUE(del1);
|
|
867
|
+
EXPECT_TRUE(del2);
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
TYPED_TEST_P(ConcurrentHashMapTest, DeletionMultipleMaps) {
|
|
871
|
+
bool del1{false}, del2{false};
|
|
872
|
+
|
|
873
|
+
{
|
|
874
|
+
CHM<int, std::shared_ptr<Wrapper>> map1;
|
|
875
|
+
CHM<int, std::shared_ptr<Wrapper>> map2;
|
|
876
|
+
|
|
877
|
+
map1.insert(0, std::make_shared<Wrapper>(del1));
|
|
878
|
+
map2.insert(0, std::make_shared<Wrapper>(del2));
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
folly::hazptr_cleanup();
|
|
882
|
+
|
|
883
|
+
EXPECT_TRUE(del1);
|
|
884
|
+
EXPECT_TRUE(del2);
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
TYPED_TEST_P(ConcurrentHashMapTest, ForEachLoop) {
|
|
888
|
+
CHM<int, int> map;
|
|
889
|
+
map.insert(1, 2);
|
|
890
|
+
size_t iters = 0;
|
|
891
|
+
for (const auto& kv : map) {
|
|
892
|
+
EXPECT_EQ(kv.first, 1);
|
|
893
|
+
EXPECT_EQ(kv.second, 2);
|
|
894
|
+
++iters;
|
|
895
|
+
}
|
|
896
|
+
EXPECT_EQ(iters, 1);
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
template <typename T>
|
|
900
|
+
struct FooBase {
|
|
901
|
+
typename T::ConstIterator it;
|
|
902
|
+
explicit FooBase(typename T::ConstIterator&& it_) : it(std::move(it_)) {}
|
|
903
|
+
FooBase(FooBase&&) = default;
|
|
904
|
+
FooBase& operator=(FooBase&&) = default;
|
|
905
|
+
};
|
|
906
|
+
|
|
907
|
+
TYPED_TEST_P(ConcurrentHashMapTest, IteratorMove) {
|
|
908
|
+
using Foo = FooBase<CHM<int, int>>;
|
|
909
|
+
CHM<int, int> map;
|
|
910
|
+
int k = 111;
|
|
911
|
+
int v = 999999;
|
|
912
|
+
map.insert(k, v);
|
|
913
|
+
Foo foo(map.find(k));
|
|
914
|
+
ASSERT_EQ(foo.it->second, v);
|
|
915
|
+
Foo foo2(map.find(0));
|
|
916
|
+
foo2 = std::move(foo);
|
|
917
|
+
ASSERT_EQ(foo2.it->second, v);
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
TYPED_TEST_P(ConcurrentHashMapTest, IteratorLoop) {
|
|
921
|
+
CHM<std::string, int> map;
|
|
922
|
+
static constexpr size_t kNum = 4000;
|
|
923
|
+
for (size_t i = 0; i < kNum; ++i) {
|
|
924
|
+
map.insert(to<std::string>(i), i);
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
size_t count = 0;
|
|
928
|
+
for (auto it = map.begin(); it != map.end(); ++it) {
|
|
929
|
+
ASSERT_LT(count, kNum);
|
|
930
|
+
++count;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
EXPECT_EQ(count, kNum);
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
namespace {
|
|
937
|
+
template <typename T, typename Arg>
|
|
938
|
+
using detector_find = decltype(std::declval<T>().find(std::declval<Arg>()));
|
|
939
|
+
|
|
940
|
+
template <typename T, typename Arg>
|
|
941
|
+
using detector_erase = decltype(std::declval<T>().erase(std::declval<Arg>()));
|
|
942
|
+
} // namespace
|
|
943
|
+
|
|
944
|
+
TYPED_TEST_P(ConcurrentHashMapTest, HeterogeneousLookup) {
|
|
945
|
+
using Hasher = folly::transparent<folly::hasher<folly::StringPiece>>;
|
|
946
|
+
using KeyEqual = folly::transparent<std::equal_to<folly::StringPiece>>;
|
|
947
|
+
using M = CHM<std::string, bool, Hasher, KeyEqual>;
|
|
948
|
+
|
|
949
|
+
constexpr auto hello = "hello"_sp;
|
|
950
|
+
constexpr auto buddy = "buddy"_sp;
|
|
951
|
+
constexpr auto world = "world"_sp;
|
|
952
|
+
|
|
953
|
+
M map;
|
|
954
|
+
map.emplace(hello, true);
|
|
955
|
+
map.emplace(world, false);
|
|
956
|
+
|
|
957
|
+
auto checks = [hello, buddy](auto& ref) {
|
|
958
|
+
// find
|
|
959
|
+
EXPECT_TRUE(ref.end() == ref.find(buddy));
|
|
960
|
+
EXPECT_EQ(hello, ref.find(hello)->first);
|
|
961
|
+
|
|
962
|
+
// at
|
|
963
|
+
EXPECT_TRUE(ref.at(hello));
|
|
964
|
+
EXPECT_THROW(ref.at(buddy), std::out_of_range);
|
|
965
|
+
|
|
966
|
+
// invocability checks
|
|
967
|
+
static_assert(
|
|
968
|
+
!is_detected_v<detector_find, decltype(ref), int>,
|
|
969
|
+
"there shouldn't be a find() overload for this string map with an int param");
|
|
970
|
+
};
|
|
971
|
+
|
|
972
|
+
checks(map);
|
|
973
|
+
checks(std::as_const(map));
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
TYPED_TEST_P(ConcurrentHashMapTest, HeterogeneousInsert) {
|
|
977
|
+
using Hasher = folly::transparent<folly::hasher<folly::StringPiece>>;
|
|
978
|
+
using KeyEqual = folly::transparent<std::equal_to<folly::StringPiece>>;
|
|
979
|
+
using P = std::pair<StringPiece, std::string>;
|
|
980
|
+
using CP = std::pair<const StringPiece, std::string>;
|
|
981
|
+
|
|
982
|
+
CHM<std::string, std::string, Hasher, KeyEqual> map;
|
|
983
|
+
P p{"foo", "hello"};
|
|
984
|
+
StringPiece foo{"foo"};
|
|
985
|
+
StringPiece bar{"bar"};
|
|
986
|
+
|
|
987
|
+
map.insert("foo", "hello");
|
|
988
|
+
map.insert(foo, "hello");
|
|
989
|
+
// TODO(T31574848): the list-initialization below does not work on libstdc++
|
|
990
|
+
// versions (e.g., GCC < 6) with no implementation of N4387 ("perfect
|
|
991
|
+
// initialization" for pairs and tuples).
|
|
992
|
+
// StringPiece sp{"foo"};
|
|
993
|
+
// map.insert({sp, "hello"});
|
|
994
|
+
map.insert({"foo", "hello"});
|
|
995
|
+
map.insert(P("foo", "hello"));
|
|
996
|
+
map.insert(CP("foo", "hello"));
|
|
997
|
+
map.insert(std::move(p));
|
|
998
|
+
map.insert_or_assign("foo", "hello");
|
|
999
|
+
map.insert_or_assign(StringPiece{"foo"}, "hello");
|
|
1000
|
+
|
|
1001
|
+
map.erase(StringPiece{"foo"});
|
|
1002
|
+
map.erase(foo);
|
|
1003
|
+
map.erase("");
|
|
1004
|
+
EXPECT_TRUE(map.empty());
|
|
1005
|
+
|
|
1006
|
+
map.insert("foo", "hello");
|
|
1007
|
+
map.insert("bar", "world");
|
|
1008
|
+
map.erase_if_equal(StringPiece{"foo"}, "hello");
|
|
1009
|
+
map.erase_key_if(bar, [](const std::string& s) { return s == "world"; });
|
|
1010
|
+
map.erase("");
|
|
1011
|
+
EXPECT_TRUE(map.empty());
|
|
1012
|
+
|
|
1013
|
+
map.insert("foo", "baz");
|
|
1014
|
+
EXPECT_TRUE(map.assign(foo, "hello2"));
|
|
1015
|
+
auto mbIt = map.assign_if_equal("foo", "hello2", "hello");
|
|
1016
|
+
EXPECT_TRUE(mbIt);
|
|
1017
|
+
EXPECT_EQ(mbIt.value()->second, "hello");
|
|
1018
|
+
EXPECT_EQ(map[foo], "hello");
|
|
1019
|
+
auto mbIt2 =
|
|
1020
|
+
map.assign_if("foo", "hello2", [](auto&& val) { return val == "hello"; });
|
|
1021
|
+
EXPECT_TRUE(mbIt);
|
|
1022
|
+
EXPECT_EQ(mbIt2.value()->second, "hello2");
|
|
1023
|
+
EXPECT_EQ(map[foo], "hello2");
|
|
1024
|
+
auto it = map.find(foo);
|
|
1025
|
+
map.erase(it);
|
|
1026
|
+
EXPECT_TRUE(map.empty());
|
|
1027
|
+
|
|
1028
|
+
map.try_emplace(foo);
|
|
1029
|
+
map.try_emplace(foo, "hello");
|
|
1030
|
+
map.try_emplace(StringPiece{"foo"}, "hello");
|
|
1031
|
+
map.try_emplace(foo, "hello");
|
|
1032
|
+
map.try_emplace(foo);
|
|
1033
|
+
map.try_emplace("foo");
|
|
1034
|
+
map.try_emplace("foo", "hello");
|
|
1035
|
+
map.try_emplace("bar", /* count */ 20, 'x');
|
|
1036
|
+
EXPECT_EQ(map[bar], std::string(20, 'x'));
|
|
1037
|
+
|
|
1038
|
+
map.emplace(StringPiece{"foo"}, "hello");
|
|
1039
|
+
map.emplace("foo", "hello");
|
|
1040
|
+
|
|
1041
|
+
// invocability checks
|
|
1042
|
+
static_assert(
|
|
1043
|
+
!is_detected_v<detector_erase, decltype(map), int>,
|
|
1044
|
+
"there shouldn't be an erase() overload for this string map with an int param");
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
TYPED_TEST_P(ConcurrentHashMapTest, InsertOrAssignIterator) {
|
|
1048
|
+
CHM<int, int> map;
|
|
1049
|
+
auto [itr1, insert1] = map.insert_or_assign(1, 1);
|
|
1050
|
+
auto [itr2, insert2] = map.insert_or_assign(1, 2);
|
|
1051
|
+
auto itr3 = map.find(1);
|
|
1052
|
+
EXPECT_EQ(itr3->second, 2);
|
|
1053
|
+
EXPECT_EQ(itr2->second, 2);
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
TYPED_TEST_P(ConcurrentHashMapTest, EraseClonedNonCopyable) {
|
|
1057
|
+
// Using a non-copyable value type to use the node structure with an
|
|
1058
|
+
// extra level of indirection to key-value items.
|
|
1059
|
+
using Value = std::unique_ptr<int>;
|
|
1060
|
+
// [TODO] Fix the SIMD version to pass this test, then change the
|
|
1061
|
+
// map type to CHM.
|
|
1062
|
+
ConcurrentHashMap<int, Value> map;
|
|
1063
|
+
int cloned = 32; // The item that will end up being cloned.
|
|
1064
|
+
for (int i = 0; i < cloned; i++) {
|
|
1065
|
+
map.try_emplace(256 * i, std::make_unique<int>(0));
|
|
1066
|
+
}
|
|
1067
|
+
auto [iter, _] = map.try_emplace(256 * cloned, std::make_unique<int>(0));
|
|
1068
|
+
// Add more items to cause rehash that clones the item.
|
|
1069
|
+
int num = 10000;
|
|
1070
|
+
for (int i = cloned + 1; i < num; i++) {
|
|
1071
|
+
map.try_emplace(256 * i, std::make_unique<int>(0));
|
|
1072
|
+
}
|
|
1073
|
+
// Erase items to invoke hazard pointer asynchronous reclamation.
|
|
1074
|
+
for (int i = 0; i < num; i++) {
|
|
1075
|
+
map.erase(256 * i);
|
|
1076
|
+
}
|
|
1077
|
+
// The cloned node and the associated key-value item should still be
|
|
1078
|
+
// protected by iter from being reclaimed.
|
|
1079
|
+
EXPECT_EQ(iter->first, 256 * cloned);
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
TYPED_TEST_P(ConcurrentHashMapTest, ConcurrentInsertClear) {
|
|
1083
|
+
DeterministicSchedule sched(DeterministicSchedule::uniform(FLAGS_seed));
|
|
1084
|
+
|
|
1085
|
+
/* 8192 and 8x / 9x multipliers are values that tend to reproduce
|
|
1086
|
+
* race condition (fixed by this change) more frequently.
|
|
1087
|
+
* Test keeps CHM size limited to chm_max_size and clear() if it exceeds.
|
|
1088
|
+
* Key space for CHM is limited to chm_max_key and exceeds max size by
|
|
1089
|
+
* small margin.
|
|
1090
|
+
* Test imitates serial traversal over key space by multiple threads,
|
|
1091
|
+
* triggering clear() by multiple threads at once.
|
|
1092
|
+
*/
|
|
1093
|
+
constexpr unsigned long chm_base_size = 8192;
|
|
1094
|
+
constexpr unsigned long chm_max_size = chm_base_size * 8;
|
|
1095
|
+
constexpr unsigned long chm_max_key = chm_base_size * 9;
|
|
1096
|
+
CHM<unsigned long,
|
|
1097
|
+
unsigned long,
|
|
1098
|
+
std::hash<unsigned long>,
|
|
1099
|
+
std::equal_to<unsigned long>,
|
|
1100
|
+
std::allocator<uint8_t>,
|
|
1101
|
+
8,
|
|
1102
|
+
Atom,
|
|
1103
|
+
Mutex>
|
|
1104
|
+
m(chm_base_size);
|
|
1105
|
+
|
|
1106
|
+
std::vector<std::thread> threads;
|
|
1107
|
+
/* 32 threads and 50k rounds are a compromise between trying to create
|
|
1108
|
+
* race conditions in insert()/clear(), and finishing test in reasonable
|
|
1109
|
+
* time */
|
|
1110
|
+
constexpr int load_divisor = folly::kIsSanitizeThread ? 4 : 1;
|
|
1111
|
+
constexpr size_t num_threads = 32 / load_divisor;
|
|
1112
|
+
constexpr size_t rounds_per_thread = 50000 / load_divisor;
|
|
1113
|
+
threads.reserve(num_threads);
|
|
1114
|
+
for (size_t t = 0; t < num_threads; t++) {
|
|
1115
|
+
threads.emplace_back([&, t]() {
|
|
1116
|
+
for (size_t i = 0; i < rounds_per_thread; ++i) {
|
|
1117
|
+
/* Code simulates traversal over whole key space by all threads
|
|
1118
|
+
* combined, with each thread contributing to semi-unique set of keys.
|
|
1119
|
+
* Each thread is assigned its own key sequence,
|
|
1120
|
+
* with thread_X traversing values X, 32+X, 32*2+X, 32*3+X, ...
|
|
1121
|
+
* 32*N+X mod chm_max_key.
|
|
1122
|
+
*/
|
|
1123
|
+
const unsigned long k = (i * num_threads + t) % chm_max_key;
|
|
1124
|
+
if (m.size() >= chm_max_size) {
|
|
1125
|
+
m.clear();
|
|
1126
|
+
}
|
|
1127
|
+
m.insert_or_assign(k, k);
|
|
1128
|
+
}
|
|
1129
|
+
});
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
for (auto& t : threads) {
|
|
1133
|
+
join;
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
TYPED_TEST_P(ConcurrentHashMapTest, StressTestReclamation) {
|
|
1138
|
+
// Create a map where we keep reclaiming a lot of objects that are linked to
|
|
1139
|
+
// one node.
|
|
1140
|
+
|
|
1141
|
+
// Ensure all entries are mapped to a single segment.
|
|
1142
|
+
struct constant_hash {
|
|
1143
|
+
uint64_t operator()(unsigned long) const noexcept { return 0; }
|
|
1144
|
+
};
|
|
1145
|
+
CHM<unsigned long, unsigned long, constant_hash> map;
|
|
1146
|
+
static constexpr unsigned long key_prev =
|
|
1147
|
+
0; // A key that the test key has a link to - to guard against immediate
|
|
1148
|
+
// reclamation.
|
|
1149
|
+
static constexpr unsigned long key_test =
|
|
1150
|
+
1; // A key that keeps being reclaimed repeatedly.
|
|
1151
|
+
static constexpr unsigned long key_link_explosion =
|
|
1152
|
+
2; // A key that is linked to the test key.
|
|
1153
|
+
|
|
1154
|
+
EXPECT_TRUE(map.insert(std::make_pair(key_prev, 0)).second);
|
|
1155
|
+
EXPECT_TRUE(map.insert(std::make_pair(key_test, 0)).second);
|
|
1156
|
+
EXPECT_TRUE(map.insert(std::make_pair(key_link_explosion, 0)).second);
|
|
1157
|
+
|
|
1158
|
+
std::vector<std::thread> threads;
|
|
1159
|
+
// Test with (2^16)+ threads, enough to overflow a 16 bit integer.
|
|
1160
|
+
// It should be uncommon to have more than 2^32 concurrent accesses.
|
|
1161
|
+
static constexpr uint64_t num_threads = std::numeric_limits<uint16_t>::max();
|
|
1162
|
+
static constexpr uint64_t iters = 100;
|
|
1163
|
+
folly::Latch start(num_threads);
|
|
1164
|
+
for (uint64_t t = 0; t < num_threads; t++) {
|
|
1165
|
+
threads.push_back(lib::thread([t, &map, &start]() {
|
|
1166
|
+
start.arrive_and_wait();
|
|
1167
|
+
static constexpr uint64_t progress_report_pct =
|
|
1168
|
+
(iters / 20); // Every 5% we log progress
|
|
1169
|
+
for (uint64_t i = 0; i < iters; i++) {
|
|
1170
|
+
if (t == 0 && (i % progress_report_pct) == 0) {
|
|
1171
|
+
// To a casual observer - to know that the test is progressing, even
|
|
1172
|
+
// if slowly
|
|
1173
|
+
LOG(INFO) << "Progress: " << (i * 100 / iters);
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
map.insert_or_assign(key_test, i * num_threads);
|
|
1177
|
+
}
|
|
1178
|
+
}));
|
|
1179
|
+
}
|
|
1180
|
+
for (auto& t : threads) {
|
|
1181
|
+
join;
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
REGISTER_TYPED_TEST_SUITE_P(
|
|
1186
|
+
ConcurrentHashMapTest,
|
|
1187
|
+
MapTest,
|
|
1188
|
+
MaxSizeTest,
|
|
1189
|
+
MoveTest,
|
|
1190
|
+
EmplaceTest,
|
|
1191
|
+
MapResizeTest,
|
|
1192
|
+
ReserveTest,
|
|
1193
|
+
MapNoCopiesTest,
|
|
1194
|
+
MapMovableKeysTest,
|
|
1195
|
+
MapUpdateTest,
|
|
1196
|
+
MapIterateTest2,
|
|
1197
|
+
MapIterateTest,
|
|
1198
|
+
MoveIterateAssignIterate,
|
|
1199
|
+
MapInsertIteratorValueTest,
|
|
1200
|
+
CopyIterator,
|
|
1201
|
+
Deletion,
|
|
1202
|
+
DeletionAssigned,
|
|
1203
|
+
DeletionMultiple,
|
|
1204
|
+
DeletionMultipleMaps,
|
|
1205
|
+
DeletionWithErase,
|
|
1206
|
+
DeletionWithForLoop,
|
|
1207
|
+
DeletionWithIterator,
|
|
1208
|
+
EraseIfEqualTest,
|
|
1209
|
+
EraseIfTest,
|
|
1210
|
+
EraseInIterateTest,
|
|
1211
|
+
AssignIfTest,
|
|
1212
|
+
EraseStressTest,
|
|
1213
|
+
EraseTest,
|
|
1214
|
+
ForEachLoop,
|
|
1215
|
+
TryEmplaceEraseStressTest,
|
|
1216
|
+
InsertOrAssignStressTest,
|
|
1217
|
+
IterateStressTest,
|
|
1218
|
+
RefcountTest,
|
|
1219
|
+
UpdateStressTest,
|
|
1220
|
+
assignStressTest,
|
|
1221
|
+
insertStressTest,
|
|
1222
|
+
IteratorMove,
|
|
1223
|
+
IteratorLoop,
|
|
1224
|
+
HeterogeneousLookup,
|
|
1225
|
+
HeterogeneousInsert,
|
|
1226
|
+
InsertOrAssignIterator,
|
|
1227
|
+
EraseClonedNonCopyable,
|
|
1228
|
+
ConcurrentInsertClear,
|
|
1229
|
+
StressTestReclamation);
|
|
1230
|
+
|
|
1231
|
+
using folly::detail::concurrenthashmap::bucket::BucketTable;
|
|
1232
|
+
|
|
1233
|
+
#if FOLLY_SSE_PREREQ(4, 2) && FOLLY_F14_VECTOR_INTRINSICS_AVAILABLE
|
|
1234
|
+
using folly::detail::concurrenthashmap::simd::SIMDTable;
|
|
1235
|
+
typedef ::testing::Types<MapFactory<BucketTable>, MapFactory<SIMDTable>>
|
|
1236
|
+
MapFactoryTypes;
|
|
1237
|
+
#else
|
|
1238
|
+
typedef ::testing::Types<MapFactory<BucketTable>> MapFactoryTypes;
|
|
1239
|
+
#endif
|
|
1240
|
+
|
|
1241
|
+
INSTANTIATE_TYPED_TEST_SUITE_P(
|
|
1242
|
+
MapFactoryTypesInstantiation, ConcurrentHashMapTest, MapFactoryTypes);
|