1. 03 May, 2019 6 commits
    • Wez Furlong's avatar
      fbcode_builder: add manifest files for some dependencies · 003da387
      Wez Furlong authored
      Summary:
      These are ported over from the logic in the watchman and eden getdeps
      scripts, with additions to help bootstrap a build environment.
      
      These are sufficient to build watchman with thrift support on windows, mac and
      linux, and eden on mac and linux when combined with the getdeps code that
      follows in later diffs in this stack.
      
      Reviewed By: simpkins
      
      Differential Revision: D14691005
      
      fbshipit-source-id: 7f8b02fedcdc020e2d0e758c466959d8161d4587
      003da387
    • Wez Furlong's avatar
      fbcode_builder: add manifest file parser · e139393e
      Wez Furlong authored
      Summary:
      Adds a parser for manifest files that describe projects
      that may be either 1st party or 3rd party.
      
      A selection of manifest files appears in a later diff in this stack.
      
      This diff provides the raw parser and a couple of low level helpers.
      It also defines a mechanism for validating the schema to help catch
      structural (rather than semantic) issues with manifest file contents.
      
      Later diffs in the stack add helpers for accessing the data in
      a higher level way.
      
      Reviewed By: sinancepel
      
      Differential Revision: D14691003
      
      fbshipit-source-id: 7d2930a3359ede0f6e21fdc45686b083ab7a9ffa
      e139393e
    • Wez Furlong's avatar
      fbcode_builder: getdeps: add boolean expression parser · 5aab1c26
      Wez Furlong authored
      Summary:
      As part of folding getdeps into fbcode_builder, this
      expression parser is needed to allow constrained and deterministic
      conditionals in the manifest file format.
      
      For example, the watchman manifest will use this cargo-inspired syntax
      for system dependent sections:
      
      ```
      [dependencies]
      folly
      
      [dependencies.not(os=windows)]
      thrift
      ```
      
      Reviewed By: sinancepel
      
      Differential Revision: D14691014
      
      fbshipit-source-id: 080bcdb20579da40d225799f5f22debe65708b03
      5aab1c26
    • Chad Austin's avatar
      detect at runtime whether SKIP should fail · 43e2ad6e
      Chad Austin authored
      Summary:
      Detect at runtime whether testpilot is the test runner to decide how
      to communicate skip status.
      
      Reviewed By: simpkins
      
      Differential Revision: D15073229
      
      fbshipit-source-id: 417a1f4e42d0655e25cc62b0abb016c157d1adea
      43e2ad6e
    • Erik Hortsch's avatar
      Allow the tick interval to be specified on folly EventBase · c0b4901a
      Erik Hortsch authored
      Summary:
      Allow the eventbase to be constructed with a higher-precision timer, for those callers that need more precision for shorter (or higher entropy) waits.
      
      (Note: this ignores all push blocking failures!)
      
      Differential Revision: D15186374
      
      fbshipit-source-id: 98cca2d15fc18f9e865129f4629a4351e9a8b9c9
      c0b4901a
    • Kirk Shoop's avatar
      fixes for take_until tests · 578c4b91
      Kirk Shoop authored
      Summary:
      there were test failures that fell into three buckets
      
      first, the strands worker had concurrency issues. the handoff between submit and the worker was wrong.
      
      second, take_until was not waiting for the producer to signal done. this was originally by-design. now the expectation is that take until will not early-complete on cancellation.
      
      third, the tests had concurrency issues. the EXPECT assertions were not allowing for non-deterministic interleaving.
      
      Reviewed By: lewissbaker
      
      Differential Revision: D14947473
      
      fbshipit-source-id: 36f7cf87b9226367dc44afed663fa6418503c059
      578c4b91
  2. 02 May, 2019 4 commits
    • Yedidya Feldblum's avatar
      Let FBVector.h support -fno-exceptions · 1299eec8
      Yedidya Feldblum authored
      Summary: [Folly] Let `folly/FBVector.h` support `-fno-exceptions`. Same mechanism as with `folly/small_vector.h`.
      
      Reviewed By: Orvid
      
      Differential Revision: D15158754
      
      fbshipit-source-id: fe67d608a5b38258d05718efae502b7277e1f4ee
      1299eec8
    • Andrii Grynenko's avatar
      Add co_awaitTry support for folly::Future · be621139
      Andrii Grynenko authored
      Summary: This also makes co_awaitTry to work for any SemiAwaitable that implements await_resume_try in it's awaiter.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15170076
      
      fbshipit-source-id: 7f6ce0e2fa762acc5bcc4a32ed29d189787bf1ef
      be621139
    • Kirk Shoop's avatar
      improve pushmi compile-time debugging · ec7519ab
      Kirk Shoop authored
      Summary:
      use PUSHMI_TEMPLATE_DEBUG in a few more places
      add some additional code to the submit customization point to allow the compiler to emit error info when none of the fallbacks worked.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15016463
      
      fbshipit-source-id: 1c43c21093d54d662c1d084040608db0e0c029be
      ec7519ab
    • Junqi Wang's avatar
      Back out "[Folly] Enforce SingletonThreadLocal uniqueness without FOLLY_TLS" · c43e3f85
      Junqi Wang authored
      Summary: Original commit changeset: 04dbc7bc7752
      
      Reviewed By: vchynarov
      
      Differential Revision: D15168113
      
      fbshipit-source-id: a69618eabec30e7599c13bb32c25f6efd6da561e
      c43e3f85
  3. 01 May, 2019 3 commits
    • Lee Howes's avatar
      Check then callability using tryCallableResult as it forwards to thenTry anyway · 7406e351
      Lee Howes authored
      Summary: Switch to the correct callability check to match the internals. Without this change then is ambiguous and can still generate errors on polymorphic lambdas.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15147830
      
      fbshipit-source-id: 3f577641495a24076e9ffa19deaad190452c420c
      7406e351
    • Chad Austin's avatar
      allow conversion from nullptr to folly::Optional<bool> · 67210f1c
      Chad Austin authored
      Summary:
      Disabling the nullptr conversion to non-pointer folly::Optional<T> has
      baked long enough. Re-enabled it with the same behavior that
      std::optional has.
      
      Reviewed By: Orvid
      
      Differential Revision: D15151503
      
      fbshipit-source-id: d170f3f0e6bf3bb4461f17bdb6f8078b5a883615
      67210f1c
    • Dan Melnic's avatar
      Fix SingletonBenchmark.cpp init · 5f8a9671
      Dan Melnic authored
      Summary: Call folly::SingletonVault::singleton<BenchmarkTag>()->registrationComplete() to avoid an assert
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15159381
      
      fbshipit-source-id: 6f3be22d433e77d6e1b5293098a6dedd42e65bb6
      5f8a9671
  4. 30 Apr, 2019 11 commits
    • Lee Howes's avatar
      Remove inaccurate comments · c501bc43
      Lee Howes authored
      Summary: Trivial change to remove comments that were initially accurate but inaccurate once we decided to DCHECK on the executor instead.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15148289
      
      fbshipit-source-id: 5d0495f4b36db3a0c8610592bc759e121ed1dcff
      c501bc43
    • myd7349's avatar
      Take care of zstd static library on Win32 (#1120) · 87f1a403
      myd7349 authored
      Summary:
      When built as a static library on Win32, `zstd` has an output name like `zstd_static.lib` and `zstd_staticd.lib`:
      https://github.com/facebook/zstd/blob/69baaee3e42f90dedea2c946bc19bfeac4e782ee/build/cmake/lib/CMakeLists.txt#L140
      So `FindZstd.cmake` should also take this into consideration.
      Pull Request resolved: https://github.com/facebook/folly/pull/1120
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15149814
      
      Pulled By: Orvid
      
      fbshipit-source-id: 298809a524468ab5aa68e58f5fef0cbb0f366051
      87f1a403
    • Orvid King's avatar
      Revert D15057633: [folly] allow conversion from nullptr to folly::Optional<bool> · 3fb4ba1d
      Orvid King authored
      Differential Revision:
      D15057633
      
      Original commit changeset: 6ba47a57a78e
      
      fbshipit-source-id: 1ae1384e5e9de3f2e80571b626a41ef6e713b3b2
      3fb4ba1d
    • Dan Melnic's avatar
      Enforce SingletonThreadLocal uniqueness without FOLLY_TLS · cad67038
      Dan Melnic authored
      Summary:
      [Folly] Enforce `SingletonThreadLocal` uniqueness also in the case where `FOLLY_TLS` is not defined.
      
      Since the uniqueness check should happen in all scenarios, just move it to a place which is not subject to conditional compilation.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15142661
      
      fbshipit-source-id: 04dbc7bc775255a010f24c1496552cfc27970e1f
      cad67038
    • Lee Howes's avatar
      Remove thenMulti · 7bfcc8a3
      Lee Howes authored
      Summary: Another overload that is not really necessary and adds complication. Removing to simplify.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15110009
      
      fbshipit-source-id: a7a90799ff4d89d45ae82d2e755be5ee3799104c
      7bfcc8a3
    • Andrii Grynenko's avatar
      Add FOLLY_NOINLINE to non-trivial await_suspend implementations · c5d71971
      Andrii Grynenko authored
      Summary: This is mainly to workaround bugs triggered by LTO, when stack allocated variables in await_suspend end up on a coroutine frame.
      
      Reviewed By: lewissbaker
      
      Differential Revision: D15143193
      
      fbshipit-source-id: 9553274e2d9c021902d9d19e7ecb2a91a86e787a
      c5d71971
    • Chad Austin's avatar
      allow conversion from nullptr to folly::Optional<bool> · 6b97363a
      Chad Austin authored
      Summary:
      Disabling the nullptr conversion to non-pointer folly::Optional<T> has
      baked long enough. Re-enabled it with the same behavior that
      std::optional has.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15057633
      
      fbshipit-source-id: 6ba47a57a78ec4834ed4ecc8987a7c8870102ae4
      6b97363a
    • Lee Howes's avatar
      Remove thenMultiWithExecutor · e40b0e44
      Lee Howes authored
      Summary: Another overload that is not really necessary and adds complication. Removing to simplify.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15109455
      
      fbshipit-source-id: 4312aab817d9796358e0b659c50c6e8f9d9ccb4e
      e40b0e44
    • Kirk Shoop's avatar
      changes strand's handling of empty and errors from the underlying executor · 668cb0bb
      Kirk Shoop authored
      Summary:
      after discussion with Lewis, change the contract for empty and error signals from the underlying executor in the strand implementation.
      
      error will forward the error to items in the queue and then reschedule for any remaining items
      
      done will forward the empty signal to items in the queue and then reschedule for any remaining items.
      
      These changes should prevent infinite scheduling loops and allow the underlying executor to push back against the items being submitted to the strand.
      
      Reviewed By: lewissbaker
      
      Differential Revision: D14955343
      
      fbshipit-source-id: 926109594d7aed1766d868b705c84a6ed664e2f3
      668cb0bb
    • Lee Howes's avatar
      add collectAnySemiFuture · 0a2bbe62
      Lee Howes authored
      Summary: Adds a SemiFuture variant of collectAny and forwards collectAny to it. This ensures that both options are available.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15111077
      
      fbshipit-source-id: f4d6efc684ca632b71f7a8d2659ca4d968d15b6f
      0a2bbe62
    • Andrii Grynenko's avatar
      Fix a race in FutureAwaitable · 0ad95397
      Andrii Grynenko authored
      Summary: Make sure the future object doesn't get destroyed concurrently with the setCallback_ call.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15122238
      
      fbshipit-source-id: c8de1cd158f317c3ed7591460ca2cccfa7633ae7
      0ad95397
  5. 29 Apr, 2019 8 commits
    • Lewis Baker's avatar
      Make folly::coro::Baton::reset() thread-safe · 9fac201a
      Lewis Baker authored
      Summary: Allow calling `baton.reset()` concurrently with `co_await`.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15058504
      
      fbshipit-source-id: af7ff69ddc2c8a4663e0f7ef03121c01502a984d
      9fac201a
    • Frieder Bluemle's avatar
      Fix GitHub spelling (#1119) · 9738cee3
      Frieder Bluemle authored
      Summary:
      Just a minor typo fix: `Github` -> `GitHub`.
      Pull Request resolved: https://github.com/facebook/folly/pull/1119
      
      Differential Revision: D15120076
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: e0caccc022d0d740fd25ad1697b130fe7680f9a3
      9738cee3
    • Brandon Schlinker's avatar
      Add WriteFlags::TIMESTAMP_TX · ed00c450
      Brandon Schlinker authored
      Summary:
      `WriteFlags::EOR` currently marks the end of a record (e.g., an HTTP response) and is used to request ACK timestamping.
      
      `WriteFlags::TIMESTAMP_TX` will be used to request timestamping when the entire write buffer has been transmitted by the NIC. If hardware timestamps are unavailable, then the timestamp will be taken when the the entire buffer has been handed to the NIC by the kernel. TX timestamps can be compared to send() timestamps to determine how long the write buffer was waiting in the kernel to be sent to the NIC. In the case of a large CWND + LOWAT, this could be a significant amount of time. In addition, TX timestamps help with throughput calculations as they enable the precise transmit time to be determined.
      
      We may want to rename `WriteFlags::EOR` or add a separate flag for ACK timestamping. For now, I've clarified the purpose of this field.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15081941
      
      fbshipit-source-id: 239833cd5a0413e7468840960118a038ffdac068
      ed00c450
    • Andrii Grynenko's avatar
      Fix a race in thenImplementation · d85ae919
      Andrii Grynenko authored
      Summary: It's unsafe to read Executor from Core, because it can be concurrently modified by a consumer thread.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15117907
      
      fbshipit-source-id: 40caf4b2878609775c1c8476336349ddf3764d4d
      d85ae919
    • Joe Loser's avatar
      Simplify HasArgumentTypes in DynamicParser-inl.h (#1086) · 79d908dd
      Joe Loser authored
      Summary:
      - `HasArgumentTypes` uses nested `boost::mpl::transform` calls to strip
        reference qualifiers from the function argument types and then another
        `mpl::transform` call to remove `const` qualifiers.
      - Replace the nested `mpl::transform` calls to just one call by using
        `folly::remove_cvref`.
      Pull Request resolved: https://github.com/facebook/folly/pull/1086
      
      Reviewed By: Orvid
      
      Differential Revision: D14638843
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 8c360e50ffaba0328aa8e4c86245ce25d45bc01b
      79d908dd
    • Andrii Grynenko's avatar
      Fix compare_exchange_strong memory order in Core · 46183b6c
      Andrii Grynenko authored
      Reviewed By: lewissbaker
      
      Differential Revision: D15114457
      
      fbshipit-source-id: 0f49d631bd316fda828946971b607c94ee75250b
      46183b6c
    • Joe Loser's avatar
      Cut endian members from fbstring_core (#1117) · d9f6a3fd
      Joe Loser authored
      Summary:
      - `fbstring_core` defines constants based on the host endianness.
      - This is purely duplicated as these constants live in `Portability.h`.
        As such, remove them from `fbstring_core` class.
      Pull Request resolved: https://github.com/facebook/folly/pull/1117
      
      Reviewed By: Orvid
      
      Differential Revision: D15096910
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: ff4e828dfd1b19daeedf48bbf1719a3fd72c0843
      d9f6a3fd
    • Joe Loser's avatar
      Implement uniform container erasure for FBVector and small_vector (#1089) · b7283ea0
      Joe Loser authored
      Summary:
      - Implement `erase` and `erase_if` for both `FBVector` and
        `small_vector`.
      - This matches the APIs as in the C++20 Library Fundamentals v2.
      Pull Request resolved: https://github.com/facebook/folly/pull/1089
      
      Reviewed By: Orvid
      
      Differential Revision: D15112753
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: dc93c600fa8e7e8a7ed42d6a6e07439d4fa51204
      b7283ea0
  6. 28 Apr, 2019 1 commit
  7. 27 Apr, 2019 7 commits
    • Matthieu Martin's avatar
      Allow fibers Semaphore's Baton to signal during post · 0371d47f
      Matthieu Martin authored
      Summary:
      This change has no effect for normal use of the semaphore.
      
      With try_acquire (previous change), we now allow the callers to pass their own baton.
      It's possible that the caller ends up not needing to use the `post`, and simply wants to signal the semaphore. It's basically useful in scenario where the caller wants to wait for the first of multiple events.
      Current code would deadlock in this scenario, this fixes it.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D15090395
      
      fbshipit-source-id: 8e3d73705ef3559717b7335f6a9e9ea8bed1cb17
      0371d47f
    • Matthieu Martin's avatar
      Add try_acquire to folly::fibers::Semaphore · c379a920
      Matthieu Martin authored
      Summary: This provides an interface for the Semaphore, which allow async waiting for more complex usage on fiber, without the future overhead.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D15082111
      
      fbshipit-source-id: 76306525509f36867999db459ee0b7c42f416b6c
      c379a920
    • Nathan Bronson's avatar
      only run copyAfterRemovedCollisions test for SIMD F14 · beef6090
      Nathan Bronson authored
      Summary:
      This new test should have been inside the
      FOLLY_F14_VECTOR_INTRINSICS_AVAILABLE conditional compilation guard.
      
      Reviewed By: mengz0
      
      Differential Revision: D15114483
      
      fbshipit-source-id: 2931be7d4abf7a4a95827052905bd219c9beff13
      beef6090
    • Andrii Grynenko's avatar
      Fix convertFuture · adfc1c67
      Andrii Grynenko authored
      Summary: It's unsafe to use Future after setCallback was called (its executor may be moved out), so we have to copy its executor before that.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15113490
      
      fbshipit-source-id: 2fa9c323ddfe1919b84bbfe05b6c5643d0c65703
      adfc1c67
    • Yedidya Feldblum's avatar
      Let RequestContext::setContext take by reference · 2d41ab6d
      Yedidya Feldblum authored
      Summary: [Folly] Let `RequestContext::setContext` and `RequestContextScopeGuard` members take `shared_ptr<RequestContex>` by reference. Saves a small amount on code size and runtime performance due to code size.
      
      Reviewed By: spalamarchuk
      
      Differential Revision: D15074704
      
      fbshipit-source-id: 20f1149b8c56d6c4375d63fe21560bdda5e5ccae
      2d41ab6d
    • Yedidya Feldblum's avatar
      Cut unused FutureBase::setContext_ overload · 16c1cb3b
      Yedidya Feldblum authored
      Summary: [Folly] Cut unused `FutureBase::setContext_` overload taking `shared_ptr<RequestContext>`.
      
      Reviewed By: mhorowitz
      
      Differential Revision: D15073509
      
      fbshipit-source-id: a8a9d37e3420168e63692ba77063452849355361
      16c1cb3b
    • Yedidya Feldblum's avatar
      Pass context by reference in the futures Core · caa3c6ee
      Yedidya Feldblum authored
      Summary: [Folly] Pass context by reference in the futures `Core`, saving on code size and a small on runtime performance due to code size.
      
      Reviewed By: Orvid
      
      Differential Revision: D15073282
      
      fbshipit-source-id: 7c55b9f6a55ee7ec22fde6f3ab9da232a8ee006b
      caa3c6ee