1. 05 Dec, 2018 4 commits
    • Yedidya Feldblum's avatar
      Allow StringPiece construction from string with custom allocator · f53901c9
      Yedidya Feldblum authored
      Summary: [Folly] Allow `StringPiece` construction from `string` with custom allocator.
      
      Reviewed By: nbronson
      
      Differential Revision: D9494207
      
      fbshipit-source-id: 22b6beb7e5718f69aa283431ad49dd36295e0825
      f53901c9
    • Yedidya Feldblum's avatar
      Let SingletonHolder impl be class member type · f2654daf
      Yedidya Feldblum authored
      Summary:
      [Folly] Let `SingletonHolder` impl be class member type v.s. function local type, which for arbitrary magical reasons improves rtti/debuginfo letting the debugger see the type exactly.
      
      Could also be done by extracting `SingletonHolderImpl` as a top-level type, but that would require an additional `friend` declaration and class member type works.
      
      Reviewed By: pixelb
      
      Differential Revision: D13333184
      
      fbshipit-source-id: 7de4f8c16706acb18c6869b5dcd0b9c6952efc46
      f2654daf
    • Yedidya Feldblum's avatar
      Fix ordering between FOLLY_HAS_EXCEPTIONS and kHasExceptions · 8d228ac4
      Yedidya Feldblum authored
      Summary: [Folly] Fix ordering between `FOLLY_HAS_EXCEPTIONS` and `kHasExceptions` definitions.
      
      Reviewed By: swolchok
      
      Differential Revision: D13338301
      
      fbshipit-source-id: 855dbf7ba42eb118f84ffb84d2520c7dfc49cf39
      8d228ac4
    • Phil Willoughby's avatar
      googletest's PrintTo for folly strings · d42a8052
      Phil Willoughby authored
      Summary:
      Prints StringPiece/FixedString/fbstring like a string and not like a vector of char when implicitly printed by googletest/googlemock.
      
      The order of printing precedence within googletest is:
      * ADL `PrintTo(T const&, ostream*)`
      * Gtest's container-printer for anything that looks like a container
      * ADL `ostream& operator<<(ostream&, T const&)`
      
      Unfortunately you need to include the <folly/test/TestUtils.h> header in every test to have this functionality. The googletest mechanism for overloading this means we can't do it in the main headers without introducing a dependency from them to googletest.
      
      Reviewed By: yfeldblum, luciang
      
      Differential Revision: D13306040
      
      fbshipit-source-id: 4e8252d377835dad04625d84a0cae7c0713ce8af
      d42a8052
  2. 04 Dec, 2018 5 commits
    • Dan Melnic's avatar
      Fix broken opt build due to unused var warning · 62080229
      Dan Melnic authored
      Summary: Fix broken opt build due to unused var warning
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13317777
      
      fbshipit-source-id: 9e4928558e0514bdb5ab21e78b026c5c1a44a380
      62080229
    • Nathan Bronson's avatar
      refactor F14Fast so it doesn't expose F14Vector-only features · a2abde96
      Nathan Bronson authored
      Summary:
      F14FastMap heuristically selects either F14ValueMap or
      F14VectorMap at compile time (same for F14FastSet).  F14VectorMap has
      stronger iteration guarantees than the other unordered associative
      containers, including providing a reverse iterator.  This diff refactors
      F14FastMap so that even when it uses the same policy as F14VectorMap it
      doesn't expose these additional guarantees.
      
      This is a precursor to extending FOLLY_F14_PERTURB_INSERTION_ORDER to
      all F14FastMap and F14FastSet.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13303823
      
      fbshipit-source-id: 5feea3d1f8cb809ceb2c4f79a7cc1bc7e447768f
      a2abde96
    • Andrii Grynenko's avatar
      Drop updates if value didn't change · 1cdb0342
      Andrii Grynenko authored
      Summary: If observer generator function returned the same shared_ptr it's safe to not propagate such an update.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13249675
      
      fbshipit-source-id: 334c33e791b664eaec3c2698009f138bef04f8a6
      1cdb0342
    • Greg McGary's avatar
      Support disabling x86 static tracepoints · 7625683a
      Greg McGary authored
      Summary: Support disabling x86 static tracepoints.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13293303
      
      fbshipit-source-id: e8578ee1d855aaf33eeacbc1e804608ab65449d5
      7625683a
    • Rachana Nandan's avatar
      add support to setReuseAddr in AsyncUDPServerSocket · e39e166b
      Rachana Nandan authored
      Summary: add an api in AsyncUDPServerSocket, to enable Address reuse
      
      Reviewed By: udippant
      
      Differential Revision: D13306371
      
      fbshipit-source-id: ac19a89af5694b181fcd7639a5d566684c2adc92
      e39e166b
  3. 03 Dec, 2018 5 commits
  4. 01 Dec, 2018 4 commits
  5. 30 Nov, 2018 4 commits
    • Subodh Iyengar's avatar
      change default for REUSEADDR to false · 21be7c3d
      Subodh Iyengar authored
      Summary:
      A default value of true for SO_REUSEADDR is dangerous.
      SO_REUSEADDR has several issues. For example if SO_REUSEADDR
      is used to bind to a socket which is already bound but not connected,
      the kernel will allow this operation to complete. This can cause overlapping
      data. https://www.spinics.net/lists/netdev/msg206437.html
      
      Looking at use cases of AsyncUDPSocket it does not look like people depend
      on this behavior of AsyncUDPSocket and this was first introduced in thrift for
      no reason.
      
      This changes the behavior back to false.
      
      Reviewed By: yfeldblum, djwatson
      
      Differential Revision: D13274704
      
      fbshipit-source-id: 391cf1bdd3f633bee38c230fcd9f1403ea950c3b
      21be7c3d
    • Nathan Bronson's avatar
      randomize folly::dynamic and most F14 map and set insert order in debug builds · 44e30c29
      Nathan Bronson authored
      Summary:
      It's easy to accidentally rely on the relationship between
      insert and iteration order in unordered containers.  This diff adds some
      randomization to the insertion order within an F14 chunk when compiled in
      debug mode.  This isn't full randomization of the order, but is enough to
      break tests that rely on the iteration order of F14 maps and sets as small
      as two elements.
      
      This diff applies randomization to folly::dynamic object, F14NodeSet,
      F14NodeMap, F14ValueSet, F14ValueMap, F14FastSet for small (< 24 bytes)
      value_type, and F14FastSet for small value_type.
      
      The long-term plan is to randomize insertion order for all F14FastSet
      and F14FastMap, leaving iteration order deterministic only for explicit
      uses of F14VectorSet and F14VectorMap.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13099681
      
      fbshipit-source-id: 35b3174a8afbc6cef27d2080adc5a01e85154dcd
      44e30c29
    • Doron Roberts-Kedes's avatar
      DeterministicSchedule: Introduce BufferedAtomic · 140f6df7
      Doron Roberts-Kedes authored
      Summary:
      Mimic the atomic history buffers in relacy. This diff allows older values for atomics to be returned as long as the memory model is respected. Enforce the memory model with vector clocks (ThreadTimestamps).
      
      Depends on D10418223
      
      Reviewed By: djwatson
      
      Differential Revision: D10418450
      
      fbshipit-source-id: 0556259e96d512030ff9924bbd5aa0f79a38dfff
      140f6df7
    • Nathan Bronson's avatar
      fix heterogeneous lookup for non-transitive is_convertible · e1766e5e
      Nathan Bronson authored
      Summary:
      In most cases two implicit conversions can be chained to perform
      an explicit construction, but that is not the case when the intermediate
      type has a template parameter that can't be deduced. This interferes
      with heterogeneous lookup when the transparent hasher or equality functor
      work by implicit conversion to a base type (like folly::Range). This diff
      disables heteregeneous find in cases where the hash functor or equality
      functor are not invocable.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13264397
      
      fbshipit-source-id: 082c3215e81ab58f3fa9519da872642e45b16245
      e1766e5e
  6. 29 Nov, 2018 10 commits
    • Scott Wolchok's avatar
      Don't include FBVector.h in String.h · 179e9a12
      Scott Wolchok authored
      Summary: No need for String to import fbvector.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13007715
      
      fbshipit-source-id: c61639a04273f14dd3daf230ee6ed9ade93d058e
      179e9a12
    • Nathan Bronson's avatar
      improve sorted_vector_{map,set} compatibility with std::{map,set} · cb838d11
      Nathan Bronson authored
      Summary:
      This diff fixes a few rough edges in the folly::sorted_vector_set
      and folly::sorted_vector_map APIs. It makes the default constructor
      implicit; it adds emplace to sorted_vector_set; and it adds bulk insertion
      via std::initializer_list to sorted_vector_set and sorted_vector_map.
      This doesn't fix all incompatibilities. It also changes sorted_vector_set
      and sorted_vector_map insertion so that they do not copy a value_type
      const& argument if the key is already in the container.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13255279
      
      fbshipit-source-id: dc5a16ea729e2a32a77f82ec0eacaeaf7854cd1a
      cb838d11
    • Andrii Grynenko's avatar
      Fix Executor::KeepAlive use in thenError · 0895c3af
      Andrii Grynenko authored
      Summary: onError destroys the Core, which holds a Executor::KeepAlive, so we have to capture it before calling onError.
      
      Differential Revision: D13250857
      
      fbshipit-source-id: 5f458765f0b8ccb225502c26413ff7bfdd46fe15
      0895c3af
    • Nathan Bronson's avatar
      silence false-positive compiler warning · a9a8d1d0
      Nathan Bronson authored
      Summary:
      Add static casts near memcpy to silence a compiler warning
      for a memcpy call site whose control flow is correctly guarded by the
      appropriate type_traits check.
      
      Reviewed By: yfeldblum, shixiao
      
      Differential Revision: D13241617
      
      fbshipit-source-id: 747b6cd1bb32c0971e805d1a4a9cdc5da6c73ea9
      a9a8d1d0
    • Yedidya Feldblum's avatar
      Extract getSingletonStackTrace · 6b1fb6fa
      Yedidya Feldblum authored
      Summary:
      [Folly] Extract `getSingletonStackTrace` to its own detail library.
      
      For now, just do conditional definition, avoiding the atomic and the global constructor.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D13213446
      
      fbshipit-source-id: 95af5701d1c29e0ef24ba48e9bcec9ec565b31b4
      6b1fb6fa
    • Yedidya Feldblum's avatar
      Let SingletonThreadLocal creator return derived type · da7f6959
      Yedidya Feldblum authored
      Summary: [Folly] Let `SingletonThreadLocal` creator return derived type. This is a different interface for the creator type, and means supporting non-moveable/non-copyable types with an extra pointer indirection pre-C++17.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D13165769
      
      fbshipit-source-id: 39f2b5fed48342dd3178a20838af50c43aabee86
      da7f6959
    • Yedidya Feldblum's avatar
      Let createGlobal return a reference · ed0cacef
      Yedidya Feldblum authored
      Summary: [Folly] Let `createGlobal` return a reference rather than a pointer, since it always returns non-`nullptr`.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D13116591
      
      fbshipit-source-id: 5618c2e8a5a04b158ac45a3e43b02eb37c6af8c1
      ed0cacef
    • Yedidya Feldblum's avatar
      A small inline fast path for StaticSingletonManager::create · ec8d84ff
      Yedidya Feldblum authored
      Summary: [Folly] A small inline fast path for `StaticSingletonManager::create`.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D13114824
      
      fbshipit-source-id: b72b6066b7ff5401e37e75aa1c8102e6536e9740
      ec8d84ff
    • Yedidya Feldblum's avatar
      Remove StaticSingletonManager support for creator function · 592b2621
      Yedidya Feldblum authored
      Summary: [Folly] Remove `StaticSingletonManager` support for creator function. In general, derived types may be used instead.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D13114823
      
      fbshipit-source-id: ecd781a1e11f1726e5e8689874e7f4473d21ecb0
      592b2621
    • Yedidya Feldblum's avatar
      Let SingletonHolder call createGlobal with no args · 60c9115b
      Yedidya Feldblum authored
      Summary: [Folly] Let `SingletonHolder` call createGlobal with no args. This was the only non-test call-site calling it with an argumnet.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D13114710
      
      fbshipit-source-id: 55205a69d25966ee9fb09d5daefed1f9ecad80b9
      60c9115b
  7. 28 Nov, 2018 2 commits
    • Jon Maltiel Swenson's avatar
      Remove incorrect call to dcheckIsInEventBaseThread · 9aede428
      Jon Maltiel Swenson authored
      Summary: The point of this diff is that `AsyncSocket::closeNow()` should be able to be called on a socket that is not attached to an event base. Removing an overly protective `dcheckIsInEventBaseThread()` enables this.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13219611
      
      fbshipit-source-id: ca57995e1a96d2b937bccf311d3f6b903abc33b7
      9aede428
    • Orvid King's avatar
      Just define STATUS_HANDLE_NOT_CLOSABLE · 8c7e748d
      Orvid King authored
      Summary: Multiple windows headers define a subset of the full list of status types and it's a mess, so just define the only extra one we need manually to avoid the warning spew.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13225857
      
      fbshipit-source-id: e963194a8c14046e7884abb4bcb265442b6978f7
      8c7e748d
  8. 27 Nov, 2018 6 commits
    • Kirk Shoop's avatar
      change abort to terminate · 77e5e1b5
      Kirk Shoop authored
      Summary: search replace abort with terminate to fix build errors
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13106734
      
      fbshipit-source-id: 146367a7fdbed9c945cb32cfdcb5ac521a1c861b
      77e5e1b5
    • Abhay Bothra's avatar
      FunctionScheduler: Fix typo in comment · f3260585
      Abhay Bothra authored
      Summary: Fixes minor typo and word re-ordering in comment
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13122529
      
      fbshipit-source-id: b713099dc06be8fdd525ba9d9e2fafd5511bd7f1
      f3260585
    • David Rothera's avatar
      Define macro for disabling thread and address sanitizer and use on range SSE methods · 7b82832d
      David Rothera authored
      Summary: [folly] Define macro for disabling thread sanitizer and use on range SSE methods
      
      Reviewed By: yfeldblum, pixelb
      
      Differential Revision: D13192417
      
      fbshipit-source-id: 23774f8e0227c4c557d51f557b4df5e79f641386
      7b82832d
    • Yedidya Feldblum's avatar
      Use static constexpr WaitOptions in UnboundedQueue · 79c28f03
      Yedidya Feldblum authored
      Summary: [Folly] Use `static constexpr WaitOptions` in `UnboundedQueue` to save one store-word-to-stack instruction in the inlined fast path with gcc.
      
      Reviewed By: magedm
      
      Differential Revision: D13187890
      
      fbshipit-source-id: 79a4f4ba585ed8abaebef344081bd364144f6cf8
      79c28f03
    • Yedidya Feldblum's avatar
      Some functions to look at UnboundedQueue inlined code · 875819ab
      Yedidya Feldblum authored
      Summary: [Folly] Some functions to look at `UnboundedQueue` inlined native code. Doing everything runs into the combinatorial explosion wall, but do USPSC and UMPMC dequeue variants.
      
      Reviewed By: magedm
      
      Differential Revision: D13187510
      
      fbshipit-source-id: 676e00c770682d44a87d0f8d81b050629bc05820
      875819ab
    • Yedidya Feldblum's avatar
      UnboundedQueue::dequeue overload returning value type · 31c7bffd
      Yedidya Feldblum authored
      Summary:
      [Folly] `UnboundedQueue::dequeue` overload returning value type.
      
      For completeness.
      
      Reviewed By: magedm
      
      Differential Revision: D13176745
      
      fbshipit-source-id: 9ab7ee36539924b2f9dbd401ec4730151ebf712b
      31c7bffd