1. 21 Apr, 2019 3 commits
    • Orvid King's avatar
      Attempt to migrate some things · 3beebd30
      Orvid King authored
      Summary: temp
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14882681
      
      fbshipit-source-id: 3017cb9743c81396764e6a61bdca183ae2692401
      3beebd30
    • Joe Loser's avatar
      Enable IntToDouble test in ConvTest (#1112) · 4ebfe3cf
      Joe Loser authored
      Summary:
      - Most of `IntToDouble` test is commented out as it previously did not
        work with GCC 4.6.1.
      - Enable the rest of this test as it works fine on GCC 5.1
      Pull Request resolved: https://github.com/facebook/folly/pull/1112
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15014999
      
      Pulled By: Orvid
      
      fbshipit-source-id: a26a0fcacc9a22c03d0d67c35cabf8ec0ca91813
      4ebfe3cf
    • Orvid King's avatar
      Fix MSVC builds · c47ff43b
      Orvid King authored
      Summary: The only fix in this diff to an error currently being seen by the contbuilds is the change to concurrent hash map. The rest would have been seen when building the slow tests is enabled.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14898822
      
      fbshipit-source-id: b28cd697496bb97b0e35b189a9bb31b666da3b17
      c47ff43b
  2. 19 Apr, 2019 6 commits
    • Joe Loser's avatar
      Simplify some macros testing __GNUC__ and __clang__ (#1095) · 6607a501
      Joe Loser authored
      Summary:
      - Both GCC and Clang define the macro `__GNUC__`, `__GNUG__` and
        friends. Simplify some macros whose intent is to check "if we are GCC or
        Clang" but do so via checking `__GNUC__` in addition to `__clang__`. It
        is sufficient to just check `__GNUC__`.
      Pull Request resolved: https://github.com/facebook/folly/pull/1095
      
      Reviewed By: Orvid
      
      Differential Revision: D14697480
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: cd6ec82c4235a1321ecdf240afaad7d5c0e99437
      6607a501
    • Yedidya Feldblum's avatar
      Consistent void return-type checks in DistributedMutex · 3291f635
      Yedidya Feldblum authored
      Summary: [Folly] Consistent `void` return-type checks in `DistributedMutex`. `const void` is a different type from `void`, but both match the `std::is_void` predicate.
      
      Reviewed By: aary
      
      Differential Revision: D14638815
      
      fbshipit-source-id: 96d1e18dfe1026b3881dafe5ceb816a8dd3add08
      3291f635
    • Giuseppe Ottaviano's avatar
      Return reference in small_vector::emplace_back · bbe656da
      Giuseppe Ottaviano authored
      Summary: Since C++17 `vector::emplace_back()` returns a reference to the new element, support that in `small_vector` too.
      
      Reviewed By: terrelln, luciang
      
      Differential Revision: D15007059
      
      fbshipit-source-id: 3873fd0097e3d50f7967f47fbecfa6ab20cc72c5
      bbe656da
    • Michael Park's avatar
      Changed the accessibility of `ThreadPoolExecutor`'s protected virtual functions. · 2bd32e7b
      Michael Park authored
      Summary: The virtual functions marked `protected` in `ThreadPoolExecutor` should be marked `protected` in `EDFThreadPoolExecutor`.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15008767
      
      fbshipit-source-id: 6bad51068a8b64f623643e0d0deb684ed6e2be22
      2bd32e7b
    • Shiva Shankar P's avatar
      Fix for build error when using -Werror=parentheses · de984b5a
      Shiva Shankar P authored
      Summary: as in title
      
      Differential Revision: D15005737
      
      fbshipit-source-id: 6ac0ff3d7498e505f0437dd5be76735d66eb953e
      de984b5a
    • Subodh Iyengar's avatar
      Remove getSelfCert and getPeerCert apis · 3ceffd7d
      Subodh Iyengar authored
      Summary:
      Remove getSelfCert and getPeerCert APIs from
      AsyncTransport.
      
      This removes an explicit dependency on the X509 type
      from openssl
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14970297
      
      fbshipit-source-id: b727789d3a37a57d4728709ab66a575d40176172
      3ceffd7d
  3. 18 Apr, 2019 1 commit
    • Joe Loser's avatar
      Do not define emplace_back_aux out-of-line in FBVector (#1077) · f844d2e1
      Joe Loser authored
      Summary:
      - Older versions of GCC required defining private member function
        `emplace_back_aux` out-of-line. That is, declare the member in-class and
        then provide the definition fully out of line.
      - These older versions of GCC are not supported anymore, so just define
        it inline as you would any other member function.
      Pull Request resolved: https://github.com/facebook/folly/pull/1077
      
      Reviewed By: meyering
      
      Differential Revision: D14591465
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 0ebfe55cec4e230c36c98ad595ec8dcfc98a211e
      f844d2e1
  4. 17 Apr, 2019 5 commits
    • Scott Wolchok's avatar
      Make Optional<int> usable as constexpr (if initialized to none) · b759bef8
      Scott Wolchok authored
      Summary: StorageTriviallyDestructible needed a constexpr ctor.
      
      Reviewed By: yfeldblum, ot, luciang
      
      Differential Revision: D14944492
      
      fbshipit-source-id: cd9d39d7cb0719e7830887f548eabcc0defa1aee
      b759bef8
    • Adam Simpkins's avatar
      use fb_github_project_workdir() for folly · a2b8b96a
      Adam Simpkins authored
      Summary:
      Update the folly spec to use `fb_github_project_workdir()` rather than just
      `github_project_workdir()`.
      
      This shouldn't have any impact for external github-based builds, but for our
      internal continuous integration builds this should make builds for downstream
      projects pick up the correct local version of folly that matches the commit of
      the downstream project that is being built.
      
      This behavior was unintentionally changed to not use the `fb_*` version in
      D10520960.
      
      Differential Revision: D14969380
      
      fbshipit-source-id: 000b10525821fb5e0312d1869198a68befa0bd91
      a2b8b96a
    • Doron Roberts-Kedes's avatar
      folly::ConcurrentHashMapSIMD - fix use after free · 6afebd2c
      Doron Roberts-Kedes authored
      Summary: The current order of retire and reclaim_nodes in clear() introduces a subtle bug which allows the hazptr library to destroy the Chunks array from reclaim_nodes, freeing the memory at chunks_, then continue reclaiming nodes which involves further access to chunks_.`
      
      Reviewed By: magedm
      
      Differential Revision: D14968860
      
      fbshipit-source-id: 1bc8e543ae54c3d0e26affb1fd352c58cc5ce897
      6afebd2c
    • Jeremy Lilley's avatar
      Fix serializedSizeZC() for IOBufQueue "packed" behavior & document · 662768f3
      Jeremy Lilley authored
      Summary:
      Recently, IOBufQueue started "packing" smaller IOBufs (i.e. <= 4KB) when serializing.
      This was helpful to avoid unnecessarily IOBuf chaining.
      
      That said, we did not update our serializedSizeZC() functions to emit an accurate
      memory estimate in the case that we did need to pack the IOBuf data. This changes
      to pass though the IOBuf size, if under the threshold.
      
      Also, add a few basic comments in the Protocol implementations about what
      serializedSize() means, because it's not entirely obvious to a new user that
      the results aren't intended to be accurate. And document what "ZC" is intended for.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14919060
      
      fbshipit-source-id: 18e9bd0c6b9e40ccd1006cffba36363c6f95ea41
      662768f3
    • Yedidya Feldblum's avatar
      Fix StaticSingletonManagerSansRaii cache · 201b0af5
      Yedidya Feldblum authored
      Summary: [Folly] Fix `StaticSingletonManagerSansRaii` cache.
      
      Reviewed By: aary
      
      Differential Revision: D14928194
      
      fbshipit-source-id: 6800c96ff40ec35e18a06b9c6a9f150a50695e37
      201b0af5
  5. 16 Apr, 2019 6 commits
    • Sean Purcell's avatar
      Fix specialization for atomic_notify_all · 24af36b0
      Sean Purcell authored
      Summary:
      The uint32_t futex specialization for atomic_notify_all didn't remove
      the Integer template parameter, causing calls with atomic<uint32_t> to not
      specialize properly.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14957311
      
      fbshipit-source-id: 063e0f6d18360d7e2ce8dd5bbf5c46c52a6fc833
      24af36b0
    • Kirk Shoop's avatar
      support if-constexpr macros on MSVC · fa67b121
      Kirk Shoop authored
      Summary: change the macros to work on MSVC
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14942488
      
      fbshipit-source-id: 12d6814230bd9b92b54603cd711d03cd8b5f8086
      fa67b121
    • Kirk Shoop's avatar
      shift the property forward decls to forward.h · 366747df
      Kirk Shoop authored
      Summary: reduces folly::Executor dependencies
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14939208
      
      fbshipit-source-id: bc354e838608eb8b25373ed5179e72acef813edd
      366747df
    • Kirk Shoop's avatar
      remove _v that are not yet supported · 6128f71c
      Kirk Shoop authored
      Summary:
      fixed some compile errors when building SMC with pushmi as a dependency
      
      some _v traits do not exist
      
      a specialization of ManualLifetime<void> was required
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14939161
      
      fbshipit-source-id: 76a1f05d7ce889d00fdf4a264e5e719fdb12d4ac
      6128f71c
    • Vitalii Kalinkin's avatar
      Removed unused type alias · 8e706ec6
      Vitalii Kalinkin authored
      Summary: `reference_type` is unused
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14944273
      
      fbshipit-source-id: f4c968735fcb7173e5ee256381455c81492e02df
      8e706ec6
    • Nick Terrell's avatar
      zstd-1.4.0 compatibility · 39afdc0b
      Nick Terrell authored
      Summary:
      In zstd-1.4.0 we've renamed one function used by folly. Add compatibility
      macros to work with both function names.
      
      Reviewed By: Cyan4973
      
      Differential Revision: D14941863
      
      fbshipit-source-id: deaf63b28ac8e4c3e6f6c0c192ed2d0e452ddca7
      39afdc0b
  6. 15 Apr, 2019 7 commits
    • Cornel Rat's avatar
      Remove recursion from TimedMutex to avoid fiber stack overflows · 10d27fea
      Cornel Rat authored
      Summary: Under heavy contention, lock will recurse several times. This can lead to fiber stack overflow.
      
      Differential Revision: D14936384
      
      fbshipit-source-id: e934569a9f742859655ba3ea888ebabd4d959651
      10d27fea
    • Krishna Kondaka's avatar
      Support for capturing metadata while doing folly json parsing · 231d1cff
      Krishna Kondaka authored
      Summary: Support for capturing metadata while doing folly json parsing
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13626597
      
      fbshipit-source-id: 8e7a26e23d966240d35c4f6d6104d9334a675a12
      231d1cff
    • Dan Melnic's avatar
      Let ThreadLocalPtr reset() synchronize with Accessor · a4ece81e
      Dan Melnic authored
      Summary: Let `ThreadLocalPtr` member `reset()` synchronize with member type `Accessor` lifetime, preventing data races that could happen if `reset()` is called while another thread is within the `Accessor` critical section.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14878801
      
      fbshipit-source-id: 4090c5749d08bee3fd9b50b23df6e716bc78c9c7
      a4ece81e
    • Kirk Shoop's avatar
      add flow support to on() · 6eb8dace
      Kirk Shoop authored
      Summary: add support for flow to `on()` - requested by Songqiao
      
      Reviewed By: ericniebler
      
      Differential Revision: D14814588
      
      fbshipit-source-id: 3989d0aa554a32482dcc15c1ba706d5604c95eb8
      6eb8dace
    • Kirk Shoop's avatar
      make transform work with move-only functions · 2d2aabcd
      Kirk Shoop authored
      Summary: Fixes bug in transform reported by rhodo
      
      Reviewed By: ericniebler
      
      Differential Revision: D14814574
      
      fbshipit-source-id: fdc3866ad56ced11e858869a24ca95b08295477d
      2d2aabcd
    • Doron Roberts-Kedes's avatar
      folly: Alias ConcurrentHashMapSIMD to use SIMDTable backend · 4ee0d411
      Doron Roberts-Kedes authored
      Summary: The Impl param is last so its a pain to switch between BucketTable and SIMDTable in the common case where only KeyType and ValueType are specified. This diff enables ConcurrentHashMapSIMD<key, value>.
      
      Reviewed By: djwatson
      
      Differential Revision: D14916671
      
      fbshipit-source-id: 980518179b87316ae344cbf96be4e6bcc032424e
      4ee0d411
    • Victor Zverovich's avatar
      Add fmt to Folly's open-source dependencies · 8a695b8f
      Victor Zverovich authored
      Reviewed By: yfeldblum
      
      Differential Revision: D14813810
      
      fbshipit-source-id: b6294f0b2e52bd062ad7b1d5977fbe68dec82d1b
      8a695b8f
  7. 14 Apr, 2019 1 commit
  8. 12 Apr, 2019 6 commits
    • Nick Terrell's avatar
      Fix UB in small_vector · 22b69cc8
      Nick Terrell authored
      Summary:
      `moveObjectsRightAndCreate()` did pointer arithmetic outside of the object,
      because it had a one before the beginning pointer. Instead, decrement the
      pointers before use.
      
      Reviewed By: ot
      
      Differential Revision: D14887926
      
      fbshipit-source-id: 198151d1eaef17e86cda800367480e0a8f7b2f49
      22b69cc8
    • Nick Terrell's avatar
      Fix small_vector insert for non-default constructible types · 21c6ab58
      Nick Terrell authored
      Summary:
      Instead of default constructing in `moveObjectsRight`, insert the objects
      directly into the hole. This has the added benefit of avoid a default
      construction. The creation function has to be careful to return references
      (rvalue, or lvalue) to avoid extra constructions without guaranteed NRVO.
      
      I've constructed the elements in reverse order since it is strange to copy
      backwards, then construct forwards, but don't have strong opinions, since
      either way is correct.
      
      Reviewed By: ot
      
      Differential Revision: D14883034
      
      fbshipit-source-id: bc0d19bf94705718500b80e2d6c202784134e7a5
      21c6ab58
    • Jorge Lopez Silva's avatar
      Add shim for void X509_STORE_CTX_set0_verified_chain. · 1f180ff8
      Jorge Lopez Silva authored
      Summary:
      In order to set the verified chain of a X509 store we need to be able to use X509_STORE_CTX_set0_verified_chain both for openssl 1.1.0 and previous versions.
      
      Proxygen needs this to complete the clang/platform007 upgrade.
      
      Reviewed By: Orvid
      
      Differential Revision: D14894384
      
      fbshipit-source-id: 378eb834b077469b666ad303f28f54af5caff990
      1f180ff8
    • Sean Purcell's avatar
      Add folly::hasher for empty tuples · c1527c03
      Sean Purcell authored
      Summary:
      This ensures that we can use any tuple type in maps/other places where
      hashes are useful.  Since there's only one value for an empty tuple, just
      return 0.
      
      Reviewed By: ot
      
      Differential Revision: D14898947
      
      fbshipit-source-id: 8fefab46df32a6cc56e43b02346bbefe4d4ec567
      c1527c03
    • Caleb Marchent's avatar
      Travis split out docker ipv6 enable (#1108) · 0d0b02a4
      Caleb Marchent authored
      Summary:
      Split out enable IPv6 on docker into its own script.
      Do not do this on MacOS hosts; where we would not be running in a docker container.
      use apt add-on rather; which automatically disabled for non-apt supporting OSes (MacOSX)
      Pull Request resolved: https://github.com/facebook/folly/pull/1108
      
      Reviewed By: vitaut
      
      Differential Revision: D14899358
      
      Pulled By: calebmarchent
      
      fbshipit-source-id: 342e7a37e27317018d98d77e8603c896f34b3bc6
      0d0b02a4
    • Laurent Stacul's avatar
      Fix warning 'redundant-move' (#1107) · c12e5941
      Laurent Stacul authored
      Summary:
      Hello Facebook,
      
      This small PR to fix the redundant std::move usage detected by gcc (GCC) 9.0.1 20190225 (experimental)
      
      ```
      /folly/BUILD/folly-2019.04.01.00/folly/executors/task_queue/PriorityLifoSemMPMCQueue.h:92:30: error: redundant move in return statement [-Werror=redundant-move]
         92 |         return std::move(item);
            |                              ^
      ```
      
      Stac
      Pull Request resolved: https://github.com/facebook/folly/pull/1107
      
      Reviewed By: Orvid
      
      Differential Revision: D14874144
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: c65a422c500606103192b3d9377a52b4abf5a653
      c12e5941
  9. 11 Apr, 2019 5 commits
    • Michael Park's avatar
      Introduced `folly/executors/EDFThreadPoolExecutor`. · 5bd275f0
      Michael Park authored
      Summary: This patch introduces an earliest-deadline-first (EDF) executor: `folly/executors/EDFThreadPoolExecutor`.
      
      Reviewed By: interwq
      
      Differential Revision: D13983430
      
      fbshipit-source-id: 0df9bc4a1cdbe9059489d1e1abad88b9e6d17ad9
      5bd275f0
    • Caleb Marchent's avatar
      fbcode_builder support for using Python virtualenv (#76) · 6eecca09
      Caleb Marchent authored
      Summary:
      Needs to be enabled by option PYTHON_VENV in the config.
      
      shell_builder.py sets up the venv and uses it once; calling activate
      
      For docker we set ENV; resulting in the virtual environment being present
      when the resulting container is run as well as at build time. This is also cleaner
      and easier to follow than re-asserting on each RUN step.
      
      For Lego builder we need to source activate on each command as environment
      will not persist between commands.
      
      While man on the posts say it makes no sense to use virtualenv within docker
      container, this method simplifies the process considerably as we can rely on the
      name pip being valid and we don't need to either ensure we are root or pass the
      --user flag to pip and setuptools.
      
      Pull Request resolved: https://github.com/facebookincubator/LogDevice/pull/76
      
      Reviewed By: wez
      
      Differential Revision: D14875633
      
      Pulled By: calebmarchent
      
      fbshipit-source-id: aabbcdd509d2a59fa36f8004032a052f014ce1ba
      6eecca09
    • Kirk Shoop's avatar
      add take_until · 5b474b9d
      Kirk Shoop authored
      Summary: add take_until algorithm
      
      Reviewed By: ericniebler
      
      Differential Revision: D13697233
      
      fbshipit-source-id: b2e060bc88cb652dc196e4915961d811a97b414d
      5b474b9d
    • Caleb Marchent's avatar
      Add .pyc to gitignore · 1689b2f7
      Caleb Marchent authored
      Reviewed By: wez
      
      Differential Revision: D14890912
      
      fbshipit-source-id: 7ea8f28348d27131cf896bd8b5669153211af591
      1689b2f7
    • Long Cheng's avatar
      Cleanup SemiFutureTest · de260dd8
      Long Cheng authored
      Summary:
      - Removed unused EventBase
      - Simplified
      ```
      auto f = p.getSemiFuture().toUnsafeFuture();
      auto sf = std::move(f).semi().defer(...);
      ```
      
      to
      
      ```
      auto sf = p.getSemiFuture().defer(...);
      ```
      
      - Corrected `semiFutureWithinNoValueReferenceWhenTimeOut`. it wasn't testing anything because the future is not waited for and if it's waited for, `callbackInput` has exception, not value.
      
      Reviewed By: LeeHowes
      
      Differential Revision: D14877386
      
      fbshipit-source-id: 03df59af0339b20aa9e85506640e89cc383f3b9a
      de260dd8