1. 12 Sep, 2018 3 commits
    • 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
  2. 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
  3. 10 Sep, 2018 4 commits
    • Paul Rosania's avatar
      Add missing detail/Futex-inl.h header (#926) · da7798c6
      Paul Rosania authored
      Summary:
      4d234b99 introduces `folly/detail/Futex-inl.h`. This patch adds it to `Makefile.am` so it gets installed when building using autotools.
      Pull Request resolved: https://github.com/facebook/folly/pull/926
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9757810
      
      Pulled By: Orvid
      
      fbshipit-source-id: 42bdaf292d9ca5e47c01d39381c5ebd4941dcb2a
      da7798c6
    • Neel Goyal's avatar
      Use AsyncTransportCertificate interfaces · c2b9a896
      Neel Goyal authored
      Summary: Have AsyncSSLSocket use AsyncTransportCertificate interfaces properly
      
      Reviewed By: mingtaoy
      
      Differential Revision: D9752031
      
      fbshipit-source-id: c65c0b808d82843bf1111bb650fe140ac98723b8
      c2b9a896
    • Nathan Bronson's avatar
      further relax F14 allocated memory size test for libc++ · 44535e79
      Nathan Bronson authored
      Summary:
      F14MapTest already had properly relaxed the post-condition for
      fallback maps after a move-clear and reserve; this diff applies the same
      relaxation to F14SetTest.
      
      Reviewed By: shixiao
      
      Differential Revision: D9756311
      
      fbshipit-source-id: 8285bb05023d923c4a7c4e014c3668bdaed591c4
      44535e79
    • Lee Howes's avatar
      Separate try and value versions of then to make deprecation and removal easier. · 201b8040
      Lee Howes authored
      Summary: Separates variants of Future::then that take differently parameterised lambdas. This will allow separately deprecating and then deleting them without having to solve all at once.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9512097
      
      fbshipit-source-id: 1b6c0946f0fa38cf8427c66fe1bef47315875e58
      201b8040
  4. 09 Sep, 2018 1 commit
    • Yedidya Feldblum's avatar
      Smaller implementation of to_ordering · f0ac6ddd
      Yedidya Feldblum authored
      Summary:
      [Folly] Smaller implementation of `to_ordering`.
      
      Shorter source code, shorter bytecode, no branches/conditionals.
      
      Reviewed By: Orvid
      
      Differential Revision: D9733375
      
      fbshipit-source-id: a2b2a8263b5de2264d3068a424419d63e5b27228
      f0ac6ddd
  5. 08 Sep, 2018 3 commits
    • Yedidya Feldblum's avatar
      Add FOLLY_HAS_EXCEPTIONS preprocessor symbol · 13d4eb3c
      Yedidya Feldblum authored
      Summary:
      [Folly] Add `FOLLY_HAS_EXCEPTIONS` preprocessor symbol.
      
      Add checks for:
      * `__cpp_exceptions` and `__has_feature(cxx_exceptions)`.
      * MSVC platform.
      
      But avoiding a single unwieldy expression.
      
      And use it in `throw_exception`.
      
      Reviewed By: mnovakovic
      
      Differential Revision: D9732924
      
      fbshipit-source-id: 4ac00e2d84007dfe8307f0e861ab2edfbde80fff
      13d4eb3c
    • Yedidya Feldblum's avatar
      Assorted partial applications of clang-format · a35bd9dd
      Yedidya Feldblum authored
      Summary:
      [Folly] Assorted partial applications of `clang-format`.
      
      Some parts of the code are explicitly opted out where `clang-format` produces poor results, and for other reasons.
      
      Future passes may remove current opt-outs.
      
      Reviewed By: Orvid, igorsugak
      
      Differential Revision: D9727723
      
      fbshipit-source-id: d191ae51f535335402d5e083c3368d83779b7f6e
      a35bd9dd
    • Naman Gupta's avatar
      Don't record stack position for ASAN builds · 62bee2d7
      Naman Gupta authored
      Summary: Disable recording highWaterMark for asan builds. I discovered this while using getHighWatermark method on test runs (build with ASAN).  It gave bogus value (>90MB), when stack size was only 24k.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D9687204
      
      fbshipit-source-id: 7ca311acb6f310694850f065febc3998a11d036a
      62bee2d7
  6. 07 Sep, 2018 7 commits
    • Yedidya Feldblum's avatar
      Split the FBString.testFixedBugs test case · 97290bca
      Yedidya Feldblum authored
      Summary: [Folly] Split the `FBString.testFixedBugs` test case into a test case per bug.
      
      Reviewed By: Orvid
      
      Differential Revision: D9727569
      
      fbshipit-source-id: b319286031ded00451a1e960c0d450e7cfc4c362
      97290bca
    • Joe Peplowski's avatar
      Fix throw_exception with -fno-exceptions -Werror=unused-parameter · 6caa1646
      Joe Peplowski authored
      Summary: Fix `throw_exception` with ` -fno-exceptions -Werror=unused-parameter`.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9693907
      
      fbshipit-source-id: d308147b7d69cf091a9f839fda8be3464aa94b9a
      6caa1646
    • Dan Melnic's avatar
      Fix: folly/experimental/coro/test/CoroBenchmarkAllocator.cpp:363:20: error:... · 1958c549
      Dan Melnic authored
      Fix: folly/experimental/coro/test/CoroBenchmarkAllocator.cpp:363:20: error: 'Recursion' has not been declared
      
      Summary: Fix: folly/experimental/coro/test/CoroBenchmarkAllocator.cpp:363:20: error: 'Recursion' has not been declared
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9727088
      
      fbshipit-source-id: 91447187bc6d34b965d5f8c2cedd66950b1fe909
      1958c549
    • Nathan Bronson's avatar
      F14 fallback mode cleanups · 7ae9308b
      Nathan Bronson authored
      Summary:
      This diff adds operator=(initializer_list) to the F14 fallback
      implementations, relaxes the guarantees provided by visitAllocationClasses
      for fallbacks (so that the current implementation can be considered
      correct), enables additional tests, and avoids a bit of logic repetition.
      Changes should only be made to the fallback mode and tests, and this diff
      should not change the set of platforms for which fallback mode is enabled.
      
      Reviewed By: shixiao
      
      Differential Revision: D9664700
      
      fbshipit-source-id: 1f3fc6f0c48009bb3e5fd249506b42f54d93df43
      7ae9308b
    • Victor Zverovich's avatar
      Fix CMake commands in README · 5bb6b0ae
      Victor Zverovich authored
      Summary:
      Remove bogus `configure` argument from cmake commands which is likely an
      artefact from automake migration. The correct invocation of CMake is
      
      ```
      cmake [<options>] {<path-to-source> | <path-to-existing-build>}
      ```
      
      Reviewed By: Orvid
      
      Differential Revision: D9721030
      
      fbshipit-source-id: 95da844d3292cbf2acbec85753499f3603567e08
      5bb6b0ae
    • Cameron Pickett's avatar
      Remove superfluous template type from Future::then · 5de46e43
      Cameron Pickett authored
      Summary: The template type here seems unnecessary, since the rest of the APIs refer to `folly::Executor` and not a template typename `Executor`
      
      Reviewed By: LeeHowes
      
      Differential Revision: D9695862
      
      fbshipit-source-id: 26d4ddb6fe09454f037fcf1f5417add062e8371f
      5de46e43
    • Nathan Bronson's avatar
      add missing operator=(initializer_list) overloads · 4b17db44
      Nathan Bronson authored
      Summary:
      F14 maps and sets were missing the operator= overload that takes
      an initializer list, resulting in map = {} having reset behavior rather
      than clear behavior.  Without the overload an empty map is constructed and
      then moved onto the lhs, freeing all memory.  With the overload we call
      clear(), which retains the existing allocation when it is not too large.
      This diff also cleans up the default constructor definitions, adding
      noexcept for F14FastMap and F14FastSet and making the others more concise.
      
      Reviewed By: shixiao
      
      Differential Revision: D9661526
      
      fbshipit-source-id: 101d66623bc4d50e7935fa9a73405a825648e6a5
      4b17db44
  7. 06 Sep, 2018 6 commits
    • Yedidya Feldblum's avatar
      Apply clang-format to folly/futures/ · 46bb4594
      Yedidya Feldblum authored
      Summary: [Folly] Apply `clang-format` to `folly/futures/`.
      
      Reviewed By: LeeHowes
      
      Differential Revision: D9672492
      
      fbshipit-source-id: c41632c4da6c450096eb249f0708af3db5057a14
      46bb4594
    • Yedidya Feldblum's avatar
      Apply clang-format to folly/container/ · 4aa9b357
      Yedidya Feldblum authored
      Summary: [Folly] Apply `clang-format` to `folly/container/`.
      
      Reviewed By: shixiao
      
      Differential Revision: D9672403
      
      fbshipit-source-id: da8e2a10eafcc8a278c002223cfeec055936d0bc
      4aa9b357
    • Yedidya Feldblum's avatar
      Apply clang-format to folly/gen/ · 062bb26d
      Yedidya Feldblum authored
      Summary: [Folly] Apply `clang-format` to `folly/gen/`.
      
      Reviewed By: Orvid
      
      Differential Revision: D9671968
      
      fbshipit-source-id: 1164cf0d236914b5fd7ed35d5d41c785935e876b
      062bb26d
    • Ajanthan Asogamoorthy's avatar
      update folly makefile · d98241e2
      Ajanthan Asogamoorthy authored
      Summary: D9624966 deleted FormatArg.cpp but makefile not updated
      
      Reviewed By: knekritz
      
      Differential Revision: D9663460
      
      fbshipit-source-id: 02dc40d4b23de697834aca0247335ee79bebc647
      d98241e2
    • Adam Norton's avatar
      KeepAlive via functions · 261d2494
      Adam Norton authored
      Summary: Add via helpers for KeepAlive argument
      
      Reviewed By: yfeldblum
      
      Differential Revision: D9617303
      
      fbshipit-source-id: 4ace3ea5f48fd8fbed70bcdf7654a1435f5e1d72
      261d2494
    • Amol Bhave's avatar
      Fix printf format specifier in Elf.h · 1723003c
      Amol Bhave authored
      Summary:
      The format specifier for printf should be %zu to take into account
      32bit machines.
      
      Reviewed By: Orvid
      
      Differential Revision: D9665574
      
      fbshipit-source-id: e7019c1deba80addef36ea8f6ebff48b45eceefa
      1723003c
  8. 05 Sep, 2018 7 commits
    • Yedidya Feldblum's avatar
      DRY some common code in folly/gen/test/ParallelBenchmark.cpp · f143a3c7
      Yedidya Feldblum authored
      Summary: [Folly] DRY some common code in `folly/gen/test/ParallelBenchmark.cpp`.
      
      Reviewed By: Orvid
      
      Differential Revision: D9664846
      
      fbshipit-source-id: adf198a60ab637e47986ddea9c5c4e7392cf8b27
      f143a3c7
    • Amol Bhave's avatar
      Fix CoroBenchmarkNRVO for non FOLLY_HAS_COROUTINE builds · f169a842
      Amol Bhave authored
      Summary:
      This code fails to compile when FOLLY_HAS_COROUTINES is false. This is
      because ExpensiveCopy is defined inside the if scope, and if that macro is
      false, then ExpensiveCopy never gets defined. Yet it gets used in the nestedCalls function.
      
      This diff fixes build for that case.
      
      Reviewed By: lewissbaker
      
      Differential Revision: D9663539
      
      fbshipit-source-id: 1c3dd70decab7db955c038cd5c476920bfa6ba53
      f169a842
    • Yedidya Feldblum's avatar
      Fix for_each and fetch unit-tests under MSVC · e89b8aa9
      Yedidya Feldblum authored
      Summary: [Folly] Refactor `for_each` and `fetch` to fix their unit-tests under MSVC. New code is smaller.
      
      Reviewed By: Orvid
      
      Differential Revision: D9569412
      
      fbshipit-source-id: 87807ddf41f1dbd16244a82c5be30eae08dbdf4c
      e89b8aa9
    • Yedidya Feldblum's avatar
      Assorted fixes to for_each and fetch comments · 8f2ad2b9
      Yedidya Feldblum authored
      Summary: [Folly] Assorted fixes to for_each and fetch comments
      
      Reviewed By: aary
      
      Differential Revision: D9632155
      
      fbshipit-source-id: 64932770d3476cdd06c5fa9eb9bd845600f18fff
      8f2ad2b9
    • Andrii Grynenko's avatar
      Coroutine allocator benchmark · ebc7efbb
      Andrii Grynenko authored
      Reviewed By: lewissbaker
      
      Differential Revision: D9388165
      
      fbshipit-source-id: fa94f008d088c5560d5207c726fabb0e764193fb
      ebc7efbb
    • Kyle Nekritz's avatar
      Bind to ephemeral port in tos tests. · 1285b5cb
      Kyle Nekritz authored
      Summary: Always using 10000 is no good for concurrent tests.
      
      Reviewed By: Orvid
      
      Differential Revision: D9656798
      
      fbshipit-source-id: 4fb7e48239e42c3b2acd2cc976cb74535c573ef6
      1285b5cb
    • Yedidya Feldblum's avatar
      Do only single var decl per statement in folly/test/DynamicConverterTest.cpp · c043e0a8
      Yedidya Feldblum authored
      Summary: [Folly] Do only single var decl per statement in `folly/test/DynamicConverterTest.cpp`.
      
      Reviewed By: igorsugak
      
      Differential Revision: D9653672
      
      fbshipit-source-id: 08bb529cc90761c69dabd2e00f58f1767f07146a
      c043e0a8