1. 16 Sep, 2018 5 commits
    • 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
  2. 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
  3. 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
  4. 13 Sep, 2018 4 commits
  5. 12 Sep, 2018 8 commits
    • Yedidya Feldblum's avatar
      Fix weird formatting of break after switch-case-close-brace · 57fa26c8
      Yedidya Feldblum authored
      Summary: [Folly] Fix weird formatting of `break` after switch-case-close-brace.
      
      Reviewed By: Orvid
      
      Differential Revision: D9796573
      
      fbshipit-source-id: 5f392e9fcf33be24acb9fc7a79bdf9ca846fd33c
      57fa26c8
    • Yedidya Feldblum's avatar
      Find libiberty headers in subdir also · 3601ea86
      Yedidya Feldblum authored
      Summary:
      [Folly] Find `libiberty` headers in subdir also.
      
      Fixes #792.
      
      Reviewed By: simpkins
      
      Differential Revision: D9330225
      
      fbshipit-source-id: 6a9c3aaf4e76e3b5c8947cb15d0b43ed6cbcc778
      3601ea86
    • Alexey Kozhevnikov's avatar
      Avoid C4291 warning in IOBuf.cpp on Windows · 55d8c7c8
      Alexey Kozhevnikov authored
      Summary:
      Warning: https://msdn.microsoft.com/en-us/library/cxdxz3x6.aspx
      
      Provide matching placement delete operator to avoid the false-positive MSVC warning about memory leak when exception is thrown inside the constructor.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9773561
      
      fbshipit-source-id: e6c4ab1d230e567491271c4cc2c23cd98469e672
      55d8c7c8
    • Xiao Shi's avatar
      reorder combining functions in preparation for `commutative_hash_range` · 1a504d88
      Xiao Shi authored
      Summary: No semantic changes
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9788374
      
      fbshipit-source-id: e619bc19d6064899ce61acc6b67b8b8a8f92101d
      1a504d88
    • Yedidya Feldblum's avatar
      Revise the kSelectInByte comments · 56000db7
      Yedidya Feldblum authored
      Summary: [Folly] Revise the `kSelectInByte` comments - hopefully be clearer and include an example.
      
      Reviewed By: luciang
      
      Differential Revision: D9780161
      
      fbshipit-source-id: 6e9b5798afed9fe161b527ab597852232c278564
      56000db7
    • Yedidya Feldblum's avatar
      Compute kSelectInByte table at compile time · b9911ca2
      Yedidya Feldblum authored
      Summary: [Folly] Compute `kSelectInByte` table at compile time rather than hardcoding the resulting precomputed table.
      
      Reviewed By: luciang
      
      Differential Revision: D9627807
      
      fbshipit-source-id: 01fbb07dd14aac4b84ad72bac10a12d3657be589
      b9911ca2
    • Nathan Bronson's avatar
      safer behavior for goodMallocSize on very large minSize · a97abdc1
      Nathan Bronson authored
      Summary:
      Currently malloc(goodMallocSize(x)) will succeed when x is larger
      than the maximum possible allocation supported by jemalloc.  This is
      not desirable.  Currently goodMallocSize(x) returns 0 if x is too large,
      but 0 is a valid argument for malloc and causes a 1 byte allocation.
      This diff causes goodMallocSize(x) to return x in that case, which will
      cause the subsequent malloc to fail.  The caller may catch that failure
      or crash immediately, but those are both preferrable to returning a
      pointer to a valid 1-byte allocation.
      
      Reviewed By: al13n321
      
      Differential Revision: D9778137
      
      fbshipit-source-id: 3eb8da72d6240b28da85483f0d91653f5e04b333
      a97abdc1
    • Yedidya Feldblum's avatar
      Refactor StaticSingletonManager · e2be2a4a
      Yedidya Feldblum authored
      Summary:
      [Folly] Refactor `StaticSingletonManager`.
      
      * Move implementation to `.cpp`.
      * Remove all `#include`s possible from `.h`.
      * Control inlining.
      
      Differential Revision: D9734721
      
      fbshipit-source-id: 82a1cda187674a6bb62e14a80431aeb07c65156c
      e2be2a4a
  6. 11 Sep, 2018 9 commits
    • Yedidya Feldblum's avatar
      A unit-test for the kSelectInByte table · ef7558cd
      Yedidya Feldblum authored
      Summary:
      [Folly] A unit-test for the `kSelectInByte` table.
      
      The table essentially contains an encoding of every byte value. So we add a unit-test which decodes from the table, confirming that each encoded byte decodes back to the original.
      
      Also add helpers to the test file to ease viewing disassembly of select64 variants.
      
      Reviewed By: ot
      
      Differential Revision: D9628409
      
      fbshipit-source-id: 61cebaff4e9aff223a06194f7440eb3580a9273d
      ef7558cd
    • Yedidya Feldblum's avatar
      Test cases for StaticSingletonManager · b05020b2
      Yedidya Feldblum authored
      Summary: [Folly] Test cases for `StaticSingletonManager`.
      
      Differential Revision: D9735443
      
      fbshipit-source-id: e922d7742c12e6ca7725dc7782cc683cf71fb6a7
      b05020b2
    • Dan Melnic's avatar
      Add SpinLock from google/base/spinlock.h to the small lock benchmark · 88324bac
      Dan Melnic authored
      Summary: Add SpinLock from google/base/spinlock.h to the small lock benchmark
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9771633
      
      fbshipit-source-id: 3cf01866ec6cd4a4a5d8c2fb4274ca20a6f545dd
      88324bac
    • Neel Goyal's avatar
      Mark getApplicationProtocol() const · 51991ebe
      Neel Goyal authored
      Summary: getApplicationProtocol should probably be const.
      
      Reviewed By: knekritz, mingtaoy
      
      Differential Revision: D9772305
      
      fbshipit-source-id: c648f9307214258639616e2f4ff3a90dfbf9484b
      51991ebe
    • JiaJie Ye's avatar
      Move hardcoded asan multiplier to a config · 2c7607f0
      JiaJie Ye authored
      Summary: This export the 16 times stack size for ASAN TSAN into a config as @[655434592:Andrii Grynenko] suggested
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9685364
      
      fbshipit-source-id: 4c76e99ba10d0fad65dd0dc30eeb003b25514c43
      2c7607f0
    • Andre Pinto's avatar
      Use checkedMalloc in IOBuf · a0988616
      Andre Pinto authored
      Summary: Use checkedMalloc everywhere in IOBuf code.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9763962
      
      fbshipit-source-id: d08046b26bf0dd3be5067ad9e0706647fdcf1e83
      a0988616
    • Andre Pinto's avatar
      Fix IOBuf::createCombined() · 7c2d39a1
      Andre Pinto authored
      Summary:
      IOBuf::createCombined was derefencing a nullptr in case of allocation failure.
      This patches fixes this issue by throwing std::bad_alloc if malloc() returns a
      nullptr.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9763331
      
      fbshipit-source-id: 7d9b9265079e74f5c63c8c8809099de97342f54d
      7c2d39a1
    • Michael Lee's avatar
      Fix typo · 875449cd
      Michael Lee authored
      Summary: Typo
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9755749
      
      fbshipit-source-id: b0295c12353a256e4462dfacf1bafce09c09c598
      875449cd
    • Sarang Masti's avatar
      Support forcing a digest update in BufferedStat · 5379b434
      Sarang Masti authored
      Summary:
      Provide an option to force digest updates in BufferedStat. This
      is useful in tests when one can't easily mock the clock.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9732899
      
      fbshipit-source-id: e6a9c01d97a156bdded58fc01d8389bbf9edbbf7
      5379b434
  7. 10 Sep, 2018 2 commits