react-native-windows 0.85.0-preview.1 → 0.85.0-preview.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Directory.Build.props +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +28 -46
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +0 -3
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +19 -13
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +107 -0
- package/Microsoft.ReactNative/Fabric/Composition/SelectionItemAutomationEvent.h +73 -0
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +105 -32
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +7 -2
- package/PropertySheets/CIBuildOptimizations.props +2 -2
- package/PropertySheets/Generated/PackageVersion.g.props +2 -2
- package/PropertySheets/JSEngine.props +1 -1
- package/PropertySheets/NuGet.LockFile.props +2 -9
- package/Scripts/NuGetRestoreForceEvaluateAllSolutions.ps1 +54 -5
- package/Scripts/UpdateNightlyDependencies.ps1 +47 -0
- package/Scripts/creaternwapp.cmd +29 -9
- package/Scripts/creaternwlib.cmd +31 -15
- package/external/.clang-format +1 -0
- package/external/External.vcxitems +10 -0
- package/external/fast-float/.syncignore +10 -0
- package/external/fast-float/LICENSE-APACHE +190 -0
- package/external/fast-float/LICENSE-BOOST +23 -0
- package/external/fast-float/LICENSE-MIT +27 -0
- package/external/fast-float/README.md +545 -0
- package/external/fast-float/cgmanifest.json +15 -0
- package/external/fast-float/fast-float.vcxitems +14 -0
- package/external/fast-float/include/fast_float/ascii_number.h +588 -0
- package/external/fast-float/include/fast_float/bigint.h +638 -0
- package/external/fast-float/include/fast_float/constexpr_feature_detect.h +46 -0
- package/external/fast-float/include/fast_float/decimal_to_binary.h +212 -0
- package/external/fast-float/include/fast_float/digit_comparison.h +457 -0
- package/external/fast-float/include/fast_float/fast_float.h +59 -0
- package/external/fast-float/include/fast_float/fast_table.h +708 -0
- package/external/fast-float/include/fast_float/float_common.h +1240 -0
- package/external/fast-float/include/fast_float/parse_number.h +399 -0
- package/external/fast-float/sync-config.json +8 -0
- package/external/fmt/.syncignore +10 -0
- package/external/fmt/CONTRIBUTING.md +20 -0
- package/external/fmt/LICENSE +27 -0
- package/external/fmt/README.md +484 -0
- package/external/fmt/cgmanifest.json +15 -0
- package/external/fmt/doc/ChangeLog-old.md +3290 -0
- package/external/fmt/doc/api.md +650 -0
- package/external/fmt/doc/fmt.css +61 -0
- package/external/fmt/doc/fmt.js +4 -0
- package/external/fmt/doc/get-started.md +222 -0
- package/external/fmt/doc/index.md +151 -0
- package/external/fmt/doc/perf.svg +1 -0
- package/external/fmt/doc/python-license.txt +290 -0
- package/external/fmt/doc/syntax.md +887 -0
- package/external/fmt/fmt.vcxitems +28 -0
- package/external/fmt/include/fmt/args.h +228 -0
- package/external/fmt/include/fmt/base.h +3077 -0
- package/external/fmt/include/fmt/chrono.h +2432 -0
- package/external/fmt/include/fmt/color.h +612 -0
- package/external/fmt/include/fmt/compile.h +529 -0
- package/external/fmt/include/fmt/core.h +5 -0
- package/external/fmt/include/fmt/format-inl.h +1928 -0
- package/external/fmt/include/fmt/format.h +4427 -0
- package/external/fmt/include/fmt/os.h +439 -0
- package/external/fmt/include/fmt/ostream.h +211 -0
- package/external/fmt/include/fmt/printf.h +656 -0
- package/external/fmt/include/fmt/ranges.h +882 -0
- package/external/fmt/include/fmt/std.h +699 -0
- package/external/fmt/include/fmt/xchar.h +322 -0
- package/external/fmt/src/fmt.cc +135 -0
- package/external/fmt/src/format.cc +43 -0
- package/external/fmt/src/os.cc +403 -0
- package/external/fmt/sync-config.json +8 -0
- package/external/folly/.syncignore +60 -0
- package/external/folly/Folly.natvis +25 -0
- package/external/folly/LICENSE +200 -0
- package/external/folly/README.md +263 -0
- package/external/folly/cgmanifest.json +25 -0
- package/external/folly/folly/.clang-format +1 -0
- package/external/folly/folly/AtomicHashArray-inl.h +546 -0
- package/external/folly/folly/AtomicHashArray.h +431 -0
- package/external/folly/folly/AtomicHashMap-inl.h +653 -0
- package/external/folly/folly/AtomicHashMap.h +484 -0
- package/external/folly/folly/AtomicIntrusiveLinkedList.h +206 -0
- package/external/folly/folly/AtomicLinkedList.h +110 -0
- package/external/folly/folly/AtomicUnorderedMap.h +522 -0
- package/external/folly/folly/BUCK +1631 -0
- package/external/folly/folly/BUILD_MODE.bzl +72 -0
- package/external/folly/folly/Benchmark.cpp +986 -0
- package/external/folly/folly/Benchmark.h +680 -0
- package/external/folly/folly/BenchmarkUtil.h +47 -0
- package/external/folly/folly/Bits.h +17 -0
- package/external/folly/folly/CMakeLists.txt +110 -0
- package/external/folly/folly/CPortability.h +338 -0
- package/external/folly/folly/CancellationToken-inl.h +449 -0
- package/external/folly/folly/CancellationToken.cpp +250 -0
- package/external/folly/folly/CancellationToken.h +365 -0
- package/external/folly/folly/Chrono.h +132 -0
- package/external/folly/folly/ClockGettimeWrappers.cpp +93 -0
- package/external/folly/folly/ClockGettimeWrappers.h +29 -0
- package/external/folly/folly/ConcurrentBitSet.h +157 -0
- package/external/folly/folly/ConcurrentLazy.h +74 -0
- package/external/folly/folly/ConcurrentSkipList-inl.h +341 -0
- package/external/folly/folly/ConcurrentSkipList.h +824 -0
- package/external/folly/folly/ConstexprMath.h +978 -0
- package/external/folly/folly/ConstructorCallbackList.h +158 -0
- package/external/folly/folly/Conv.cpp +1205 -0
- package/external/folly/folly/Conv.h +2026 -0
- package/external/folly/folly/CppAttributes.h +170 -0
- package/external/folly/folly/CpuId.h +297 -0
- package/external/folly/folly/DefaultKeepAliveExecutor.h +172 -0
- package/external/folly/folly/Demangle.cpp +255 -0
- package/external/folly/folly/Demangle.h +73 -0
- package/external/folly/folly/DiscriminatedPtr.h +236 -0
- package/external/folly/folly/DynamicConverter.h +17 -0
- package/external/folly/folly/Exception.h +150 -0
- package/external/folly/folly/ExceptionString.cpp +51 -0
- package/external/folly/folly/ExceptionString.h +33 -0
- package/external/folly/folly/ExceptionWrapper-inl.h +264 -0
- package/external/folly/folly/ExceptionWrapper.cpp +37 -0
- package/external/folly/folly/ExceptionWrapper.h +377 -0
- package/external/folly/folly/Executor.cpp +111 -0
- package/external/folly/folly/Executor.h +351 -0
- package/external/folly/folly/Expected.h +1725 -0
- package/external/folly/folly/FBString.h +2888 -0
- package/external/folly/folly/FBVector.h +17 -0
- package/external/folly/folly/File.cpp +180 -0
- package/external/folly/folly/File.h +177 -0
- package/external/folly/folly/FileUtil.cpp +378 -0
- package/external/folly/folly/FileUtil.h +332 -0
- package/external/folly/folly/Fingerprint.cpp +135 -0
- package/external/folly/folly/Fingerprint.h +289 -0
- package/external/folly/folly/FixedString.h +2965 -0
- package/external/folly/folly/FollyMemcpy.cpp +30 -0
- package/external/folly/folly/FollyMemcpy.h +23 -0
- package/external/folly/folly/FollyMemset.cpp +29 -0
- package/external/folly/folly/FollyMemset.h +25 -0
- package/external/folly/folly/Format-inl.h +1152 -0
- package/external/folly/folly/Format.cpp +429 -0
- package/external/folly/folly/Format.h +463 -0
- package/external/folly/folly/FormatArg.h +285 -0
- package/external/folly/folly/FormatTraits.h +65 -0
- package/external/folly/folly/Function.h +1159 -0
- package/external/folly/folly/GLog.h +85 -0
- package/external/folly/folly/GroupVarint.cpp +153 -0
- package/external/folly/folly/GroupVarint.h +630 -0
- package/external/folly/folly/Hash.h +20 -0
- package/external/folly/folly/IPAddress.cpp +490 -0
- package/external/folly/folly/IPAddress.h +667 -0
- package/external/folly/folly/IPAddressException.h +82 -0
- package/external/folly/folly/IPAddressV4.cpp +305 -0
- package/external/folly/folly/IPAddressV4.h +495 -0
- package/external/folly/folly/IPAddressV6.cpp +541 -0
- package/external/folly/folly/IPAddressV6.h +627 -0
- package/external/folly/folly/Indestructible.h +164 -0
- package/external/folly/folly/IndexedMemPool.h +550 -0
- package/external/folly/folly/IntrusiveList.h +17 -0
- package/external/folly/folly/Lazy.h +142 -0
- package/external/folly/folly/Likely.h +76 -0
- package/external/folly/folly/MPMCPipeline.h +280 -0
- package/external/folly/folly/MPMCQueue.h +1556 -0
- package/external/folly/folly/MacAddress.cpp +188 -0
- package/external/folly/folly/MacAddress.h +260 -0
- package/external/folly/folly/MapUtil.h +17 -0
- package/external/folly/folly/Math.h +258 -0
- package/external/folly/folly/MaybeManagedPtr.h +120 -0
- package/external/folly/folly/Memory.h +900 -0
- package/external/folly/folly/MicroLock.cpp +76 -0
- package/external/folly/folly/MicroLock.h +354 -0
- package/external/folly/folly/MicroSpinLock.h +17 -0
- package/external/folly/folly/MoveWrapper.h +76 -0
- package/external/folly/folly/ObserverContainer.h +1026 -0
- package/external/folly/folly/Optional.h +743 -0
- package/external/folly/folly/Overload.h +325 -0
- package/external/folly/folly/PackedSyncPtr.h +147 -0
- package/external/folly/folly/Padded.h +464 -0
- package/external/folly/folly/Poly-inl.h +230 -0
- package/external/folly/folly/Poly.h +1095 -0
- package/external/folly/folly/PolyException.h +43 -0
- package/external/folly/folly/Portability.h +644 -0
- package/external/folly/folly/Preprocessor.h +236 -0
- package/external/folly/folly/ProducerConsumerQueue.h +182 -0
- package/external/folly/folly/RWSpinLock.h +17 -0
- package/external/folly/folly/Random-inl.h +86 -0
- package/external/folly/folly/Random.cpp +184 -0
- package/external/folly/folly/Random.h +434 -0
- package/external/folly/folly/Range.h +1772 -0
- package/external/folly/folly/Replaceable.h +636 -0
- package/external/folly/folly/ScopeGuard.cpp +29 -0
- package/external/folly/folly/ScopeGuard.h +420 -0
- package/external/folly/folly/SharedMutex.cpp +81 -0
- package/external/folly/folly/SharedMutex.h +1751 -0
- package/external/folly/folly/Singleton-inl.h +332 -0
- package/external/folly/folly/Singleton.cpp +512 -0
- package/external/folly/folly/Singleton.h +891 -0
- package/external/folly/folly/SingletonThreadLocal.cpp +53 -0
- package/external/folly/folly/SingletonThreadLocal.h +263 -0
- package/external/folly/folly/SocketAddress.cpp +786 -0
- package/external/folly/folly/SocketAddress.h +768 -0
- package/external/folly/folly/SpinLock.h +55 -0
- package/external/folly/folly/String-inl.h +668 -0
- package/external/folly/folly/String.cpp +777 -0
- package/external/folly/folly/String.h +767 -0
- package/external/folly/folly/Subprocess.cpp +1142 -0
- package/external/folly/folly/Subprocess.h +1055 -0
- package/external/folly/folly/Synchronized.h +1833 -0
- package/external/folly/folly/SynchronizedPtr.h +106 -0
- package/external/folly/folly/ThreadCachedInt.h +175 -0
- package/external/folly/folly/ThreadLocal.h +478 -0
- package/external/folly/folly/TimeoutQueue.cpp +78 -0
- package/external/folly/folly/TimeoutQueue.h +123 -0
- package/external/folly/folly/TokenBucket.h +673 -0
- package/external/folly/folly/Traits.h +1442 -0
- package/external/folly/folly/Try-inl.h +372 -0
- package/external/folly/folly/Try.cpp +23 -0
- package/external/folly/folly/Try.h +728 -0
- package/external/folly/folly/UTF8String.h +56 -0
- package/external/folly/folly/Unicode.cpp +201 -0
- package/external/folly/folly/Unicode.h +94 -0
- package/external/folly/folly/Unit.h +65 -0
- package/external/folly/folly/Uri-inl.h +101 -0
- package/external/folly/folly/Uri.cpp +190 -0
- package/external/folly/folly/Uri.h +142 -0
- package/external/folly/folly/Utility.h +932 -0
- package/external/folly/folly/VERSION +1 -0
- package/external/folly/folly/Varint.h +230 -0
- package/external/folly/folly/VirtualExecutor.h +17 -0
- package/external/folly/folly/algorithm/simd/BUCK +47 -0
- package/external/folly/folly/algorithm/simd/Contains.cpp +42 -0
- package/external/folly/folly/algorithm/simd/Contains.h +116 -0
- package/external/folly/folly/algorithm/simd/FindFixed.h +301 -0
- package/external/folly/folly/algorithm/simd/Ignore.h +52 -0
- package/external/folly/folly/algorithm/simd/Movemask.h +207 -0
- package/external/folly/folly/algorithm/simd/detail/BUCK +70 -0
- package/external/folly/folly/algorithm/simd/detail/ContainsImpl.h +91 -0
- package/external/folly/folly/algorithm/simd/detail/SimdAnyOf.h +83 -0
- package/external/folly/folly/algorithm/simd/detail/SimdForEach.h +209 -0
- package/external/folly/folly/algorithm/simd/detail/SimdPlatform.h +445 -0
- package/external/folly/folly/algorithm/simd/detail/Traits.h +125 -0
- package/external/folly/folly/algorithm/simd/detail/UnrollUtils.h +126 -0
- package/external/folly/folly/base64.h +264 -0
- package/external/folly/folly/chrono/BUCK +29 -0
- package/external/folly/folly/chrono/Clock.h +65 -0
- package/external/folly/folly/chrono/Conv.h +712 -0
- package/external/folly/folly/chrono/Hardware.h +155 -0
- package/external/folly/folly/chrono/test/BUCK +26 -0
- package/external/folly/folly/chrono/test/ClockTest.cpp +68 -0
- package/external/folly/folly/chrono/test/ConvTest.cpp +652 -0
- package/external/folly/folly/concurrency/AtomicSharedPtr.h +387 -0
- package/external/folly/folly/concurrency/BUCK +170 -0
- package/external/folly/folly/concurrency/CacheLocality.cpp +633 -0
- package/external/folly/folly/concurrency/CacheLocality.h +460 -0
- package/external/folly/folly/concurrency/ConcurrentHashMap.h +822 -0
- package/external/folly/folly/concurrency/CoreCachedSharedPtr.h +232 -0
- package/external/folly/folly/concurrency/DeadlockDetector.cpp +27 -0
- package/external/folly/folly/concurrency/DeadlockDetector.h +44 -0
- package/external/folly/folly/concurrency/DynamicBoundedQueue.h +751 -0
- package/external/folly/folly/concurrency/PriorityUnboundedQueueSet.h +207 -0
- package/external/folly/folly/concurrency/ProcessLocalUniqueId.cpp +46 -0
- package/external/folly/folly/concurrency/ProcessLocalUniqueId.h +38 -0
- package/external/folly/folly/concurrency/SingletonRelaxedCounter.h +325 -0
- package/external/folly/folly/concurrency/ThreadCachedSynchronized.h +227 -0
- package/external/folly/folly/concurrency/UnboundedQueue.h +891 -0
- package/external/folly/folly/concurrency/container/BUCK +77 -0
- package/external/folly/folly/concurrency/container/FlatCombiningPriorityQueue.h +426 -0
- package/external/folly/folly/concurrency/container/LockFreeRingBuffer.h +306 -0
- package/external/folly/folly/concurrency/container/RelaxedConcurrentPriorityQueue.h +1212 -0
- package/external/folly/folly/concurrency/container/SingleWriterFixedHashMap.h +322 -0
- package/external/folly/folly/concurrency/container/atomic_grow_array.h +564 -0
- package/external/folly/folly/concurrency/container/test/BUCK +75 -0
- package/external/folly/folly/concurrency/container/test/FlatCombiningPriorityQueueTest.cpp +570 -0
- package/external/folly/folly/concurrency/container/test/LockFreeRingBufferTest.cpp +276 -0
- package/external/folly/folly/concurrency/container/test/RelaxedConcurrentPriorityQueueTest.cpp +1570 -0
- package/external/folly/folly/concurrency/container/test/SingleWriterFixedHashMapTest.cpp +401 -0
- package/external/folly/folly/concurrency/container/test/atomic_grow_array_test.cpp +187 -0
- package/external/folly/folly/concurrency/detail/AtomicSharedPtr-detail.h +212 -0
- package/external/folly/folly/concurrency/detail/ConcurrentHashMap-detail.h +1911 -0
- package/external/folly/folly/concurrency/memory/AtomicReadMostlyMainPtr.cpp +43 -0
- package/external/folly/folly/concurrency/memory/AtomicReadMostlyMainPtr.h +190 -0
- package/external/folly/folly/concurrency/memory/BUCK +53 -0
- package/external/folly/folly/concurrency/memory/PrimaryPtr.h +338 -0
- package/external/folly/folly/concurrency/memory/ReadMostlySharedPtr.h +511 -0
- package/external/folly/folly/concurrency/memory/TLRefCount.h +228 -0
- package/external/folly/folly/concurrency/memory/test/AtomicReadMostlyMainPtrBenchmark.cpp +56 -0
- package/external/folly/folly/concurrency/memory/test/AtomicReadMostlyMainPtrTest.cpp +454 -0
- package/external/folly/folly/concurrency/memory/test/BUCK +95 -0
- package/external/folly/folly/concurrency/memory/test/PrimaryPtrTest.cpp +303 -0
- package/external/folly/folly/concurrency/memory/test/ReadMostlySharedPtrBenchmark.cpp +138 -0
- package/external/folly/folly/concurrency/memory/test/ReadMostlySharedPtrStressTest.cpp +75 -0
- package/external/folly/folly/concurrency/memory/test/ReadMostlySharedPtrTest.cpp +378 -0
- package/external/folly/folly/concurrency/memory/test/RefCountBenchmark.cpp +90 -0
- package/external/folly/folly/concurrency/memory/test/RefCountTest.cpp +168 -0
- package/external/folly/folly/concurrency/test/AtomicSharedPtrCounted.h +156 -0
- package/external/folly/folly/concurrency/test/AtomicSharedPtrPerformance.cpp +255 -0
- package/external/folly/folly/concurrency/test/AtomicSharedPtrTest.cpp +257 -0
- package/external/folly/folly/concurrency/test/BUCK +229 -0
- package/external/folly/folly/concurrency/test/CacheLocalityBenchmark.cpp +392 -0
- package/external/folly/folly/concurrency/test/CacheLocalityTest.cpp +1229 -0
- package/external/folly/folly/concurrency/test/ConcurrentHashMapBench.cpp +260 -0
- package/external/folly/folly/concurrency/test/ConcurrentHashMapTest.cpp +1242 -0
- package/external/folly/folly/concurrency/test/CoreCachedSharedPtrTest.cpp +408 -0
- package/external/folly/folly/concurrency/test/DynamicBoundedQueueTest.cpp +984 -0
- package/external/folly/folly/concurrency/test/PriorityUnboundedQueueSetTest.cpp +73 -0
- package/external/folly/folly/concurrency/test/ProcessLocalUniqueIdTest.cpp +66 -0
- package/external/folly/folly/concurrency/test/SingletonRelaxedCounterBench.cpp +101 -0
- package/external/folly/folly/concurrency/test/SingletonRelaxedCounterTest.cpp +185 -0
- package/external/folly/folly/concurrency/test/ThreadCachedSynchronizedBench.cpp +76 -0
- package/external/folly/folly/concurrency/test/ThreadCachedSynchronizedTest.cpp +93 -0
- package/external/folly/folly/concurrency/test/UnboundedQueueTest.cpp +1302 -0
- package/external/folly/folly/container/Access.h +57 -0
- package/external/folly/folly/container/Array.h +87 -0
- package/external/folly/folly/container/BUCK +353 -0
- package/external/folly/folly/container/BitIterator.h +203 -0
- package/external/folly/folly/container/Enumerate.h +162 -0
- package/external/folly/folly/container/EvictingCacheMap.h +730 -0
- package/external/folly/folly/container/F14.md +300 -0
- package/external/folly/folly/container/F14Map-fwd.h +113 -0
- package/external/folly/folly/container/F14Map.h +2108 -0
- package/external/folly/folly/container/F14Set-fwd.h +95 -0
- package/external/folly/folly/container/F14Set.h +1603 -0
- package/external/folly/folly/container/FBVector.h +1711 -0
- package/external/folly/folly/container/Foreach-inl.h +316 -0
- package/external/folly/folly/container/Foreach.h +209 -0
- package/external/folly/folly/container/HeterogeneousAccess-fwd.h +33 -0
- package/external/folly/folly/container/HeterogeneousAccess.h +171 -0
- package/external/folly/folly/container/IntrusiveHeap.h +268 -0
- package/external/folly/folly/container/IntrusiveList.h +131 -0
- package/external/folly/folly/container/Iterator.h +843 -0
- package/external/folly/folly/container/MapUtil.h +376 -0
- package/external/folly/folly/container/Merge.h +90 -0
- package/external/folly/folly/container/RegexMatchCache.cpp +521 -0
- package/external/folly/folly/container/RegexMatchCache.h +699 -0
- package/external/folly/folly/container/Reserve.h +109 -0
- package/external/folly/folly/container/SparseByteSet.h +123 -0
- package/external/folly/folly/container/View.h +81 -0
- package/external/folly/folly/container/WeightedEvictingCacheMap.h +651 -0
- package/external/folly/folly/container/detail/BUCK +115 -0
- package/external/folly/folly/container/detail/BitIteratorDetail.h +87 -0
- package/external/folly/folly/container/detail/F14Defaults.h +34 -0
- package/external/folly/folly/container/detail/F14IntrinsicsAvailability.h +67 -0
- package/external/folly/folly/container/detail/F14MapFallback.h +717 -0
- package/external/folly/folly/container/detail/F14Mask.h +235 -0
- package/external/folly/folly/container/detail/F14Policy.h +1523 -0
- package/external/folly/folly/container/detail/F14SetFallback.h +528 -0
- package/external/folly/folly/container/detail/F14Table.cpp +71 -0
- package/external/folly/folly/container/detail/F14Table.h +2680 -0
- package/external/folly/folly/container/detail/Util.h +303 -0
- package/external/folly/folly/container/detail/tape_detail.h +135 -0
- package/external/folly/folly/container/detail/test/BUCK +14 -0
- package/external/folly/folly/container/detail/test/F14DetailTest.cpp +47 -0
- package/external/folly/folly/container/heap_vector_types.h +1683 -0
- package/external/folly/folly/container/range_traits.h +81 -0
- package/external/folly/folly/container/small_vector.h +1476 -0
- package/external/folly/folly/container/sorted_vector_types.h +1652 -0
- package/external/folly/folly/container/span.h +408 -0
- package/external/folly/folly/container/tape.h +608 -0
- package/external/folly/folly/container/test/.clang-tidy +12 -0
- package/external/folly/folly/container/test/AccessTest.cpp +138 -0
- package/external/folly/folly/container/test/ArrayTest.cpp +84 -0
- package/external/folly/folly/container/test/BUCK +568 -0
- package/external/folly/folly/container/test/BitIteratorBench.cpp +112 -0
- package/external/folly/folly/container/test/BitIteratorTest.cpp +109 -0
- package/external/folly/folly/container/test/EnumerateTest.cpp +294 -0
- package/external/folly/folly/container/test/EvictingCacheMapBench.cpp +80 -0
- package/external/folly/folly/container/test/EvictingCacheMapTest.cpp +842 -0
- package/external/folly/folly/container/test/F14AsanSupportTest.cpp +143 -0
- package/external/folly/folly/container/test/F14FwdTest.cpp +37 -0
- package/external/folly/folly/container/test/F14InterprocessTest.cpp +404 -0
- package/external/folly/folly/container/test/F14MapTest.cpp +2543 -0
- package/external/folly/folly/container/test/F14PolicyTest.cpp +49 -0
- package/external/folly/folly/container/test/F14SetTest.cpp +1738 -0
- package/external/folly/folly/container/test/F14SmallOverheads.cpp +215 -0
- package/external/folly/folly/container/test/F14TestUtil.h +117 -0
- package/external/folly/folly/container/test/FBVectorBenchmark.cpp +380 -0
- package/external/folly/folly/container/test/FBVectorBenchmarks.cpp.h +100 -0
- package/external/folly/folly/container/test/FBVectorTest.cpp +326 -0
- package/external/folly/folly/container/test/FBVectorTests.cpp.h +304 -0
- package/external/folly/folly/container/test/ForeachBenchmark.cpp +388 -0
- package/external/folly/folly/container/test/ForeachTest.cpp +338 -0
- package/external/folly/folly/container/test/HashMapsBench.cpp +458 -0
- package/external/folly/folly/container/test/HeterogeneousAccessTest.cpp +242 -0
- package/external/folly/folly/container/test/IntrusiveHeapTest.cpp +262 -0
- package/external/folly/folly/container/test/IteratorTest.cpp +989 -0
- package/external/folly/folly/container/test/MapUtilTest.cpp +365 -0
- package/external/folly/folly/container/test/MergeTest.cpp +66 -0
- package/external/folly/folly/container/test/RegexMatchCacheTest.cpp +634 -0
- package/external/folly/folly/container/test/ReserveTest.cpp +173 -0
- package/external/folly/folly/container/test/SparseByteSetBenchmark.cpp +153 -0
- package/external/folly/folly/container/test/SparseByteSetTest.cpp +117 -0
- package/external/folly/folly/container/test/TrackingTypes.h +584 -0
- package/external/folly/folly/container/test/UtilTest.cpp +609 -0
- package/external/folly/folly/container/test/WeightedEvictingCacheMapTest.cpp +800 -0
- package/external/folly/folly/container/test/heap_vector_types_test.cpp +1774 -0
- package/external/folly/folly/container/test/range_traits_test.cpp +59 -0
- package/external/folly/folly/container/test/small_vector_test.cpp +1571 -0
- package/external/folly/folly/container/test/sorted_vector_test.cpp +1589 -0
- package/external/folly/folly/container/test/span_test.cpp +520 -0
- package/external/folly/folly/container/test/tape_bench.cpp +200 -0
- package/external/folly/folly/container/test/tape_test.cpp +590 -0
- package/external/folly/folly/defs.bzl +238 -0
- package/external/folly/folly/detail/AsyncTrace.cpp +36 -0
- package/external/folly/folly/detail/AsyncTrace.h +44 -0
- package/external/folly/folly/detail/AtomicHashUtils.h +42 -0
- package/external/folly/folly/detail/AtomicUnorderedMapUtils.h +80 -0
- package/external/folly/folly/detail/BUCK +406 -0
- package/external/folly/folly/detail/DiscriminatedPtrDetail.h +172 -0
- package/external/folly/folly/detail/FileUtilDetail.cpp +63 -0
- package/external/folly/folly/detail/FileUtilDetail.h +85 -0
- package/external/folly/folly/detail/FileUtilVectorDetail.h +81 -0
- package/external/folly/folly/detail/FingerprintPolynomial.h +132 -0
- package/external/folly/folly/detail/Futex-inl.h +123 -0
- package/external/folly/folly/detail/Futex.cpp +273 -0
- package/external/folly/folly/detail/Futex.h +109 -0
- package/external/folly/folly/detail/GroupVarintDetail.h +101 -0
- package/external/folly/folly/detail/IPAddress.cpp +37 -0
- package/external/folly/folly/detail/IPAddress.h +57 -0
- package/external/folly/folly/detail/IPAddressSource.h +278 -0
- package/external/folly/folly/detail/Iterators.h +156 -0
- package/external/folly/folly/detail/MPMCPipelineDetail.h +122 -0
- package/external/folly/folly/detail/MemoryIdler.cpp +233 -0
- package/external/folly/folly/detail/MemoryIdler.h +216 -0
- package/external/folly/folly/detail/PerfScoped.cpp +112 -0
- package/external/folly/folly/detail/PerfScoped.h +70 -0
- package/external/folly/folly/detail/PolyDetail.h +921 -0
- package/external/folly/folly/detail/RangeCommon.cpp +55 -0
- package/external/folly/folly/detail/RangeCommon.h +93 -0
- package/external/folly/folly/detail/RangeSse42.cpp +198 -0
- package/external/folly/folly/detail/RangeSse42.h +30 -0
- package/external/folly/folly/detail/SimpleSimdStringUtils.cpp +31 -0
- package/external/folly/folly/detail/SimpleSimdStringUtils.h +27 -0
- package/external/folly/folly/detail/SimpleSimdStringUtilsImpl.h +63 -0
- package/external/folly/folly/detail/Singleton.h +34 -0
- package/external/folly/folly/detail/SlowFingerprint.h +90 -0
- package/external/folly/folly/detail/SocketFastOpen.cpp +175 -0
- package/external/folly/folly/detail/SocketFastOpen.h +89 -0
- package/external/folly/folly/detail/SplitStringSimd.cpp +84 -0
- package/external/folly/folly/detail/SplitStringSimd.h +151 -0
- package/external/folly/folly/detail/SplitStringSimdImpl.h +149 -0
- package/external/folly/folly/detail/Sse.cpp +35 -0
- package/external/folly/folly/detail/Sse.h +45 -0
- package/external/folly/folly/detail/StaticSingletonManager.cpp +119 -0
- package/external/folly/folly/detail/StaticSingletonManager.h +298 -0
- package/external/folly/folly/detail/ThreadLocalDetail.cpp +492 -0
- package/external/folly/folly/detail/ThreadLocalDetail.h +800 -0
- package/external/folly/folly/detail/TrapOnAvx512.cpp +41 -0
- package/external/folly/folly/detail/TrapOnAvx512.h +21 -0
- package/external/folly/folly/detail/TurnSequencer.h +295 -0
- package/external/folly/folly/detail/TypeList.h +551 -0
- package/external/folly/folly/detail/UniqueInstance.cpp +136 -0
- package/external/folly/folly/detail/UniqueInstance.h +68 -0
- package/external/folly/folly/detail/base64_detail/BUCK +102 -0
- package/external/folly/folly/detail/base64_detail/Base64Api.cpp +40 -0
- package/external/folly/folly/detail/base64_detail/Base64Api.h +101 -0
- package/external/folly/folly/detail/base64_detail/Base64Common.h +80 -0
- package/external/folly/folly/detail/base64_detail/Base64Constants.h +79 -0
- package/external/folly/folly/detail/base64_detail/Base64HiddenConstants.h +129 -0
- package/external/folly/folly/detail/base64_detail/Base64SWAR.cpp +161 -0
- package/external/folly/folly/detail/base64_detail/Base64SWAR.h +32 -0
- package/external/folly/folly/detail/base64_detail/Base64Scalar.h +262 -0
- package/external/folly/folly/detail/base64_detail/Base64Simd.h +102 -0
- package/external/folly/folly/detail/base64_detail/Base64_SSE4_2.cpp +42 -0
- package/external/folly/folly/detail/base64_detail/Base64_SSE4_2.h +33 -0
- package/external/folly/folly/detail/base64_detail/Base64_SSE4_2_Platform.h +167 -0
- package/external/folly/folly/detail/base64_detail/README.md +392 -0
- package/external/folly/folly/detail/base64_detail/tests/BUCK +36 -0
- package/external/folly/folly/detail/base64_detail/tests/Base64AgainstScalarTest.cpp +141 -0
- package/external/folly/folly/detail/base64_detail/tests/Base64PlatformTest.cpp +273 -0
- package/external/folly/folly/detail/base64_detail/tests/Base64SpecialCasesTest.cpp +555 -0
- package/external/folly/folly/detail/test/AsyncTraceTest.cpp +43 -0
- package/external/folly/folly/detail/test/BUCK +118 -0
- package/external/folly/folly/detail/test/FileUtilDetailTest.cpp +56 -0
- package/external/folly/folly/detail/test/PerfScopedTest.cpp +107 -0
- package/external/folly/folly/detail/test/SimpleSimdStringUtilsTest.cpp +92 -0
- package/external/folly/folly/detail/test/SplitStringSimdTest.cpp +242 -0
- package/external/folly/folly/detail/test/StaticSingletonManagerTest.cpp +121 -0
- package/external/folly/folly/detail/test/ThreadLocalBenchmark.cpp +116 -0
- package/external/folly/folly/detail/test/ThreadLocalDetailTest.cpp +194 -0
- package/external/folly/folly/detail/test/TrapOnAvx512TestNegative.cpp +29 -0
- package/external/folly/folly/detail/test/UniqueInstanceTest.cpp +60 -0
- package/external/folly/folly/detail/thread_local_globals.cpp +69 -0
- package/external/folly/folly/detail/thread_local_globals.h +36 -0
- package/external/folly/folly/docs/AtomicHashMap.md +134 -0
- package/external/folly/folly/docs/Benchmark.md +310 -0
- package/external/folly/folly/docs/Conv.md +291 -0
- package/external/folly/folly/docs/Dynamic.md +220 -0
- package/external/folly/folly/docs/DynamicConverter.md +71 -0
- package/external/folly/folly/docs/Executors.md +63 -0
- package/external/folly/folly/docs/FBString.md +46 -0
- package/external/folly/folly/docs/FBVector.md +200 -0
- package/external/folly/folly/docs/Fbvector--graphical_solutions.png +0 -0
- package/external/folly/folly/docs/Format.md +177 -0
- package/external/folly/folly/docs/Function.md +92 -0
- package/external/folly/folly/docs/Futures.md +263 -0
- package/external/folly/folly/docs/GroupVarint.md +46 -0
- package/external/folly/folly/docs/Histogram.md +104 -0
- package/external/folly/folly/docs/MapUtils.md +80 -0
- package/external/folly/folly/docs/Overview.md +263 -0
- package/external/folly/folly/docs/PackedSyncPtr.md +77 -0
- package/external/folly/folly/docs/Poly.md +500 -0
- package/external/folly/folly/docs/ProducerConsumerQueue.md +82 -0
- package/external/folly/folly/docs/Rcu.md +218 -0
- package/external/folly/folly/docs/SmallLocks.md +24 -0
- package/external/folly/folly/docs/Synchronized.md +793 -0
- package/external/folly/folly/docs/ThreadCachedInt.md +98 -0
- package/external/folly/folly/docs/ThreadLocal.md +105 -0
- package/external/folly/folly/docs/Traits.md +161 -0
- package/external/folly/folly/docs/small_vector.md +64 -0
- package/external/folly/folly/docs/style.css +23 -0
- package/external/folly/folly/dynamic-inl.h +17 -0
- package/external/folly/folly/dynamic.h +17 -0
- package/external/folly/folly/folly_extended_library.bzl +28 -0
- package/external/folly/folly/functional/ApplyTuple.h +204 -0
- package/external/folly/folly/functional/BUCK +57 -0
- package/external/folly/folly/functional/Invoke.h +880 -0
- package/external/folly/folly/functional/Partial.h +130 -0
- package/external/folly/folly/functional/protocol.h +203 -0
- package/external/folly/folly/functional/test/ApplyTupleTest.cpp +549 -0
- package/external/folly/folly/functional/test/BUCK +57 -0
- package/external/folly/folly/functional/test/InvokeTest.cpp +483 -0
- package/external/folly/folly/functional/test/PartialTest.cpp +141 -0
- package/external/folly/folly/functional/test/protocol_test.cpp +177 -0
- package/external/folly/folly/functional/test/traits_test.cpp +551 -0
- package/external/folly/folly/functional/traits.h +675 -0
- package/external/folly/folly/hash/BUCK +86 -0
- package/external/folly/folly/hash/Checksum.cpp +275 -0
- package/external/folly/folly/hash/Checksum.h +94 -0
- package/external/folly/folly/hash/FarmHash.h +46 -0
- package/external/folly/folly/hash/Hash.h +1045 -0
- package/external/folly/folly/hash/MurmurHash.h +86 -0
- package/external/folly/folly/hash/SpookyHashV1.cpp +391 -0
- package/external/folly/folly/hash/SpookyHashV1.h +307 -0
- package/external/folly/folly/hash/SpookyHashV2.cpp +392 -0
- package/external/folly/folly/hash/SpookyHashV2.h +339 -0
- package/external/folly/folly/hash/detail/BUCK +26 -0
- package/external/folly/folly/hash/detail/ChecksumDetail.cpp +296 -0
- package/external/folly/folly/hash/detail/ChecksumDetail.h +137 -0
- package/external/folly/folly/hash/detail/Crc32CombineDetail.cpp +191 -0
- package/external/folly/folly/hash/detail/Crc32cDetail.cpp +303 -0
- package/external/folly/folly/hash/test/BUCK +132 -0
- package/external/folly/folly/hash/test/ChecksumBenchmark.cpp +91 -0
- package/external/folly/folly/hash/test/ChecksumTest.cpp +587 -0
- package/external/folly/folly/hash/test/FarmHashTest.cpp +41 -0
- package/external/folly/folly/hash/test/HashBenchmark.cpp +238 -0
- package/external/folly/folly/hash/test/HashTest.cpp +997 -0
- package/external/folly/folly/hash/test/MurmurHashTest.cpp +76 -0
- package/external/folly/folly/hash/test/SpookyHashV1Test.cpp +559 -0
- package/external/folly/folly/hash/test/SpookyHashV2Test.cpp +549 -0
- package/external/folly/folly/hash/test/traits_test.cpp +69 -0
- package/external/folly/folly/hash/traits.h +115 -0
- package/external/folly/folly/json/BUCK +155 -0
- package/external/folly/folly/json/DynamicConverter.h +464 -0
- package/external/folly/folly/json/DynamicParser-inl.h +316 -0
- package/external/folly/folly/json/DynamicParser.cpp +198 -0
- package/external/folly/folly/json/DynamicParser.h +394 -0
- package/external/folly/folly/json/JSONSchema.cpp +1030 -0
- package/external/folly/folly/json/JSONSchema.h +73 -0
- package/external/folly/folly/json/JsonMockUtil.h +73 -0
- package/external/folly/folly/json/JsonTestUtil.cpp +167 -0
- package/external/folly/folly/json/JsonTestUtil.h +88 -0
- package/external/folly/folly/json/bser/BUCK +24 -0
- package/external/folly/folly/json/bser/Bser.h +107 -0
- package/external/folly/folly/json/bser/Dump.cpp +253 -0
- package/external/folly/folly/json/bser/Load.cpp +246 -0
- package/external/folly/folly/json/bser/test/BUCK +14 -0
- package/external/folly/folly/json/bser/test/BserTest.cpp +149 -0
- package/external/folly/folly/json/dynamic-inl.h +1438 -0
- package/external/folly/folly/json/dynamic.cpp +552 -0
- package/external/folly/folly/json/dynamic.h +1346 -0
- package/external/folly/folly/json/json.cpp +1118 -0
- package/external/folly/folly/json/json.h +238 -0
- package/external/folly/folly/json/json_patch.cpp +325 -0
- package/external/folly/folly/json/json_patch.h +126 -0
- package/external/folly/folly/json/json_pointer.cpp +114 -0
- package/external/folly/folly/json/json_pointer.h +87 -0
- package/external/folly/folly/json/test/BUCK +147 -0
- package/external/folly/folly/json/test/DynamicBenchmark.cpp +146 -0
- package/external/folly/folly/json/test/DynamicConverterTest.cpp +518 -0
- package/external/folly/folly/json/test/DynamicOtherTest.cpp +344 -0
- package/external/folly/folly/json/test/DynamicParserTest.cpp +443 -0
- package/external/folly/folly/json/test/DynamicTest.cpp +1647 -0
- package/external/folly/folly/json/test/JSONSchemaTest.cpp +450 -0
- package/external/folly/folly/json/test/JsonBenchmark.cpp +264 -0
- package/external/folly/folly/json/test/JsonOtherTest.cpp +51 -0
- package/external/folly/folly/json/test/JsonTest.cpp +1153 -0
- package/external/folly/folly/json/test/JsonTestUtilTest.cpp +97 -0
- package/external/folly/folly/json/test/json_patch_test.cpp +361 -0
- package/external/folly/folly/json/test/json_pointer_test.cpp +58 -0
- package/external/folly/folly/json/tool/BUCK +13 -0
- package/external/folly/folly/json/tool/JSONSchemaTester.cpp +58 -0
- package/external/folly/folly/json.h +17 -0
- package/external/folly/folly/json_patch.h +17 -0
- package/external/folly/folly/json_pointer.h +17 -0
- package/external/folly/folly/lang/Access.h +29 -0
- package/external/folly/folly/lang/Align.h +240 -0
- package/external/folly/folly/lang/Aligned.h +92 -0
- package/external/folly/folly/lang/Assume.h +82 -0
- package/external/folly/folly/lang/BUCK +287 -0
- package/external/folly/folly/lang/Badge.h +108 -0
- package/external/folly/folly/lang/Bits.h +570 -0
- package/external/folly/folly/lang/BitsClass.h +312 -0
- package/external/folly/folly/lang/Builtin.h +74 -0
- package/external/folly/folly/lang/CArray.h +34 -0
- package/external/folly/folly/lang/CString.cpp +86 -0
- package/external/folly/folly/lang/CString.h +55 -0
- package/external/folly/folly/lang/Cast.h +51 -0
- package/external/folly/folly/lang/CheckedMath.h +253 -0
- package/external/folly/folly/lang/CustomizationPoint.h +58 -0
- package/external/folly/folly/lang/Exception.cpp +822 -0
- package/external/folly/folly/lang/Exception.h +716 -0
- package/external/folly/folly/lang/Extern.h +55 -0
- package/external/folly/folly/lang/Hint-inl.h +144 -0
- package/external/folly/folly/lang/Hint.h +238 -0
- package/external/folly/folly/lang/Keep.h +98 -0
- package/external/folly/folly/lang/New.h +124 -0
- package/external/folly/folly/lang/Ordering.h +140 -0
- package/external/folly/folly/lang/Pretty.h +159 -0
- package/external/folly/folly/lang/PropagateConst.h +413 -0
- package/external/folly/folly/lang/RValueReferenceWrapper.h +152 -0
- package/external/folly/folly/lang/SafeAssert.cpp +589 -0
- package/external/folly/folly/lang/SafeAssert.h +188 -0
- package/external/folly/folly/lang/StaticConst.h +33 -0
- package/external/folly/folly/lang/Thunk.h +100 -0
- package/external/folly/folly/lang/ToAscii.cpp +348 -0
- package/external/folly/folly/lang/ToAscii.h +182 -0
- package/external/folly/folly/lang/TypeInfo.h +58 -0
- package/external/folly/folly/lang/UncaughtExceptions.cpp +17 -0
- package/external/folly/folly/lang/UncaughtExceptions.h +19 -0
- package/external/folly/folly/lang/test/AlignTest.cpp +87 -0
- package/external/folly/folly/lang/test/AlignedTest.cpp +130 -0
- package/external/folly/folly/lang/test/BUCK +258 -0
- package/external/folly/folly/lang/test/BadgeTest.cpp +89 -0
- package/external/folly/folly/lang/test/BitsBenchmark.cpp +164 -0
- package/external/folly/folly/lang/test/BitsClassBenchmark.cpp +122 -0
- package/external/folly/folly/lang/test/BitsClassTest.cpp +379 -0
- package/external/folly/folly/lang/test/BitsTest.cpp +577 -0
- package/external/folly/folly/lang/test/CStringTest.cpp +60 -0
- package/external/folly/folly/lang/test/CastTest.cpp +47 -0
- package/external/folly/folly/lang/test/CheckedMathTest.cpp +394 -0
- package/external/folly/folly/lang/test/ExceptionBench.cpp +427 -0
- package/external/folly/folly/lang/test/ExceptionTest.cpp +413 -0
- package/external/folly/folly/lang/test/ExternTest.cpp +39 -0
- package/external/folly/folly/lang/test/HintTest.cpp +100 -0
- package/external/folly/folly/lang/test/NewTest.cpp +38 -0
- package/external/folly/folly/lang/test/OrderingTest.cpp +105 -0
- package/external/folly/folly/lang/test/PrettyTest.cpp +44 -0
- package/external/folly/folly/lang/test/PropagateConstTest.cpp +356 -0
- package/external/folly/folly/lang/test/RValueReferenceWrapperTest.cpp +85 -0
- package/external/folly/folly/lang/test/SafeAssertTest.cpp +75 -0
- package/external/folly/folly/lang/test/ThunkTest.cpp +105 -0
- package/external/folly/folly/lang/test/ToAsciiBench.cpp +466 -0
- package/external/folly/folly/lang/test/ToAsciiTest.cpp +266 -0
- package/external/folly/folly/lang/test/TypeInfoTest.cpp +56 -0
- package/external/folly/folly/memcpy.S +292 -0
- package/external/folly/folly/memcpy_select_aarch64.cpp +145 -0
- package/external/folly/folly/memory/Arena-inl.h +83 -0
- package/external/folly/folly/memory/Arena.h +325 -0
- package/external/folly/folly/memory/BUCK +191 -0
- package/external/folly/folly/memory/JemallocHugePageAllocator.cpp +449 -0
- package/external/folly/folly/memory/JemallocHugePageAllocator.h +105 -0
- package/external/folly/folly/memory/JemallocHugePageAllocatorTest.cpp +341 -0
- package/external/folly/folly/memory/JemallocNodumpAllocator.cpp +176 -0
- package/external/folly/folly/memory/JemallocNodumpAllocator.h +119 -0
- package/external/folly/folly/memory/JemallocNodumpAllocatorTest.cpp +61 -0
- package/external/folly/folly/memory/MallctlHelper.cpp +37 -0
- package/external/folly/folly/memory/MallctlHelper.h +167 -0
- package/external/folly/folly/memory/Malloc.h +551 -0
- package/external/folly/folly/memory/MemoryResource.h +57 -0
- package/external/folly/folly/memory/ReentrantAllocator.cpp +162 -0
- package/external/folly/folly/memory/ReentrantAllocator.h +261 -0
- package/external/folly/folly/memory/SanitizeAddress.cpp +75 -0
- package/external/folly/folly/memory/SanitizeAddress.h +117 -0
- package/external/folly/folly/memory/SanitizeLeak.cpp +119 -0
- package/external/folly/folly/memory/SanitizeLeak.h +108 -0
- package/external/folly/folly/memory/ThreadCachedArena.cpp +53 -0
- package/external/folly/folly/memory/ThreadCachedArena.h +90 -0
- package/external/folly/folly/memory/UninitializedMemoryHacks.h +426 -0
- package/external/folly/folly/memory/detail/BUCK +10 -0
- package/external/folly/folly/memory/detail/MallocImpl.cpp +52 -0
- package/external/folly/folly/memory/detail/MallocImpl.h +97 -0
- package/external/folly/folly/memory/not_null-inl.h +522 -0
- package/external/folly/folly/memory/not_null.h +449 -0
- package/external/folly/folly/memory/test/ArenaTest.cpp +354 -0
- package/external/folly/folly/memory/test/BUCK +146 -0
- package/external/folly/folly/memory/test/MallctlHelperTest.cpp +169 -0
- package/external/folly/folly/memory/test/MallocBenchmark.cpp +91 -0
- package/external/folly/folly/memory/test/MallocTest.cpp +78 -0
- package/external/folly/folly/memory/test/MemoryResourceTest.cpp +31 -0
- package/external/folly/folly/memory/test/ReentrantAllocatorTest.cpp +144 -0
- package/external/folly/folly/memory/test/SanitizeAddressTest.cpp +67 -0
- package/external/folly/folly/memory/test/SanitizeLeakTest.cpp +139 -0
- package/external/folly/folly/memory/test/ThreadCachedArenaTest.cpp +276 -0
- package/external/folly/folly/memory/test/UninitializedMemoryHacksODR.cpp +21 -0
- package/external/folly/folly/memory/test/UninitializedMemoryHacksTest.cpp +327 -0
- package/external/folly/folly/memory/test/not_null_test.cpp +608 -0
- package/external/folly/folly/memset.S +245 -0
- package/external/folly/folly/memset_select_aarch64.cpp +72 -0
- package/external/folly/folly/portability/Asm.h +50 -0
- package/external/folly/folly/portability/Atomic.h +31 -0
- package/external/folly/folly/portability/BUCK +456 -0
- package/external/folly/folly/portability/Builtins.cpp +31 -0
- package/external/folly/folly/portability/Builtins.h +161 -0
- package/external/folly/folly/portability/Config.h +43 -0
- package/external/folly/folly/portability/Constexpr.h +145 -0
- package/external/folly/folly/portability/Dirent.cpp +140 -0
- package/external/folly/folly/portability/Dirent.h +41 -0
- package/external/folly/folly/portability/Event.h +44 -0
- package/external/folly/folly/portability/Fcntl.cpp +120 -0
- package/external/folly/folly/portability/Fcntl.h +67 -0
- package/external/folly/folly/portability/Filesystem.cpp +67 -0
- package/external/folly/folly/portability/Filesystem.h +114 -0
- package/external/folly/folly/portability/FmtCompile.h +40 -0
- package/external/folly/folly/portability/GFlags.h +139 -0
- package/external/folly/folly/portability/GMock.h +35 -0
- package/external/folly/folly/portability/GTest.h +35 -0
- package/external/folly/folly/portability/IOVec.h +34 -0
- package/external/folly/folly/portability/Libgen.cpp +59 -0
- package/external/folly/folly/portability/Libgen.h +29 -0
- package/external/folly/folly/portability/Libunwind.h +21 -0
- package/external/folly/folly/portability/Malloc.cpp +31 -0
- package/external/folly/folly/portability/Malloc.h +53 -0
- package/external/folly/folly/portability/Math.h +90 -0
- package/external/folly/folly/portability/Memory.h +26 -0
- package/external/folly/folly/portability/OpenSSL.cpp +17 -0
- package/external/folly/folly/portability/OpenSSL.h +102 -0
- package/external/folly/folly/portability/PThread.cpp +697 -0
- package/external/folly/folly/portability/PThread.h +148 -0
- package/external/folly/folly/portability/README.md +21 -0
- package/external/folly/folly/portability/Sched.cpp +41 -0
- package/external/folly/folly/portability/Sched.h +45 -0
- package/external/folly/folly/portability/Sockets.cpp +245 -0
- package/external/folly/folly/portability/Sockets.h +155 -0
- package/external/folly/folly/portability/SourceLocation.h +49 -0
- package/external/folly/folly/portability/Stdio.cpp +77 -0
- package/external/folly/folly/portability/Stdio.h +32 -0
- package/external/folly/folly/portability/Stdlib.cpp +172 -0
- package/external/folly/folly/portability/Stdlib.h +64 -0
- package/external/folly/folly/portability/String.cpp +53 -0
- package/external/folly/folly/portability/String.h +39 -0
- package/external/folly/folly/portability/SysFile.cpp +46 -0
- package/external/folly/folly/portability/SysFile.h +27 -0
- package/external/folly/folly/portability/SysMembarrier.cpp +104 -0
- package/external/folly/folly/portability/SysMembarrier.h +26 -0
- package/external/folly/folly/portability/SysMman.cpp +242 -0
- package/external/folly/folly/portability/SysMman.h +68 -0
- package/external/folly/folly/portability/SysResource.cpp +108 -0
- package/external/folly/folly/portability/SysResource.h +71 -0
- package/external/folly/folly/portability/SysStat.cpp +66 -0
- package/external/folly/folly/portability/SysStat.h +52 -0
- package/external/folly/folly/portability/SysSyscall.h +73 -0
- package/external/folly/folly/portability/SysTime.cpp +62 -0
- package/external/folly/folly/portability/SysTime.h +50 -0
- package/external/folly/folly/portability/SysTypes.h +44 -0
- package/external/folly/folly/portability/SysUio.cpp +179 -0
- package/external/folly/folly/portability/SysUio.h +51 -0
- package/external/folly/folly/portability/Syslog.h +39 -0
- package/external/folly/folly/portability/Time.cpp +357 -0
- package/external/folly/folly/portability/Time.h +74 -0
- package/external/folly/folly/portability/Unistd.cpp +33 -0
- package/external/folly/folly/portability/Unistd.h +111 -0
- package/external/folly/folly/portability/Windows.h +108 -0
- package/external/folly/folly/portability/openat2.c +30 -0
- package/external/folly/folly/portability/openat2.h +39 -0
- package/external/folly/folly/portability/test/BUCK +59 -0
- package/external/folly/folly/portability/test/ConstexprTest.cpp +102 -0
- package/external/folly/folly/portability/test/FilesystemTest.cpp +35 -0
- package/external/folly/folly/portability/test/LibgenTest.cpp +35 -0
- package/external/folly/folly/portability/test/OpenSSLPortabilityTest.cpp +108 -0
- package/external/folly/folly/portability/test/PThreadTest.cpp +80 -0
- package/external/folly/folly/portability/test/TimeTest.cpp +90 -0
- package/external/folly/folly/small_vector.h +17 -0
- package/external/folly/folly/somerge_defs.bzl +399 -0
- package/external/folly/folly/sorted_vector_types.h +17 -0
- package/external/folly/folly/stop_watch.h +317 -0
- package/external/folly/folly/synchronization/AsymmetricThreadFence.cpp +91 -0
- package/external/folly/folly/synchronization/AsymmetricThreadFence.h +60 -0
- package/external/folly/folly/synchronization/AtomicNotification-inl.h +146 -0
- package/external/folly/folly/synchronization/AtomicNotification.cpp +34 -0
- package/external/folly/folly/synchronization/AtomicNotification.h +117 -0
- package/external/folly/folly/synchronization/AtomicRef.h +181 -0
- package/external/folly/folly/synchronization/AtomicStruct.h +150 -0
- package/external/folly/folly/synchronization/AtomicUtil-inl.h +482 -0
- package/external/folly/folly/synchronization/AtomicUtil.h +179 -0
- package/external/folly/folly/synchronization/BUCK +418 -0
- package/external/folly/folly/synchronization/Baton.h +419 -0
- package/external/folly/folly/synchronization/CallOnce.h +263 -0
- package/external/folly/folly/synchronization/DelayedInit.h +179 -0
- package/external/folly/folly/synchronization/DistributedMutex-inl.h +1744 -0
- package/external/folly/folly/synchronization/DistributedMutex.cpp +27 -0
- package/external/folly/folly/synchronization/DistributedMutex.h +342 -0
- package/external/folly/folly/synchronization/EventCount.h +200 -0
- package/external/folly/folly/synchronization/FlatCombining.h +629 -0
- package/external/folly/folly/synchronization/Hazptr-fwd.h +217 -0
- package/external/folly/folly/synchronization/Hazptr.cpp +36 -0
- package/external/folly/folly/synchronization/Hazptr.h +209 -0
- package/external/folly/folly/synchronization/HazptrDomain.cpp +68 -0
- package/external/folly/folly/synchronization/HazptrDomain.h +832 -0
- package/external/folly/folly/synchronization/HazptrHolder.h +431 -0
- package/external/folly/folly/synchronization/HazptrObj.h +533 -0
- package/external/folly/folly/synchronization/HazptrObjLinked.h +315 -0
- package/external/folly/folly/synchronization/HazptrRec.h +68 -0
- package/external/folly/folly/synchronization/HazptrThrLocal.h +180 -0
- package/external/folly/folly/synchronization/HazptrThreadPoolExecutor.cpp +46 -0
- package/external/folly/folly/synchronization/HazptrThreadPoolExecutor.h +25 -0
- package/external/folly/folly/synchronization/Latch.h +160 -0
- package/external/folly/folly/synchronization/LifoSem.h +767 -0
- package/external/folly/folly/synchronization/Lock.h +887 -0
- package/external/folly/folly/synchronization/MicroSpinLock.h +154 -0
- package/external/folly/folly/synchronization/NativeSemaphore.h +187 -0
- package/external/folly/folly/synchronization/ParkingLot.cpp +37 -0
- package/external/folly/folly/synchronization/ParkingLot.h +330 -0
- package/external/folly/folly/synchronization/PicoSpinLock.h +167 -0
- package/external/folly/folly/synchronization/RWSpinLock.h +549 -0
- package/external/folly/folly/synchronization/Rcu.cpp +26 -0
- package/external/folly/folly/synchronization/Rcu.h +553 -0
- package/external/folly/folly/synchronization/RelaxedAtomic.h +336 -0
- package/external/folly/folly/synchronization/SanitizeThread.cpp +141 -0
- package/external/folly/folly/synchronization/SanitizeThread.h +166 -0
- package/external/folly/folly/synchronization/SaturatingSemaphore.h +324 -0
- package/external/folly/folly/synchronization/SmallLocks.h +36 -0
- package/external/folly/folly/synchronization/ThrottledLifoSem.h +362 -0
- package/external/folly/folly/synchronization/WaitOptions.cpp +25 -0
- package/external/folly/folly/synchronization/WaitOptions.h +75 -0
- package/external/folly/folly/synchronization/detail/AtomicUtils.h +59 -0
- package/external/folly/folly/synchronization/detail/BUCK +104 -0
- package/external/folly/folly/synchronization/detail/Hardware.cpp +192 -0
- package/external/folly/folly/synchronization/detail/Hardware.h +75 -0
- package/external/folly/folly/synchronization/detail/HazptrUtils.h +339 -0
- package/external/folly/folly/synchronization/detail/InlineFunctionRef.h +229 -0
- package/external/folly/folly/synchronization/detail/Sleeper.cpp +27 -0
- package/external/folly/folly/synchronization/detail/Sleeper.h +62 -0
- package/external/folly/folly/synchronization/detail/Spin.h +96 -0
- package/external/folly/folly/synchronization/detail/ThreadCachedLists.h +174 -0
- package/external/folly/folly/synchronization/detail/ThreadCachedReaders.h +189 -0
- package/external/folly/folly/synchronization/detail/ThreadCachedTag.h +26 -0
- package/external/folly/folly/synchronization/detail/test/BUCK +28 -0
- package/external/folly/folly/synchronization/detail/test/HardwareTest.cpp +74 -0
- package/external/folly/folly/synchronization/detail/test/InlineFunctionRefTest.cpp +286 -0
- package/external/folly/folly/synchronization/example/BUCK +27 -0
- package/external/folly/folly/synchronization/example/HazptrLockFreeLIFO.h +88 -0
- package/external/folly/folly/synchronization/example/HazptrSWMRSet.h +133 -0
- package/external/folly/folly/synchronization/example/HazptrWideCAS.h +62 -0
- package/external/folly/folly/synchronization/test/AtomicNotificationTest.cpp +236 -0
- package/external/folly/folly/synchronization/test/AtomicRefTest.cpp +170 -0
- package/external/folly/folly/synchronization/test/AtomicStructTest.cpp +65 -0
- package/external/folly/folly/synchronization/test/AtomicUtilBench.cpp +457 -0
- package/external/folly/folly/synchronization/test/AtomicUtilTest.cpp +650 -0
- package/external/folly/folly/synchronization/test/BUCK +495 -0
- package/external/folly/folly/synchronization/test/Barrier.h +52 -0
- package/external/folly/folly/synchronization/test/BarrierTest.cpp +56 -0
- package/external/folly/folly/synchronization/test/BatonBenchmark.cpp +77 -0
- package/external/folly/folly/synchronization/test/BatonTest.cpp +164 -0
- package/external/folly/folly/synchronization/test/BatonTestHelpers.h +118 -0
- package/external/folly/folly/synchronization/test/CallOnceBenchmark.cpp +72 -0
- package/external/folly/folly/synchronization/test/CallOnceTest.cpp +153 -0
- package/external/folly/folly/synchronization/test/DelayedInitTest.cpp +281 -0
- package/external/folly/folly/synchronization/test/DistributedMutexTest.cpp +2074 -0
- package/external/folly/folly/synchronization/test/EventCountTest.cpp +124 -0
- package/external/folly/folly/synchronization/test/FlatCombiningBenchmark.cpp +1789 -0
- package/external/folly/folly/synchronization/test/FlatCombiningExamples.h +222 -0
- package/external/folly/folly/synchronization/test/FlatCombiningTest.cpp +121 -0
- package/external/folly/folly/synchronization/test/FlatCombiningTestHelpers.h +227 -0
- package/external/folly/folly/synchronization/test/HazptrTest.cpp +1689 -0
- package/external/folly/folly/synchronization/test/LatchTest.cpp +224 -0
- package/external/folly/folly/synchronization/test/LifoSemBench.cpp +185 -0
- package/external/folly/folly/synchronization/test/LifoSemTests.cpp +353 -0
- package/external/folly/folly/synchronization/test/LockTest.cpp +1239 -0
- package/external/folly/folly/synchronization/test/NativeSemaphoreTest.cpp +37 -0
- package/external/folly/folly/synchronization/test/ParkingLotBenchmark.cpp +239 -0
- package/external/folly/folly/synchronization/test/ParkingLotTest.cpp +170 -0
- package/external/folly/folly/synchronization/test/RWSpinLockTest.cpp +235 -0
- package/external/folly/folly/synchronization/test/RcuBench.cpp +66 -0
- package/external/folly/folly/synchronization/test/RcuTest.cpp +330 -0
- package/external/folly/folly/synchronization/test/RelaxedAtomicTest.cpp +389 -0
- package/external/folly/folly/synchronization/test/SaturatingSemaphoreTest.cpp +166 -0
- package/external/folly/folly/synchronization/test/Semaphore.h +242 -0
- package/external/folly/folly/synchronization/test/SemaphoreTest.cpp +271 -0
- package/external/folly/folly/synchronization/test/SmallLocksBenchmark.cpp +1296 -0
- package/external/folly/folly/synchronization/test/SmallLocksTest.cpp +510 -0
- package/external/folly/folly/synchronization/test/ThreadCachedEpochBench.h +67 -0
- package/external/folly/folly/synchronization/test/ThreadCachedReadersBench.cpp +42 -0
- package/external/folly/folly/synchronization/test/ThreadCachedReadersTest.cpp +52 -0
- package/external/folly/folly/synchronization/test/ThrottledLifoSemTest.cpp +243 -0
- package/external/folly/folly/system/AtFork.cpp +205 -0
- package/external/folly/folly/system/AtFork.h +116 -0
- package/external/folly/folly/system/AuxVector.h +198 -0
- package/external/folly/folly/system/BUCK +144 -0
- package/external/folly/folly/system/EnvUtil.cpp +93 -0
- package/external/folly/folly/system/EnvUtil.h +113 -0
- package/external/folly/folly/system/HardwareConcurrency.cpp +39 -0
- package/external/folly/folly/system/HardwareConcurrency.h +23 -0
- package/external/folly/folly/system/MemoryMapping.cpp +477 -0
- package/external/folly/folly/system/MemoryMapping.h +287 -0
- package/external/folly/folly/system/Pid.cpp +87 -0
- package/external/folly/folly/system/Pid.h +34 -0
- package/external/folly/folly/system/Shell.cpp +33 -0
- package/external/folly/folly/system/Shell.h +93 -0
- package/external/folly/folly/system/ThreadId.cpp +89 -0
- package/external/folly/folly/system/ThreadId.h +62 -0
- package/external/folly/folly/system/ThreadName.cpp +330 -0
- package/external/folly/folly/system/ThreadName.h +72 -0
- package/external/folly/folly/system/test/AtForkTest.cpp +309 -0
- package/external/folly/folly/system/test/AuxVectorTest.cpp +55 -0
- package/external/folly/folly/system/test/BUCK +120 -0
- package/external/folly/folly/system/test/EnvUtilSubprocess.cpp +26 -0
- package/external/folly/folly/system/test/EnvUtilTest.cpp +197 -0
- package/external/folly/folly/system/test/MemoryMappingTest.cpp +179 -0
- package/external/folly/folly/system/test/PidTest.cpp +46 -0
- package/external/folly/folly/system/test/ShellTest.cpp +66 -0
- package/external/folly/folly/system/test/ThreadIdTest.cpp +114 -0
- package/external/folly/folly/system/test/ThreadNameTest.cpp +85 -0
- package/external/folly/folly.vcxitems +164 -0
- package/external/folly/static/logo.svg +1 -0
- package/external/folly/sync-config.json +8 -0
- package/package.json +3 -3
- package/templates/cpp-lib/example/metro.config.js +18 -2
|
@@ -0,0 +1,800 @@
|
|
|
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 <limits.h>
|
|
20
|
+
|
|
21
|
+
#include <atomic>
|
|
22
|
+
#include <functional>
|
|
23
|
+
#include <memory>
|
|
24
|
+
#include <mutex>
|
|
25
|
+
#include <string>
|
|
26
|
+
#include <thread>
|
|
27
|
+
#include <unordered_map>
|
|
28
|
+
#include <unordered_set>
|
|
29
|
+
#include <vector>
|
|
30
|
+
|
|
31
|
+
#include <glog/logging.h>
|
|
32
|
+
|
|
33
|
+
#include <folly/Exception.h>
|
|
34
|
+
#include <folly/Function.h>
|
|
35
|
+
#include <folly/MapUtil.h>
|
|
36
|
+
#include <folly/Portability.h>
|
|
37
|
+
#include <folly/ScopeGuard.h>
|
|
38
|
+
#include <folly/SharedMutex.h>
|
|
39
|
+
#include <folly/Synchronized.h>
|
|
40
|
+
#include <folly/concurrency/container/atomic_grow_array.h>
|
|
41
|
+
#include <folly/container/Foreach.h>
|
|
42
|
+
#include <folly/detail/StaticSingletonManager.h>
|
|
43
|
+
#include <folly/detail/UniqueInstance.h>
|
|
44
|
+
#include <folly/lang/Exception.h>
|
|
45
|
+
#include <folly/memory/Malloc.h>
|
|
46
|
+
#include <folly/portability/PThread.h>
|
|
47
|
+
#include <folly/synchronization/MicroSpinLock.h>
|
|
48
|
+
#include <folly/synchronization/RelaxedAtomic.h>
|
|
49
|
+
#include <folly/system/AtFork.h>
|
|
50
|
+
#include <folly/system/ThreadId.h>
|
|
51
|
+
|
|
52
|
+
namespace folly {
|
|
53
|
+
|
|
54
|
+
enum class TLPDestructionMode { THIS_THREAD, ALL_THREADS };
|
|
55
|
+
struct AccessModeStrict {};
|
|
56
|
+
|
|
57
|
+
namespace threadlocal_detail {
|
|
58
|
+
|
|
59
|
+
constexpr uint32_t kEntryIDInvalid = std::numeric_limits<uint32_t>::max();
|
|
60
|
+
|
|
61
|
+
// as a memory-usage optimization, try to make this deleter fit in-situ in
|
|
62
|
+
// the deleter function storage rather than being heap-allocated separately
|
|
63
|
+
//
|
|
64
|
+
// for libstdc++, specialization below of std::__is_location_invariant
|
|
65
|
+
//
|
|
66
|
+
// TODO: ensure in-situ storage for other standard-library implementations
|
|
67
|
+
struct SharedPtrDeleter {
|
|
68
|
+
mutable std::shared_ptr<void> ts_;
|
|
69
|
+
explicit SharedPtrDeleter(std::shared_ptr<void> const& ts) noexcept;
|
|
70
|
+
SharedPtrDeleter(SharedPtrDeleter const& that) noexcept;
|
|
71
|
+
void operator=(SharedPtrDeleter const& that) = delete;
|
|
72
|
+
~SharedPtrDeleter();
|
|
73
|
+
void operator()(void* ptr, folly::TLPDestructionMode) const;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
} // namespace threadlocal_detail
|
|
77
|
+
|
|
78
|
+
} // namespace folly
|
|
79
|
+
|
|
80
|
+
#if defined(__GLIBCXX__)
|
|
81
|
+
|
|
82
|
+
namespace std {
|
|
83
|
+
|
|
84
|
+
template <>
|
|
85
|
+
struct __is_location_invariant<::folly::threadlocal_detail::SharedPtrDeleter>
|
|
86
|
+
: std::true_type {};
|
|
87
|
+
|
|
88
|
+
} // namespace std
|
|
89
|
+
|
|
90
|
+
#endif
|
|
91
|
+
|
|
92
|
+
namespace folly {
|
|
93
|
+
|
|
94
|
+
namespace threadlocal_detail {
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* POD wrapper around an element (a void*) and an associated deleter.
|
|
98
|
+
* This must be POD, as we memset() it to 0 and memcpy() it around.
|
|
99
|
+
*/
|
|
100
|
+
struct ElementWrapper {
|
|
101
|
+
using DeleterFunType = void(void*, TLPDestructionMode);
|
|
102
|
+
using DeleterObjType = std::function<DeleterFunType>;
|
|
103
|
+
|
|
104
|
+
static inline constexpr auto deleter_obj_mask = uintptr_t(0b01);
|
|
105
|
+
static inline constexpr auto deleter_all_mask = uintptr_t(0) //
|
|
106
|
+
| deleter_obj_mask //
|
|
107
|
+
;
|
|
108
|
+
|
|
109
|
+
static_assert(alignof(DeleterObjType) > deleter_all_mask);
|
|
110
|
+
|
|
111
|
+
// must be noinline and must launder: https://godbolt.org/z/bo6f7f6v6
|
|
112
|
+
FOLLY_NOINLINE static uintptr_t castForgetAlign(DeleterFunType*) noexcept;
|
|
113
|
+
|
|
114
|
+
bool dispose(TLPDestructionMode mode) noexcept {
|
|
115
|
+
if (ptr == nullptr) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
DCHECK_NE(0, deleter);
|
|
120
|
+
auto const deleter_masked = deleter & ~deleter_all_mask;
|
|
121
|
+
if (deleter & deleter_obj_mask) {
|
|
122
|
+
auto& obj = *reinterpret_cast<DeleterObjType*>(deleter_masked);
|
|
123
|
+
obj(ptr, mode);
|
|
124
|
+
} else {
|
|
125
|
+
auto& fun = *reinterpret_cast<DeleterFunType*>(deleter_masked);
|
|
126
|
+
fun(ptr, mode);
|
|
127
|
+
}
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
void* release() {
|
|
132
|
+
auto retPtr = ptr;
|
|
133
|
+
|
|
134
|
+
if (ptr != nullptr) {
|
|
135
|
+
cleanup();
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return retPtr;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
template <class Ptr>
|
|
142
|
+
void set(Ptr p) {
|
|
143
|
+
DCHECK_EQ(static_cast<void*>(nullptr), ptr);
|
|
144
|
+
DCHECK_EQ(0, deleter);
|
|
145
|
+
|
|
146
|
+
if (!p) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
auto const fun =
|
|
150
|
+
+[](void* pt, TLPDestructionMode) { delete static_cast<Ptr>(pt); };
|
|
151
|
+
auto const raw = castForgetAlign(fun);
|
|
152
|
+
if (raw & deleter_all_mask) {
|
|
153
|
+
return set(p, std::ref(*fun));
|
|
154
|
+
}
|
|
155
|
+
DCHECK_EQ(0, raw & deleter_all_mask);
|
|
156
|
+
deleter = raw;
|
|
157
|
+
ptr = p;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
template <typename Ptr, typename Deleter>
|
|
161
|
+
static auto makeDeleter(const Deleter& d) {
|
|
162
|
+
return [d](void* pt, TLPDestructionMode mode) {
|
|
163
|
+
d(static_cast<Ptr>(pt), mode);
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
template <typename Ptr>
|
|
168
|
+
static decltype(auto) makeDeleter(const SharedPtrDeleter& d) {
|
|
169
|
+
return d;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
template <class Ptr, class Deleter>
|
|
173
|
+
void set(Ptr p, const Deleter& d) {
|
|
174
|
+
DCHECK_EQ(static_cast<void*>(nullptr), ptr);
|
|
175
|
+
DCHECK_EQ(0, deleter);
|
|
176
|
+
|
|
177
|
+
if (!p) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
auto guard = makeGuard([&] { d(p, TLPDestructionMode::THIS_THREAD); });
|
|
182
|
+
auto const obj = new DeleterObjType(makeDeleter<Ptr>(d));
|
|
183
|
+
guard.dismiss();
|
|
184
|
+
auto const raw = reinterpret_cast<uintptr_t>(obj);
|
|
185
|
+
DCHECK_EQ(0, raw & deleter_all_mask);
|
|
186
|
+
deleter = raw | deleter_obj_mask;
|
|
187
|
+
ptr = p;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
void cleanup() noexcept {
|
|
191
|
+
if (deleter & deleter_obj_mask) {
|
|
192
|
+
auto const deleter_masked = deleter & ~deleter_all_mask;
|
|
193
|
+
auto const obj = reinterpret_cast<DeleterObjType*>(deleter_masked);
|
|
194
|
+
delete obj;
|
|
195
|
+
}
|
|
196
|
+
ptr = nullptr;
|
|
197
|
+
deleter = 0;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
void* ptr;
|
|
201
|
+
uintptr_t deleter;
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
struct StaticMetaBase;
|
|
205
|
+
struct ThreadEntryList;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Per-thread entry. Each thread using a StaticMeta object has one.
|
|
209
|
+
* This is written from the owning thread only (under the lock), read
|
|
210
|
+
* from the owning thread (no lock necessary), and read from other threads
|
|
211
|
+
* (under the lock).
|
|
212
|
+
*/
|
|
213
|
+
struct ThreadEntry {
|
|
214
|
+
ElementWrapper* elements{nullptr};
|
|
215
|
+
std::atomic<size_t> elementsCapacity{0};
|
|
216
|
+
ThreadEntryList* list{nullptr};
|
|
217
|
+
ThreadEntry* listNext{nullptr};
|
|
218
|
+
StaticMetaBase* meta{nullptr};
|
|
219
|
+
bool removed_{false};
|
|
220
|
+
uint64_t tid_os{};
|
|
221
|
+
aligned_storage_for_t<std::thread::id> tid_data{};
|
|
222
|
+
|
|
223
|
+
size_t getElementsCapacity() const noexcept {
|
|
224
|
+
return elementsCapacity.load(std::memory_order_relaxed);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
void setElementsCapacity(size_t capacity) noexcept {
|
|
228
|
+
elementsCapacity.store(capacity, std::memory_order_relaxed);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
std::thread::id& tid() {
|
|
232
|
+
return *reinterpret_cast<std::thread::id*>(&tid_data);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/*
|
|
236
|
+
* Releases element from ThreadEntry::elements at index @id.
|
|
237
|
+
*/
|
|
238
|
+
void* releaseElement(uint32_t id);
|
|
239
|
+
|
|
240
|
+
/*
|
|
241
|
+
* Clean up element from ThreadEntry::elements at index @id.
|
|
242
|
+
*/
|
|
243
|
+
void cleanupElement(uint32_t id);
|
|
244
|
+
|
|
245
|
+
/*
|
|
246
|
+
* Templated methods to deal with reset with and without a deleter
|
|
247
|
+
* for the element @id
|
|
248
|
+
*/
|
|
249
|
+
template <class Ptr>
|
|
250
|
+
void resetElement(Ptr p, uint32_t id);
|
|
251
|
+
|
|
252
|
+
template <class Ptr, class Deleter>
|
|
253
|
+
void resetElement(Ptr p, Deleter& d, uint32_t id);
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
struct ThreadEntryList {
|
|
257
|
+
ThreadEntry* head{nullptr};
|
|
258
|
+
size_t count{0};
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* We want to disable onThreadExit call at the end of shutdown, we don't care
|
|
263
|
+
* about leaking memory at that point.
|
|
264
|
+
*
|
|
265
|
+
* Otherwise if ThreadLocal is used in a shared library, onThreadExit may be
|
|
266
|
+
* called after dlclose().
|
|
267
|
+
*
|
|
268
|
+
* This class has one single static instance; however since it's so widely used,
|
|
269
|
+
* directly or indirectly, by so many classes, we need to take care to avoid
|
|
270
|
+
* problems stemming from the Static Initialization/Destruction Order Fiascos.
|
|
271
|
+
* Therefore this class needs to be constexpr-constructible, so as to avoid
|
|
272
|
+
* the need for this to participate in init/destruction order.
|
|
273
|
+
*/
|
|
274
|
+
class PthreadKeyUnregister {
|
|
275
|
+
public:
|
|
276
|
+
static constexpr size_t kMaxKeys = size_t(1) << 16;
|
|
277
|
+
|
|
278
|
+
~PthreadKeyUnregister() {
|
|
279
|
+
// If static constructor priorities are not supported then
|
|
280
|
+
// ~PthreadKeyUnregister logic is not safe.
|
|
281
|
+
#if !defined(__APPLE__) && !defined(_MSC_VER)
|
|
282
|
+
MSLGuard lg(lock_);
|
|
283
|
+
while (size_) {
|
|
284
|
+
pthread_key_delete(keys_[--size_]);
|
|
285
|
+
}
|
|
286
|
+
#endif
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
static void registerKey(pthread_key_t key) { instance_.registerKeyImpl(key); }
|
|
290
|
+
|
|
291
|
+
private:
|
|
292
|
+
/**
|
|
293
|
+
* Only one global instance should exist, hence this is private.
|
|
294
|
+
* See also the important note at the top of this class about `constexpr`
|
|
295
|
+
* usage.
|
|
296
|
+
*/
|
|
297
|
+
constexpr PthreadKeyUnregister() : lock_(), size_(0), keys_() {}
|
|
298
|
+
|
|
299
|
+
void registerKeyImpl(pthread_key_t key) {
|
|
300
|
+
MSLGuard lg(lock_);
|
|
301
|
+
if (size_ == kMaxKeys) {
|
|
302
|
+
throw_exception<std::logic_error>(
|
|
303
|
+
"pthread_key limit has already been reached");
|
|
304
|
+
}
|
|
305
|
+
keys_[size_++] = key;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
MicroSpinLock lock_;
|
|
309
|
+
size_t size_;
|
|
310
|
+
pthread_key_t keys_[kMaxKeys];
|
|
311
|
+
|
|
312
|
+
static PthreadKeyUnregister instance_;
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
// ThreadEntrySet is used to track all ThreadEntry that have a valid
|
|
316
|
+
// ElementWrapper for a particular TL id. The class provides no internal locking
|
|
317
|
+
// and caller must ensure safety of any access.
|
|
318
|
+
struct ThreadEntrySet {
|
|
319
|
+
// Vector of ThreadEntry for fast iteration during accessAllThreads.
|
|
320
|
+
using EntryVector = std::vector<ThreadEntry*>;
|
|
321
|
+
EntryVector threadEntries;
|
|
322
|
+
// Map from ThreadEntry* to its slot in the threadEntries vector to be able
|
|
323
|
+
// to remove an entry quickly.
|
|
324
|
+
using EntryIndex = std::unordered_map<ThreadEntry*, EntryVector::size_type>;
|
|
325
|
+
EntryIndex entryToVectorSlot;
|
|
326
|
+
|
|
327
|
+
bool basicSanity() const;
|
|
328
|
+
|
|
329
|
+
void clear() {
|
|
330
|
+
DCHECK(basicSanity());
|
|
331
|
+
entryToVectorSlot.clear();
|
|
332
|
+
threadEntries.clear();
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
bool contains(ThreadEntry* entry) const {
|
|
336
|
+
DCHECK(basicSanity());
|
|
337
|
+
return entryToVectorSlot.find(entry) != entryToVectorSlot.end();
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
bool insert(ThreadEntry* entry) {
|
|
341
|
+
DCHECK(basicSanity());
|
|
342
|
+
auto iter = entryToVectorSlot.find(entry);
|
|
343
|
+
if (iter != entryToVectorSlot.end()) {
|
|
344
|
+
// Entry already present. Sanity check and exit.
|
|
345
|
+
DCHECK_EQ(entry, threadEntries[iter->second]);
|
|
346
|
+
return false;
|
|
347
|
+
}
|
|
348
|
+
threadEntries.push_back(entry);
|
|
349
|
+
auto idx = threadEntries.size() - 1;
|
|
350
|
+
entryToVectorSlot[entry] = idx;
|
|
351
|
+
return true;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
bool erase(ThreadEntry* entry) {
|
|
355
|
+
DCHECK(basicSanity());
|
|
356
|
+
auto iter = entryToVectorSlot.find(entry);
|
|
357
|
+
if (iter == entryToVectorSlot.end()) {
|
|
358
|
+
// Entry not present.
|
|
359
|
+
return false;
|
|
360
|
+
}
|
|
361
|
+
auto idx = iter->second;
|
|
362
|
+
DCHECK_LT(idx, threadEntries.size());
|
|
363
|
+
entryToVectorSlot.erase(iter);
|
|
364
|
+
if (idx != threadEntries.size() - 1) {
|
|
365
|
+
ThreadEntry* last = threadEntries.back();
|
|
366
|
+
threadEntries[idx] = last;
|
|
367
|
+
entryToVectorSlot[last] = idx;
|
|
368
|
+
}
|
|
369
|
+
threadEntries.pop_back();
|
|
370
|
+
DCHECK(basicSanity());
|
|
371
|
+
if (compressible()) {
|
|
372
|
+
compress();
|
|
373
|
+
}
|
|
374
|
+
DCHECK(basicSanity());
|
|
375
|
+
return true;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/// compressible
|
|
379
|
+
///
|
|
380
|
+
/// If many elements have been removed, then size might be much less than
|
|
381
|
+
/// capacity and it becomes possible to reduce memory usage.
|
|
382
|
+
bool compressible() const {
|
|
383
|
+
// We choose a sufficiently-large multiplier so that there is no risk of a
|
|
384
|
+
// following insert growing the vector and then a following erase shrinking
|
|
385
|
+
// the vector, since that way lies non-amortized-O(N)-complexity costs for
|
|
386
|
+
// both insert and erase ops.
|
|
387
|
+
constexpr size_t const mult = 4;
|
|
388
|
+
auto& vec = threadEntries;
|
|
389
|
+
return std::max(size_t(1), vec.size()) * mult <= vec.capacity();
|
|
390
|
+
}
|
|
391
|
+
/// compress
|
|
392
|
+
///
|
|
393
|
+
/// Attempt to reduce the memory usage of the data structure.
|
|
394
|
+
void compress();
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
struct StaticMetaBase {
|
|
398
|
+
// In general, emutls cleanup is not guaranteed to play nice with the way
|
|
399
|
+
// StaticMeta mixes direct pthread calls and the use of __thread. This has
|
|
400
|
+
// caused problems on multiple platforms so don't use __thread there.
|
|
401
|
+
//
|
|
402
|
+
// XXX: Ideally we would instead determine if emutls is in use at runtime as
|
|
403
|
+
// it is possible to configure glibc on Linux to use emutls regardless.
|
|
404
|
+
static constexpr bool kUseThreadLocal = !kIsMobile && !kIsApple && !kMscVer;
|
|
405
|
+
|
|
406
|
+
// Represents an ID of a thread local object. Initially set to the maximum
|
|
407
|
+
// uint. This representation allows us to avoid a branch in accessing TLS data
|
|
408
|
+
// (because if you test capacity > id if id = maxint then the test will always
|
|
409
|
+
// fail). It allows us to keep a constexpr constructor and avoid SIOF.
|
|
410
|
+
class EntryID {
|
|
411
|
+
public:
|
|
412
|
+
std::atomic<uint32_t> value;
|
|
413
|
+
|
|
414
|
+
constexpr EntryID() : value(kEntryIDInvalid) {}
|
|
415
|
+
|
|
416
|
+
EntryID(EntryID&& other) noexcept : value(other.value.load()) {
|
|
417
|
+
other.value = kEntryIDInvalid;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
EntryID& operator=(EntryID&& other) noexcept {
|
|
421
|
+
assert(this != &other);
|
|
422
|
+
DCHECK(value.load() == kEntryIDInvalid);
|
|
423
|
+
value = other.value.load();
|
|
424
|
+
other.value = kEntryIDInvalid;
|
|
425
|
+
return *this;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
EntryID(const EntryID& other) = delete;
|
|
429
|
+
EntryID& operator=(const EntryID& other) = delete;
|
|
430
|
+
|
|
431
|
+
uint32_t getOrInvalid() { return value.load(std::memory_order_acquire); }
|
|
432
|
+
|
|
433
|
+
uint32_t getOrAllocate(StaticMetaBase& meta) {
|
|
434
|
+
uint32_t id = getOrInvalid();
|
|
435
|
+
if (id != kEntryIDInvalid) {
|
|
436
|
+
return id;
|
|
437
|
+
}
|
|
438
|
+
// The lock inside allocate ensures that a single value is allocated
|
|
439
|
+
return meta.allocate(this);
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
StaticMetaBase(ThreadEntry* (*threadEntry)(), bool strict);
|
|
444
|
+
|
|
445
|
+
FOLLY_EXPORT static ThreadEntryList* getThreadEntryList();
|
|
446
|
+
|
|
447
|
+
static bool dying();
|
|
448
|
+
|
|
449
|
+
static void onThreadExit(void* ptr);
|
|
450
|
+
|
|
451
|
+
// Helper to do final free and delete of ThreadEntry and ThreadEntryList
|
|
452
|
+
// structures.
|
|
453
|
+
static void cleanupThreadEntriesAndList(ThreadEntryList* list);
|
|
454
|
+
|
|
455
|
+
// returns the elementsCapacity for the
|
|
456
|
+
// current thread ThreadEntry struct
|
|
457
|
+
uint32_t elementsCapacity() const;
|
|
458
|
+
|
|
459
|
+
uint32_t allocate(EntryID* ent);
|
|
460
|
+
|
|
461
|
+
void destroy(EntryID* ent);
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Reserve enough space in the ThreadEntry::elements for the item
|
|
465
|
+
* @id to fit in.
|
|
466
|
+
*/
|
|
467
|
+
void reserve(EntryID* id);
|
|
468
|
+
|
|
469
|
+
ElementWrapper& getElement(EntryID* ent);
|
|
470
|
+
|
|
471
|
+
using SynchronizedThreadEntrySet = folly::Synchronized<ThreadEntrySet>;
|
|
472
|
+
|
|
473
|
+
/*
|
|
474
|
+
* Helper inline methods to add/remove/clear ThreadEntry* from
|
|
475
|
+
* allId2ThreadEntrySets_
|
|
476
|
+
*/
|
|
477
|
+
|
|
478
|
+
/*
|
|
479
|
+
* Return true if given ThreadEntry is already present in the ThreadEntrySet
|
|
480
|
+
* for the given id.
|
|
481
|
+
*/
|
|
482
|
+
FOLLY_ALWAYS_INLINE bool isThreadEntryInSet(ThreadEntry* te, uint32_t id) {
|
|
483
|
+
return allId2ThreadEntrySets_[id].rlock()->contains(te);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
/*
|
|
487
|
+
* Ensure the given ThreadEntry* is present in the tracking set for the
|
|
488
|
+
* given id. Once added, we do not remove it until the thread exits or the
|
|
489
|
+
* whole set is reaped when the TL id itself is destroyed.
|
|
490
|
+
*
|
|
491
|
+
* Note: Call may drop and reacquire the read lock.
|
|
492
|
+
* If the provided entry is not already in the set, the given RLockedPtr will
|
|
493
|
+
* be released, entry added under a WLockedPtr, and RLockedPtr reacquired
|
|
494
|
+
* before returning.
|
|
495
|
+
*/
|
|
496
|
+
FOLLY_NOINLINE void ensureThreadEntryIsInSet(
|
|
497
|
+
ThreadEntry* te,
|
|
498
|
+
SynchronizedThreadEntrySet& set,
|
|
499
|
+
SynchronizedThreadEntrySet::RLockedPtr& rlock);
|
|
500
|
+
|
|
501
|
+
/*
|
|
502
|
+
* Remove a ThreadEntry* from the map of allId2ThreadEntrySets_
|
|
503
|
+
* for all slot @id's in ThreadEntry::elements that are
|
|
504
|
+
* used. This is essentially clearing out a ThreadEntry entirely
|
|
505
|
+
* from the allId2ThreadEntrySets_.
|
|
506
|
+
*/
|
|
507
|
+
FOLLY_ALWAYS_INLINE void removeThreadEntryFromAllInMap(ThreadEntry* te) {
|
|
508
|
+
uint32_t maxId = nextId_.load();
|
|
509
|
+
for (uint32_t i = 0; i < maxId; ++i) {
|
|
510
|
+
allId2ThreadEntrySets_[i].wlock()->erase(te);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
/*
|
|
515
|
+
* Check if ThreadEntry* is present in the map for all slots of @ids.
|
|
516
|
+
*/
|
|
517
|
+
FOLLY_ALWAYS_INLINE bool isThreadEntryRemovedFromAllInMap(
|
|
518
|
+
ThreadEntry* te, bool needForkLock) {
|
|
519
|
+
std::shared_lock rlocked(forkHandlerLock_, std::defer_lock);
|
|
520
|
+
if (needForkLock) {
|
|
521
|
+
rlocked.lock();
|
|
522
|
+
}
|
|
523
|
+
uint32_t maxId = nextId_.load();
|
|
524
|
+
for (uint32_t i = 0; i < maxId; ++i) {
|
|
525
|
+
if (allId2ThreadEntrySets_[i].rlock()->contains(te)) {
|
|
526
|
+
return false;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
return true;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
// static helper method to reallocate the ThreadEntry::elements
|
|
533
|
+
// returns != nullptr if the ThreadEntry::elements was reallocated
|
|
534
|
+
// nullptr if the ThreadEntry::elements was just extended
|
|
535
|
+
// and throws stdd:bad_alloc if memory cannot be allocated
|
|
536
|
+
static ElementWrapper* reallocate(
|
|
537
|
+
ThreadEntry* threadEntry, uint32_t idval, size_t& newCapacity);
|
|
538
|
+
|
|
539
|
+
relaxed_atomic_uint32_t nextId_;
|
|
540
|
+
std::vector<uint32_t> freeIds_;
|
|
541
|
+
std::mutex lock_;
|
|
542
|
+
mutable SharedMutex accessAllThreadsLock_;
|
|
543
|
+
// As part of handling fork, we need to ensure no locks used by ThreadLocal
|
|
544
|
+
// implementation are held by threads other than the one forking. The total
|
|
545
|
+
// number of locks involved is large due to the per ThreadEntrySet lock. TSAN
|
|
546
|
+
// builds have to track each lock acquire and release. TSAN also has its own
|
|
547
|
+
// fork handler. Using a lot of locks in fork handler can end up deadlocking
|
|
548
|
+
// TSAN. To avoid that behavior, we the forkHandlerLock_. All code paths that
|
|
549
|
+
// acquire a lock on any ThreadEntrySet (accessAllThreads() or reset() calls)
|
|
550
|
+
// must also acquire a shared lock on forkHandlerLock_.
|
|
551
|
+
// Fork handler will acquire an exclusive lock on forkHandlerLock_,
|
|
552
|
+
// along with exclusive locks on accessAllThreadsLock_ and lock_.
|
|
553
|
+
mutable SharedMutex forkHandlerLock_;
|
|
554
|
+
pthread_key_t pthreadKey_;
|
|
555
|
+
ThreadEntry* (*threadEntry_)();
|
|
556
|
+
bool strict_;
|
|
557
|
+
// Total size of ElementWrapper arrays across all threads. This is meant
|
|
558
|
+
// to surface the overhead of thread local tracking machinery since the array
|
|
559
|
+
// can be sparse when there are lots of thread local variables under the same
|
|
560
|
+
// tag.
|
|
561
|
+
relaxed_atomic_int64_t totalElementWrappers_{0};
|
|
562
|
+
// This is a map of all thread entries mapped to index i with active
|
|
563
|
+
// elements[i];
|
|
564
|
+
folly::atomic_grow_array<SynchronizedThreadEntrySet> allId2ThreadEntrySets_;
|
|
565
|
+
|
|
566
|
+
// Note on locking rules. There are 4 locks involved in managing StaticMeta:
|
|
567
|
+
// fork handler lock (getStaticMetaGlobalForkMutex(),
|
|
568
|
+
// access all threads lock (accessAllThreadsLock_),
|
|
569
|
+
// per thread entry set lock implicit in SynchronizedThreadEntrySet and
|
|
570
|
+
// meta lock (lock_)
|
|
571
|
+
//
|
|
572
|
+
// If multiple locks need to be acquired in a call path, the above is also
|
|
573
|
+
// the order in which they should be acquired. Additionally, if per
|
|
574
|
+
// ThreadEntrySet locks are the only ones that are acquired in a path, it
|
|
575
|
+
// must also acquire shared lock on the fork handler lock.
|
|
576
|
+
};
|
|
577
|
+
|
|
578
|
+
struct FakeUniqueInstance {
|
|
579
|
+
template <template <typename...> class Z, typename... Key, typename... Mapped>
|
|
580
|
+
FOLLY_ERASE constexpr explicit FakeUniqueInstance(
|
|
581
|
+
tag_t<Z<Key..., Mapped...>>, tag_t<Key...>, tag_t<Mapped...>) noexcept {}
|
|
582
|
+
};
|
|
583
|
+
|
|
584
|
+
/*
|
|
585
|
+
* Resets element from ThreadEntry::elements at index @id.
|
|
586
|
+
* call set() on the element to reset it.
|
|
587
|
+
* This is a templated method for when a deleter is not provided.
|
|
588
|
+
*/
|
|
589
|
+
template <class Ptr>
|
|
590
|
+
void ThreadEntry::resetElement(Ptr p, uint32_t id) {
|
|
591
|
+
auto& set = meta->allId2ThreadEntrySets_[id];
|
|
592
|
+
auto rlock = set.rlock();
|
|
593
|
+
if (p != nullptr && !removed_ && !rlock->contains(this)) {
|
|
594
|
+
meta->ensureThreadEntryIsInSet(this, set, rlock);
|
|
595
|
+
}
|
|
596
|
+
cleanupElement(id);
|
|
597
|
+
elements[id].set(p);
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
/*
|
|
601
|
+
* Resets element from ThreadEntry::elements at index @id.
|
|
602
|
+
* call set() on the element to reset it.
|
|
603
|
+
* This is a templated method for when a deleter is not provided.
|
|
604
|
+
*/
|
|
605
|
+
template <class Ptr, class Deleter>
|
|
606
|
+
void ThreadEntry::resetElement(Ptr p, Deleter& d, uint32_t id) {
|
|
607
|
+
auto& set = meta->allId2ThreadEntrySets_[id];
|
|
608
|
+
auto rlock = set.rlock();
|
|
609
|
+
if (p != nullptr && !removed_ && !rlock->contains(this)) {
|
|
610
|
+
meta->ensureThreadEntryIsInSet(this, set, rlock);
|
|
611
|
+
}
|
|
612
|
+
cleanupElement(id);
|
|
613
|
+
elements[id].set(p, d);
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
// Held in a singleton to track our global instances.
|
|
617
|
+
// We have one of these per "Tag", by default one for the whole system
|
|
618
|
+
// (Tag=void).
|
|
619
|
+
//
|
|
620
|
+
// Creating and destroying ThreadLocalPtr objects, as well as thread exit
|
|
621
|
+
// for threads that use ThreadLocalPtr objects collide on a lock inside
|
|
622
|
+
// StaticMeta; you can specify multiple Tag types to break that lock.
|
|
623
|
+
template <class Tag, class AccessMode>
|
|
624
|
+
struct FOLLY_EXPORT StaticMeta final : StaticMetaBase {
|
|
625
|
+
private:
|
|
626
|
+
static constexpr bool IsTagVoid = std::is_void_v<Tag>;
|
|
627
|
+
static constexpr bool IsAccessModeStrict =
|
|
628
|
+
std::is_same_v<AccessMode, AccessModeStrict>;
|
|
629
|
+
static_assert(!IsTagVoid || !IsAccessModeStrict);
|
|
630
|
+
|
|
631
|
+
using UniqueInstance =
|
|
632
|
+
conditional_t<IsTagVoid, FakeUniqueInstance, detail::UniqueInstance>;
|
|
633
|
+
static UniqueInstance unique;
|
|
634
|
+
|
|
635
|
+
public:
|
|
636
|
+
StaticMeta()
|
|
637
|
+
: StaticMetaBase(&StaticMeta::getThreadEntrySlow, IsAccessModeStrict) {
|
|
638
|
+
AtFork::registerHandler(
|
|
639
|
+
this,
|
|
640
|
+
/*prepare*/ &StaticMeta::preFork,
|
|
641
|
+
/*parent*/ &StaticMeta::onForkParent,
|
|
642
|
+
/*child*/ &StaticMeta::onForkChild);
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
static StaticMeta<Tag, AccessMode>& instance() {
|
|
646
|
+
(void)unique; // force the object not to be thrown out as unused
|
|
647
|
+
// Leak it on exit, there's only one per process and we don't have to
|
|
648
|
+
// worry about synchronization with exiting threads.
|
|
649
|
+
return detail::createGlobal<StaticMeta<Tag, AccessMode>, void>();
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
struct LocalCache {
|
|
653
|
+
ThreadEntry* threadEntry;
|
|
654
|
+
size_t capacity;
|
|
655
|
+
};
|
|
656
|
+
static_assert(std::is_standard_layout_v<LocalCache>);
|
|
657
|
+
static_assert(std::is_trivial_v<LocalCache>);
|
|
658
|
+
|
|
659
|
+
FOLLY_EXPORT FOLLY_ALWAYS_INLINE static LocalCache& getLocalCache() {
|
|
660
|
+
static thread_local LocalCache instance;
|
|
661
|
+
return instance;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
FOLLY_ALWAYS_INLINE static ElementWrapper& get(EntryID* ent) {
|
|
665
|
+
// Eliminate as many branches and as much extra code as possible in the
|
|
666
|
+
// cached fast path, leaving only one branch here and one indirection
|
|
667
|
+
// below.
|
|
668
|
+
|
|
669
|
+
ThreadEntry* te = getThreadEntry(ent);
|
|
670
|
+
uint32_t id = ent->getOrInvalid();
|
|
671
|
+
// Only valid index into the the elements array
|
|
672
|
+
DCHECK_NE(id, kEntryIDInvalid);
|
|
673
|
+
return te->elements[id];
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
/*
|
|
677
|
+
* In order to facilitate adding/clearing ThreadEntry* to
|
|
678
|
+
* StaticMetaBase::allId2ThreadEntrySets_ during ThreadLocalPtr
|
|
679
|
+
* reset()/release() we need access to the ThreadEntry* directly. This allows
|
|
680
|
+
* for direct interaction with StaticMetaBase::allId2ThreadEntrySets_. We keep
|
|
681
|
+
* StaticMetaBase::allId2ThreadEntrySets_ updated with ThreadEntry* whenever a
|
|
682
|
+
* ThreadLocal is set/released.
|
|
683
|
+
*/
|
|
684
|
+
FOLLY_ALWAYS_INLINE static ThreadEntry* getThreadEntry(EntryID* ent) {
|
|
685
|
+
if (!kUseThreadLocal) {
|
|
686
|
+
return getThreadEntrySlowReserve(ent);
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
// Eliminate as many branches and as much extra code as possible in the
|
|
690
|
+
// cached fast path, leaving only one branch here and one indirection below.
|
|
691
|
+
uint32_t id = ent->getOrInvalid();
|
|
692
|
+
auto& cache = getLocalCache();
|
|
693
|
+
if (FOLLY_UNLIKELY(cache.capacity <= id)) {
|
|
694
|
+
getSlowReserveAndCache(ent, cache);
|
|
695
|
+
}
|
|
696
|
+
return cache.threadEntry;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
FOLLY_NOINLINE static void getSlowReserveAndCache(
|
|
700
|
+
EntryID* ent, LocalCache& cache) {
|
|
701
|
+
auto threadEntry = getThreadEntrySlowReserve(ent);
|
|
702
|
+
cache.capacity = threadEntry->getElementsCapacity();
|
|
703
|
+
cache.threadEntry = threadEntry;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
FOLLY_NOINLINE static ThreadEntry* getThreadEntrySlowReserve(EntryID* ent) {
|
|
707
|
+
uint32_t id = ent->getOrInvalid();
|
|
708
|
+
|
|
709
|
+
auto& inst = instance();
|
|
710
|
+
auto threadEntry = inst.threadEntry_();
|
|
711
|
+
if (FOLLY_UNLIKELY(threadEntry->getElementsCapacity() <= id)) {
|
|
712
|
+
inst.reserve(ent);
|
|
713
|
+
id = ent->getOrInvalid();
|
|
714
|
+
}
|
|
715
|
+
assert(threadEntry->getElementsCapacity() > id);
|
|
716
|
+
return threadEntry;
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
FOLLY_EXPORT FOLLY_NOINLINE static ThreadEntry* getThreadEntrySlow() {
|
|
720
|
+
auto& meta = instance();
|
|
721
|
+
auto key = meta.pthreadKey_;
|
|
722
|
+
ThreadEntry* threadEntry =
|
|
723
|
+
static_cast<ThreadEntry*>(pthread_getspecific(key));
|
|
724
|
+
if (!threadEntry) {
|
|
725
|
+
ThreadEntryList* threadEntryList = StaticMeta::getThreadEntryList();
|
|
726
|
+
threadEntry = new ThreadEntry();
|
|
727
|
+
|
|
728
|
+
threadEntry->list = threadEntryList;
|
|
729
|
+
threadEntry->listNext = threadEntryList->head;
|
|
730
|
+
threadEntryList->head = threadEntry;
|
|
731
|
+
|
|
732
|
+
threadEntry->tid() = std::this_thread::get_id();
|
|
733
|
+
threadEntry->tid_os = folly::getOSThreadID();
|
|
734
|
+
|
|
735
|
+
// if we're adding a thread entry
|
|
736
|
+
// we need to increment the list count
|
|
737
|
+
// even if the entry is reused
|
|
738
|
+
threadEntryList->count++;
|
|
739
|
+
|
|
740
|
+
threadEntry->meta = &meta;
|
|
741
|
+
int ret = pthread_setspecific(key, threadEntry);
|
|
742
|
+
checkPosixError(ret, "pthread_setspecific failed");
|
|
743
|
+
}
|
|
744
|
+
return threadEntry;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
static bool preFork() {
|
|
748
|
+
auto& meta = instance();
|
|
749
|
+
bool gotLock = meta.forkHandlerLock_.try_lock(); // Make sure it's created
|
|
750
|
+
if (!gotLock) {
|
|
751
|
+
return false;
|
|
752
|
+
}
|
|
753
|
+
meta.accessAllThreadsLock_.lock();
|
|
754
|
+
meta.lock_.lock();
|
|
755
|
+
// Okay to not lock each set in meta.allId2ThreadEntrySets
|
|
756
|
+
// as accessAllThreadsLock_ in held by calls to reset() and
|
|
757
|
+
// accessAllThreads.
|
|
758
|
+
return true;
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
static void onForkParent() {
|
|
762
|
+
auto& meta = instance();
|
|
763
|
+
meta.lock_.unlock();
|
|
764
|
+
meta.accessAllThreadsLock_.unlock();
|
|
765
|
+
meta.forkHandlerLock_.unlock();
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
static void onForkChild() {
|
|
769
|
+
auto& meta = instance();
|
|
770
|
+
// only the current thread survives
|
|
771
|
+
meta.lock_.unlock();
|
|
772
|
+
meta.accessAllThreadsLock_.unlock();
|
|
773
|
+
auto threadEntry = meta.threadEntry_();
|
|
774
|
+
// Loop through allId2ThreadEntrySets_; Only keep ThreadEntry* in the map
|
|
775
|
+
// for ThreadEntry::elements that are still in use by the current thread.
|
|
776
|
+
// Evict all of the ThreadEntry* from other threads.
|
|
777
|
+
uint32_t maxId = meta.nextId_.load();
|
|
778
|
+
for (uint32_t id = 0; id < maxId; ++id) {
|
|
779
|
+
auto wlockedSet = meta.allId2ThreadEntrySets_[id].wlock();
|
|
780
|
+
if (wlockedSet->contains(threadEntry)) {
|
|
781
|
+
wlockedSet->clear();
|
|
782
|
+
wlockedSet->insert(threadEntry);
|
|
783
|
+
} else {
|
|
784
|
+
wlockedSet->clear();
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
meta.forkHandlerLock_.unlock();
|
|
788
|
+
}
|
|
789
|
+
};
|
|
790
|
+
|
|
791
|
+
FOLLY_PUSH_WARNING
|
|
792
|
+
FOLLY_CLANG_DISABLE_WARNING("-Wglobal-constructors")
|
|
793
|
+
template <typename Tag, typename AccessMode>
|
|
794
|
+
typename StaticMeta<Tag, AccessMode>::UniqueInstance
|
|
795
|
+
StaticMeta<Tag, AccessMode>::unique{
|
|
796
|
+
tag<StaticMeta>, tag<Tag>, tag<AccessMode>};
|
|
797
|
+
FOLLY_POP_WARNING
|
|
798
|
+
|
|
799
|
+
} // namespace threadlocal_detail
|
|
800
|
+
} // namespace folly
|