1. 06 Feb, 2022 3 commits
    • Yedidya Feldblum's avatar
      avoid Function instantiating std::decay over lambdas · c5d1dc7b
      Yedidya Feldblum authored
      Summary:
      It turns out that `std::decay` becomes expensive when as widely instantiated as it is.
      
      ```name=trunk
      $ foundation/scripts/run-perf-compile --syntax folly/futures/test/FutureTest.cpp
           6,336,421,499      instructions:uP
      ```
      
      ```name=branch
      $ foundation/scripts/run-perf-compile --syntax folly/futures/test/FutureTest.cpp
           6,287,269,480      instructions:uP
      ```
      
      Reviewed By: Gownta, luciang
      
      Differential Revision: D32973204
      
      fbshipit-source-id: 75d52fd5ced58f50518913d3c00709bcee27c87b
      c5d1dc7b
    • Yedidya Feldblum's avatar
      fix fbcode-builder build with googletest-1.11 · 4da17f04
      Yedidya Feldblum authored
      Reviewed By: ahornby
      
      Differential Revision: D34030118
      
      fbshipit-source-id: 2229527eebb147a9c2eea90be78ab72e63e2fe3f
      4da17f04
    • Alex Hornby's avatar
      declare the libsodium dependency · bc9cc4b3
      Alex Hornby authored
      Summary: Folly has an optional libsodium dependency.  Declare that in folly getdeps manifest so that the relevant code is built and tested in CI.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D34028478
      
      fbshipit-source-id: 5e7c2f86602b94a3a975907adf8bd04f49ec33c0
      bc9cc4b3
  2. 05 Feb, 2022 6 commits
    • Yedidya Feldblum's avatar
      avoid Function instantiating std::move over lambdas · 7603afa2
      Yedidya Feldblum authored
      Summary:
      There are many lambda types so that can be a lot of instantiations. This shows up with futures, which use `Function` under the hood with lambdas.
      
      It is not as helpful to avoid `std::move` completely - it is primarily important to avoid it over callables, since these locations are widely-instantiated but may also be the only instantiations over the callables.
      
      ```name=trunk
      $ foundation/scripts/run-perf-compile --syntax folly/futures/test/FutureTest.cpp
           6,359,421,839      instructions:uP
      ```
      ```name=branch
      $ foundation/scripts/run-perf-compile --syntax folly/futures/test/FutureTest.cpp
           6,331,468,279      instructions:uP
      ```
      
      Reviewed By: Gownta, luciang
      
      Differential Revision: D32971147
      
      fbshipit-source-id: b2ce1325330ed59d9fb23fed48476fddf24e7854
      7603afa2
    • Yedidya Feldblum's avatar
      to_integral · 5e963ae5
      Yedidya Feldblum authored
      Summary:
      A utility function for modeling explicit floating-point-to-integral conversions but without requiring the destination type to be spelled if it can be inferred from context.
      
      Useful when it is important to highlight one abstract category of a conversion, that it is a floating-point-to-integral conversion, and when highlighting the concrete types involved tends to hide the category.
      
      Like `to_narrow`, which models explicit integral same-sign narrowing conversions.
      
      Differential Revision: D33992808
      
      fbshipit-source-id: 5010d84eb6382087250a815d223ab42adfa26ca7
      5e963ae5
    • Yedidya Feldblum's avatar
      lift the sfinae from to_narrow_convertible::operator() · 375e7918
      Yedidya Feldblum authored
      Summary: Having the complex conditions extracted to helper variables or types leaves the function declaration simpler.
      
      Differential Revision: D33992433
      
      fbshipit-source-id: f51775bc2901bb232c1bbd3136eb988e234c8af2
      375e7918
    • Adam Norton's avatar
      dynamic try_emplace · 95f1ce0f
      Adam Norton authored
      Summary: Expose `try_emplace` to give clients signal on whether an element was actually inserted. This will allow for more efficient code without needing to check for existence before inserting.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D34006997
      
      fbshipit-source-id: 3bdb7d4d81c19d0fcd7c82f194f1f695b79cf57b
      95f1ce0f
    • Yedidya Feldblum's avatar
      private inheritance for formatter<fbstring> · d2331436
      Yedidya Feldblum authored
      Summary: And other fixes. Because Hyrum's Law comes for all.
      
      Reviewed By: vitaut
      
      Differential Revision: D34010783
      
      fbshipit-source-id: 95c56f24ef4b129b2758d4ec465366cd09acac93
      d2331436
    • Philip Pronin's avatar
      fix SoftRealTimeExecutor interface · 8a17d8d1
      Philip Pronin authored
      Summary: Methods should be `public`.
      
      Reviewed By: ot, luciang
      
      Differential Revision: D34014408
      
      fbshipit-source-id: 49adaa3a01189f5c9dee7082a872147386a95548
      8a17d8d1
  3. 04 Feb, 2022 13 commits
    • Dan Melnic's avatar
      Reset the zerocopyReadDisabled_ flag on callback change · 5039adc2
      Dan Melnic authored
      Summary:
      We need to reset the zerocopyReadDisabled_ flag every time we switch between read callbacks since some of them might support a mem store. we verify the support again on the next read attempt.
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: yfeldblum
      
      Differential Revision: D33957906
      
      fbshipit-source-id: 37a962c6187502e241288ea179f04ca11c4c27b9
      5039adc2
    • Yedidya Feldblum's avatar
      revise BadExpectedAccess following P0323R11 · 8d89ba5c
      Yedidya Feldblum authored
      Summary:
      * `BadExpectedAccess<void>` inherits `std::exception` and `BadExpectedAccess<E>` inherits `BadExpectedAccess<void>`.
      * Copy-constructor, copy-assignment-operator.
      * Member `error` returns a reference.
      
      Paper: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p0323r11.html.
      
      Reviewed By: Gownta
      
      Differential Revision: D33907293
      
      fbshipit-source-id: 5002dfa548840431f957540bec23d95f34c9a68d
      8d89ba5c
    • Yedidya Feldblum's avatar
      decltype of fun-ptr should use explicit & · ee89ab55
      Yedidya Feldblum authored
      Summary: Some compilers may not understand `decltype(function)` when they would understand `decltype(&function)`, in particular, when that function has an exception specification.
      
      Differential Revision: D34000718
      
      fbshipit-source-id: 8adf2846d9ed877109a35a25c79b694cc7ed4e6f
      ee89ab55
    • Victor Zverovich's avatar
      Add a formatter for fbstring · 92bff437
      Victor Zverovich authored
      Summary: {fmt} is moving away from relying on implicit conversions because they may introduce ODR violations and not supported consistently. For example, `fbstring` can be formatted via an implicit conversion or via `operator<<`. To make sure this doesn't happen and make the code compatible with future versions of {fmt} add a `formatter` specialization for `fbstring`. This is consistent with `folly::StringPiece` which already has such specialization.
      
      Reviewed By: ot
      
      Differential Revision: D33994222
      
      fbshipit-source-id: 8150415ef45bd97b24aa12dd209b56c977c148c6
      92bff437
    • Yedidya Feldblum's avatar
      fix some FOLLY_SAFE_CHECK docs · 6199764f
      Yedidya Feldblum authored
      Summary: Fix some typos and expand some of the descriptions.
      
      Differential Revision: D33959231
      
      fbshipit-source-id: 70c7bb4f15757c75f28d00271af325b440da8e19
      6199764f
    • Yedidya Feldblum's avatar
      specialize Function internals over trivially-copyable callables · a32a7701
      Yedidya Feldblum authored
      Summary:
      `Function` requires an instantiation of a control function for every unique callable type. There are two control functions, named `execSmall` and `execBig`.
      
      But instantiation is expensive for build speed and build size - especially instantiation per unique callable type.
      
      An hypothesis is that it is common for callable types to be trivially-copyable. In particular, that it is common to have lambdas with implicit by-reference captures and no other captures, as `[&] { /* ... */ }`.
      
      So we introduce a new dispatch class, `DispatchSmallTrivial`, with a member function `exec` which is instantiated as few times as possible and which is used for all trivially-copyable callable types.
      
      Reviewed By: ot, luciang
      
      Differential Revision: D32932586
      
      fbshipit-source-id: 34ecad6b6bcbbc3ed379e3d32babf04c91d76557
      a32a7701
    • Alex Hornby's avatar
      improve OSS CI jobs for eden and eden_scm · 6c475cc6
      Alex Hornby authored
      Summary: Make the --facebook-internal flag value available from BuildOptions so can have jobs of both values where required
      
      Reviewed By: xavierd
      
      Differential Revision: D33945588
      
      fbshipit-source-id: 5d0e1b42973bd3e411a4a71075915bdb2755f0eb
      6c475cc6
    • Alex Hornby's avatar
      set BOOST_ROOT_1_69_0 as well as BOOST_ROOT_1_78_0 · ef8accd5
      Alex Hornby authored
      Summary: CentOS Stream 8's cmake 3.20.2 boost rules don't find the system boost with just BOOST_ROOT_1_78_0 (make sense, the system boost is 1.69),  so set BOOST_ROOT_1_69_0 as well
      
      Reviewed By: chadaustin
      
      Differential Revision: D34000244
      
      fbshipit-source-id: 73df3b6b9f1c091fd70fd61bc7169c5f77ed632b
      ef8accd5
    • Yedidya Feldblum's avatar
      brace-initialize common invocables · 6c35a50b
      Yedidya Feldblum authored
      Summary: Not sure if necessary today, but some compilers have historically required this.
      
      Differential Revision: D33992255
      
      fbshipit-source-id: 14cec23d7e6d29f7f15934e27b004f002cac71ef
      6c35a50b
    • Harvey Hunt's avatar
      getdeps: Add support for brew packages and define package dependencies · c2270f28
      Harvey Hunt authored
      Summary:
      In order to speed up build times on a mac, add homebrew support to
      getdeps.
      
      Homebrew packages can be declared in a manifest using the `homebrew` header.
      
      Futher, ahornby has added manifest entries for homebrew packages which are
      included in this diff and also included a change to use the correct version of
      openssl. Without this openssl change, homebrew cmake configure finds an old
      openssl 1.0.2 install.
      
      This diff provides a 2x speed up for building folly:
      
      Timings for clean getdeps folly build on mid-2018 2.9Ghz i9 6 core intel macbook pro with 32GB RAM:
      
      With new homebrew system deps:
      ```
      rm -rf /Users/ahornby/.scratch/UsersZahornbyZfbsource/fbcode_builder_getdeps/
      time ./opensource/fbcode_builder/getdeps.py build --allow-system-packages folly
      real	17m39.329s
      user	76m10.317s
      sys	5m50.163s
      ```
      
      Without:
      ```
      rm -rf /Users/ahornby/.scratch/UsersZahornbyZfbsource/fbcode_builder_getdeps/
      time ./opensource/fbcode_builder/getdeps.py build folly
      real	32m10.344s
      user	105m53.448s
      sys	15m57.858s
      ```
      
      Reviewed By: ahornby
      
      Differential Revision: D33842632
      
      fbshipit-source-id: ac785d4a8dcfa31b77292bddd9e747022ac36e3b
      c2270f28
    • Alex Hornby's avatar
      allow expressions for shipit manifest entries · e711c040
      Alex Hornby authored
      Summary: Add expressions for shipit entries so that we can map different directories if needed
      
      Differential Revision: D33947996
      
      fbshipit-source-id: e765769ae5a6ab90055b63284e538b965d6071b3
      e711c040
    • Alex Hornby's avatar
      pick rust installation independently of --facebook-internal · 62fcc612
      Alex Hornby authored
      Summary: Create a new fbsource property for manifests so we can still use monorepo rust toolchain when running builds with --no-facebook-internal
      
      Differential Revision: D33945559
      
      fbshipit-source-id: 606af62e03d09c3529018af4478bcafecd0cd640
      62fcc612
    • Yedidya Feldblum's avatar
      fix calls to fmt::format with non-consteval format strings · 96978d34
      Yedidya Feldblum authored
      Summary: Newly a thing with `fmt` v8.
      
      Differential Revision: D33995623
      
      fbshipit-source-id: 4560f1498a8f8253ab572105a441b735d53d776f
      96978d34
  4. 03 Feb, 2022 10 commits
    • Chad Austin's avatar
      upgrade boost to 1.78.0 · 17d5b56c
      Chad Austin authored
      Summary: Boost 1.69 does not build on Fedora 35, so upgrade to Boost 1.78.
      
      Reviewed By: ahornby
      
      Differential Revision: D33855670
      
      fbshipit-source-id: 85469a835a1dab1a7d5222413b1f1349bdcff280
      17d5b56c
    • Genevieve Helsel's avatar
      restrict fbthrift python dependency to fix watchman-diag · 6f48553f
      Genevieve Helsel authored
      Reviewed By: singhsrb
      
      Differential Revision: D33982894
      
      fbshipit-source-id: 5ec3f1555a551f3931983fde844346293704231c
      6f48553f
    • Chad Austin's avatar
      don't follow mount points when applying shipit transformation · bfb70cac
      Chad Austin authored
      Summary:
      If a getdeps project creates a bind mount in a subdirectory, we don't
      want the shipit transformer to copy all of the bind mount's contents
      to the ship-transformed output.
      
      This manifested when I was using Vagrant inside of Watchman and
      `getdeps.py fetch watchman` would copy all of the Vagrant VMs too.
      
      Reviewed By: ahornby
      
      Differential Revision: D33855553
      
      fbshipit-source-id: e2bc50ecfe0d067490c95be05d074d6a844f30d5
      bfb70cac
    • Chad Austin's avatar
      upgrade cpptoml to a patched upstream · 50791b79
      Chad Austin authored
      Summary:
      cpptoml is unsupported and is missing an #include. Switch to a patched
      fork so we build on recent gcc, including Fedora 35.
      
      Reviewed By: xavierd
      
      Differential Revision: D33855455
      
      fbshipit-source-id: 48675a116fc1f53246c6bf206f1deee32bd7d6c3
      50791b79
    • Chad Austin's avatar
      prefetch projects in the background · 0c9a8d53
      Chad Austin authored
      Summary:
      There's no reason to block a getdeps build on prefetching its sources,
      so issue all prefetches in the background.
      
      Reviewed By: genevievehelsel
      
      Differential Revision: D33855396
      
      fbshipit-source-id: 1ba01b0587e9bc0e74e6bba5b8571af76bf2516d
      0c9a8d53
    • Dan Melnic's avatar
      Check before redefining TCP_ZEROCOPY_RECEIVE · 9ad7c2a8
      Dan Melnic authored
      Summary: Check before redefining TCP_ZEROCOPY_RECEIVE
      
      Reviewed By: henrywang8atfbdotcom, kevin-vigor
      
      Differential Revision: D33982730
      
      fbshipit-source-id: 1f6a6d95e247e0fe824d853c4504ef0bd17e76bf
      9ad7c2a8
    • Dan Melnic's avatar
      Call scheduleImmediateRead() outside of the loop · 09bcbb11
      Dan Melnic authored
      Summary: Call scheduleImmediateRead() outside of the loop
      
      Reviewed By: simpkins, kevin-vigor
      
      Differential Revision: D33981511
      
      fbshipit-source-id: d71cb9ac3f1f5eebae82195d5c93a2a90e80a636
      09bcbb11
    • Yedidya Feldblum's avatar
      lift Unexpected to the top of the file · 1c49e380
      Yedidya Feldblum authored
      Summary: To avoid unnecessary forward-declarations.
      
      Reviewed By: Gownta
      
      Differential Revision: D32015253
      
      fbshipit-source-id: be8d5db93aebcd187dad379cd59ec69e2e274731
      1c49e380
    • Dan Melnic's avatar
      Fix typo · 741d2636
      Dan Melnic authored
      Summary: Fix typo
      
      Reviewed By: yfeldblum
      
      Differential Revision: D33956691
      
      fbshipit-source-id: 49b0c59554eb1d45f856e2e2b2a3598f74715179
      741d2636
    • Yedidya Feldblum's avatar
      dispatch indirection for function exec · 23d4c5e2
      Yedidya Feldblum authored
      Summary:
      The type-erased Function is widely used with lambdas and the type of every lambda is unique. Template instantiations are costly for build speed so, for the parts of Function which interact with lambdas, we choose techniques to optimize build speed.
      
      In particular, we avoid the extra layer of constructor templates which must be overload-tested and instantiated. The existing design of the extra layer was clean - it effectively used tag-dispatch and was able to deduplicate code with the coercing constructor. However, the choice of techniques was not optimal for build speed.
      
      ```name=trunk
      $ foundation/scripts/run-perf-compile --syntax folly/futures/test/FutureTest.cpp
           6,407,492,259      instructions:uP
      ```
      
      ```name=branch
      $ foundation/scripts/run-perf-compile --syntax folly/futures/test/FutureTest.cpp
           6,303,165,111      instructions:uP
      ```
      
      Reviewed By: Gownta, ot, luciang
      
      Differential Revision: D32940920
      
      fbshipit-source-id: 742cb67b994e7c3e6c070254386f3cdf5dffa38c
      23d4c5e2
  5. 02 Feb, 2022 7 commits
    • Michael Voznesensky's avatar
      Expose cloneAsValue from IOBuf.h in cython IOBuf · 7e27b793
      Michael Voznesensky authored
      Summary: We need it for lego
      
      Reviewed By: yfeldblum
      
      Differential Revision: D33910794
      
      fbshipit-source-id: 2a326f8fc41baae0db68657331f93b3d8124b8d8
      7e27b793
    • Adam Gleitman's avatar
      fix: Flip signs in Time.h's Apple version checks (#1688) · 4a8837f3
      Adam Gleitman authored
      Summary:
      When trying to bring react-native-macos up to date with 0.66, I was running into an issue getting RNTester to compile due to an error regarding redefining `clockid_t`. Other people have been seeing similar issues as per [these search results](https://github.com/facebook/folly/issues?q=clockid_t).
      
      The history behind this appears to be as follows:
      
      Several declarations in `<time.h>` were not available on Apple platforms until macOS 10.12 and iOS 10, which is why Folly needs to check the minimum version and set `FOLLY_HAVE_CLOCK_GETTIME` as needed. The problem is, the current logic as it stands right now is to set `FOLLY_HAVE_CLOCK_GETTIME = 1` (which implies that we don't need to declare them ourselves as the OS provides them for us) if...
      * ...we're building for macOS, and the minimum required version is less than 10.12, or...
      * ...we're building for iOS, and the minimum required version is less than 10.
      
      However, this doesn't make any sense. This is saying that we don't need to declare these missing APIs if we could be compiling Folly for use on an older version (i.e., macOS 10.11/iOS 9 or earlier), which is totally wrong! Instead, we ought to be checking if the versions are *at least* macOS 10.12 or iOS 10.
      
      React Native currently works around this by eliminating the minimum version check entirely with [this PR](https://github.com/facebook/react-native/pull/32715/), which is certainly a valid local fix ([the minimum iOS version for React Native apps is currently iOS 11](https://github.com/facebook/react-native/blob/1b31d6bb582768ccbe92d3c1a9e43354a8c531e5/template/ios/Podfile#L4)), but doesn't solve the problem at its core. This PR does solve the problem.
      
      I have not tested building this with a minimum version below the above thresholds for use on a modern version of macOS/iOS, but considering the discussion in https://github.com/facebook/folly/issues/1545, I think we should be safe to ignore these older versions from now on.
      
      Pull Request resolved: https://github.com/facebook/folly/pull/1688
      
      Reviewed By: yfeldblum
      
      Differential Revision: D33483705
      
      Pulled By: Orvid
      
      fbshipit-source-id: 0fe7c556af7e5b79a7679f75d003cf81a8f412ce
      4a8837f3
    • Yicheng Wang's avatar
      remove temp directive in AsyncServerSocket · c6981b29
      Yicheng Wang authored
      Summary: ^
      
      Reviewed By: praihan
      
      Differential Revision: D33807636
      
      fbshipit-source-id: 0a0aaa533387284f758daf057529aaa7ddc3ce04
      c6981b29
    • Dan Melnic's avatar
      Add support for Linux TCP zerocopy RX · a02ba06a
      Dan Melnic authored
      Summary:
      Add support for Linux TCP zerocopy RX
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: simpkins
      
      Differential Revision: D32741177
      
      fbshipit-source-id: 412981fdd4a27437d6f22a80dc7c5fc864335ddf
      a02ba06a
    • Kenny Yu's avatar
      delete detail::getSingletonStackTrace · 886ed94b
      Kenny Yu authored
      Summary: This removes `detail::getSingletonStackTrace` in favor of `symbolizer::getStackTraceStr`.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D33783970
      
      fbshipit-source-id: 416ff70abb79ce4e9c3180c0872432ae2966effc
      886ed94b
    • Yedidya Feldblum's avatar
      recursive function · 9adda7dd
      Yedidya Feldblum authored
      Summary:
      Check that recursion builds with specific versions of gcc. Fix failures with that version.
      
      Addresses these failures:
      
      ```
      In file included from folly/test/FunctionTest.cpp:17:
      folly/Function.h: In substitution of 'template<class ReturnType, class ... Args> template<class F, class R> using IfSafeResult = folly::detail::function::IfSafeResultImpl<R, ReturnType> [with F = folly::Function<RecFolly()>; R = RecFolly; ReturnType = RecFolly; Args = {}]':
      folly/Function.h:761:7:   required by substitution of 'template<class Signature, class> folly::Function<RecFolly()>::Function(folly::Function<F>&&) [with Signature = RecFolly(); <template-parameter-1-2> = <missing>]'
      folly/Function.h:293:40:   required by substitution of 'template<class From, class To, class> using IfSafeResultImpl = decltype ((void)(static_cast<To>(declval<From>()))) [with From = RecFolly; To = RecFolly; <template-parameter-1-3> = void]'
      folly/Function.h:363:9:   required by substitution of 'template<class ReturnType, class ... Args> template<class F, class R> using IfSafeResult = folly::detail::function::IfSafeResultImpl<R, ReturnType> [with F = folly::Function<RecFolly()>; R = RecFolly; ReturnType = RecFolly; Args = {}]'
      folly/Function.h:761:7:   required by substitution of 'template<class Signature, class> folly::Function<RecFolly()>::Function(folly::Function<F>&&) [with Signature = RecFolly(); <template-parameter-1-2> = <missing>]'
      folly/Function.h:293:40:   required by substitution of 'template<class From, class To, class> using IfSafeResultImpl = decltype ((void)(static_cast<To>(declval<From>()))) [with From = RecFolly; To = RecFolly; <template-parameter-1-3> = void]'
      folly/Function.h:363:9:   [ skipping 501 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
      folly/Function.h:363:9:   required by substitution of 'template<class ReturnType, class ... Args> template<class F, class R> using IfSafeResult = folly::detail::function::IfSafeResultImpl<R, ReturnType> [with F = folly::Function<RecFolly()>; R = RecFolly; ReturnType = RecFolly; Args = {}]'
      folly/Function.h:761:7:   required by substitution of 'template<class Signature, class> folly::Function<RecFolly()>::Function(folly::Function<F>&&) [with Signature = RecFolly(); <template-parameter-1-2> = <missing>]'
      folly/Function.h:293:40:   required by substitution of 'template<class From, class To, class> using IfSafeResultImpl = decltype ((void)(static_cast<To>(declval<From>()))) [with From = RecFolly; To = RecFolly; <template-parameter-1-3> = void]'
      folly/Function.h:363:9:   required by substitution of 'template<class ReturnType, class ... Args> template<class F, class R> using IfSafeResult = folly::detail::function::IfSafeResultImpl<R, ReturnType> [with F = folly::Function<RecFolly()>; R = RecFolly; ReturnType = RecFolly; Args = {}]'
      folly/Function.h:761:7:   required by substitution of 'template<class Signature, class> folly::Function<RecFolly()>::Function(folly::Function<F>&&) [with Signature = RecFolly(); <template-parameter-1-2> = <missing>]'
      folly/test/FunctionTest.cpp:212:54:   required from here
      folly/Function.h:363:9: fatal error: template instantiation depth exceeds maximum of 512 (use '-ftemplate-depth=' to increase the maximum)
        363 |   using IfSafeResult = IfSafeResultImpl<R, ReturnType>;
            |         ^~~~~~~~~~~~
      compilation terminated.
      ```
      
      ```
      In file included from folly/test/FunctionTest.cpp:17:
      folly/Function.h: In member function 'virtual void Function_SelfMove_Test::TestBody()':
      folly/Function.h:709:70: error: 'f.folly::Function<int()>::exec_' is used uninitialized in this function [-Werror=uninitialized]
        709 |   Function(Function&& that) noexcept : call_(that.call_), exec_(that.exec_) {
            |                                                                 ~~~~~^~~~~
      folly/Function.h: In member function 'virtual void Function_SelfMove2_Test::TestBody()':
      folly/Function.h:709:70: warning: 'f.folly::Function<int()>::exec_' may be used uninitialized in this function [-Wmaybe-uninitialized]
        709 |   Function(Function&& that) noexcept : call_(that.call_), exec_(that.exec_) {
            |                                                                 ~~~~~^~~~~
      folly/Function.h: In member function 'virtual void Function_SelfStdSwap_Test::TestBody()':
      folly/Function.h:709:70: error: 'f.folly::Function<int()>::exec_' is used uninitialized in this function [-Werror=uninitialized]
        709 |   Function(Function&& that) noexcept : call_(that.call_), exec_(that.exec_) {
            |                                                                 ~~~~~^~~~~
      folly/Function.h:709:70: warning: 'f.folly::Function<int()>::exec_' may be used uninitialized in this function [-Wmaybe-uninitialized]
        709 |   Function(Function&& that) noexcept : call_(that.call_), exec_(that.exec_) {
            |                                                                 ~~~~~^~~~~
      folly/Function.h:709:70: warning: 'f.folly::Function<int()>::exec_' may be used uninitialized in this function [-Wmaybe-uninitialized]
        709 |   Function(Function&& that) noexcept : call_(that.call_), exec_(that.exec_) {
            |                                                                 ~~~~~^~~~~
      ```
      
      Notes:
      * For some versions of gcc, the compiler sees the converting-move-ctor as a better match than the actual move-ctor and this leads the compiler to infinite recursion; to work around this, explicitly exclude the same-type case of the converting-move-ctor.
      * `std::exchange` on `exec_` would be incorrect for self-move because of order of operations.
      * `std::exchange` on `call_` might be correct but it would be an extra template instantiation which is not desireable for `folly::Function`.
      
      Differential Revision: D33881266
      
      fbshipit-source-id: 5403b83498b9c1afa772564246eba4f112495761
      9adda7dd
    • Chad Austin's avatar
      limit parallelism based on available RAM · fa2f89f9
      Chad Austin authored
      Summary:
      A long time ago, getdeps scheduled each build up to the number of hardware threads. For some builds, that was too heavy, so it got throttled back to only ever use half the hardware threads. This left parallelism on the table for CPU-bound projects that don't use much RAM per compilation.
      
      This commit makes better use of the hardware with finer-grained logic that allows each manifest to specify a `job_weight_mib` estimate in MiB, and limit concurrency to `available_ram / job_weight`.
      
      Reviewed By: ahornby
      
      Differential Revision: D33754018
      
      fbshipit-source-id: 785bed6c6cfe3c473244e0806a77cec1fc119e1f
      fa2f89f9
  6. 01 Feb, 2022 1 commit
    • Yedidya Feldblum's avatar
      atomic_fetch_flip · aa68792c
      Yedidya Feldblum authored
      Summary:
      The flip operation, like the set and reset operations, are optimizable on x86-related architectures using the `btc` instruction, compared with `bts` and `btr` for set and reset operations.
      
      The optimization is done for gnu-like compilers. However, for MSVC, there is no interlocked intrinsic for `btc`, so the optimization is not done.
      
      Reviewed By: luciang
      
      Differential Revision: D32049844
      
      fbshipit-source-id: 5f60f8c4c534fb0ee41d76c5d766f96f7ff94892
      aa68792c