1. 01 Nov, 2016 1 commit
    • Andrii Grynenko's avatar
      Simplify the API exposed by BoostContextCompatibility · 10191891
      Andrii Grynenko authored
      Summary: Instead of exposing raw jumpContext, it now exposes a higher-level FiberImpl class, which can be extended for newer versions of jump_fcontext.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4099849
      
      fbshipit-source-id: 28c7ce32284a0109cf040c264d46a31a45867934
      10191891
  2. 31 Oct, 2016 8 commits
    • Andrii Grynenko's avatar
      Simplify activateFiber()/deactivateFiber() · 9b30deab
      Andrii Grynenko authored
      Summary: A cleanup in preparation to make folly::fibers work with newer boost.
      
      Reviewed By: jsedgwick
      
      Differential Revision: D4093947
      
      fbshipit-source-id: e9a0aaeb915c40af96282169d4758afe572f2dd8
      9b30deab
    • Maged Michael's avatar
      Update hazard pointers interface and implementation · c45de72c
      Maged Michael authored
      Summary:
      The main purpose of this diff and this library at this point is to be a public reference for the C++ standard committee and whoever is interested in the proposal to the committee.
      
      This diff aims to be consistent with the latest version of the proposal (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0233r2.pdf).
      
      The current interface proposal focuses on the core components (domain, object base, and raii owner). Once, that part is settled we can add to the interface:
      - Thread local options (thread caching of hazard pointers and private storage of retired objects)
      - Programmer control of reclamation (when and by which threads)
      Also, at this point the implementation does not optimize memory ordering.
      
      I removed hazptr_domain::try_reclaim() from the public interface at this point. The latest update to interface aims to relieve the programmer from the need to take spacial precautions against shutdown fiascos involving reclamation functions of objects stored by the default domain. Please let me know if you have any concerns about this.
      
      Having said that about the current purpose of this library, I really appreciate any comments (in this diff or separately) on the interface in general and any suggestions for the eventual optimized implementation.
      
      Reviewed By: davidtgoldblatt
      
      Differential Revision: D4104381
      
      fbshipit-source-id: df98adf6fd9b7a93406cb8eeca8fe2ad12388139
      c45de72c
    • Lucian Grijincu's avatar
      folly: AsyncSignalHandler: update comments to match code · 21d7adcd
      Lucian Grijincu authored
      Summary: #accept2ship
      
      Reviewed By: jsedgwick
      
      Differential Revision: D4105140
      
      fbshipit-source-id: eca1f7066e514ec3c5d316f974edc34e03872784
      21d7adcd
    • Christopher Dykes's avatar
      Access the individual words of an IPv6 address correctly in IPAddressTest on Windows · ec1cb4c0
      Christopher Dykes authored
      Summary: Winsock defines the internals of `in6_addr` in its own way, so we have to account for that.
      
      Reviewed By: jsedgwick
      
      Differential Revision: D4099453
      
      fbshipit-source-id: c0ebb4e2017f61bed7d5d63058161ef3f16f9a65
      ec1cb4c0
    • Christopher Dykes's avatar
      In the portability implementation of sendmsg return a partial message send if it would block · 210b5664
      Christopher Dykes authored
      Summary: If multiple iovs are passed to sendmsg, sendmsg is supposed to return the number of bytes sent if it would block, but only if the number of bytes sent is greater than 0.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4099691
      
      fbshipit-source-id: e58fa71604966129b1fbd418c24b1bf012060428
      210b5664
    • Ameya Limaye's avatar
      Implement AtomicBatchDispatcher in folly::fibers · 7aa24338
      Ameya Limaye authored
      Summary:
      Implement AtomicBatchDispatcher in folly::fibers
      - Details about how to use the added functionality can be found
        in the doc comment for class AtomicBatchDispatcher.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D4054148
      
      fbshipit-source-id: 090272eeab8c8abb15d5e400e52725853fcfc364
      7aa24338
    • Kyle Nekritz's avatar
      Use MSG_MORE instead of 2 setsockopt calls on every AsyncSSLSocket write. · e0277a6c
      Kyle Nekritz authored
      Summary: Previously we set the cork option on the socket before making multiple writes, and then unset it after, which elip found was hurting perf with 2 extra syscalls. The cork logic was also not the same as the buffer combining logic, which made us often set cork even when only doing one write.
      
      Reviewed By: djwatson
      
      Differential Revision: D4058357
      
      fbshipit-source-id: 1a07447ff5e027751e455a2403e0042bf67cb1c5
      e0277a6c
    • Nathan Bronson's avatar
      improvements to folly::doNotOptimizeAway · 81d9192f
      Nathan Bronson authored
      Summary:
      A common failure mode for folly::doNotOptimizeAway is to pass it a
      pointer to a complex object that the caller wants to ensure is fully
      calculated, which doesn't actually ensure that.  Also, the GCC and
      MSVC implementations used inline assembly with an in-out parameter,
      which causes a store.  A survey of many usages of doNotOptimizeAway
      found only 1 that relies on this make-unpredictable behavior.
      
      This diff makes doNotOptimizeAway(&x) equivalent to doNotOptimizeAway(x)
      for GCC and clang, and makes it a read-only sink.  For the rare
      case that the benchmark wants to disable subexpression elimination,
      constant propagation, or power reduction, there is a new function
      makeUnpredictable.  It also merges the clang and GCC implementations,
      removing a potential bias in our microbenchmarks.
      
      Reviewed By: davidtgoldblatt
      
      Differential Revision: D4074670
      
      fbshipit-source-id: 43f02e7fe149147bb172babe77787dea06e098fa
      81d9192f
  3. 29 Oct, 2016 1 commit
  4. 28 Oct, 2016 1 commit
    • Christopher Dykes's avatar
      Don't abort when calling qfind_first_byte_of_sse42 without compiler support for SSE 4.2 · 5c379929
      Christopher Dykes authored
      Summary:
      If Folly was compiled without support for SSE 4.2, but this function ends up getting called, we'd abort due to the check failing.
      To solve this, just don't do the check and fall back to the non-sse version.
      
      This is reasonable because it means that the code calling `qfind_first_byte_of_sse42` only needs to care whether there is CPU support for SSE 4.2, not whether we were able to actually implement the search with SSE 4.2 based on compiler support.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4096645
      
      fbshipit-source-id: d26a791c09f61595e40c84c47a7a2596b9b69c1e
      5c379929
  5. 27 Oct, 2016 1 commit
    • Andrew Gallagher's avatar
      folly/experimental/hazptr: mark static local as "library-local" · b7e1694c
      Andrew Gallagher authored
      Summary:
      When using `-fvisibility-inlines-hidden` or using C/C++ shared libs
      transitively from a Python binary, static locals in inline functions
      can potentially have more than one definition at runtime.  This diff
      explicitly marks this static local as safe for this scenario.
      
      Reviewed By: djwatson
      
      Differential Revision: D4082831
      
      fbshipit-source-id: 75616ac26a39f44691ef59b889ea555e9daa391b
      b7e1694c
  6. 26 Oct, 2016 2 commits
    • Giuseppe Ottaviano's avatar
      Add default constructor to dynamic, make other constructors simpler and stricter · 94e96497
      Giuseppe Ottaviano authored
      Summary:
      Now that the initializer list syntax has been removed we can add a default constructor.
      Also,
      - The `dynamic(T)` constructor was unconstrained, so it would match any type but then fail to compile (as a side effect, `is_convertible<T, dynamic>` would be always true). This also leaked the implementation details of `Array` and `Object`, as they were accepted as arguments. The diff makes the constructor accept only integral and float arguments, and all other types are SFINAEd out.
      - `dynamic(Iterator, Iterator)` is made `explicit` to avoid accepting statements like `dynamic d = {"a", "b"};`.
      - `object(...)` methods are simplified.
      
      Reviewed By: luciang
      
      Differential Revision: D4065021
      
      fbshipit-source-id: ac289da7bece67c674b7036b7b51d5e016b297e5
      94e96497
    • Andrew Gallagher's avatar
      Move inline functions with static-locals to implementation files · e4431011
      Andrew Gallagher authored
      Summary:
      This refactors inline functions defined in headers which had static locals
      so that their definition is moved to the corresponding implementation file.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4049175
      
      fbshipit-source-id: 56eeb82eb23b04c3b9940d803d05050949aa5ef9
      e4431011
  7. 25 Oct, 2016 5 commits
    • Matthieu Martin's avatar
      Small rewording in folly Benchmark comment · e0cb729e
      Matthieu Martin authored
      Summary: A bit more clear
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4075931
      
      fbshipit-source-id: 1398500336d412b5e7663ef1e67b20a329ce2979
      e0cb729e
    • Michael Lee's avatar
      Fix maybe-uninitialized warning in Conv.h · 9db297bf
      Michael Lee authored
      Summary: Some compilers think result may be uninitialized
      
      Reviewed By: francis-ma
      
      Differential Revision: D4074526
      
      fbshipit-source-id: 5df4568cfa5eb8f3b2993a82b831fd5e4028a281
      9db297bf
    • Philip Pronin's avatar
      fix Expected<..., eUnion> move / copy ctor · c1ead85d
      Philip Pronin authored
      Summary:
      Consider `Expected<..., eUnion>(Expected&&)` ctor, where
      `ExpectedUnion` move ctor would be called first, which is noop leaving
      `which_`  uninitialized; then `MoveConstructible` ctor is executed, calling
      `assignValue()`, which performs action depending on uninitialized `which_`.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4073199
      
      fbshipit-source-id: 623660e7047afcebf9f72d83f91f84ff6078090f
      c1ead85d
    • Ben Maurer's avatar
      prevPowTwo / faster bit operations · 02548aa0
      Ben Maurer authored
      Summary:
      Add a prevPowTwo method to bits.h and optimize the current code for
      GCCs output.
      
      Reviewed By: ot
      
      Differential Revision: D4072341
      
      fbshipit-source-id: 6e949d0bfcf88ff8500022939d08a2b5aa9e00c9
      02548aa0
    • Tudor Bosman's avatar
      No need for libdwarf, only the header file matters · 78753f62
      Tudor Bosman authored
      Summary:
      folly/experimental/symbolizer doesn't actually link with libdwarf, it only requires dwarf.h.
      Closes https://github.com/facebook/folly/pull/501
      
      Differential Revision: D4068438
      
      Pulled By: djwatson
      
      fbshipit-source-id: 6339eabf8fceac300caafb478c003833768125fd
      78753f62
  8. 24 Oct, 2016 3 commits
    • Subodh Iyengar's avatar
      Add smart pointer types for ec · d724e512
      Subodh Iyengar authored
      Summary:
      Add smart pointer types for ec groups
      and points
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4066848
      
      fbshipit-source-id: f8a5c59cf902584e5a4bea7265834fcc8898677b
      d724e512
    • James Sedgwick's avatar
      sync README · aa046701
      James Sedgwick authored
      Summary: as above
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4066250
      
      fbshipit-source-id: 7dfe07656dd338ec42fcd966328e46331202bf58
      aa046701
    • Sven Over's avatar
      add folly::Function::asSharedProxy · 62001f5e
      Sven Over authored
      Summary:
      This diff adds a method to folly::Function that moves the
      Function object into a copyable, callable proxy object.
      
      folly::Function already has the asStdFunction method, which
      does the same, but wraps the proxy object in a std::function.
      When a copyable shared-state proxy of a folly::Function is needed,
      it is not necessarily to turn it into a std::function.
      If instead the shared proxy will be passed to several functions
      taking folly::Function, what happens is the folly::Function
      is moved on the heap, a shared_ptr is put into a std::function,
      and that is wrapped in a new folly::Function, which always
      requires a memory allocation, because std::function is not
      noexcept-movable. When using asSharedProxy instead, an
      unspecified copyable type is returned that can implicitly
      converted into a folly::Function, but without an additional
      memory allocation at this point.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4048621
      
      fbshipit-source-id: b642027b0a6957058fe0089cceeb657ec52e8669
      62001f5e
  9. 22 Oct, 2016 1 commit
  10. 21 Oct, 2016 1 commit
    • Eric Niebler's avatar
      Reverted commit D3927397 · fbf4e10c
      Eric Niebler authored
      Summary: Someone debugged a runtime crash and traced it back to code like: `vector<fbstring>{{"this", "that"}}`. Presumably the user thought they were passing an initializer list of strings to the vector constructor. Instead, they constructed a single fbstring with two char pointers pointing into //different// strings. With the appropriate fbstring constructors, we can flag this as invalid at compile-time.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D3927397
      
      fbshipit-source-id: ab61e1e8498ec99592a2a7726eaf1cb6324f1455
      fbf4e10c
  11. 20 Oct, 2016 5 commits
    • Laurent Demailly's avatar
      improve documentation of custom singleton creation through an example · cbec2f20
      Laurent Demailly authored
      Summary:
      improve documentation of custom singleton creation through an example
      (from fbcode SIOF thread suggestion)
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4053322
      
      fbshipit-source-id: e9c2ef3d1ef43d52c0bf0a601d94c017047a23a3
      cbec2f20
    • Eric Niebler's avatar
      Prevent erroneous code like vector<fbstring>{{"this", "that"}} from compiling · d8d93ebf
      Eric Niebler authored
      Summary: Someone debugged a runtime crash and traced it back to code like: `vector<fbstring>{{"this", "that"}}`. Presumably the user thought they were passing an initializer list of strings to the vector constructor. Instead, they constructed a single fbstring with two char pointers pointing into //different// strings. With the appropriate fbstring constructors, we can flag this as invalid at compile-time.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D3927397
      
      fbshipit-source-id: a5f335073fb55bbb703a23f06874238cbdb5d91a
      d8d93ebf
    • Jim Meyering's avatar
      folly/Synchronized.h: avoid shadowing warnings · d2e50930
      Jim Meyering authored
      Summary:
      Nested uses of SYNCHRONIZED (and related) macros leads
      inevitably to shadowed variable declarations.
      There is already a use of FOLLY_GCC_DISABLE_WARNING(shadow)
      to disable -Wshadow in that code, but obviously, that cannot
      help with the new options, so do similar for them via
      the new FOLLY_GCC_DISABLE_NEW_SHADOW_WARNINGS.
      
      Depends on D4041696
      
      Reviewed By: markisaa
      
      Differential Revision: D4041728
      
      fbshipit-source-id: b85fb3452f6855d359f9b910abbd02cf8433f3f7
      d2e50930
    • Jim Meyering's avatar
      configure.ac: check for -Wshadow-local and -Wshadow-compatible-local · 9047707e
      Jim Meyering authored
      Summary:
      Add a configure-time check for whether -Wshadow-local and
      -Wshadow-compatible-local are supported.  If so, arrange to
      define HAVE_SHADOW_LOCAL_WARNINGS.
      
      In Portability.h, use that new symbol to choose whether
      to define FOLLY_GCC_DISABLE_NEW_SHADOW_WARNINGS, which
      used pragmas to disable those new warnings.
      
      Differential Revision: D4041696
      
      fbshipit-source-id: 520ee88ae55147a13d0a045aca7d86567a8da99d
      9047707e
    • Shubhanshu Agrawal's avatar
      add missing includes · 8b4722fa
      Shubhanshu Agrawal authored
      Summary: add missing includes in folly fibers.q
      
      Reviewed By: A5he
      
      Differential Revision: D4036830
      
      fbshipit-source-id: 4dcb87377979f2875ba31b4869c2637a82298957
      8b4722fa
  12. 19 Oct, 2016 11 commits