1. 05 Feb, 2016 7 commits
    • Francis Ma's avatar
      Make folly/future portable on android · 1ef44c0c
      Francis Ma authored
      Summary: Some small changes to port folly/futures onto android
      
      Reviewed By: mzlee
      
      Differential Revision: D2787564
      
      fb-gh-sync-id: 8c161942c24c2b7b0484339eaa51c5a356f17de5
      1ef44c0c
    • Yedidya Feldblum's avatar
      ConditionallyExistent<typename> · b29d023b
      Yedidya Feldblum authored
      Summary:
      [Folly] `ConditionallyExistent<typename>`.
      
      For when we need extra member fields in dbg builds, but want to save the space in opt builds. Or other situations along similar lines, but with perhaps another the statically-known condition.
      
      Conditional compilation can have some nasty side-effects. Best to avoid it. Let the compiler see everything, rather than having the preprocessor ruin our day. Let the optimizer remove code that will never be called, after the compiler has seen it. Let us have a single AST in our source file, not one AST for dbg and one for opt, or other statically-known conditions.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D2879397
      
      fb-gh-sync-id: d631141a984eebd46674f27a40a97f670eb33f54
      b29d023b
    • Andrii Grynenko's avatar
      Revert D2853921 · e0f9b598
      Andrii Grynenko authored
      Summary: This was causing memory leaks. I assume that happens if FiberManager was once requested from a thread (so that thread local was initialized), but the thread was never used since then, accumulating EventBase* in the queue.
      
      Reviewed By: simonmar
      
      Differential Revision: D2906752
      
      fb-gh-sync-id: 71ab14cb051a9cee3684a30eaf6729ef65888a52
      e0f9b598
    • Michael Lee's avatar
      Turn off a FBStringTest for Android. · ada7babc
      Michael Lee authored
      Summary:
      The wstring support on KitKat is not exactly working.  Works
      on Lollipop though.
      
      Reviewed By: markisaa
      
      Differential Revision: D2901732
      
      fb-gh-sync-id: 97b57fb4d8c645192be62dca25d8fb1b2397ad7d
      ada7babc
    • Louis Brandy's avatar
      Greatly expand the components overview in Overview.md · 6bfc6869
      Louis Brandy authored
      Summary: See title. This is create a big flat mess, which I may clean up in a follow on to highlight the biggest and most generally useful libraries.
      
      Reviewed By: fugalh
      
      Differential Revision: D2902152
      
      fb-gh-sync-id: 028633448ab97f47a3419f31fa58c79b77a89e52
      6bfc6869
    • Louis Brandy's avatar
      promote a bunch of high level txt to the main Readme.md · 4b1912cf
      Louis Brandy authored
      Summary: See title
      
      Reviewed By: snarkmaster
      
      Differential Revision: D2901817
      
      fb-gh-sync-id: 5b9ede7b941cf18e7be352a93ec5686e6f1f50a7
      4b1912cf
    • Lee Howes's avatar
      Adding addTaskFuture and addTaskRemoteFuture to FiberManager. · 9103c1fe
      Lee Howes authored
      Summary: Adds functionality to fibermanager to add tasks locally and remotely that will return futures. As a side effect, also wraps the function in addTaskRemote in a move wrapper so that it behaves correctly with move-only types such as promises.
      
      Reviewed By: andriigrynenko, yfeldblum
      
      Differential Revision: D2892898
      
      fb-gh-sync-id: 1666c103db35d9c149c36f8b8c3058cd6e0465fc
      9103c1fe
  2. 04 Feb, 2016 3 commits
  3. 03 Feb, 2016 2 commits
  4. 02 Feb, 2016 8 commits
    • Wez Furlong's avatar
      folly: add bser encode/decode for dynamic · ebcef6dc
      Wez Furlong authored
      Summary:
      To support consuming Watchman from within fbcode and hhvm
      in particular, these functions add a BSER serialization for the
      folly::dynamic data type.
      
      Reviewed By: bhamiltoncx
      
      Differential Revision: D2876539
      
      fb-gh-sync-id: bc49d6bc453cc66cebda7185a5907a6f70970b24
      ebcef6dc
    • Denis Samoylov's avatar
      fixed Ubuntu 12 build script dependencies · 36c00bd2
      Denis Samoylov authored
      Summary: added missed boost dependency and changed CMake build order
      
      Reviewed By: snarkmaster, yfeldblum
      
      Differential Revision: D2878880
      
      fb-gh-sync-id: 2a5cded97afde4fd0d741168c3296f2c71426374
      36c00bd2
    • Martin Martin's avatar
      Add some quick comments about folly::fiber implementation classes. · 32d696cb
      Martin Martin authored
      Summary: Add some quick comments about folly::fiber implementation classes.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D2891940
      
      fb-gh-sync-id: b9899bb63df03f32763f93a5dae8dff94c8e354e
      32d696cb
    • Giuseppe Ottaviano's avatar
      Kill writeTerminator in fbstring · 1aa61f23
      Giuseppe Ottaviano authored
      Summary:
      `writeTerminator` needs to determine the string category, and in the small case, also its size. This information is often known, but the compiler cannot optimize it away especially if `capacity_` was just overwritten. Also, some occurrences are just redundant. We can remove the latter and specialize the former.
      
      Small operations such as `push_back` are up to 40% faster.
      
      Before/after:
      ```
      $ ./fbstring_benchmark_using_jemalloc --bm_regex '_fbstring' --bm_min_usec 200000 --bm_max_secs 2
      ============================================================================ ===================
      ./folly/test/FBStringTestBenchmarks.cpp.h       relative  time/iter  iters/s  time/iter  iters/s
      ============================================================================ ===================
      BM_initRNG_fbstring(0)                                       0.00fs  Infinity    0.00fs  Infinity
      BM_defaultCtor_fbstring(0)                                   6.82us  146.60K     6.26us  159.74K
      BM_copyCtor_fbstring(32768)                                 16.86ns   59.32M    15.50ns   64.52M
      BM_ctorFromArray_fbstring(32768)                             2.25us  444.78K     2.12us  471.58K
      BM_ctorFromTwoPointers_fbstring(0)                           9.76ns  102.44M     7.85ns  127.35M
      BM_ctorFromTwoPointers_fbstring(7)                           9.68ns  103.32M     8.10ns  123.47M
      BM_ctorFromTwoPointers_fbstring(15)                          9.77ns  102.34M     8.12ns  123.17M
      BM_ctorFromTwoPointers_fbstring(23)                          9.46ns  105.68M     8.78ns  113.88M
      BM_ctorFromTwoPointers_fbstring(24)                         31.23ns   32.02M    30.71ns   32.56M
      BM_ctorFromChar_fbstring(1048576)                           40.04ns   24.97M    35.68ns   28.03M
      BM_assignmentOp_fbstring(256)                               66.76ns   14.98M    63.93ns   15.64M
      BM_assignmentFill_fbstring(0)                                8.23ns  121.47M     7.02ns  142.49M
      BM_resize_fbstring(524288)                                   4.09us  244.63K     3.94us  253.84K
      BM_equality_fbstring(65536)                                  2.47ms   404.63     2.19ms   455.92
      BM_replace_fbstring(256)                                   172.36ns    5.80M   159.10ns    6.29M
      BM_push_back_fbstring(1)                                     9.32ns  107.27M     7.79ns  128.40M
      BM_push_back_fbstring(23)                                  252.44ns    3.96M   158.31ns    6.32M
      BM_push_back_fbstring(127)                                 721.50ns    1.39M   515.08ns    1.94M
      BM_push_back_fbstring(1024)                                  5.21us  191.87K     3.14us  318.03K
      BM_short_append_fbstring(23)                               431.71ns    2.32M   335.74ns    2.98M
      BM_short_append_fbstring(1024)                              11.96us   83.64K     9.19us  108.78K
      BM_getline_fbstring(23)                                     57.06ns   17.53M    39.78ns   25.14M
      BM_getline_fbstring(1000)                                  232.26ns    4.31M   203.24ns    4.92M
      ============================================================================ ===================
      
      ```
      
      (`find` benchmarks were removed due to high variance caused by randomness)
      
      Reviewed By: luciang
      
      Differential Revision: D2879646
      
      fb-gh-sync-id: 10fd8573495d285220ae98858d11de9ec6d97e54
      1aa61f23
    • Orvid King's avatar
      Allow building without JEMalloc under MSVC · 1b35c9fe
      Orvid King authored
      Summary: This was falling back to a hard depency on JEMalloc, and MSVC doesn't have proper weak linkage, so emulate it with some linker magic to get things building.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D2887695
      
      Pulled By: Orvid
      
      fb-gh-sync-id: 50c812a07c4e4e5bbe71263b86386783bf76ba82
      1b35c9fe
    • Lucian Grijincu's avatar
      folly: #define UNDEFINED_SANITIZER in ubsan mode · 8b7f6f5a
      Lucian Grijincu authored
      Summary:
      Undefined Sanitizer doesn't define any macro to detect that it's active.
      
      The build system should provide `-DUNDEFINED_SANITIZER` when building
      with -fsanitize=undefined or any of the other flags from
      http://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
      
      FWIW: Chrome defines the same preprocessor symbol:
      https://chromium.googlesource.com/chromium/src/+/ac18f489dca8c902e4dfaa1a28d716b7914121d0%5E%21/build/common.gypi
      
      Reviewed By: andrewjcg
      
      Differential Revision: D2885167
      
      fb-gh-sync-id: e1129c0863bfde5d032c32e7d5cea7c43d82009f
      8b7f6f5a
    • Dmitry Pleshkov's avatar
      Implementing callback functionality for exception routines · 20bd643d
      Dmitry Pleshkov authored
      Summary: Depends on D2865911
      
      Reviewed By: luciang
      
      Differential Revision: D2742158
      
      fb-gh-sync-id: 3e7866a742575ee4f7501cff0abbd5c21e26a46e
      20bd643d
    • Lucian Grijincu's avatar
      folly: ubsan: Benchmark: avoid division by zero (fsanitize=float-divide-by-zero) · c046205c
      Lucian Grijincu authored
      Reviewed By: philippv
      
      Differential Revision: D2886132
      
      fb-gh-sync-id: a845d657fb920847df52fe5ec077e91554544f5b
      c046205c
  5. 01 Feb, 2016 7 commits
    • Igor Sugak's avatar
      folly: fix one more -Wunused-parameter · cdadb047
      Igor Sugak authored
      Summary: The usage is guarded by a preprocessor macro, and I didn't noticed this earlier.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D2887016
      
      fb-gh-sync-id: 791c4d16475aab77235792953997a281354018e9
      cdadb047
    • Scott Wolchok's avatar
      Remove unnecessary includes from Optional.h · 0704bd04
      Scott Wolchok authored
      Summary:
      I want to be able to include this in
      fbobjc/xplat/folly:headers_only, but it currently pulls in a boost
      header and Portability.h. Fortunately, neither of those includes are
      needed.
      
      Reviewed By: ddrcoder, yfeldblum, mhorowitz
      
      Differential Revision: D2880443
      
      fb-gh-sync-id: 409561b8fb555ac3946d59cd6657c6c643b67c86
      0704bd04
    • Christopher Dykes's avatar
      Support constexpr_strlen under MSVC. · db12591c
      Christopher Dykes authored
      Summary: MSVC doesn't support evaluating strlen at compile time, so implement our own version instead.
      
      Reviewed By: yfeldblum, lbrandy
      
      Differential Revision: D2856926
      
      fb-gh-sync-id: 22222350b57d9eff6a06c9d0f37d43a3cb1f2534
      db12591c
    • Lucian Grijincu's avatar
      folly: Hash: use loadUnassigned to avoid UB in hsieh_hash32_buf (fsanitize=alignment) · 58e3caa4
      Lucian Grijincu authored
      Reviewed By: philippv
      
      Differential Revision: D2886152
      
      fb-gh-sync-id: 64c3543db831c72c7f4cf307867223270293066e
      58e3caa4
    • Lucian Grijincu's avatar
      folly: ubsan: HashTest: avoid invalid shift (sanitize=shift) · 45bedee3
      Lucian Grijincu authored
      Summary:
        [ RUN      ] Hash.TWang_Unmix64
        folly/test/HashTest.cpp:125:20: runtime error: shift exponent 32 is too large for 32-bit type 'unsigned int'
      
      Reviewed By: philippv
      
      Differential Revision: D2886144
      
      fb-gh-sync-id: 8d7963c087c9db34b08c07451d35e5568c750520
      45bedee3
    • Igor Sugak's avatar
      folly: fix clang -Wmissing-field-initializers · 9cbe74a3
      Igor Sugak authored
      Summary: Fix a few `-Wmissing-field-initializers` exposed by clang.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D2881902
      
      fb-gh-sync-id: 67fdffd39d3ccca64f84055adae1f3b47fdec633
      9cbe74a3
    • Neel Goyal's avatar
      Comments for SSLVerifyPeerEnum · 760795a2
      Neel Goyal authored
      Summary:
      Document what the enum settings mean since they can be
      somewhat confusing.
      
      Reviewed By: shamdor-fb
      
      Differential Revision: D2882929
      
      fb-gh-sync-id: 74ec30132bf5d2dce42f51a0b7b30cf2fae12dbf
      760795a2
  6. 30 Jan, 2016 2 commits
    • Igor Sugak's avatar
      folly: fix -Wunused-parameter in opt mode · 259d9a88
      Igor Sugak authored
      Summary: Fix a few remaining unused parameters, that are exposed only in opt build.
      
      Reviewed By: markisaa
      
      Differential Revision: D2878865
      
      fb-gh-sync-id: d0d9761362220973cda14d99ab7342fbe8b1a469
      259d9a88
    • Igor Sugak's avatar
      folly: fix clang build with -Wunused-const-variable · 225af552
      Igor Sugak authored
      Summary: Fix a few unused const variables exposed by clang's `-Wunused-const-variable`.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D2878944
      
      fb-gh-sync-id: f5500fda4782eac2964761c0398d016d57716269
      225af552
  7. 29 Jan, 2016 5 commits
    • Orvid King's avatar
      Adjust AsyncServerSocket to not use getsockname before it's connected · 2a8d81ac
      Orvid King authored
      Summary:
      Winsock doesn't like it when you try to call getsockname on a socket that hasn't yet been connected or bound, because that socket doesn't have a name yet.
      This only occurred because we were trying to get the family of the socket.
      To solve this, I just passed the family in from the parent methods that already knew what the family was.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D2871859
      
      Pulled By: Orvid
      
      fb-gh-sync-id: 7674f565a968aa0258355fc977c185a416e4fbe4
      2a8d81ac
    • Michael Lee's avatar
      Handle tmp dir on Android · 6ea3164e
      Michael Lee authored
      Summary:
      There is no universally accessible tmpdir on Android which
      means mkstemp fails. This diff calls a function that the test runner
      should provide to fill a valid temporary directory.
      
      Reviewed By: yangchi
      
      Differential Revision: D2842034
      
      fb-gh-sync-id: 9b826757bd750af016a18adccd5a21174be644d6
      6ea3164e
    • Denis Samoylov's avatar
      Make advanced init function for test optional · 754118c4
      Denis Samoylov authored
      Summary: In order to avoid mandatory dependncy on elf, dwarf, unwind made new init function optional
      
      Reviewed By: markisaa
      
      Differential Revision: D2878545
      
      fb-gh-sync-id: f66d3884a531dcf56fc1432330325ab45b149d7f
      754118c4
    • Michael Lee's avatar
      Exclude based on __APPLE__ · a8faf480
      Michael Lee authored
      Summary: This was showing up on a Linux compile to my sadness.
      
      Reviewed By: francis-ma
      
      Differential Revision: D2876010
      
      fb-gh-sync-id: f638d593712c0aeb50177d96aaacb26575820359
      a8faf480
    • Giuseppe Ottaviano's avatar
      Optimize getline(istream&, fbstring&) implementation · 116f13d8
      Giuseppe Ottaviano authored
      Summary:
      Current `getline` implementation in `fbstring` always allocates, even if the passed string is already large enough. Furthermore, the growing strategy relies on outdated assumptions about the allocator.
      This implementation reuses the existing allocation as much as possible, then uses exponential growth.
      
      Reviewed By: luciang, philippv
      
      Differential Revision: D2871976
      
      fb-gh-sync-id: 8db9512030be3f4953efa8f008747827504c032c
      116f13d8
  8. 28 Jan, 2016 6 commits
    • Denis Samoylov's avatar
      A common init function for binaries and a default main function for tests · 754568a3
      Denis Samoylov authored
      Summary: Added initialization routines to test main function that can help with debugging tests
      
      Reviewed By: markisaa, yfeldblum
      
      Differential Revision: D2839759
      
      fb-gh-sync-id: 71cad45f3747336c8c7f8706db139cd060e1442b
      754568a3
    • Lucian Grijincu's avatar
      folly: ubsan: replace undefined call through reinterpret-cast fn-pointer with std::function · e2c9fd6c
      Lucian Grijincu authored
      Summary:
      This code casts function pointers to void(*fn)(void*) and calls
      functions through that type. Calling functions through a different
      pointer type is undefined behavior. Casts were used to avoid memory
      allocations.
      
      `std::bind` needs a memory allocation - so it's avoided in EventBase.
      
        std::function<void()> x = std::bind(fn, args);
      
      `std::function` should use small object optimizations when possible and embed the functor in the body of `std::function`.
      
      On GCC 5.0 and forward small lambdas don't need memory allocations
      (lambdas being tiny structures - two pointers in this case - and a
      function operator).
      
        std::function<void()> y = [=] { fn(args); };
      
      On GCC 4.7 .. 4.9 functors for which __is_location_invariant<Func> is
      true also don't need memory allocations.
      
      Remove undefined behavior by using a `SmallFunctor` which leverages `std::function`'s small object optimization.
      
      Reviewed By: philippv
      
      Differential Revision: D2864895
      
      fb-gh-sync-id: ab40f60b3519ce38f43fecebf88ccdbf09d9bea9
      e2c9fd6c
    • Michael Lee's avatar
      Add (void)ssl back to SSLContext for -Wunused-parameter · 08dba571
      Michael Lee authored
      Summary:
      I'm not sure what accepted practice is to make the
      -Wunused-parameter not balk.
      
      Reviewed By: igorsugak
      
      Differential Revision: D2874705
      
      fb-gh-sync-id: 8765bae504fd90dfd8896857f4bf865ca8f64a8a
      08dba571
    • Marcus Holland-Moritz's avatar
      Fix unused parameter errors under -Werror · 4a61b67f
      Marcus Holland-Moritz authored
      Summary:
      D2872406 enables -Werror=unused-parameter, which in conjunction with mode/opt
      (which eliminates asserts) causes two files in folly/io/async to fail to compile.
      This change works around the error.
      
      Reviewed By: vchalyshev
      
      Differential Revision: D2874625
      
      fb-gh-sync-id: 97104679f964390c5df88ee7831af7df243a152a
      4a61b67f
    • Igor Sugak's avatar
      folly: build with -Wunused-parameter · a1614fee
      Igor Sugak authored
      Summary: Mechanical changes (using custom clang-tidy) to fix all of the `-Wunused-parameter` violations in folly.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D2872406
      
      fb-gh-sync-id: bdb1941f3dadf6ab854e7a9f271f50fda93f9480
      a1614fee
    • Igor Sugak's avatar
      folly/test/FBVectorTestBenchmarks.cpp.h: remove unused argument · 08391a01
      Igor Sugak authored
      Summary: Remove unused argument `iters`.
      
      Reviewed By: meyering
      
      Differential Revision: D2872551
      
      fb-gh-sync-id: 0989e5b256d4d80dd3ad02401e3fc65d0f749ba6
      08391a01