1. 20 Sep, 2018 3 commits
    • Andrii Grynenko's avatar
      Remove non-destructive timed wait() from the public API · d1caa885
      Andrii Grynenko authored
      Summary: This change will allow simplifying DeferredExecutor and implementing both wait() and timed wait() using custom executors.
      
      Reviewed By: LeeHowes
      
      Differential Revision: D9890644
      
      fbshipit-source-id: ad8472213e7022ccc23b4a9c48f8b9c4b9c70dfa
      d1caa885
    • Andrii Grynenko's avatar
      Make blockingWait fibers compatible · 959e3cff
      Andrii Grynenko authored
      Summary: This will make it easy to use coro primitives from fibers code.
      
      Reviewed By: lewissbaker
      
      Differential Revision: D9932012
      
      fbshipit-source-id: cd0524ccfee7bee9405f29ddaa3533084b18b38b
      959e3cff
    • Yedidya Feldblum's avatar
      Fix move-of-const in ThreadWheelTimekeeper · 25612675
      Yedidya Feldblum authored
      Summary: [Folly] Fix move-of-const in `ThreadWheelTimekeeper`.
      
      Reviewed By: capickett
      
      Differential Revision: D9950653
      
      fbshipit-source-id: 76d45cdac1026c41de73489936c4afdac3f57fd7
      25612675
  2. 19 Sep, 2018 4 commits
    • Pragash Sivasundaram's avatar
      Adding functions to the cFollyFuture cpp Class Definition · 2f214cc1
      Pragash Sivasundaram authored
      Summary: - Adding hasValue() function
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9926823
      
      fbshipit-source-id: 2316eb67cd6a906850ad0dec913988f116f840d6
      2f214cc1
    • Yedidya Feldblum's avatar
      Just use constexpr keyword in folly/lang/Bits.h · 1876763a
      Yedidya Feldblum authored
      Summary: [Folly] Just use `constexpr` keyword in `folly/lang/Bits.h` - since they are now template functions, `constexpr` is okay even when all instantiations would be non-`constexpr`.
      
      Reviewed By: Orvid
      
      Differential Revision: D9934124
      
      fbshipit-source-id: cdf4fc87262a058af6f63e28bb2c390e44f2cad0
      1876763a
    • Xiao Shi's avatar
      implement `commutative_hash_combine_*` for unordered containers · e06814f9
      Xiao Shi authored
      Summary:
      `hash_range(c.begin(), c.end()` combines hashes of individual elements of a
      container in an ordered manner. This diff provides the equivalent for
      unordered containers.
      
      Unlike `hash_range`, `commutative_hash_combine_range` defaults to `folly::Hash`
      as its hasher; it mixes the individual hash if the `hasher` is not deemed
      avalanching.
      
      It uses a commutative accumulator described in this paper:
      https://www.preprints.org/manuscript/201710.0192/v1/download
      In the experiments in the paper, the symmetric polynomial yielded a better
      spread of hash values and lower collision rates than `+` or `xor`.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9688687
      
      fbshipit-source-id: c812b25975a53a868d98f78645146cb8bdbb5c32
      e06814f9
    • Jonathan Sailor's avatar
      add a comment about some sketchy behavior · 34b79e43
      Jonathan Sailor authored
      Summary:
      `IOThreadPoolExecutor.pickThread()` has some sketchy behavior where, if the
      threadpool has no threads, it returns `*thisThread_` unconditionally. My read
      is that this can happen only in two cases.
      
      First, `getEventBase` could be called from outside the threadpool while the
      threadpool has no threads (either because it was stopped or because somebody
      set it to 0 threads.) In this case, `*thisThread_` will be nullptr and
      `getEventBase` will try to immediately dereference it, (hopefully) crashing.
      
      Second, `getEventBase` could be called from inside the threadpool, but from a
      thread which is shutting down. This is also somewhat dodgy, because by the time
      we get to this case (`me && !contains(threadList_.get(), me)`), stopThreads
      will have already called terminateLoopSoon on the evb. While it would still be
      possible to use the evb safely (in the sense that one could write a program
      which does not hit undefined behavior), I think it'd be strongly dependent on
      the way IOTPE and EventBase are currently implemented and therefore probably a
      bad idea.
      
      I don't have the bandwidth to really dig into this now and figure out what the
      correct behavior is, or how to fix people who might be relying on the broken
      one. But I figure I can at least leave a comment behind that this is something
      maybe worth looking into.
      
      Reviewed By: meyering
      
      Differential Revision: D9754314
      
      fbshipit-source-id: 6851d49e634707cacc803a95763eda023967b932
      34b79e43
  3. 18 Sep, 2018 3 commits
    • Orvid King's avatar
      Only require C++14 for Windows builds · d233d995
      Orvid King authored
      Summary: Because reasons :(
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9923447
      
      fbshipit-source-id: 7a3a9ab86764dc5c7f5b70f2f728aec8b67bdf1f
      d233d995
    • Nathan Bronson's avatar
      probabilistic F14 ref and iter stability testing under ASAN · ed2ea649
      Nathan Bronson authored
      Summary:
      This diff adds spurious rehash at places where the caller should
      not be assuming reference (unless guaranteed) or iterator stability,
      allowing ASAN to detect these problems.  Under ASAN it also junk-fills
      deleted value_type instances that can't be immediately deallocated.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9826273
      
      fbshipit-source-id: 2d543473b17ffd7debb52082a3e72842121ece1a
      ed2ea649
    • Gisle Dankel's avatar
      Jemalloc Huge Page Allocator · 546113b4
      Gisle Dankel authored
      Summary:
      An allocator that uses a jemalloc arena backed by 2MB huge pages.
      
      This uses the jemalloc extent hooks to let jemalloc hand out memory backed by huge pages.
      The huge pages are allocated when init(int nr_pages) is called, and does not grow (although extending it to grow in the future should be fairly straightforward).
      
      madvise is used to mark the pages as huge. It does not guarantee success, and the only way to tell is by looking at /proc/<pid>/smaps and the total huge pages in /proc/<pid>/status.
      
      The HugePageAllocator can be used as template parameter for stl and folly collections.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9297627
      
      fbshipit-source-id: 734ca1b19972a8b5d7a12ee60cba1ffa3da50dc2
      546113b4
  4. 17 Sep, 2018 4 commits
  5. 16 Sep, 2018 6 commits
    • Orvid King's avatar
      Remove the Kerberos portability header · 66e48fe3
      Orvid King authored
      Summary: It's no longer needed.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9847073
      
      fbshipit-source-id: 072f4e5fc207ab199689e42c4f492d4fcb67aa8e
      66e48fe3
    • Orvid King's avatar
      Implement pthread_rwlock_t and pthread_cond_t in the portability layer · 55820ab7
      Orvid King authored
      Summary:
      The last bits of pthread needed for thrift.
      Also define PTHREAD_MUTEX_NORMAL properly.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9846774
      
      fbshipit-source-id: 124013c6df07f9faa214b77fa8ebe8b37d8f460e
      55820ab7
    • Yedidya Feldblum's avatar
      Fix rcu_domain move-assignment pointer copy · fd99fa95
      Yedidya Feldblum authored
      Summary: [Folly] Fix `rcu_domain` move-assignment pointer copy which seemingly should be a pointer exchange.
      
      Reviewed By: magedm
      
      Differential Revision: D9846892
      
      fbshipit-source-id: ef3a113780af7456d66dacd376b3bf43670fcb9e
      fd99fa95
    • Lee Howes's avatar
      Modify folly futures documentation to use thenValue, thenError, thenTry · abf92b38
      Lee Howes authored
      Summary: Documentation has drifted out of date with updated plan. This brings the core parts into line.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9833211
      
      fbshipit-source-id: b372f9cfc0c787feab86490beeb1dcaa290e8566
      abf92b38
    • Yedidya Feldblum's avatar
      Tweak ThreadLocal inlining · a15c6d08
      Yedidya Feldblum authored
      Summary:
      [Folly] Tweak `ThreadLocal` inlining.
      
      Shrinks overly-large generated code for `ThreadLocal::get()`.
      
      Reviewed By: luciang
      
      Differential Revision: D9732837
      
      fbshipit-source-id: 71eb10d9759e1fa17248e0feed75f610948afe21
      a15c6d08
    • Yedidya Feldblum's avatar
      Tweak ThreadLocal fast-path functions · 462232b4
      Yedidya Feldblum authored
      Summary: [Folly] Tweak `ThreadLocal` fast-path functions. Mostly code golf.
      
      Differential Revision: D9732836
      
      fbshipit-source-id: fc48a7c067c6961413e6aa94106ae26f87d3d603
      462232b4
  6. 15 Sep, 2018 5 commits
    • Orvid King's avatar
      Remove support for building with autotools · 1d58fd57
      Orvid King authored
      Summary: Let's see what breaks.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9569029
      
      fbshipit-source-id: 2edbafc018ec70d8640f2e28d35735089c9eb69d
      1d58fd57
    • Orvid King's avatar
      Remove uses of liburcu · 5e0a8b79
      Orvid King authored
      Summary: This only exists for perf comparisons, and has been unused for years.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9846361
      
      fbshipit-source-id: ad28ff12fe16deb0ceee50ce6c098f234e8f9692
      5e0a8b79
    • Lee Howes's avatar
      Modify comments in Future.h to use thenValue, thenTry and thenError rather than then and onError · 13deb457
      Lee Howes authored
      Summary: Make comments consistent with the updated recommendations where it makes sense.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9833280
      
      fbshipit-source-id: 8de3372b013a322e57cd2d54a512d75bf963d1a5
      13deb457
    • Aaryaman Sagar's avatar
      fetch_set and fetch_reset for single bit setting and resetting · 56768cc0
      Aaryaman Sagar authored
      Summary:
      lock bts and lock btr with the varying lengths turn out to be faster than
      a single CAS instruction
      
      fetch_set uses lock bts and fetch_reset uses lock btr when possible.
      std::atomic::fetch_or and std::atomic::fetch_and with a mask otherwise
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9652759
      
      fbshipit-source-id: e6d10fdb119a10e15e32131c7389f1d4203a0d91
      56768cc0
    • Dan Melnic's avatar
      Make rcu_default_domain_ folly::Indestructible<rcu_domain<RcuTag>> to avoid... · 99ef4c99
      Dan Melnic authored
      Make rcu_default_domain_ folly::Indestructible<rcu_domain<RcuTag>> to avoid asserts on _dl_open/_dl_init __static_initialization_and_destruction_0
      
      Summary: Make rcu_default_domain_ folly::Indestructible<rcu_domain<RcuTag>> to avoid asserts on _dl_open/_dl_init __static_initialization_and_destruction_0
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9845303
      
      fbshipit-source-id: e858e86a6f7885bf6a3ad8d5e957ee947a5ce2b3
      99ef4c99
  7. 14 Sep, 2018 7 commits
    • Orvid King's avatar
      Make downcast to float explicit · 89fe1eb4
      Orvid King authored
      Summary: Because explicit is better.
      
      Reviewed By: sathyaphoenix
      
      Differential Revision: D9834733
      
      fbshipit-source-id: 6e6af1d5215021db522284b6c58c753522df20df
      89fe1eb4
    • Matt Glazar's avatar
      Make TestLogHandler::getMessageValues const · 7aeeb5c1
      Matt Glazar authored
      Summary: I want to use TestLogHandler::getMessageValues with a const TestLogHandler reference. Mark getMessageValues as const so it can be called on a const TestLogHandler. getMessageValues doesn't mutate class state, so this should be safe.
      
      Reviewed By: chadaustin
      
      Differential Revision: D9815552
      
      fbshipit-source-id: 275625d1a001fe536586229228eb2c9eee7e6330
      7aeeb5c1
    • Orvid King's avatar
      Expand the pthread portability layer to basic pthread operations · 9c6832ee
      Orvid King authored
      Summary: The pthread library we were using is getting to be annoying so just implement things ourself.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9777661
      
      fbshipit-source-id: fb53d0d369ed27a869e9f6285a548778c3492f2e
      9c6832ee
    • Mark Williams's avatar
      Fix a bug in ElfFile::getSectionByName · 95918c0f
      Mark Williams authored
      Summary:
      It first looks for the name, then looks for a section with that
      offset. But strings can be overlaid; eg .rela.debug_info and .debug_info
      can be overlapped, so we won't find .debug_info at all.
      
      Instead, just iterate the sections checking to see if the name matches
      the one we're looking for.
      
      Reviewed By: ricklavoie, palmtenor
      
      Differential Revision: D9809817
      
      fbshipit-source-id: b165719c6f9004ecc964096677114bce357ece30
      95918c0f
    • Irene Liu's avatar
      Add variadic template for get_optional to support nested map (#932) · 6cc710c4
      Irene Liu authored
      Summary:
      Pull Request resolved: https://github.com/facebook/folly/pull/932
      
      As title.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9817328
      
      fbshipit-source-id: 261c68f21316e91f3ed752c4aeab9e9c95dfe16d
      6cc710c4
    • Yeolar's avatar
      toAppend support DoubleToStringConverter::SHORTEST_SINGLE (#928) · f81f9a88
      Yeolar authored
      Summary:
      toAppend support DoubleToStringConverter::SHORTEST_SINGLE for float type.
      Pull Request resolved: https://github.com/facebook/folly/pull/928
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9790564
      
      Pulled By: Orvid
      
      fbshipit-source-id: b38d6542518aa0ed7f2b0e222e9870bb5f3a51e5
      f81f9a88
    • Irene Liu's avatar
      Delete duplicate check in folly test · bb4adabb
      Irene Liu authored
      Summary: As title.
      
      Reviewed By: JohnRambo
      
      Differential Revision: D9820130
      
      fbshipit-source-id: 58128c561825681d463759da33be94b861057f2e
      bb4adabb
  8. 13 Sep, 2018 4 commits
  9. 12 Sep, 2018 4 commits