1. 08 Feb, 2022 6 commits
    • Alex Hornby's avatar
      generate the eden_scm github actions (#103) · f57a1427
      Alex Hornby authored
      Summary:
      Pull Request resolved: https://github.com/facebookexperimental/eden/pull/103
      
      Automate maintenance of the edenscm_* github actions yamls
      
      Add job file and name options and support for the Rust install section
      
      Reviewed By: fanzeyi
      
      Differential Revision: D34044422
      
      fbshipit-source-id: 7d5f07d37bab1eff5de30a88e710dbf7479ca192
      f57a1427
    • Alex Hornby's avatar
      regenerate github actions · 713c9b5e
      Alex Hornby authored
      Summary: Fix the getdeps.py  generation sub command and regenerate github actions before making changes to support actions generation for eden_scm
      
      Reviewed By: fanzeyi
      
      Differential Revision: D34044243
      
      fbshipit-source-id: 0039d04f25af4c842145dc142dae6b9996fc8046
      713c9b5e
    • Yedidya Feldblum's avatar
      revise Indestructible to elide dtors · 1c6d910c
      Yedidya Feldblum authored
      Summary:
      For global variables with nontrivial destructors, the compiler inserts calls to `atexit` to destroy the variables at shutdown time. For global variables with trivial destructors, the compiler elides such calls. Revise `Indestructible` to have a trivial destructor.
      
      Some compilers optimize further and remove such calls even for some nontrivial destructors, but not all do so.
      
      Also remove move-construction and move-assignment. And remove actual `constexpr`-constructibility since `::new` is not a constant expression.
      
      Reviewed By: chadaustin
      
      Differential Revision: D34026842
      
      fbshipit-source-id: 9ab2f957cbe9a67809a6c99e6b9370c1f4315777
      1c6d910c
    • Yedidya Feldblum's avatar
      let FOLLY_SAFE_CHECK macro-stringize the expression only once · 2b4fe254
      Yedidya Feldblum authored
      Reviewed By: ot, luciang
      
      Differential Revision: D33864764
      
      fbshipit-source-id: 9839f578bd0fe5e8f69d5299287a59cb471f8cf3
      2b4fe254
    • Yedidya Feldblum's avatar
      register_pass_v and usage in Function · 72c2e98e
      Yedidya Feldblum authored
      Summary: Whether a value is passed in registers also depends on its size, not just whether it is trivially copyable. (It also depends on its position in the arg-list but that is another step in complexity.)
      
      Reviewed By: luciang
      
      Differential Revision: D33079529
      
      fbshipit-source-id: ae7383d61491001e54892cf077e45556801bdcf4
      72c2e98e
    • Yedidya Feldblum's avatar
      avoid implicit conversions in Bits · fe4dbb77
      Yedidya Feldblum authored
      Differential Revision: D34056336
      
      fbshipit-source-id: adf4c0b96d6fd3f5e15c7bfefe7e908e85baf5b1
      fe4dbb77
  2. 07 Feb, 2022 2 commits
    • Yedidya Feldblum's avatar
      avoid excessive instantiations of std::declval in Function · c1b3be25
      Yedidya Feldblum authored
      Summary:
      It turns out that instantiating this function declaration template so widely measurably affects build speed. Prefer alternative techniques, such as `FOLLY_DECLVAL`.
      
      ```name=trunk
      $ foundation/scripts/run-perf-compile --syntax folly/futures/test/FutureTest.cpp
           8,462,001,355      instructions:uP
      ```
      ```name=branch
      $ foundation/scripts/run-perf-compile --syntax folly/futures/test/FutureTest.cpp
           8,362,569,934      instructions:uP
      ```
      
      Reviewed By: Gownta, luciang
      
      Differential Revision: D32973365
      
      fbshipit-source-id: 6930f75e04e0bb9ac4216b08645e67b98ca2c2f3
      c1b3be25
    • Yedidya Feldblum's avatar
      condense the atomic-fetch-bit-op implementations · d60894bf
      Yedidya Feldblum authored
      Summary: Coalesce the inline-asm. Use invokers.
      
      Reviewed By: Gownta
      
      Differential Revision: D32302511
      
      fbshipit-source-id: 6edf75c6ef820ed80e751d965174e5acfaac957e
      d60894bf
  3. 06 Feb, 2022 4 commits
    • Zino Benaissa's avatar
      heap_vector_map, heap_vector_set · 80c05933
      Zino Benaissa authored
      Summary:
      Define `heap_vector_map` and `heap_vector_set`. These feature a fast lookup (find operation) which does not rely on `std::lower_bound` or similar to find keys. Map elements are not laid out in sorted order. Instead, they are laid out in heap order, which is also known as Eytzinger order. A heap order layout is optimal to maximize memory and cache locality of lookup operations.
      
      A heap vector set containing the elements 0-7 lays out the elements as:
      
                                           elements  in sorted order
        heap_container[0]  =  4 <-- middle
        heap_container[1]  =  2
        heap_container[2]  =  6
        heap_container[3]  =  1
        heap_container[4]  =  3
        heap_container[5]  =  5
        heap_container[6]  =  7 <-- max
        heap_container[7]  =  0 <-- min
      
      `heap_vector_map` (referred below as HM) is almost a drop-in replacements for `sorted_vector_map` (referred as SM). All SM APIs are supported, and are semantically equal, with very few exceptions.
      
      Although HM works correctly for any key value SM supports, the speedup of find operation (random key search) is typically limited to maps with small key types with comparison operations subject to inlining. Measurements suggest up to 2x speedup of find operation for HM compared to SM.
      
      The key tradeoff is that HM has slower insertion and removal operations and slower iteration. Prefer HM if updates and traversals operations are rare, and lookups are the dominant operation. Of course, SM itself has slow insertion and removal operations so, if these operations are sufficiently common, another map type entirely would be preferable.
      
      Key similarities:
      
      1) They have the same in-situ sizes: `sizeof(HM) == sizeof(SM)`.
      2) Insertions and removals. As expected, these operations are slower for HM. Both SM and HM need to move elements while preserving sorted or heap order but the SM operation can be much simpler.
      3) A fast construction of HM from a sorted vector or from a SM.
      4) An iterator that follows sorted order compatible with SM. This is complex, though. When sorted iteration order is not required, it is faster to use the enclosed container's iteration order.
      
      Key differences:
      
      1) iterate() is a new API that provides the iterator range of the container vector. iterate() enables the fastest traversal of the heap container elements. For example,
                for (auto& element : HS.iterator()) { // traversed as laid out in memory
                    std::cout << e << ", ";
                 }
      for above examples, the loop prints:  4, 2, 6, 1, 3, 5, 7, 0,
                 for (auto& element : HS) { // key-sorted
                    std::cout << e << ", ";
                 }
      for above examples, the loop prints:   0, 1, 2, 3, 4, 5, 6, 7,
      
      2) data() is purposely not provided because it does not point to the first elements. If the start address is needed, use instead HM.iterate().data()
      
      Reviewed By: Gownta
      
      Differential Revision: D32128733
      
      fbshipit-source-id: 1df7372720b969ee7a84004ded101db132e0c224
      80c05933
    • 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
  4. 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
  5. 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
  6. 03 Feb, 2022 9 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