react-native-windows 0.81.34 → 0.81.36
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 -16
- package/Folly/ThreadNameStub.cpp +4 -6
- package/Microsoft.ReactNative/Fabric/Composition/BorderPrimitive.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +27 -4
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +8 -4
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +7 -3
- package/Microsoft.ReactNative/Fabric/Composition/TooltipService.cpp +48 -2
- package/Microsoft.ReactNative/Fabric/WindowsImageManager.cpp +40 -13
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +1 -7
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters +0 -3
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/PropertySheets/React.Cpp.props +3 -3
- package/ReactCommon/ReactCommon.vcxproj +0 -10
- package/ReactCommon/packages.lock.win32.json +0 -10
- package/Scripts/Tfs/Layout-Desktop-Headers.ps1 +4 -37
- package/Scripts/creaternwlib.cmd +2 -2
- package/Shared/Shared.vcxitems +2 -0
- package/{Folly → external}/.clang-format +0 -1
- 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/{fmt → external/fmt}/cgmanifest.json +1 -1
- 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/{fmt/TEMP_UntilFmtUpdate/core.h → external/fmt/include/fmt/base.h} +1188 -1036
- 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/LICENSE +200 -0
- package/external/folly/README.md +263 -0
- package/{fmt → external/folly/folly}/.clang-format +0 -1
- 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/ConstructorCallbackList.h +158 -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/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.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/{Folly/TEMP_UntilFollyUpdate → external/folly/folly}/hash/SpookyHashV2.h +6 -1
- 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.cpp +552 -0
- package/external/folly/folly/json/dynamic.h +1346 -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/StaticConst.h +33 -0
- package/external/folly/folly/lang/Thunk.h +100 -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.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/template/cpp-app/proj/MyApp.sln +0 -33
- package/template/cpp-lib/proj/MyLib.sln +0 -33
- package/template/cs-app/proj/MyApp.sln +0 -33
- package/template/cs-lib/proj/MyLib.sln +0 -33
- package/templates/cpp-app/windows/MyApp.sln +0 -33
- package/templates/cpp-lib/example/metro.config.js +31 -6
- package/templates/cpp-lib/windows/MyLib.sln +0 -33
- package/Folly/Folly.vcxproj +0 -383
- package/Folly/Folly.vcxproj.filters +0 -558
- package/Folly/Folly.win32.vcxproj +0 -11
- package/Folly/packages.lock.win32.json +0 -20
- package/Scripts/Warm-RnwFeedCache.ps1 +0 -413
- package/fmt/fmt.vcxproj +0 -163
- package/fmt/fmt.vcxproj.filters +0 -59
- package/fmt/fmt.win32.vcxproj +0 -10
- package/fmt/pch.cpp +0 -4
- package/fmt/pch.h +0 -2
- /package/{Folly → external/folly}/Folly.natvis +0 -0
- /package/{Folly → external/folly}/cgmanifest.json +0 -0
- /package/{Folly/TEMP_UntilFollyUpdate → external/folly/folly}/ConstexprMath.h +0 -0
- /package/{Folly/TEMP_UntilFollyUpdate → external/folly/folly}/Conv.cpp +0 -0
- /package/{Folly/TEMP_UntilFollyUpdate → external/folly/folly}/chrono/Hardware.h +0 -0
- /package/{Folly/TEMP_UntilFollyUpdate → external/folly/folly}/concurrency/CacheLocality.cpp +0 -0
- /package/{Folly/TEMP_UntilFollyUpdate → external/folly/folly}/json/dynamic-inl.h +0 -0
- /package/{Folly/TEMP_UntilFollyUpdate → external/folly/folly}/json/json.cpp +0 -0
- /package/{Folly/TEMP_UntilFollyUpdate → external/folly/folly}/lang/SafeAssert.h +0 -0
- /package/{Folly/TEMP_UntilFollyUpdate → external/folly/folly}/lang/ToAscii.cpp +0 -0
- /package/{Folly/TEMP_UntilFollyUpdate → external/folly/folly}/lang/ToAscii.h +0 -0
- /package/{Folly/TEMP_UntilFollyUpdate → external/folly/folly}/portability/Unistd.cpp +0 -0
|
@@ -0,0 +1,1523 @@
|
|
|
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
|
+
#pragma once
|
|
18
|
+
|
|
19
|
+
#include <memory>
|
|
20
|
+
#include <new>
|
|
21
|
+
#include <type_traits>
|
|
22
|
+
#include <utility>
|
|
23
|
+
|
|
24
|
+
#include <folly/Memory.h>
|
|
25
|
+
#include <folly/Portability.h>
|
|
26
|
+
#include <folly/Traits.h>
|
|
27
|
+
#include <folly/Unit.h>
|
|
28
|
+
#include <folly/container/HeterogeneousAccess.h>
|
|
29
|
+
#include <folly/container/detail/F14Table.h>
|
|
30
|
+
#include <folly/hash/Hash.h>
|
|
31
|
+
#include <folly/lang/Align.h>
|
|
32
|
+
#include <folly/lang/SafeAssert.h>
|
|
33
|
+
#include <folly/memory/Malloc.h>
|
|
34
|
+
|
|
35
|
+
#if FOLLY_F14_VECTOR_INTRINSICS_AVAILABLE
|
|
36
|
+
|
|
37
|
+
namespace folly {
|
|
38
|
+
namespace f14 {
|
|
39
|
+
namespace detail {
|
|
40
|
+
|
|
41
|
+
template <typename Ptr>
|
|
42
|
+
using NonConstPtr = typename std::pointer_traits<Ptr>::template rebind<
|
|
43
|
+
std::remove_const_t<typename std::pointer_traits<Ptr>::element_type>>;
|
|
44
|
+
|
|
45
|
+
template <typename KeyType, typename MappedType>
|
|
46
|
+
using MapValueType = std::pair<KeyType const, MappedType>;
|
|
47
|
+
|
|
48
|
+
template <typename KeyType, typename MappedTypeOrVoid>
|
|
49
|
+
using SetOrMapValueType = std::conditional_t<
|
|
50
|
+
std::is_same<MappedTypeOrVoid, void>::value,
|
|
51
|
+
KeyType,
|
|
52
|
+
MapValueType<KeyType, MappedTypeOrVoid>>;
|
|
53
|
+
|
|
54
|
+
template <typename T>
|
|
55
|
+
using IsNothrowMoveAndDestroy = Conjunction<
|
|
56
|
+
std::is_nothrow_move_constructible<T>,
|
|
57
|
+
std::is_nothrow_destructible<T>>;
|
|
58
|
+
|
|
59
|
+
// Used to enable EBO for Hasher, KeyEqual, and Alloc. std::tuple of
|
|
60
|
+
// all empty objects is empty in libstdc++ but not libc++.
|
|
61
|
+
template <
|
|
62
|
+
char Tag,
|
|
63
|
+
typename T,
|
|
64
|
+
bool Inherit = std::is_empty<T>::value && !std::is_final<T>::value>
|
|
65
|
+
struct ObjectHolder {
|
|
66
|
+
T value_;
|
|
67
|
+
|
|
68
|
+
template <typename... Args>
|
|
69
|
+
ObjectHolder(Args&&... args) : value_{std::forward<Args>(args)...} {}
|
|
70
|
+
|
|
71
|
+
T& operator*() { return value_; }
|
|
72
|
+
T const& operator*() const { return value_; }
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
template <char Tag, typename T>
|
|
76
|
+
struct ObjectHolder<Tag, T, true> : T {
|
|
77
|
+
template <typename... Args>
|
|
78
|
+
ObjectHolder(Args&&... args) : T{std::forward<Args>(args)...} {}
|
|
79
|
+
|
|
80
|
+
T& operator*() { return *this; }
|
|
81
|
+
T const& operator*() const { return *this; }
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
// Policy provides the functionality of hasher, key_equal, and
|
|
85
|
+
// allocator_type. In addition, it can add indirection to the values
|
|
86
|
+
// contained in the base table by defining a non-trivial value() method.
|
|
87
|
+
//
|
|
88
|
+
// To facilitate stateful implementations it is guaranteed that there
|
|
89
|
+
// will be a 1:1 relationship between BaseTable and Policy instance:
|
|
90
|
+
// policies will only be copied when their owning table is copied, and
|
|
91
|
+
// they will only be moved when their owning table is moved.
|
|
92
|
+
//
|
|
93
|
+
// Key equality will have the user-supplied search key as its first
|
|
94
|
+
// argument and the table contents as its second. Heterogeneous lookup
|
|
95
|
+
// should be handled on the first argument.
|
|
96
|
+
//
|
|
97
|
+
// Item is the data stored inline in the hash table's chunks. The policy
|
|
98
|
+
// controls how this is mapped to the corresponding Value.
|
|
99
|
+
//
|
|
100
|
+
// The policies defined in this file work for either set or map types.
|
|
101
|
+
// Most of the functionality is identical. A few methods detect the
|
|
102
|
+
// collection type by checking to see if MappedType is void, and then use
|
|
103
|
+
// SFINAE to select the appropriate implementation.
|
|
104
|
+
template <
|
|
105
|
+
typename KeyType,
|
|
106
|
+
typename MappedTypeOrVoid,
|
|
107
|
+
typename HasherOrVoid,
|
|
108
|
+
typename KeyEqualOrVoid,
|
|
109
|
+
typename AllocOrVoid,
|
|
110
|
+
typename ItemType>
|
|
111
|
+
struct FOLLY_MSVC_DECLSPEC(empty_bases) BasePolicy
|
|
112
|
+
: private ObjectHolder<
|
|
113
|
+
'H',
|
|
114
|
+
Defaulted<HasherOrVoid, DefaultHasher<KeyType>>>,
|
|
115
|
+
private ObjectHolder<
|
|
116
|
+
'E',
|
|
117
|
+
Defaulted<KeyEqualOrVoid, DefaultKeyEqual<KeyType>>>,
|
|
118
|
+
private ObjectHolder<
|
|
119
|
+
'A',
|
|
120
|
+
Defaulted<
|
|
121
|
+
AllocOrVoid,
|
|
122
|
+
DefaultAlloc<SetOrMapValueType<KeyType, MappedTypeOrVoid>>>> {
|
|
123
|
+
//////// user-supplied types
|
|
124
|
+
|
|
125
|
+
using Key = KeyType;
|
|
126
|
+
using Mapped = MappedTypeOrVoid;
|
|
127
|
+
using Value = SetOrMapValueType<Key, Mapped>;
|
|
128
|
+
using Item = ItemType;
|
|
129
|
+
using Hasher = Defaulted<HasherOrVoid, DefaultHasher<Key>>;
|
|
130
|
+
using KeyEqual = Defaulted<KeyEqualOrVoid, DefaultKeyEqual<Key>>;
|
|
131
|
+
using Alloc = Defaulted<AllocOrVoid, DefaultAlloc<Value>>;
|
|
132
|
+
using AllocTraits = std::allocator_traits<Alloc>;
|
|
133
|
+
|
|
134
|
+
using ByteAlloc = typename AllocTraits::template rebind_alloc<uint8_t>;
|
|
135
|
+
using ByteAllocTraits = typename std::allocator_traits<ByteAlloc>;
|
|
136
|
+
using BytePtr = typename ByteAllocTraits::pointer;
|
|
137
|
+
|
|
138
|
+
//////// info about user-supplied types
|
|
139
|
+
|
|
140
|
+
static_assert(
|
|
141
|
+
std::is_same<typename AllocTraits::value_type, Value>::value,
|
|
142
|
+
"wrong allocator value_type");
|
|
143
|
+
|
|
144
|
+
private:
|
|
145
|
+
using HasherHolder = ObjectHolder<'H', Hasher>;
|
|
146
|
+
using KeyEqualHolder = ObjectHolder<'E', KeyEqual>;
|
|
147
|
+
using AllocHolder = ObjectHolder<'A', Alloc>;
|
|
148
|
+
|
|
149
|
+
// emulate c++17's std::allocator_traits<A>::is_always_equal
|
|
150
|
+
|
|
151
|
+
template <typename A, typename = void>
|
|
152
|
+
struct AllocIsAlwaysEqual : std::is_empty<A> {};
|
|
153
|
+
|
|
154
|
+
template <typename A>
|
|
155
|
+
struct AllocIsAlwaysEqual<A, typename A::is_always_equal>
|
|
156
|
+
: A::is_always_equal {};
|
|
157
|
+
|
|
158
|
+
public:
|
|
159
|
+
static constexpr bool kAllocIsAlwaysEqual = AllocIsAlwaysEqual<Alloc>::value;
|
|
160
|
+
|
|
161
|
+
static constexpr bool kDefaultConstructIsNoexcept =
|
|
162
|
+
std::is_nothrow_default_constructible<Hasher>::value &&
|
|
163
|
+
std::is_nothrow_default_constructible<KeyEqual>::value &&
|
|
164
|
+
std::is_nothrow_default_constructible<Alloc>::value;
|
|
165
|
+
|
|
166
|
+
static constexpr bool kSwapIsNoexcept = kAllocIsAlwaysEqual &&
|
|
167
|
+
std::is_nothrow_swappable_v<Hasher> &&
|
|
168
|
+
std::is_nothrow_swappable_v<KeyEqual>;
|
|
169
|
+
|
|
170
|
+
static constexpr bool isAvalanchingHasher() {
|
|
171
|
+
return IsAvalanchingHasher<Hasher, Key>::value;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
static constexpr bool shouldAssume32BitHash() {
|
|
175
|
+
return ShouldAssume32BitHash<Hasher>::value;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
//////// internal types and constants
|
|
179
|
+
|
|
180
|
+
using InternalSizeType = std::size_t;
|
|
181
|
+
|
|
182
|
+
// if false, F14Table will be smaller but F14Table::begin() won't work
|
|
183
|
+
static constexpr bool kEnableItemIteration = true;
|
|
184
|
+
|
|
185
|
+
using Chunk = F14Chunk<Item>;
|
|
186
|
+
using ChunkPtr = typename std::pointer_traits<
|
|
187
|
+
typename AllocTraits::pointer>::template rebind<Chunk>;
|
|
188
|
+
using ItemIter = F14ItemIter<ChunkPtr>;
|
|
189
|
+
|
|
190
|
+
static constexpr bool kIsMap = !std::is_same<Key, Value>::value;
|
|
191
|
+
static_assert(
|
|
192
|
+
kIsMap == !std::is_void<MappedTypeOrVoid>::value,
|
|
193
|
+
"Assumption for the kIsMap check violated.");
|
|
194
|
+
|
|
195
|
+
using MappedOrBool = std::conditional_t<kIsMap, Mapped, bool>;
|
|
196
|
+
|
|
197
|
+
// if true, bucket_count() after reserve(n) will be as close as possible
|
|
198
|
+
// to n for multi-chunk tables
|
|
199
|
+
static constexpr bool kContinuousCapacity = false;
|
|
200
|
+
|
|
201
|
+
//////// methods
|
|
202
|
+
|
|
203
|
+
BasePolicy(Hasher const& hasher, KeyEqual const& keyEqual, Alloc const& alloc)
|
|
204
|
+
: HasherHolder{hasher}, KeyEqualHolder{keyEqual}, AllocHolder{alloc} {}
|
|
205
|
+
|
|
206
|
+
BasePolicy(BasePolicy const& rhs)
|
|
207
|
+
: HasherHolder{rhs.hasher()},
|
|
208
|
+
KeyEqualHolder{rhs.keyEqual()},
|
|
209
|
+
AllocHolder{
|
|
210
|
+
AllocTraits::select_on_container_copy_construction(rhs.alloc())} {}
|
|
211
|
+
|
|
212
|
+
BasePolicy(BasePolicy const& rhs, Alloc const& alloc)
|
|
213
|
+
: HasherHolder{rhs.hasher()},
|
|
214
|
+
KeyEqualHolder{rhs.keyEqual()},
|
|
215
|
+
AllocHolder{alloc} {}
|
|
216
|
+
|
|
217
|
+
BasePolicy(BasePolicy&& rhs) noexcept
|
|
218
|
+
: HasherHolder{std::move(rhs.hasher())},
|
|
219
|
+
KeyEqualHolder{std::move(rhs.keyEqual())},
|
|
220
|
+
AllocHolder{std::move(rhs.alloc())} {}
|
|
221
|
+
|
|
222
|
+
BasePolicy(BasePolicy&& rhs, Alloc const& alloc) noexcept
|
|
223
|
+
: HasherHolder{std::move(rhs.hasher())},
|
|
224
|
+
KeyEqualHolder{std::move(rhs.keyEqual())},
|
|
225
|
+
AllocHolder{alloc} {}
|
|
226
|
+
|
|
227
|
+
private:
|
|
228
|
+
template <typename Src>
|
|
229
|
+
void maybeAssignAlloc(std::true_type, Src&& src) {
|
|
230
|
+
alloc() = std::forward<Src>(src);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
template <typename Src>
|
|
234
|
+
void maybeAssignAlloc(std::false_type, Src&&) {}
|
|
235
|
+
|
|
236
|
+
template <typename A>
|
|
237
|
+
void maybeSwapAlloc(std::true_type, A& rhs) {
|
|
238
|
+
using std::swap;
|
|
239
|
+
swap(alloc(), rhs);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
template <typename A>
|
|
243
|
+
void maybeSwapAlloc(std::false_type, A&) {}
|
|
244
|
+
|
|
245
|
+
public:
|
|
246
|
+
BasePolicy& operator=(BasePolicy const& rhs) {
|
|
247
|
+
hasher() = rhs.hasher();
|
|
248
|
+
keyEqual() = rhs.keyEqual();
|
|
249
|
+
maybeAssignAlloc(
|
|
250
|
+
typename AllocTraits::propagate_on_container_copy_assignment{},
|
|
251
|
+
rhs.alloc());
|
|
252
|
+
return *this;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
BasePolicy& operator=(BasePolicy&& rhs) noexcept {
|
|
256
|
+
hasher() = std::move(rhs.hasher());
|
|
257
|
+
keyEqual() = std::move(rhs.keyEqual());
|
|
258
|
+
maybeAssignAlloc(
|
|
259
|
+
typename AllocTraits::propagate_on_container_move_assignment{},
|
|
260
|
+
std::move(rhs.alloc()));
|
|
261
|
+
return *this;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
void swapBasePolicy(BasePolicy& rhs) {
|
|
265
|
+
using std::swap;
|
|
266
|
+
swap(hasher(), rhs.hasher());
|
|
267
|
+
swap(keyEqual(), rhs.keyEqual());
|
|
268
|
+
maybeSwapAlloc(
|
|
269
|
+
typename AllocTraits::propagate_on_container_swap{}, rhs.alloc());
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
Hasher& hasher() { return *static_cast<HasherHolder&>(*this); }
|
|
273
|
+
Hasher const& hasher() const {
|
|
274
|
+
return *static_cast<HasherHolder const&>(*this);
|
|
275
|
+
}
|
|
276
|
+
KeyEqual& keyEqual() { return *static_cast<KeyEqualHolder&>(*this); }
|
|
277
|
+
KeyEqual const& keyEqual() const {
|
|
278
|
+
return *static_cast<KeyEqualHolder const&>(*this);
|
|
279
|
+
}
|
|
280
|
+
Alloc& alloc() { return *static_cast<AllocHolder&>(*this); }
|
|
281
|
+
Alloc const& alloc() const { return *static_cast<AllocHolder const&>(*this); }
|
|
282
|
+
|
|
283
|
+
template <typename K>
|
|
284
|
+
std::size_t computeKeyHash(K const& key) const {
|
|
285
|
+
static_assert(
|
|
286
|
+
isAvalanchingHasher() == IsAvalanchingHasher<Hasher, K>::value, "");
|
|
287
|
+
static_assert(
|
|
288
|
+
!isAvalanchingHasher() ||
|
|
289
|
+
sizeof(decltype(hasher()(key))) >= sizeof(std::size_t),
|
|
290
|
+
"hasher is not avalanching if it doesn't return enough bits");
|
|
291
|
+
return hasher()(key);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
Key const& keyForValue(Key const& v) const { return v; }
|
|
295
|
+
Key const& keyForValue(std::pair<Key const, MappedOrBool> const& p) const {
|
|
296
|
+
return p.first;
|
|
297
|
+
}
|
|
298
|
+
Key const& keyForValue(std::pair<Key&&, MappedOrBool&&> const& p) const {
|
|
299
|
+
return p.first;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// map's choice of pair<K const, T> as value_type is unfortunate,
|
|
303
|
+
// because it means we either need a proxy iterator, a pointless key
|
|
304
|
+
// copy when moving items during rehash, or some sort of UB hack.
|
|
305
|
+
//
|
|
306
|
+
// This code implements the hack. Use moveValue(v) instead of
|
|
307
|
+
// std::move(v) as the source of a move construction. enable_if_t is
|
|
308
|
+
// used so that this works for maps while being a no-op for sets.
|
|
309
|
+
template <typename Dummy = int>
|
|
310
|
+
static std::pair<Key&&, MappedOrBool&&> moveValue(
|
|
311
|
+
std::pair<Key const, MappedOrBool>& value,
|
|
312
|
+
std::enable_if_t<kIsMap, Dummy> = 0) {
|
|
313
|
+
return {std::move(const_cast<Key&>(value.first)), std::move(value.second)};
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
template <typename Dummy = int>
|
|
317
|
+
static Value&& moveValue(Value& value, std::enable_if_t<!kIsMap, Dummy> = 0) {
|
|
318
|
+
return std::move(value);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
template <typename P>
|
|
322
|
+
bool beforeBuild(
|
|
323
|
+
std::size_t /*size*/, std::size_t /*capacity*/, P&& /*rhs*/) {
|
|
324
|
+
return false;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
template <typename P>
|
|
328
|
+
void afterBuild(
|
|
329
|
+
bool /*undoState*/,
|
|
330
|
+
bool /*success*/,
|
|
331
|
+
std::size_t /*size*/,
|
|
332
|
+
std::size_t /*capacity*/,
|
|
333
|
+
P&& /*rhs*/) {}
|
|
334
|
+
|
|
335
|
+
std::size_t alignedAllocSize(std::size_t n) const {
|
|
336
|
+
if (kRequiredVectorAlignment <= alignof(max_align_t) ||
|
|
337
|
+
std::is_same<ByteAlloc, std::allocator<uint8_t>>::value) {
|
|
338
|
+
return n;
|
|
339
|
+
} else {
|
|
340
|
+
return n + kRequiredVectorAlignment;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
bool beforeRehash(
|
|
345
|
+
std::size_t /*size*/,
|
|
346
|
+
std::size_t /*oldCapacity*/,
|
|
347
|
+
std::size_t /*newCapacity*/,
|
|
348
|
+
std::size_t chunkAllocSize,
|
|
349
|
+
BytePtr& outChunkAllocation) {
|
|
350
|
+
outChunkAllocation =
|
|
351
|
+
allocateOverAligned<ByteAlloc, kRequiredVectorAlignment>(
|
|
352
|
+
ByteAlloc{alloc()}, chunkAllocSize);
|
|
353
|
+
return false;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
void afterRehash(
|
|
357
|
+
bool /*undoState*/,
|
|
358
|
+
bool /*success*/,
|
|
359
|
+
std::size_t /*size*/,
|
|
360
|
+
std::size_t /*oldCapacity*/,
|
|
361
|
+
std::size_t /*newCapacity*/,
|
|
362
|
+
BytePtr chunkAllocation,
|
|
363
|
+
std::size_t chunkAllocSize) {
|
|
364
|
+
// on success, this will be the old allocation, on failure the new one
|
|
365
|
+
if (chunkAllocation != nullptr) {
|
|
366
|
+
deallocateOverAligned<ByteAlloc, kRequiredVectorAlignment>(
|
|
367
|
+
ByteAlloc{alloc()}, chunkAllocation, chunkAllocSize);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
void beforeClear(std::size_t /*size*/, std::size_t /*capacity*/) {}
|
|
372
|
+
|
|
373
|
+
void afterClear(std::size_t /*size*/, std::size_t /*capacity*/) {}
|
|
374
|
+
|
|
375
|
+
void beforeReset(std::size_t /*size*/, std::size_t /*capacity*/) {}
|
|
376
|
+
|
|
377
|
+
void afterReset(
|
|
378
|
+
std::size_t /*size*/,
|
|
379
|
+
std::size_t /*capacity*/,
|
|
380
|
+
BytePtr chunkAllocation,
|
|
381
|
+
std::size_t chunkAllocSize) {
|
|
382
|
+
deallocateOverAligned<ByteAlloc, kRequiredVectorAlignment>(
|
|
383
|
+
ByteAlloc{alloc()}, chunkAllocation, chunkAllocSize);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
void prefetchValue(Item const&) const {
|
|
387
|
+
// Subclass should disable with prefetchBeforeRehash(),
|
|
388
|
+
// prefetchBeforeCopy(), and prefetchBeforeDestroy(). if they don't
|
|
389
|
+
// override this method, because neither gcc nor clang can figure
|
|
390
|
+
// out that DenseMaskIter with an empty body can be elided.
|
|
391
|
+
FOLLY_SAFE_DCHECK(false, "should be disabled");
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
void afterDestroyWithoutDeallocate(Value* addr, std::size_t n) {
|
|
395
|
+
if (kIsLibrarySanitizeAddress) {
|
|
396
|
+
memset(static_cast<void*>(addr), 0x66, sizeof(Value) * n);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
// BaseIter is a convenience for concrete set and map implementations
|
|
402
|
+
template <typename ValuePtr, typename Item>
|
|
403
|
+
class BaseIter {
|
|
404
|
+
private:
|
|
405
|
+
using pointee = typename std::pointer_traits<ValuePtr>::element_type;
|
|
406
|
+
|
|
407
|
+
public:
|
|
408
|
+
using iterator_category = std::forward_iterator_tag;
|
|
409
|
+
using value_type = std::remove_const_t<pointee>;
|
|
410
|
+
using difference_type = std::ptrdiff_t;
|
|
411
|
+
using pointer = ValuePtr;
|
|
412
|
+
using reference = pointee&;
|
|
413
|
+
|
|
414
|
+
protected:
|
|
415
|
+
using Chunk = F14Chunk<Item>;
|
|
416
|
+
using ChunkPtr =
|
|
417
|
+
typename std::pointer_traits<ValuePtr>::template rebind<Chunk>;
|
|
418
|
+
using ItemIter = F14ItemIter<ChunkPtr>;
|
|
419
|
+
|
|
420
|
+
using ValueConstPtr = typename std::pointer_traits<ValuePtr>::template rebind<
|
|
421
|
+
std::add_const_t<typename std::pointer_traits<ValuePtr>::element_type>>;
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
//////// ValueContainer
|
|
425
|
+
|
|
426
|
+
template <
|
|
427
|
+
typename Key,
|
|
428
|
+
typename Mapped,
|
|
429
|
+
typename HasherOrVoid,
|
|
430
|
+
typename KeyEqualOrVoid,
|
|
431
|
+
typename AllocOrVoid>
|
|
432
|
+
class ValueContainerPolicy;
|
|
433
|
+
|
|
434
|
+
template <typename ValuePtr>
|
|
435
|
+
using ValueContainerIteratorBase = BaseIter<
|
|
436
|
+
ValuePtr,
|
|
437
|
+
std::remove_const_t<typename std::pointer_traits<ValuePtr>::element_type>>;
|
|
438
|
+
|
|
439
|
+
template <typename ValuePtr>
|
|
440
|
+
class ValueContainerIterator : public ValueContainerIteratorBase<ValuePtr> {
|
|
441
|
+
using Super = ValueContainerIteratorBase<ValuePtr>;
|
|
442
|
+
using ItemIter = typename Super::ItemIter;
|
|
443
|
+
using ValueConstPtr = typename Super::ValueConstPtr;
|
|
444
|
+
|
|
445
|
+
public:
|
|
446
|
+
using pointer = typename Super::pointer;
|
|
447
|
+
using reference = typename Super::reference;
|
|
448
|
+
using value_type = typename Super::value_type;
|
|
449
|
+
|
|
450
|
+
ValueContainerIterator() = default;
|
|
451
|
+
ValueContainerIterator(ValueContainerIterator const&) = default;
|
|
452
|
+
ValueContainerIterator(ValueContainerIterator&&) = default;
|
|
453
|
+
ValueContainerIterator& operator=(ValueContainerIterator const&) = default;
|
|
454
|
+
ValueContainerIterator& operator=(ValueContainerIterator&&) = default;
|
|
455
|
+
~ValueContainerIterator() = default;
|
|
456
|
+
|
|
457
|
+
/*implicit*/ operator ValueContainerIterator<ValueConstPtr>() const {
|
|
458
|
+
return ValueContainerIterator<ValueConstPtr>{underlying_};
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
reference operator*() const { return underlying_.item(); }
|
|
462
|
+
|
|
463
|
+
pointer operator->() const {
|
|
464
|
+
return std::pointer_traits<pointer>::pointer_to(**this);
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
ValueContainerIterator& operator++() {
|
|
468
|
+
underlying_.advance();
|
|
469
|
+
return *this;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
ValueContainerIterator operator++(int) {
|
|
473
|
+
auto cur = *this;
|
|
474
|
+
++*this;
|
|
475
|
+
return cur;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
friend bool operator==(
|
|
479
|
+
ValueContainerIterator const& lhs, ValueContainerIterator const& rhs) {
|
|
480
|
+
return lhs.underlying_ == rhs.underlying_;
|
|
481
|
+
}
|
|
482
|
+
friend bool operator!=(
|
|
483
|
+
ValueContainerIterator const& lhs, ValueContainerIterator const& rhs) {
|
|
484
|
+
return !(lhs == rhs);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
private:
|
|
488
|
+
ItemIter underlying_;
|
|
489
|
+
|
|
490
|
+
explicit ValueContainerIterator(ItemIter const& underlying)
|
|
491
|
+
: underlying_{underlying} {}
|
|
492
|
+
|
|
493
|
+
template <typename K, typename M, typename H, typename E, typename A>
|
|
494
|
+
friend class ValueContainerPolicy;
|
|
495
|
+
|
|
496
|
+
template <typename P>
|
|
497
|
+
friend class ValueContainerIterator;
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
template <
|
|
501
|
+
typename Key,
|
|
502
|
+
typename MappedTypeOrVoid,
|
|
503
|
+
typename HasherOrVoid,
|
|
504
|
+
typename KeyEqualOrVoid,
|
|
505
|
+
typename AllocOrVoid>
|
|
506
|
+
class ValueContainerPolicy : public BasePolicy<
|
|
507
|
+
Key,
|
|
508
|
+
MappedTypeOrVoid,
|
|
509
|
+
HasherOrVoid,
|
|
510
|
+
KeyEqualOrVoid,
|
|
511
|
+
AllocOrVoid,
|
|
512
|
+
SetOrMapValueType<Key, MappedTypeOrVoid>> {
|
|
513
|
+
public:
|
|
514
|
+
using Super = BasePolicy<
|
|
515
|
+
Key,
|
|
516
|
+
MappedTypeOrVoid,
|
|
517
|
+
HasherOrVoid,
|
|
518
|
+
KeyEqualOrVoid,
|
|
519
|
+
AllocOrVoid,
|
|
520
|
+
SetOrMapValueType<Key, MappedTypeOrVoid>>;
|
|
521
|
+
using Alloc = typename Super::Alloc;
|
|
522
|
+
using AllocTraits = typename Super::AllocTraits;
|
|
523
|
+
using Item = typename Super::Item;
|
|
524
|
+
using ItemIter = typename Super::ItemIter;
|
|
525
|
+
using Value = typename Super::Value;
|
|
526
|
+
using KeyEqual = typename Super::KeyEqual;
|
|
527
|
+
using Hasher = typename Super::Hasher;
|
|
528
|
+
using Mapped = typename Super::Mapped;
|
|
529
|
+
|
|
530
|
+
static constexpr bool kDefaultConstructIsNoexcept =
|
|
531
|
+
Super::kDefaultConstructIsNoexcept;
|
|
532
|
+
static constexpr bool kAllocIsAlwaysEqual = Super::kAllocIsAlwaysEqual;
|
|
533
|
+
static constexpr bool kEnableItemIteration = Super::kEnableItemIteration;
|
|
534
|
+
static constexpr bool kContinuousCapacity = Super::kContinuousCapacity;
|
|
535
|
+
static constexpr auto isAvalanchingHasher = Super::isAvalanchingHasher;
|
|
536
|
+
static constexpr bool kSwapIsNoexcept = Super::kSwapIsNoexcept;
|
|
537
|
+
|
|
538
|
+
private:
|
|
539
|
+
using ByteAlloc = typename Super::ByteAlloc;
|
|
540
|
+
|
|
541
|
+
using Super::kIsMap;
|
|
542
|
+
|
|
543
|
+
public:
|
|
544
|
+
using ConstIter = ValueContainerIterator<typename AllocTraits::const_pointer>;
|
|
545
|
+
using Iter = std::conditional_t<
|
|
546
|
+
kIsMap,
|
|
547
|
+
ValueContainerIterator<typename AllocTraits::pointer>,
|
|
548
|
+
ConstIter>;
|
|
549
|
+
|
|
550
|
+
//////// F14Table policy
|
|
551
|
+
|
|
552
|
+
static constexpr bool prefetchBeforeRehash() { return false; }
|
|
553
|
+
|
|
554
|
+
static constexpr bool prefetchBeforeCopy() { return false; }
|
|
555
|
+
|
|
556
|
+
static constexpr bool prefetchBeforeDestroy() { return false; }
|
|
557
|
+
|
|
558
|
+
static constexpr bool destroyItemOnClear() {
|
|
559
|
+
return !std::is_trivially_destructible<Item>::value ||
|
|
560
|
+
!AllocatorHasDefaultObjectDestroy<Alloc, Item>::value;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
// inherit constructors
|
|
564
|
+
using Super::Super;
|
|
565
|
+
|
|
566
|
+
void swapPolicy(ValueContainerPolicy& rhs) { this->swapBasePolicy(rhs); }
|
|
567
|
+
|
|
568
|
+
using Super::keyForValue;
|
|
569
|
+
static_assert(
|
|
570
|
+
std::is_same<Item, Value>::value,
|
|
571
|
+
"Item and Value should be the same type for ValueContainerPolicy.");
|
|
572
|
+
|
|
573
|
+
std::size_t computeItemHash(Item const& item) const {
|
|
574
|
+
return this->computeKeyHash(keyForValue(item));
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
template <typename K>
|
|
578
|
+
bool keyMatchesItem(K const& key, Item const& item) const {
|
|
579
|
+
return this->keyEqual()(key, keyForValue(item));
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
Value const& buildArgForItem(Item const& item) const& { return item; }
|
|
583
|
+
|
|
584
|
+
// buildArgForItem(Item&)&& is used when moving between unequal allocators
|
|
585
|
+
decltype(auto) buildArgForItem(Item& item) && {
|
|
586
|
+
return Super::moveValue(item);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
Value const& valueAtItem(Item const& item) const { return item; }
|
|
590
|
+
|
|
591
|
+
Value&& valueAtItemForExtract(Item& item) { return std::move(item); }
|
|
592
|
+
|
|
593
|
+
template <typename Table, typename... Args>
|
|
594
|
+
void constructValueAtItem(Table&&, Item* itemAddr, Args&&... args) {
|
|
595
|
+
Alloc& a = this->alloc();
|
|
596
|
+
// GCC < 6 doesn't use the fact that itemAddr came from a reference
|
|
597
|
+
// to avoid a null-check in the placement new. folly::assume-ing it
|
|
598
|
+
// here gets rid of that branch. The branch is very predictable,
|
|
599
|
+
// but spoils some further optimizations. All clang versions that
|
|
600
|
+
// compile folly seem to be okay.
|
|
601
|
+
//
|
|
602
|
+
// TODO(T31574848): clean up assume-s used to optimize placement new
|
|
603
|
+
assume(itemAddr != nullptr);
|
|
604
|
+
AllocTraits::construct(a, itemAddr, std::forward<Args>(args)...);
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
template <typename T>
|
|
608
|
+
std::enable_if_t<IsNothrowMoveAndDestroy<T>::value>
|
|
609
|
+
complainUnlessNothrowMoveAndDestroy() {}
|
|
610
|
+
|
|
611
|
+
template <typename T>
|
|
612
|
+
[[deprecated(
|
|
613
|
+
"mark {key_type,mapped_type} {move constructor,destructor} noexcept, or use F14Node* if they aren't")]] std::
|
|
614
|
+
enable_if_t<!IsNothrowMoveAndDestroy<T>::value>
|
|
615
|
+
complainUnlessNothrowMoveAndDestroy() {}
|
|
616
|
+
|
|
617
|
+
void moveItemDuringRehash(Item* itemAddr, Item& src) {
|
|
618
|
+
complainUnlessNothrowMoveAndDestroy<Key>();
|
|
619
|
+
complainUnlessNothrowMoveAndDestroy<lift_unit_t<MappedTypeOrVoid>>();
|
|
620
|
+
|
|
621
|
+
constructValueAtItem(0, itemAddr, Super::moveValue(src));
|
|
622
|
+
if (destroyItemOnClear()) {
|
|
623
|
+
if (kIsMap) {
|
|
624
|
+
// Laundering in the standard is only described as a solution
|
|
625
|
+
// for changes to const fields due to the creation of a new
|
|
626
|
+
// object lifetime (destroy and then placement new in the same
|
|
627
|
+
// location), but it seems highly likely that it will also cause
|
|
628
|
+
// the compiler to drop such assumptions that are violated due
|
|
629
|
+
// to our UB const_cast in moveValue.
|
|
630
|
+
destroyItem(*std::launder(std::addressof(src)));
|
|
631
|
+
} else {
|
|
632
|
+
destroyItem(src);
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
void destroyItem(Item& item) noexcept {
|
|
638
|
+
Alloc& a = this->alloc();
|
|
639
|
+
auto ptr = std::addressof(item);
|
|
640
|
+
AllocTraits::destroy(a, ptr);
|
|
641
|
+
this->afterDestroyWithoutDeallocate(ptr, 1);
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
template <typename V>
|
|
645
|
+
void visitPolicyAllocationClasses(
|
|
646
|
+
std::size_t chunkAllocSize,
|
|
647
|
+
std::size_t /*size*/,
|
|
648
|
+
std::size_t /*capacity*/,
|
|
649
|
+
V&& visitor) const {
|
|
650
|
+
if (chunkAllocSize > 0) {
|
|
651
|
+
visitor(
|
|
652
|
+
allocationBytesForOverAligned<ByteAlloc, kRequiredVectorAlignment>(
|
|
653
|
+
chunkAllocSize),
|
|
654
|
+
1);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
//////// F14BasicMap/Set policy
|
|
659
|
+
|
|
660
|
+
FOLLY_ALWAYS_INLINE Iter makeIter(ItemIter const& underlying) const {
|
|
661
|
+
return Iter{underlying};
|
|
662
|
+
}
|
|
663
|
+
ConstIter makeConstIter(ItemIter const& underlying) const {
|
|
664
|
+
return ConstIter{underlying};
|
|
665
|
+
}
|
|
666
|
+
ItemIter const& unwrapIter(ConstIter const& iter) const {
|
|
667
|
+
return iter.underlying_;
|
|
668
|
+
}
|
|
669
|
+
};
|
|
670
|
+
|
|
671
|
+
//////// NodeContainer
|
|
672
|
+
|
|
673
|
+
template <
|
|
674
|
+
typename Key,
|
|
675
|
+
typename Mapped,
|
|
676
|
+
typename HasherOrVoid,
|
|
677
|
+
typename KeyEqualOrVoid,
|
|
678
|
+
typename AllocOrVoid>
|
|
679
|
+
class NodeContainerPolicy;
|
|
680
|
+
|
|
681
|
+
template <typename ValuePtr>
|
|
682
|
+
class NodeContainerIterator : public BaseIter<ValuePtr, NonConstPtr<ValuePtr>> {
|
|
683
|
+
using Super = BaseIter<ValuePtr, NonConstPtr<ValuePtr>>;
|
|
684
|
+
using ItemIter = typename Super::ItemIter;
|
|
685
|
+
using ValueConstPtr = typename Super::ValueConstPtr;
|
|
686
|
+
|
|
687
|
+
public:
|
|
688
|
+
using pointer = typename Super::pointer;
|
|
689
|
+
using reference = typename Super::reference;
|
|
690
|
+
using value_type = typename Super::value_type;
|
|
691
|
+
|
|
692
|
+
NodeContainerIterator() = default;
|
|
693
|
+
NodeContainerIterator(NodeContainerIterator const&) = default;
|
|
694
|
+
NodeContainerIterator(NodeContainerIterator&&) = default;
|
|
695
|
+
NodeContainerIterator& operator=(NodeContainerIterator const&) = default;
|
|
696
|
+
NodeContainerIterator& operator=(NodeContainerIterator&&) = default;
|
|
697
|
+
~NodeContainerIterator() = default;
|
|
698
|
+
|
|
699
|
+
/*implicit*/ operator NodeContainerIterator<ValueConstPtr>() const {
|
|
700
|
+
return NodeContainerIterator<ValueConstPtr>{underlying_};
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
reference operator*() const { return *underlying_.item(); }
|
|
704
|
+
|
|
705
|
+
pointer operator->() const {
|
|
706
|
+
return std::pointer_traits<pointer>::pointer_to(**this);
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
NodeContainerIterator& operator++() {
|
|
710
|
+
underlying_.advance();
|
|
711
|
+
return *this;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
NodeContainerIterator operator++(int) {
|
|
715
|
+
auto cur = *this;
|
|
716
|
+
++*this;
|
|
717
|
+
return cur;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
friend bool operator==(
|
|
721
|
+
NodeContainerIterator const& lhs, NodeContainerIterator const& rhs) {
|
|
722
|
+
return lhs.underlying_ == rhs.underlying_;
|
|
723
|
+
}
|
|
724
|
+
friend bool operator!=(
|
|
725
|
+
NodeContainerIterator const& lhs, NodeContainerIterator const& rhs) {
|
|
726
|
+
return !(lhs == rhs);
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
private:
|
|
730
|
+
ItemIter underlying_;
|
|
731
|
+
|
|
732
|
+
explicit NodeContainerIterator(ItemIter const& underlying)
|
|
733
|
+
: underlying_{underlying} {}
|
|
734
|
+
|
|
735
|
+
template <typename K, typename M, typename H, typename E, typename A>
|
|
736
|
+
friend class NodeContainerPolicy;
|
|
737
|
+
|
|
738
|
+
template <typename P>
|
|
739
|
+
friend class NodeContainerIterator;
|
|
740
|
+
};
|
|
741
|
+
|
|
742
|
+
template <
|
|
743
|
+
typename Key,
|
|
744
|
+
typename MappedTypeOrVoid,
|
|
745
|
+
typename HasherOrVoid,
|
|
746
|
+
typename KeyEqualOrVoid,
|
|
747
|
+
typename AllocOrVoid>
|
|
748
|
+
class NodeContainerPolicy
|
|
749
|
+
: public BasePolicy<
|
|
750
|
+
Key,
|
|
751
|
+
MappedTypeOrVoid,
|
|
752
|
+
HasherOrVoid,
|
|
753
|
+
KeyEqualOrVoid,
|
|
754
|
+
AllocOrVoid,
|
|
755
|
+
typename std::allocator_traits<Defaulted<
|
|
756
|
+
AllocOrVoid,
|
|
757
|
+
DefaultAlloc<std::conditional_t<
|
|
758
|
+
std::is_void<MappedTypeOrVoid>::value,
|
|
759
|
+
Key,
|
|
760
|
+
MapValueType<Key, MappedTypeOrVoid>>>>>::pointer> {
|
|
761
|
+
public:
|
|
762
|
+
using Super = BasePolicy<
|
|
763
|
+
Key,
|
|
764
|
+
MappedTypeOrVoid,
|
|
765
|
+
HasherOrVoid,
|
|
766
|
+
KeyEqualOrVoid,
|
|
767
|
+
AllocOrVoid,
|
|
768
|
+
typename std::allocator_traits<Defaulted<
|
|
769
|
+
AllocOrVoid,
|
|
770
|
+
DefaultAlloc<std::conditional_t<
|
|
771
|
+
std::is_void<MappedTypeOrVoid>::value,
|
|
772
|
+
Key,
|
|
773
|
+
MapValueType<Key, MappedTypeOrVoid>>>>>::pointer>;
|
|
774
|
+
using Alloc = typename Super::Alloc;
|
|
775
|
+
using AllocTraits = typename Super::AllocTraits;
|
|
776
|
+
using Item = typename Super::Item;
|
|
777
|
+
using ItemIter = typename Super::ItemIter;
|
|
778
|
+
using Value = typename Super::Value;
|
|
779
|
+
|
|
780
|
+
private:
|
|
781
|
+
using ByteAlloc = typename Super::ByteAlloc;
|
|
782
|
+
|
|
783
|
+
using Super::kIsMap;
|
|
784
|
+
|
|
785
|
+
public:
|
|
786
|
+
using ConstIter = NodeContainerIterator<typename AllocTraits::const_pointer>;
|
|
787
|
+
using Iter = std::conditional_t<
|
|
788
|
+
kIsMap,
|
|
789
|
+
NodeContainerIterator<typename AllocTraits::pointer>,
|
|
790
|
+
ConstIter>;
|
|
791
|
+
|
|
792
|
+
//////// F14Table policy
|
|
793
|
+
|
|
794
|
+
static constexpr bool prefetchBeforeRehash() { return true; }
|
|
795
|
+
|
|
796
|
+
static constexpr bool prefetchBeforeCopy() { return true; }
|
|
797
|
+
|
|
798
|
+
static constexpr bool prefetchBeforeDestroy() {
|
|
799
|
+
return !std::is_trivially_destructible<Value>::value;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
static constexpr bool destroyItemOnClear() { return true; }
|
|
803
|
+
|
|
804
|
+
// inherit constructors
|
|
805
|
+
using Super::Super;
|
|
806
|
+
|
|
807
|
+
void swapPolicy(NodeContainerPolicy& rhs) { this->swapBasePolicy(rhs); }
|
|
808
|
+
|
|
809
|
+
using Super::keyForValue;
|
|
810
|
+
|
|
811
|
+
std::size_t computeItemHash(Item const& item) const {
|
|
812
|
+
return this->computeKeyHash(keyForValue(*item));
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
template <typename K>
|
|
816
|
+
bool keyMatchesItem(K const& key, Item const& item) const {
|
|
817
|
+
return this->keyEqual()(key, keyForValue(*item));
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
Value const& buildArgForItem(Item const& item) const& { return *item; }
|
|
821
|
+
|
|
822
|
+
// buildArgForItem(Item&)&& is used when moving between unequal allocators
|
|
823
|
+
decltype(auto) buildArgForItem(Item& item) && {
|
|
824
|
+
return Super::moveValue(*item);
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
Value const& valueAtItem(Item const& item) const { return *item; }
|
|
828
|
+
|
|
829
|
+
Value&& valueAtItemForExtract(Item& item) { return std::move(*item); }
|
|
830
|
+
|
|
831
|
+
template <typename Table, typename... Args>
|
|
832
|
+
void constructValueAtItem(Table&&, Item* itemAddr, Args&&... args) {
|
|
833
|
+
Alloc& a = this->alloc();
|
|
834
|
+
// TODO(T31574848): clean up assume-s used to optimize placement new
|
|
835
|
+
assume(itemAddr != nullptr);
|
|
836
|
+
new (itemAddr) Item{AllocTraits::allocate(a, 1)};
|
|
837
|
+
auto p = std::addressof(**itemAddr);
|
|
838
|
+
// TODO(T31574848): clean up assume-s used to optimize placement new
|
|
839
|
+
assume(p != nullptr);
|
|
840
|
+
auto rollback = makeGuard([&] { AllocTraits::deallocate(a, p, 1); });
|
|
841
|
+
AllocTraits::construct(a, p, std::forward<Args>(args)...);
|
|
842
|
+
rollback.dismiss();
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
void moveItemDuringRehash(Item* itemAddr, Item& src) {
|
|
846
|
+
// This is basically *itemAddr = src; src = nullptr, but allowing
|
|
847
|
+
// for fancy pointers.
|
|
848
|
+
// TODO(T31574848): clean up assume-s used to optimize placement new
|
|
849
|
+
assume(itemAddr != nullptr);
|
|
850
|
+
new (itemAddr) Item{std::move(src)};
|
|
851
|
+
src = nullptr;
|
|
852
|
+
src.~Item();
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
void prefetchValue(Item const& item) const {
|
|
856
|
+
prefetchAddr(std::addressof(*item));
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
template <typename T>
|
|
860
|
+
std::enable_if_t<std::is_nothrow_destructible<T>::value>
|
|
861
|
+
complainUnlessNothrowDestroy() {}
|
|
862
|
+
|
|
863
|
+
template <typename T>
|
|
864
|
+
[[deprecated("Mark key and mapped type destructor nothrow")]] std::
|
|
865
|
+
enable_if_t<!std::is_nothrow_destructible<T>::value>
|
|
866
|
+
complainUnlessNothrowDestroy() {}
|
|
867
|
+
|
|
868
|
+
void destroyItem(Item& item) noexcept {
|
|
869
|
+
complainUnlessNothrowDestroy<Key>();
|
|
870
|
+
complainUnlessNothrowDestroy<lift_unit_t<MappedTypeOrVoid>>();
|
|
871
|
+
if (item != nullptr) {
|
|
872
|
+
Alloc& a = this->alloc();
|
|
873
|
+
AllocTraits::destroy(a, std::addressof(*item));
|
|
874
|
+
AllocTraits::deallocate(a, item, 1);
|
|
875
|
+
}
|
|
876
|
+
item.~Item();
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
template <typename V>
|
|
880
|
+
void visitPolicyAllocationClasses(
|
|
881
|
+
std::size_t chunkAllocSize,
|
|
882
|
+
std::size_t size,
|
|
883
|
+
std::size_t /*capacity*/,
|
|
884
|
+
V&& visitor) const {
|
|
885
|
+
if (chunkAllocSize > 0) {
|
|
886
|
+
visitor(
|
|
887
|
+
allocationBytesForOverAligned<ByteAlloc, kRequiredVectorAlignment>(
|
|
888
|
+
chunkAllocSize),
|
|
889
|
+
1);
|
|
890
|
+
}
|
|
891
|
+
if (size > 0) {
|
|
892
|
+
visitor(sizeof(Value), size);
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
//////// F14BasicMap/Set policy
|
|
897
|
+
|
|
898
|
+
FOLLY_ALWAYS_INLINE Iter makeIter(ItemIter const& underlying) const {
|
|
899
|
+
return Iter{underlying};
|
|
900
|
+
}
|
|
901
|
+
ConstIter makeConstIter(ItemIter const& underlying) const {
|
|
902
|
+
return Iter{underlying};
|
|
903
|
+
}
|
|
904
|
+
ItemIter const& unwrapIter(ConstIter const& iter) const {
|
|
905
|
+
return iter.underlying_;
|
|
906
|
+
}
|
|
907
|
+
};
|
|
908
|
+
|
|
909
|
+
//////// VectorContainer
|
|
910
|
+
|
|
911
|
+
template <
|
|
912
|
+
typename Key,
|
|
913
|
+
typename MappedTypeOrVoid,
|
|
914
|
+
typename HasherOrVoid,
|
|
915
|
+
typename KeyEqualOrVoid,
|
|
916
|
+
typename AllocOrVoid,
|
|
917
|
+
typename EligibleForPerturbedInsertionOrder>
|
|
918
|
+
class VectorContainerPolicy;
|
|
919
|
+
|
|
920
|
+
template <typename ValuePtr>
|
|
921
|
+
class VectorContainerIterator : public BaseIter<ValuePtr, uint32_t> {
|
|
922
|
+
using Super = BaseIter<ValuePtr, uint32_t>;
|
|
923
|
+
using ValueConstPtr = typename Super::ValueConstPtr;
|
|
924
|
+
|
|
925
|
+
public:
|
|
926
|
+
using pointer = typename Super::pointer;
|
|
927
|
+
using reference = typename Super::reference;
|
|
928
|
+
using value_type = typename Super::value_type;
|
|
929
|
+
|
|
930
|
+
VectorContainerIterator() = default;
|
|
931
|
+
VectorContainerIterator(VectorContainerIterator const&) = default;
|
|
932
|
+
VectorContainerIterator(VectorContainerIterator&&) = default;
|
|
933
|
+
VectorContainerIterator& operator=(VectorContainerIterator const&) = default;
|
|
934
|
+
VectorContainerIterator& operator=(VectorContainerIterator&&) = default;
|
|
935
|
+
~VectorContainerIterator() = default;
|
|
936
|
+
|
|
937
|
+
/*implicit*/ operator VectorContainerIterator<ValueConstPtr>() const {
|
|
938
|
+
return VectorContainerIterator<ValueConstPtr>{current_, lowest_};
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
reference operator*() const { return *current_; }
|
|
942
|
+
|
|
943
|
+
pointer operator->() const { return current_; }
|
|
944
|
+
|
|
945
|
+
VectorContainerIterator& operator++() {
|
|
946
|
+
if (FOLLY_UNLIKELY(current_ == lowest_)) {
|
|
947
|
+
current_ = nullptr;
|
|
948
|
+
} else {
|
|
949
|
+
--current_;
|
|
950
|
+
}
|
|
951
|
+
return *this;
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
VectorContainerIterator operator++(int) {
|
|
955
|
+
auto cur = *this;
|
|
956
|
+
++*this;
|
|
957
|
+
return cur;
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
friend bool operator==(
|
|
961
|
+
VectorContainerIterator const& lhs, VectorContainerIterator const& rhs) {
|
|
962
|
+
return lhs.current_ == rhs.current_;
|
|
963
|
+
}
|
|
964
|
+
friend bool operator!=(
|
|
965
|
+
VectorContainerIterator const& lhs, VectorContainerIterator const& rhs) {
|
|
966
|
+
return !(lhs == rhs);
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
private:
|
|
970
|
+
ValuePtr current_;
|
|
971
|
+
ValuePtr lowest_;
|
|
972
|
+
|
|
973
|
+
explicit VectorContainerIterator(ValuePtr current, ValuePtr lowest)
|
|
974
|
+
: current_(current), lowest_(lowest) {}
|
|
975
|
+
|
|
976
|
+
std::size_t index() const { return current_ - lowest_; }
|
|
977
|
+
|
|
978
|
+
template <
|
|
979
|
+
typename K,
|
|
980
|
+
typename M,
|
|
981
|
+
typename H,
|
|
982
|
+
typename E,
|
|
983
|
+
typename A,
|
|
984
|
+
typename P>
|
|
985
|
+
friend class VectorContainerPolicy;
|
|
986
|
+
|
|
987
|
+
template <typename P>
|
|
988
|
+
friend class VectorContainerIterator;
|
|
989
|
+
};
|
|
990
|
+
|
|
991
|
+
struct VectorContainerIndexSearch {
|
|
992
|
+
uint32_t index_;
|
|
993
|
+
};
|
|
994
|
+
|
|
995
|
+
template <
|
|
996
|
+
typename Key,
|
|
997
|
+
typename MappedTypeOrVoid,
|
|
998
|
+
typename HasherOrVoid,
|
|
999
|
+
typename KeyEqualOrVoid,
|
|
1000
|
+
typename AllocOrVoid,
|
|
1001
|
+
typename EligibleForPerturbedInsertionOrder>
|
|
1002
|
+
class VectorContainerPolicy : public BasePolicy<
|
|
1003
|
+
Key,
|
|
1004
|
+
MappedTypeOrVoid,
|
|
1005
|
+
HasherOrVoid,
|
|
1006
|
+
KeyEqualOrVoid,
|
|
1007
|
+
AllocOrVoid,
|
|
1008
|
+
uint32_t> {
|
|
1009
|
+
public:
|
|
1010
|
+
using Super = BasePolicy<
|
|
1011
|
+
Key,
|
|
1012
|
+
MappedTypeOrVoid,
|
|
1013
|
+
HasherOrVoid,
|
|
1014
|
+
KeyEqualOrVoid,
|
|
1015
|
+
AllocOrVoid,
|
|
1016
|
+
uint32_t>;
|
|
1017
|
+
using Value = typename Super::Value;
|
|
1018
|
+
using Alloc = typename Super::Alloc;
|
|
1019
|
+
using AllocTraits = typename Super::AllocTraits;
|
|
1020
|
+
using ByteAlloc = typename Super::ByteAlloc;
|
|
1021
|
+
using ByteAllocTraits = typename Super::ByteAllocTraits;
|
|
1022
|
+
using BytePtr = typename Super::BytePtr;
|
|
1023
|
+
using Hasher = typename Super::Hasher;
|
|
1024
|
+
using Item = typename Super::Item;
|
|
1025
|
+
using ItemIter = typename Super::ItemIter;
|
|
1026
|
+
using KeyEqual = typename Super::KeyEqual;
|
|
1027
|
+
|
|
1028
|
+
using Super::kAllocIsAlwaysEqual;
|
|
1029
|
+
|
|
1030
|
+
private:
|
|
1031
|
+
using Super::kIsMap;
|
|
1032
|
+
|
|
1033
|
+
public:
|
|
1034
|
+
static constexpr bool kEnableItemIteration = false;
|
|
1035
|
+
|
|
1036
|
+
static constexpr bool kContinuousCapacity = true;
|
|
1037
|
+
|
|
1038
|
+
using InternalSizeType = Item;
|
|
1039
|
+
|
|
1040
|
+
using ConstIter =
|
|
1041
|
+
VectorContainerIterator<typename AllocTraits::const_pointer>;
|
|
1042
|
+
using Iter = std::conditional_t<
|
|
1043
|
+
kIsMap,
|
|
1044
|
+
VectorContainerIterator<typename AllocTraits::pointer>,
|
|
1045
|
+
ConstIter>;
|
|
1046
|
+
using ConstReverseIter = typename AllocTraits::const_pointer;
|
|
1047
|
+
using ReverseIter = std::
|
|
1048
|
+
conditional_t<kIsMap, typename AllocTraits::pointer, ConstReverseIter>;
|
|
1049
|
+
|
|
1050
|
+
using ValuePtr = typename AllocTraits::pointer;
|
|
1051
|
+
|
|
1052
|
+
//////// F14Table policy
|
|
1053
|
+
|
|
1054
|
+
static constexpr bool prefetchBeforeRehash() { return true; }
|
|
1055
|
+
|
|
1056
|
+
static constexpr bool prefetchBeforeCopy() { return false; }
|
|
1057
|
+
|
|
1058
|
+
static constexpr bool prefetchBeforeDestroy() { return false; }
|
|
1059
|
+
|
|
1060
|
+
static constexpr bool destroyItemOnClear() { return false; }
|
|
1061
|
+
|
|
1062
|
+
private:
|
|
1063
|
+
static constexpr bool valueIsTriviallyCopyable() {
|
|
1064
|
+
return AllocatorHasDefaultObjectConstruct<Alloc, Value, Value>::value &&
|
|
1065
|
+
AllocatorHasDefaultObjectDestroy<Alloc, Value>::value &&
|
|
1066
|
+
std::is_trivially_copyable<Value>::value;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
public:
|
|
1070
|
+
VectorContainerPolicy(
|
|
1071
|
+
Hasher const& hasher, KeyEqual const& keyEqual, Alloc const& alloc)
|
|
1072
|
+
: Super{hasher, keyEqual, alloc} {}
|
|
1073
|
+
|
|
1074
|
+
VectorContainerPolicy(VectorContainerPolicy const& rhs) : Super{rhs} {
|
|
1075
|
+
// values_ will get allocated later to do the copy
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
VectorContainerPolicy(VectorContainerPolicy const& rhs, Alloc const& alloc)
|
|
1079
|
+
: Super{rhs, alloc} {
|
|
1080
|
+
// values_ will get allocated later to do the copy
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
VectorContainerPolicy(VectorContainerPolicy&& rhs) noexcept
|
|
1084
|
+
: Super{std::move(rhs)}, values_{rhs.values_} {
|
|
1085
|
+
rhs.values_ = nullptr;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
VectorContainerPolicy(
|
|
1089
|
+
VectorContainerPolicy&& rhs, Alloc const& alloc) noexcept
|
|
1090
|
+
: Super{std::move(rhs), alloc} {
|
|
1091
|
+
if (kAllocIsAlwaysEqual || this->alloc() == rhs.alloc()) {
|
|
1092
|
+
// common case
|
|
1093
|
+
values_ = rhs.values_;
|
|
1094
|
+
rhs.values_ = nullptr;
|
|
1095
|
+
} else {
|
|
1096
|
+
// table must be constructed in new memory
|
|
1097
|
+
values_ = nullptr;
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
VectorContainerPolicy& operator=(VectorContainerPolicy const& rhs) {
|
|
1102
|
+
if (this != &rhs) {
|
|
1103
|
+
FOLLY_SAFE_DCHECK(values_ == nullptr, "");
|
|
1104
|
+
Super::operator=(rhs);
|
|
1105
|
+
}
|
|
1106
|
+
return *this;
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
VectorContainerPolicy& operator=(VectorContainerPolicy&& rhs) noexcept {
|
|
1110
|
+
if (this != &rhs) {
|
|
1111
|
+
FOLLY_SAFE_DCHECK(values_ == nullptr, "");
|
|
1112
|
+
bool transfer =
|
|
1113
|
+
AllocTraits::propagate_on_container_move_assignment::value ||
|
|
1114
|
+
kAllocIsAlwaysEqual || this->alloc() == rhs.alloc();
|
|
1115
|
+
Super::operator=(std::move(rhs));
|
|
1116
|
+
if (transfer) {
|
|
1117
|
+
values_ = rhs.values_;
|
|
1118
|
+
rhs.values_ = nullptr;
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
return *this;
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
void swapPolicy(VectorContainerPolicy& rhs) {
|
|
1125
|
+
using std::swap;
|
|
1126
|
+
this->swapBasePolicy(rhs);
|
|
1127
|
+
swap(values_, rhs.values_);
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
template <typename K>
|
|
1131
|
+
std::size_t computeKeyHash(K const& key) const {
|
|
1132
|
+
static_assert(
|
|
1133
|
+
Super::isAvalanchingHasher() == IsAvalanchingHasher<Hasher, K>::value,
|
|
1134
|
+
"");
|
|
1135
|
+
return this->hasher()(key);
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
std::size_t computeKeyHash(VectorContainerIndexSearch const& key) const {
|
|
1139
|
+
return computeItemHash(key.index_);
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
using Super::keyForValue;
|
|
1143
|
+
|
|
1144
|
+
std::size_t computeItemHash(Item const& item) const {
|
|
1145
|
+
return this->computeKeyHash(keyForValue(values_[item]));
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
bool keyMatchesItem(
|
|
1149
|
+
VectorContainerIndexSearch const& key, Item const& item) const {
|
|
1150
|
+
return key.index_ == item;
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
template <typename K>
|
|
1154
|
+
bool keyMatchesItem(K const& key, Item const& item) const {
|
|
1155
|
+
return this->keyEqual()(key, keyForValue(values_[item]));
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
Key const& keyForValue(VectorContainerIndexSearch const& arg) const {
|
|
1159
|
+
return keyForValue(values_[arg.index_]);
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
VectorContainerIndexSearch buildArgForItem(Item const& item) const {
|
|
1163
|
+
return {item};
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
Value const& valueAtItem(Item const& item) const { return values_[item]; }
|
|
1167
|
+
|
|
1168
|
+
Value&& valueAtItemForExtract(Item& item) { return std::move(values_[item]); }
|
|
1169
|
+
|
|
1170
|
+
template <typename Table>
|
|
1171
|
+
void constructValueAtItem(
|
|
1172
|
+
Table&&, Item* itemAddr, VectorContainerIndexSearch arg) {
|
|
1173
|
+
*itemAddr = arg.index_;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
template <typename Table, typename... Args>
|
|
1177
|
+
void constructValueAtItem(Table&& table, Item* itemAddr, Args&&... args) {
|
|
1178
|
+
Alloc& a = this->alloc();
|
|
1179
|
+
auto size = static_cast<InternalSizeType>(table.size());
|
|
1180
|
+
FOLLY_SAFE_DCHECK(
|
|
1181
|
+
table.size() < std::numeric_limits<InternalSizeType>::max(), "");
|
|
1182
|
+
*itemAddr = size;
|
|
1183
|
+
auto dst = std::addressof(values_[size]);
|
|
1184
|
+
// TODO(T31574848): clean up assume-s used to optimize placement new
|
|
1185
|
+
assume(dst != nullptr);
|
|
1186
|
+
AllocTraits::construct(a, dst, std::forward<Args>(args)...);
|
|
1187
|
+
|
|
1188
|
+
constexpr bool perturb = FOLLY_F14_PERTURB_INSERTION_ORDER;
|
|
1189
|
+
if (EligibleForPerturbedInsertionOrder::value && perturb &&
|
|
1190
|
+
!tlsPendingSafeInserts()) {
|
|
1191
|
+
// Pick a random victim. We have to do this post-construction
|
|
1192
|
+
// because the item and tag are already set in the table before
|
|
1193
|
+
// calling constructValueAtItem, so if there is a tag collision
|
|
1194
|
+
// find may evaluate values_[size] during the search.
|
|
1195
|
+
auto i = static_cast<InternalSizeType>(tlsMinstdRand(size + 1));
|
|
1196
|
+
if (i != size) {
|
|
1197
|
+
auto& lhsItem = *itemAddr;
|
|
1198
|
+
auto rhsIter = table.find(
|
|
1199
|
+
VectorContainerIndexSearch{static_cast<InternalSizeType>(i)});
|
|
1200
|
+
FOLLY_SAFE_DCHECK(!rhsIter.atEnd(), "");
|
|
1201
|
+
auto& rhsItem = rhsIter.item();
|
|
1202
|
+
FOLLY_SAFE_DCHECK(lhsItem == size, "");
|
|
1203
|
+
FOLLY_SAFE_DCHECK(rhsItem == i, "");
|
|
1204
|
+
|
|
1205
|
+
aligned_storage_for_t<Value> tmp;
|
|
1206
|
+
Value* tmpValue = static_cast<Value*>(static_cast<void*>(&tmp));
|
|
1207
|
+
transfer(a, std::addressof(values_[i]), tmpValue, 1);
|
|
1208
|
+
transfer(
|
|
1209
|
+
a, std::addressof(values_[size]), std::addressof(values_[i]), 1);
|
|
1210
|
+
transfer(a, tmpValue, std::addressof(values_[size]), 1);
|
|
1211
|
+
lhsItem = i;
|
|
1212
|
+
rhsItem = size;
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
void moveItemDuringRehash(Item* itemAddr, Item& src) { *itemAddr = src; }
|
|
1218
|
+
|
|
1219
|
+
void prefetchValue(Item const& item) const {
|
|
1220
|
+
prefetchAddr(std::addressof(values_[item]));
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
void destroyItem(Item&) noexcept {}
|
|
1224
|
+
|
|
1225
|
+
template <typename T>
|
|
1226
|
+
std::enable_if_t<IsNothrowMoveAndDestroy<T>::value>
|
|
1227
|
+
complainUnlessNothrowMoveAndDestroy() {}
|
|
1228
|
+
|
|
1229
|
+
template <typename T>
|
|
1230
|
+
[[deprecated(
|
|
1231
|
+
"mark {key_type,mapped_type} {move constructor,destructor} noexcept, or use F14Node* if they aren't")]] std::
|
|
1232
|
+
enable_if_t<!IsNothrowMoveAndDestroy<T>::value>
|
|
1233
|
+
complainUnlessNothrowMoveAndDestroy() {}
|
|
1234
|
+
|
|
1235
|
+
void transfer(Alloc& a, Value* src, Value* dst, std::size_t n) {
|
|
1236
|
+
complainUnlessNothrowMoveAndDestroy<Key>();
|
|
1237
|
+
complainUnlessNothrowMoveAndDestroy<lift_unit_t<MappedTypeOrVoid>>();
|
|
1238
|
+
|
|
1239
|
+
auto origSrc = src;
|
|
1240
|
+
if (valueIsTriviallyCopyable()) {
|
|
1241
|
+
std::memcpy(
|
|
1242
|
+
static_cast<void*>(dst),
|
|
1243
|
+
static_cast<void const*>(src),
|
|
1244
|
+
n * sizeof(Value));
|
|
1245
|
+
} else {
|
|
1246
|
+
for (std::size_t i = 0; i < n; ++i, ++src, ++dst) {
|
|
1247
|
+
// TODO(T31574848): clean up assume-s used to optimize placement new
|
|
1248
|
+
assume(dst != nullptr);
|
|
1249
|
+
AllocTraits::construct(a, dst, Super::moveValue(*src));
|
|
1250
|
+
if (kIsMap) {
|
|
1251
|
+
AllocTraits::destroy(a, std::launder(src));
|
|
1252
|
+
} else {
|
|
1253
|
+
AllocTraits::destroy(a, src);
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
this->afterDestroyWithoutDeallocate(origSrc, n);
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
template <typename P, typename V>
|
|
1261
|
+
bool beforeBuildImpl(std::size_t size, P&& rhs, V const& constructorArgFor) {
|
|
1262
|
+
Alloc& a = this->alloc();
|
|
1263
|
+
|
|
1264
|
+
FOLLY_SAFE_DCHECK(values_ != nullptr, "");
|
|
1265
|
+
|
|
1266
|
+
auto src = std::addressof(rhs.values_[0]);
|
|
1267
|
+
Value* dst = std::addressof(values_[0]);
|
|
1268
|
+
|
|
1269
|
+
if (valueIsTriviallyCopyable()) {
|
|
1270
|
+
std::memcpy(
|
|
1271
|
+
static_cast<void*>(dst),
|
|
1272
|
+
static_cast<void const*>(src),
|
|
1273
|
+
size * sizeof(Value));
|
|
1274
|
+
} else {
|
|
1275
|
+
for (std::size_t i = 0; i < size; ++i, ++src, ++dst) {
|
|
1276
|
+
try {
|
|
1277
|
+
// TODO(T31574848): clean up assume-s used to optimize placement new
|
|
1278
|
+
assume(dst != nullptr);
|
|
1279
|
+
AllocTraits::construct(a, dst, constructorArgFor(*src));
|
|
1280
|
+
} catch (...) {
|
|
1281
|
+
for (Value* cleanup = std::addressof(values_[0]); cleanup != dst;
|
|
1282
|
+
++cleanup) {
|
|
1283
|
+
AllocTraits::destroy(a, cleanup);
|
|
1284
|
+
}
|
|
1285
|
+
throw;
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
return true;
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
bool beforeBuild(
|
|
1293
|
+
std::size_t size,
|
|
1294
|
+
std::size_t /*capacity*/,
|
|
1295
|
+
VectorContainerPolicy const& rhs) {
|
|
1296
|
+
return beforeBuildImpl(size, rhs, [](Value const& v) { return v; });
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
bool beforeBuild(
|
|
1300
|
+
std::size_t size, std::size_t /*capacity*/, VectorContainerPolicy&& rhs) {
|
|
1301
|
+
return beforeBuildImpl(
|
|
1302
|
+
size, rhs, [](Value& v) { return Super::moveValue(v); });
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
template <typename P>
|
|
1306
|
+
void afterBuild(
|
|
1307
|
+
bool /*undoState*/,
|
|
1308
|
+
bool success,
|
|
1309
|
+
std::size_t /*size*/,
|
|
1310
|
+
std::size_t /*capacity*/,
|
|
1311
|
+
P&& /*rhs*/) {
|
|
1312
|
+
// buildArgForItem can be used to construct a new item trivially,
|
|
1313
|
+
// so no failure between beforeBuild and afterBuild should be possible
|
|
1314
|
+
FOLLY_SAFE_DCHECK(success, "");
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
private:
|
|
1318
|
+
// Returns the byte offset of the first Value in a unified allocation
|
|
1319
|
+
// that first holds prefixBytes of data, where prefixBytes comes from
|
|
1320
|
+
// Chunk storage and may be only 4-byte aligned due to sub-chunk
|
|
1321
|
+
// allocation.
|
|
1322
|
+
static std::size_t valuesOffset(std::size_t prefixBytes) {
|
|
1323
|
+
FOLLY_SAFE_DCHECK((prefixBytes % alignof(Item)) == 0, "");
|
|
1324
|
+
if (alignof(Value) > alignof(Item)) {
|
|
1325
|
+
prefixBytes = -(-prefixBytes & ~(alignof(Value) - 1));
|
|
1326
|
+
}
|
|
1327
|
+
FOLLY_SAFE_DCHECK((prefixBytes % alignof(Value)) == 0, "");
|
|
1328
|
+
return prefixBytes;
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
// Returns the total number of bytes that should be allocated to store
|
|
1332
|
+
// prefixBytes of Chunks and valueCapacity values.
|
|
1333
|
+
static std::size_t allocSize(
|
|
1334
|
+
std::size_t prefixBytes, std::size_t valueCapacity) {
|
|
1335
|
+
return valuesOffset(prefixBytes) + sizeof(Value) * valueCapacity;
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
public:
|
|
1339
|
+
ValuePtr beforeRehash(
|
|
1340
|
+
std::size_t size,
|
|
1341
|
+
std::size_t oldCapacity,
|
|
1342
|
+
std::size_t newCapacity,
|
|
1343
|
+
std::size_t chunkAllocSize,
|
|
1344
|
+
BytePtr& outChunkAllocation) {
|
|
1345
|
+
FOLLY_SAFE_DCHECK(
|
|
1346
|
+
size <= oldCapacity && ((values_ == nullptr) == (oldCapacity == 0)) &&
|
|
1347
|
+
newCapacity > 0 &&
|
|
1348
|
+
newCapacity <= (std::numeric_limits<Item>::max)(),
|
|
1349
|
+
"");
|
|
1350
|
+
|
|
1351
|
+
outChunkAllocation =
|
|
1352
|
+
allocateOverAligned<ByteAlloc, kRequiredVectorAlignment>(
|
|
1353
|
+
ByteAlloc{Super::alloc()}, allocSize(chunkAllocSize, newCapacity));
|
|
1354
|
+
|
|
1355
|
+
ValuePtr before = values_;
|
|
1356
|
+
ValuePtr after = std::pointer_traits<ValuePtr>::pointer_to(
|
|
1357
|
+
*static_cast<Value*>(static_cast<void*>(
|
|
1358
|
+
&*outChunkAllocation + valuesOffset(chunkAllocSize))));
|
|
1359
|
+
|
|
1360
|
+
if (size > 0) {
|
|
1361
|
+
Alloc& a = this->alloc();
|
|
1362
|
+
transfer(a, std::addressof(before[0]), std::addressof(after[0]), size);
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
values_ = after;
|
|
1366
|
+
return before;
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
FOLLY_NOINLINE void afterFailedRehash(ValuePtr state, std::size_t size) {
|
|
1370
|
+
// state holds the old storage
|
|
1371
|
+
Alloc& a = this->alloc();
|
|
1372
|
+
if (size > 0) {
|
|
1373
|
+
transfer(a, std::addressof(values_[0]), std::addressof(state[0]), size);
|
|
1374
|
+
}
|
|
1375
|
+
values_ = state;
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
void afterRehash(
|
|
1379
|
+
ValuePtr state,
|
|
1380
|
+
bool success,
|
|
1381
|
+
std::size_t size,
|
|
1382
|
+
std::size_t oldCapacity,
|
|
1383
|
+
std::size_t newCapacity,
|
|
1384
|
+
BytePtr chunkAllocation,
|
|
1385
|
+
std::size_t chunkAllocSize) {
|
|
1386
|
+
if (!success) {
|
|
1387
|
+
afterFailedRehash(state, size);
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
// on success, chunkAllocation is the old allocation, on failure it is the
|
|
1391
|
+
// new one
|
|
1392
|
+
if (chunkAllocation != nullptr) {
|
|
1393
|
+
deallocateOverAligned<ByteAlloc, kRequiredVectorAlignment>(
|
|
1394
|
+
ByteAlloc{Super::alloc()},
|
|
1395
|
+
chunkAllocation,
|
|
1396
|
+
allocSize(chunkAllocSize, (success ? oldCapacity : newCapacity)));
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
void beforeClear(std::size_t size, std::size_t capacity) {
|
|
1401
|
+
FOLLY_SAFE_DCHECK(
|
|
1402
|
+
size <= capacity && ((values_ == nullptr) == (capacity == 0)), "");
|
|
1403
|
+
Alloc& a = this->alloc();
|
|
1404
|
+
for (std::size_t i = 0; i < size; ++i) {
|
|
1405
|
+
AllocTraits::destroy(a, std::addressof(values_[i]));
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
void beforeReset(std::size_t size, std::size_t capacity) {
|
|
1410
|
+
beforeClear(size, capacity);
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
void afterReset(
|
|
1414
|
+
std::size_t /*size*/,
|
|
1415
|
+
std::size_t capacity,
|
|
1416
|
+
BytePtr chunkAllocation,
|
|
1417
|
+
std::size_t chunkAllocSize) {
|
|
1418
|
+
if (chunkAllocation != nullptr) {
|
|
1419
|
+
deallocateOverAligned<ByteAlloc, kRequiredVectorAlignment>(
|
|
1420
|
+
ByteAlloc{Super::alloc()},
|
|
1421
|
+
chunkAllocation,
|
|
1422
|
+
allocSize(chunkAllocSize, capacity));
|
|
1423
|
+
values_ = nullptr;
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1427
|
+
template <typename V>
|
|
1428
|
+
void visitPolicyAllocationClasses(
|
|
1429
|
+
std::size_t chunkAllocSize,
|
|
1430
|
+
std::size_t /*size*/,
|
|
1431
|
+
std::size_t capacity,
|
|
1432
|
+
V&& visitor) const {
|
|
1433
|
+
FOLLY_SAFE_DCHECK((chunkAllocSize == 0) == (capacity == 0), "");
|
|
1434
|
+
if (chunkAllocSize > 0) {
|
|
1435
|
+
visitor(
|
|
1436
|
+
allocationBytesForOverAligned<ByteAlloc, kRequiredVectorAlignment>(
|
|
1437
|
+
allocSize(chunkAllocSize, capacity)),
|
|
1438
|
+
1);
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
// Iterator stuff
|
|
1443
|
+
|
|
1444
|
+
Iter linearBegin(std::size_t size) const {
|
|
1445
|
+
return size > 0 ? Iter{values_ + size - 1, values_}
|
|
1446
|
+
: Iter{nullptr, nullptr};
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
Iter linearEnd() const { return Iter{nullptr, nullptr}; }
|
|
1450
|
+
|
|
1451
|
+
//////// F14BasicMap/Set policy
|
|
1452
|
+
|
|
1453
|
+
Iter makeIter(ItemIter const& underlying) const {
|
|
1454
|
+
if (underlying.atEnd()) {
|
|
1455
|
+
return linearEnd();
|
|
1456
|
+
} else {
|
|
1457
|
+
assume(values_ + underlying.item() != nullptr);
|
|
1458
|
+
assume(values_ != nullptr);
|
|
1459
|
+
return Iter{values_ + underlying.item(), values_};
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
ConstIter makeConstIter(ItemIter const& underlying) const {
|
|
1464
|
+
return makeIter(underlying);
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
Item iterToIndex(ConstIter const& iter) const {
|
|
1468
|
+
auto n = iter.index();
|
|
1469
|
+
assume(n <= std::numeric_limits<Item>::max());
|
|
1470
|
+
return static_cast<Item>(n);
|
|
1471
|
+
}
|
|
1472
|
+
|
|
1473
|
+
Iter indexToIter(Item index) const { return Iter{values_ + index, values_}; }
|
|
1474
|
+
|
|
1475
|
+
Iter iter(ReverseIter it) { return Iter{it, values_}; }
|
|
1476
|
+
|
|
1477
|
+
ConstIter iter(ConstReverseIter it) const { return ConstIter{it, values_}; }
|
|
1478
|
+
|
|
1479
|
+
ReverseIter riter(Iter it) { return it.current_; }
|
|
1480
|
+
|
|
1481
|
+
ConstReverseIter riter(ConstIter it) const { return it.current_; }
|
|
1482
|
+
|
|
1483
|
+
ValuePtr values_{nullptr};
|
|
1484
|
+
};
|
|
1485
|
+
|
|
1486
|
+
template <
|
|
1487
|
+
template <typename, typename, typename, typename, typename, typename...>
|
|
1488
|
+
class Policy,
|
|
1489
|
+
typename Key,
|
|
1490
|
+
typename Mapped,
|
|
1491
|
+
typename Hasher,
|
|
1492
|
+
typename KeyEqual,
|
|
1493
|
+
typename Alloc,
|
|
1494
|
+
typename... Args>
|
|
1495
|
+
using MapPolicyWithDefaults = Policy<
|
|
1496
|
+
Key,
|
|
1497
|
+
Mapped,
|
|
1498
|
+
VoidDefault<Hasher, DefaultHasher<Key>>,
|
|
1499
|
+
VoidDefault<KeyEqual, DefaultKeyEqual<Key>>,
|
|
1500
|
+
VoidDefault<Alloc, DefaultAlloc<std::pair<Key const, Mapped>>>,
|
|
1501
|
+
Args...>;
|
|
1502
|
+
|
|
1503
|
+
template <
|
|
1504
|
+
template <typename, typename, typename, typename, typename, typename...>
|
|
1505
|
+
class Policy,
|
|
1506
|
+
typename Key,
|
|
1507
|
+
typename Hasher,
|
|
1508
|
+
typename KeyEqual,
|
|
1509
|
+
typename Alloc,
|
|
1510
|
+
typename... Args>
|
|
1511
|
+
using SetPolicyWithDefaults = Policy<
|
|
1512
|
+
Key,
|
|
1513
|
+
void,
|
|
1514
|
+
VoidDefault<Hasher, DefaultHasher<Key>>,
|
|
1515
|
+
VoidDefault<KeyEqual, DefaultKeyEqual<Key>>,
|
|
1516
|
+
VoidDefault<Alloc, DefaultAlloc<Key>>,
|
|
1517
|
+
Args...>;
|
|
1518
|
+
|
|
1519
|
+
} // namespace detail
|
|
1520
|
+
} // namespace f14
|
|
1521
|
+
} // namespace folly
|
|
1522
|
+
|
|
1523
|
+
#endif // FOLLY_F14_VECTOR_INTRINSICS_AVAILABLE
|