1. 05 Mar, 2018 1 commit
  2. 04 Mar, 2018 1 commit
    • Xiao Shi's avatar
      add std::list/deque, small_vector to fbvector benchmark · 306be9f1
      Xiao Shi authored
      Summary:
      Adding a few other data structures to the benchmark. Code clean-up:
      * split `insert` into `insertFront` and `pushBack`
      * delete current `erase` benchmark, which is mostly spinning since `iters` can
        easily be larger than the original vector size.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7067000
      
      fbshipit-source-id: 3073f7c396888787b49993468c7e6fdac70b77ac
      306be9f1
  3. 03 Mar, 2018 3 commits
    • Yedidya Feldblum's avatar
      Remove the spin-lock protecting Future's executor · f9fb46d1
      Yedidya Feldblum authored
      Summary:
      [Folly] Remove the spin-lock protecting `Future`'s executor.
      
      The executor can be set in a few places:
      * When constructing a new `Promise` and `Future` pair before handing off the `Promise` in `Future::thenImplementation`.
      * After invoking `SemiFuture::wait` and `Future::wait` in the non-timeout case.
      * In `SemiFuture` dtor, if it has a core.
      
      In the first case, the executor is set in the future thread before being read by the promise thread. In the second case, the executor is set after being read by the promise thread. In the third case, if there is a core, then no callback could have been attached. But there is no race between setting and reading.
      
      Reviewed By: djwatson
      
      Differential Revision: D7115700
      
      fbshipit-source-id: 5a0f90a9f01a7dcf295f39d323959e91aeae26da
      f9fb46d1
    • Andrii Grynenko's avatar
      Revert D7130814: [folly] Always suspend coroutine before destruction · fa45ee46
      Andrii Grynenko authored
      Summary:
      This reverts commit bf3e2b8f4a086f1786ab46f453c3dd9171d018e8
      
      bypass-lint
      
      An infra SEV is better than not reverting this diff.
      If you copy this password, see you in SEV Review!
      cause_a_sev_many_files
      
      Differential Revision:
      D7130814
      
      Original commit changeset: bf3e2b8f4a08
      
      fbshipit-source-id: 8f67c9ec365853f8fbc736e0fd29133fd7653a59
      fa45ee46
    • Xiao Shi's avatar
      fix HAVE_INT128_TRAITS cmake test · 49efc3ab
      Xiao Shi authored
      Summary:
      C++17 defined integer traits for `__int128` as well as a (trivial) std::hash,
      this diff adds the check in `FOLLY_SUPPLY_MISSING_INT128_TRAITS`.
      
      There was an unintended linebreak in the cmake test which rendered it non
      functional. This diff fixes it.
      
      Original issue:
      https://github.com/facebook/folly/commit/b2b96f59c57cd7aba686cc4f61ceba0314cdeb72#comments
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7138006
      
      fbshipit-source-id: ca1841b9ca847f1f6570b58e95380f50fe092345
      49efc3ab
  4. 02 Mar, 2018 6 commits
    • Giuseppe Ottaviano's avatar
      Fix bounds check in fbstring::at · 8e458f98
      Giuseppe Ottaviano authored
      Summary:
      From http://en.cppreference.com/w/cpp/string/basic_string/at
      
      > Throws std::out_of_range if pos >= size().
      
      Furthermore it was inconsistent between the `const` and non-`const` version.
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: philippv, luciang
      
      Differential Revision: D6355911
      
      fbshipit-source-id: 54acbba791fc5a8aeb4fdf46e786f8519fd18701
      8e458f98
    • Lee Howes's avatar
      Remove Promise::getFuture from Future-inl.h 2/4 - waitImpl · 6afcbf48
      Lee Howes authored
      Summary: Replace calls to Promise::getFuture in waitImpl with getSemiFuture. There is a slight behavioural change here in that we now set the executor on the returned future, but this appears to be the correct behaviour.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7104627
      
      fbshipit-source-id: fd19c3f6884b560f7d5ea1276f3c80c082dfc53d
      6afcbf48
    • Nathan Bronson's avatar
      add comment to help people debugging an assertion failure · a440441d
      Nathan Bronson authored
      Summary:
      SharedMutex asserts that all locks have been released before
      destruction.  This diff adds a comment near those asserts making it more
      clear what they are checking.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7137906
      
      fbshipit-source-id: 082a804616950d9a962ee932c9021c453f43a35d
      a440441d
    • Brian Gesiak's avatar
      Always suspend coroutine before destruction · 57c236fe
      Brian Gesiak authored
      Summary:
      Suspending the coroutine before it's destroyed prevents a dangling
      reference to its value.
      
      This dangling reference is exposed when running tests that were
      built with `-O3` with ASAN. To run tests at this level, split the
      tests up: move tests that cannot be compiled with ASAN at `-O3`,
      due to https://bugs.llvm.org/show_bug.cgi?id=34289, into their
      own file. The remaining tests stay where they are, with `-O3`
      re-enabled.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7130814
      
      fbshipit-source-id: bf3e2b8f4a086f1786ab46f453c3dd9171d018e8
      57c236fe
    • Boris Momčilović's avatar
      CMake: folly-deps: gflags is gflags-shared on Fedora #753 · 42ee21f1
      Boris Momčilović authored
      Summary:
      This targets Fedora specifically. More details are available in #753
      
      I personally do not think this is the best way to handle this, but it's something (and works). Still, there might be a chance for this to get merged in? Thank you!
      
      /cc yfeldblum
      Closes https://github.com/facebook/folly/pull/789
      
      Reviewed By: simpkins
      
      Differential Revision: D7111531
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 508aeeeb7bfaf2402150cd33f7d6c8b726539053
      42ee21f1
    • Dan Melnic's avatar
      CHECK(ev->ev_base) so we get a proper message instead of just a SIGSEGV · 43e42d0c
      Dan Melnic authored
      Summary: CHECK(ev->ev_base) so we get a proper message instead of just a SIGSEGV
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7118625
      
      fbshipit-source-id: 9426ac54fc32e0d34ad36df97708e3f0ae6043a9
      43e42d0c
  5. 01 Mar, 2018 9 commits
    • Adam Simpkins's avatar
      logging: add an FB_LOG_RAW() macro · 634f2652
      Adam Simpkins authored
      Summary:
      `FB_LOG_RAW()` is similar to `FB_LOG()` but allows the caller to pass in the
      log level as a variable, and to specify an alternate file name and line number.
      
      This is useful for callers that wish to implement their own logging utility
      functions that log a message, but pass through their caller's file name and
      line number.
      
      Reviewed By: wez
      
      Differential Revision: D7128091
      
      fbshipit-source-id: 1fec158a9312b9c9dc53cf3dc87004d42f9806c6
      634f2652
    • Xiao Shi's avatar
      add hashers for __int128 and unsigned __int128 · b2b96f59
      Xiao Shi authored
      Summary: Add hashers for signed and unsigned int128 for platforms that have them.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7101875
      
      fbshipit-source-id: ab5df6d06c7f292204318e479d172560ae2a4ec6
      b2b96f59
    • Xiao Shi's avatar
      adjust config for FOLLY_SUPPLY_MISSING_INT128_TRAITS · b4881fa5
      Xiao Shi authored
      Summary:
      * remove the redundant `!defined(_WIN32)` condition;
      * llvm added traits for (u)int128 in
        https://reviews.llvm.org/D2917; and std::hash in
        https://reviews.llvm.org/rL266587.
      
      Reviewed By: nbronson
      
      Differential Revision: D7111138
      
      fbshipit-source-id: 91a05354846575677eddd48c8b8f4e05c53b01cb
      b4881fa5
    • Ian Petersen's avatar
      Remove some undefined behaviour from const Lazy. · 6229600d
      Ian Petersen authored
      Summary:
      operator()() const uses const_cast to forward its implementation
      to operator()(), which invokes UB when writing to the internal state.
      This change marks the internal state mutable, which means we can delete
      the const_cast.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7089568
      
      fbshipit-source-id: 09f726e6399a95987075d6170ce6fb8103189552
      6229600d
    • Amir Livneh's avatar
      Add compatibility function for X509_STORE_up_ref() · 35970f56
      Amir Livneh authored
      Reviewed By: yfeldblum
      
      Differential Revision: D7111876
      
      fbshipit-source-id: eba9e29321e0ac89084ceae410bdcb4ebb86f91c
      35970f56
    • Yedidya Feldblum's avatar
      Switch away from using the legacy Synchronized macros · 65105e81
      Yedidya Feldblum authored
      Summary: [Folly] Switch away from using the legacy `Synchronized` macros within Folly.
      
      Reviewed By: simpkins
      
      Differential Revision: D7118324
      
      fbshipit-source-id: 328ecdd572d84bb99a28ddb8689bdc4ae08421a6
      65105e81
    • Yedidya Feldblum's avatar
      Cut build config items for bits/functexcept.h · 2d40a641
      Yedidya Feldblum authored
      Summary:
      [Folly] Cut build config items for `bits/functexcept.h`.
      
      Folly no longer uses the non-portable functions declared in that internal libstdc++ header.
      
      Reviewed By: mzlee
      
      Differential Revision: D7119064
      
      fbshipit-source-id: 6879dc6a5bc490726b188d65d7686a2eca136980
      2d40a641
    • Lee Howes's avatar
      Remove Promise::getFuture from Future-inl.h 1/4 - simple cases · 8e00d117
      Lee Howes authored
      Summary:
      Removing calls to folly::Promise::getFuture from Future-inl.h's simpler cases. Replacing with getSemiFuture.
      
      In the case of the collect variants I continue to return a Future, completing inline, until those functions are modified to return SemiFuture.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7103938
      
      fbshipit-source-id: 3737887a934cd0fe8f7c1511ae2ba252ea047a49
      8e00d117
    • Joe Loser's avatar
      Fix unused variable error in AsyncUDPSocket · 4503a319
      Joe Loser authored
      Summary:
      Some OSes do not define `IP_MTU_DISCOVER` or `IPV6_MTU_DISCOVER`. As such, this would result in the function argument parameter `df` being unused, which is a warning that is then treated as an error.
      
      Earlier today (2806dda4), this logic was added about setting the DF which broke Mac builds.
      Closes https://github.com/facebook/folly/pull/791
      
      Reviewed By: igorsugak
      
      Differential Revision: D7116863
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 5092891c8977a44ab58723f8cef352dd4eaa1210
      4503a319
  6. 28 Feb, 2018 8 commits
    • Igor Sugak's avatar
      fix multiple invalid-null-argument UBSAN errors in io/Cursor.h · 417d7131
      Igor Sugak authored
      Summary:
      Exposed by UBSAN:
      {P59121025}
      {P59121310}
      {P59121558}
      
      Add appropriate checks to avoid the UB.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7112776
      
      fbshipit-source-id: 82bd9f85ed4c82aa1b030a38d6ad9358e8f2d38a
      417d7131
    • Yang Chi's avatar
      Add an API to AsyncUDPSocket to set DF bit · 2806dda4
      Yang Chi authored
      Summary: Some application requires IP not to fragment the the datagram. Add an API to AsyncUDPSocket to set such option.
      
      Reviewed By: siyengar
      
      Differential Revision: D5421406
      
      fbshipit-source-id: 6cd3ab262f1420e22eb0948e0e2bfef77b7b6e92
      2806dda4
    • Joe Loser's avatar
      Fix DynamicConverter to work with vector<bool> · 2b5eff82
      Joe Loser authored
      Summary:
      Introduce a specialization for `std::vector<bool>` as the existing
      specialization for "other ranges" is not sufficient for binding the
      proxy iterator (`bit_const_reference`) to an lvalue when iterating over
      the `vector<bool>`.
      
      I do not think you can simply change the type from `const auto&` to `auto&&` when iterating over the container for the "other ranges" specialization.  This is because we cannot bind an rvalue to an lvalue reference (which is the function argument type for our `construct` specializations).
      
      See #752 and https://github.com/facebook/folly/pull/756 for more info.
      Closes https://github.com/facebook/folly/pull/781
      
      Reviewed By: andrewjcg
      
      Differential Revision: D7078659
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 0089183a3c68d20ed14e483859e950dfb4ae729e
      2b5eff82
    • Joe Loser's avatar
      Add find module for Snappy · 29fb51a6
      Joe Loser authored
      Summary:
      Add a find_package module for Snappy
      Closes https://github.com/facebook/folly/pull/783
      
      Reviewed By: simpkins
      
      Differential Revision: D7079554
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: bf5dc3f3c37367f43fcbf8b40aaa3bb0a030bee5
      29fb51a6
    • Xiao Shi's avatar
      refactor fbvector test and benchmark, enable test, DRY · 0ac0f114
      Xiao Shi authored
      Summary:
      Previously, there are a number of tests in `FBVectorTestBenchmarks.cpp.h` that
      are not used anywhere. This diff separates out the tests from the benchmarks
      and actually include them in `FBVectorTest.cpp`.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7103453
      
      fbshipit-source-id: 9427bb1ddcebefb2bbd2c91707fdd572890dc42e
      0ac0f114
    • Mingtao Yang's avatar
      Make OpenSSLVersionFinder static methods free functions · d2bc1134
      Mingtao Yang authored
      Summary:
      getOpenSSLNumericVersion was not static, while getOpenSSLLongVersion() was.
      Rather than change it to static, these functions should simply be free
      functions.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7094066
      
      fbshipit-source-id: 808a9d169100c9d94d466d9348418a4e8a50c751
      d2bc1134
    • Yedidya Feldblum's avatar
      Tweak throw_exception condition · 2f331d91
      Yedidya Feldblum authored
      Summary: [Folly] Tweak throw_exception condition, fixing reference to `__GNUC__` and restructuring to make adding checks for alternative compilers more trivial.
      
      Reviewed By: mzlee
      
      Differential Revision: D7102307
      
      fbshipit-source-id: e4e00ded71f37db8fa93822744b608b42960a58a
      2f331d91
    • Enji Cooper's avatar
      Fix typos ("and and" -> "and") · 3383a04e
      Enji Cooper authored
      Reviewed By: yfeldblum
      
      Differential Revision: D7091797
      
      fbshipit-source-id: cbba7e5c17e1b6d4446570fb7a2b888db8bcd17e
      3383a04e
  7. 27 Feb, 2018 4 commits
    • Dave Watson's avatar
      more ConcurrentHashMap deletion tests · be9eff5a
      Dave Watson authored
      Summary:
      Re-committing.  Original: D6993857 revert: D7051998
      
      Fixes for hazptr deletion on map destruction.
      Several iteration cases don't properly release their hazard pointers.
      This isn't disastrous, but means objects may stick around longer than necessary.
      Adds tests and fixes for iteration to ensure we eagerly reset all hazard pointers.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7063727
      
      fbshipit-source-id: 2ae32ead4965b37866096d2a8c6ea8c42c201335
      be9eff5a
    • Yedidya Feldblum's avatar
      Let to_signed be constexpr under C++11 rules · 850b5469
      Yedidya Feldblum authored
      Summary: [Folly] Let `to_signed` be `constexpr` under C++11 rules.
      
      Reviewed By: simpkins
      
      Differential Revision: D7079545
      
      fbshipit-source-id: 69a56f2180f9ec3492cd1ad9cd26dd8bba255442
      850b5469
    • Joe Loser's avatar
      Fix case sensitivity for LZ4 find module · 7d455083
      Joe Loser authored
      Summary:
      CMake find_package modules are case sensitive. Since the script is called
      "FindLZ4.cmake" the corresponding call to `find_package` must match LZ4
      and not "lz4".
      
      For an example of the problem, see the [Travis Log](https://travis-ci.org/facebook/folly/jobs/345661072). Namely:
      
      ```
      CMake Warning at CMake/folly-deps.cmake:101 (find_package):
        No "Findlz4.cmake" found in CMAKE_MODULE_PATH.
      Call Stack (most recent call first):
        CMakeLists.txt:65 (include)
      CMake Warning (dev) at CMake/folly-deps.cmake:101 (find_package):
        Findlz4.cmake must either be part of this project itself, in this case
        adjust CMAKE_MODULE_PATH so that it points to the correct location inside
        its source tree.
      ```
      
      This was not caught on my local machine as I use case-insensitive options in my terminal; in addition, this is not a "hard error" for CMake, so the builds happily continued successfully when 7dc5a4ed landed.
      Closes https://github.com/facebook/folly/pull/782
      
      Reviewed By: simpkins
      
      Differential Revision: D7079535
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: dd51d8c6ffa804be72c2d9cd264890280dcf5ab9
      7d455083
    • Yedidya Feldblum's avatar
      Cut folly/portability/BitsFunctexcept.h · 380daecc
      Yedidya Feldblum authored
      Summary: [Folly] Cut `folly/portability/BitsFunctexcept.h`.
      
      Reviewed By: simpkins
      
      Differential Revision: D7066504
      
      fbshipit-source-id: ed260ab36759a58dee103addd92c6a5a47dac330
      380daecc
  8. 26 Feb, 2018 2 commits
    • Neel Goyal's avatar
      Add uint32 type flags · d75c4747
      Neel Goyal authored
      Summary: Add DECLARE/DEFINE_uint32 to the portability layer
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7085534
      
      fbshipit-source-id: 3f6f1bf79371b052706f4b3a03dca1d503b879da
      d75c4747
    • Nathan Bronson's avatar
      doc fix for dynamic::operator[] · f9fd348f
      Nathan Bronson authored
      Summary:
      folly::dynamic's operator[] was documented as never invalidating
      iterators.  In the object case when a key is implicitly inserted the
      underlying unordered_map can rehash, which does invalidate the iterators.
      This diff amends the comment to reflect this case.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7085861
      
      fbshipit-source-id: 41ce0497bc60dba9f4529d10010f3b92f9a6c2b3
      f9fd348f
  9. 25 Feb, 2018 1 commit
  10. 24 Feb, 2018 4 commits
    • David Lai's avatar
      - Fix unused parameter warning in StlVectorTest.cpp · 974e6be0
      David Lai authored
      Summary: We are going to enable `-Werror=unused-parameter` flag and I need to manually fix some files so we rest of this process can be automated with a tool called clang-tidy.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7071617
      
      fbshipit-source-id: 0165d9c79834b479ad0f598ea64404a86f47dcc6
      974e6be0
    • Yedidya Feldblum's avatar
      to_signed and to_unsigned · 5ec7c712
      Yedidya Feldblum authored
      Summary:
      [Folly] `to_signed` and `to_unsigned`, for casting a value to the signed or unsigned version of the value's type.
      
      And use them in time conversion functions.
      
      Reviewed By: markw65
      
      Differential Revision: D7020215
      
      fbshipit-source-id: 47a6aeeea487cd7d59d23e7ded40cc66dcc57c52
      5ec7c712
    • Yedidya Feldblum's avatar
      throw_exception to support -fno-exceptions · 1ea94b5e
      Yedidya Feldblum authored
      Summary:
      [Folly] `throw_exception` to support `-fno-exceptions`, switching all invocations of `std::__throw_....`.
      
      Removes the need to use the non-portable `bits/functexcept.h`.
      
      Reviewed By: mzlee, ot
      
      Differential Revision: D7050335
      
      fbshipit-source-id: 53d15639baa268a51f703816f04f314454d64979
      1ea94b5e
    • Joe Loser's avatar
      Simplify FsUtilTest.cpp · 740a9b01
      Joe Loser authored
      Summary:
      This test suite used to wrap equality of two paths by using `EXPECT_TRUE` to
      avoid an old bug in GTest 1.6.0. Now that we use GTest 1.8.0, we can
      simplify our test.
      Closes https://github.com/facebook/folly/pull/780
      
      Differential Revision: D7052503
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 5459736fca04cc45acf88a3d7dffc855ad7c9376
      740a9b01
  11. 23 Feb, 2018 1 commit
    • Xiao Shi's avatar
      EASY: clang-format fbvector benchmark · bc4bb891
      Xiao Shi authored
      Summary: format changes, purely generated by clang-format.
      
      Differential Revision: D7035579
      
      fbshipit-source-id: 8452e1613adefe7dcfbbed4a3ef97be681790416
      bc4bb891