1. 01 Aug, 2019 1 commit
    • Amir Livneh's avatar
      Remove extra space in comment · dd239cec
      Amir Livneh authored
      Reviewed By: JunqiWang
      
      Differential Revision: D16497024
      
      fbshipit-source-id: aa0e42b4bfba3c70769514131daa30df84851126
      dd239cec
  2. 31 Jul, 2019 6 commits
    • John Strizich's avatar
      move CmakeLists to tld · 09aec77b
      John Strizich authored
      Summary: bring this in line with other facebook opensource projects
      
      Reviewed By: saifhhasan
      
      Differential Revision: D16577367
      
      fbshipit-source-id: d762658505f824cc180c55ea4485cecf525b8fdc
      09aec77b
    • Mark Santaniello's avatar
      pmr aliases for sorted_vector_types · dcb399d0
      Mark Santaniello authored
      Summary: Add convenience aliases for std::pmr versions of folly::sorted_vector_set and folly::sorted_vector_map.  I also add the traditional one-argument constructor taking the allocator.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D16523576
      
      fbshipit-source-id: 33514db62eb8dc1b603f45204977751091e528d9
      dcb399d0
    • Dan Schatzberg's avatar
      Revert D16568423: [easy][coro][2/?] Cleanup coroutine code to not use InlineExecutor · 62a3a550
      Dan Schatzberg authored
      Differential Revision:
      D16568423
      
      Original commit changeset: 533353ef623a
      
      fbshipit-source-id: fa2a719d34ee422a3e20a6e69f3c5edfb0f00257
      62a3a550
    • Yedidya Feldblum's avatar
      Fix -Wshadow violations found by gcc · fe4c11a9
      Yedidya Feldblum authored
      Summary: [Folly] Fix `-Wshadow` violations found by gcc.
      
      Reviewed By: meyering
      
      Differential Revision: D16578896
      
      fbshipit-source-id: 3ffe6089ad7b78d9c01d085029b55ec94d6adcff
      fe4c11a9
    • Andrii Grynenko's avatar
      Cleanup coroutine code to not use InlineExecutor · 91678d99
      Andrii Grynenko authored
      Reviewed By: yfeldblum, VitalyKalinkin
      
      Differential Revision: D16568423
      
      fbshipit-source-id: 533353ef623a4bd2629a3c1782b6228f598d6c01
      91678d99
    • Alexey Spiridonov's avatar
      Fix gmock handling in rsocket opensource build · eba20f4d
      Alexey Spiridonov authored
      Summary:
      Simply linking `GMOCK_LIBS` into a binary was not telling CMake that the binary depends on `gmock` being built. So, let's add that dependency explicitly.
      
      This wasn't breaking in production because we typically build with `-j 4`, and `gmock` was getting built before the first dependent binary would attempt to link.
      
      Also, since `rsocket` bundles its own `gmock`, it is just a waste of time to compile a system-level gmock. It's not a real dependency.
      
      NB: The change in `fbcode_builder.py` is needed because now that `rsocket` no longer depends on anything on Github, driver programs that were unconditionally setting `projects_dir` started to fail to build `rsocket`.
      
      Reviewed By: simpkins
      
      Differential Revision: D16461572
      
      fbshipit-source-id: 1e95654e96256e7ed37d42e702b5433bf2fe5328
      eba20f4d
  3. 30 Jul, 2019 2 commits
    • Nathan Bronson's avatar
      getrusage harness for CacheLocality · 92f03ddd
      Nathan Bronson authored
      Summary:
      This diff adds unit tests that print out the wall, user, and
      system time for two backend implementations of CacheLocality gathering.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D16547404
      
      fbshipit-source-id: 5b5467965eb21bc50ad7248c0badd814edc71d68
      92f03ddd
    • Yedidya Feldblum's avatar
      Fix non-portable annotation syntax in F14TestUtil.h · 8deb4210
      Yedidya Feldblum authored
      Summary: [Folly] Fix non-portable annotation syntax in `F14TestUtil.h`, using portable `[[noreturn]]` v.s. non-portable `__annotation__((__noreturn__))`. The non-portable syntax works with GCC and Clang, but is not recognized by MSVC.
      
      Reviewed By: jkedgar, terrelln, Orvid
      
      Differential Revision: D16553166
      
      fbshipit-source-id: a652d31d31eca773009885f648f44ea3798e1460
      8deb4210
  4. 29 Jul, 2019 1 commit
  5. 28 Jul, 2019 1 commit
    • Nathan Bronson's avatar
      extract locality info from /proc/cpuinfo instead of sysfs · 60be5ec6
      Nathan Bronson authored
      Summary:
      Cache locality information under /sys is dispersed across a
      very large number of files. This is a problem for short-lived processes
      due to direct overheads and lock contention in the kernel. This diff
      switches to a heuristic strategy that infers the interference pattern from
      /proc/cpuinfo instead of computing it exactly. This doesn't necessarily
      produce exactly the correct cache hierarchy info, but it yields the
      correct topological sort for machines that have only core-local and
      socket-local cache locality.
      
      Differential Revision: D16459331
      
      fbshipit-source-id: a322c126d1a4775d015bfb81451dbc6ad6fcc0fd
      60be5ec6
  6. 26 Jul, 2019 4 commits
    • Matt Glazar's avatar
      Fix flake8 with Python 2.7 · 2af6f0c7
      Matt Glazar authored
      Summary:
      flake8 (in Python 2.7 mode) complains that `typing` is mentioned in type annotations but is not defined:
      
      ```
      fbcode_builder/getdeps/buildopts.py:251:21: F821 undefined name 'typing'
          subst_mapping,  # type: typing.Mapping[str, str]
                          ^
      fbcode_builder/getdeps/buildopts.py:253:5: F821 undefined name 'typing'
          # type: (...) -> typing.Optional[str]
          ^
      2     F821 undefined name 'typing'
      2
      ```
      
      Import `typing` explicitly to silence this warning.
      
      Because `typing` may be unavailable, import it conditionally. (Because it's only referenced in comments, failing to import `typing` should have no effect at run time.)
      
      Reviewed By: snarkmaster
      
      Differential Revision: D16435696
      
      fbshipit-source-id: 78a4a7b07acc46aa998f02b54b1a6e52c1daafde
      2af6f0c7
    • Nick Wolchko's avatar
      fix blockingWait interaction with RequestContext · 136979f1
      Nick Wolchko authored
      Summary:
      We need to wrap coro_.resume() with a RequestContextScopeGuard so that
      if the task changes the request context, we restore it after the coroutine
      suspends itself.
      
      Reviewed By: lewissbaker
      
      Differential Revision: D16497375
      
      fbshipit-source-id: 439a6f41b2294e56d2ec1b0013a6013524b5ae6a
      136979f1
    • Julio C. Rocha's avatar
      Add ARM64 support. (#1191) · db4dba1b
      Julio C. Rocha authored
      Summary:
      Allow builds for 64-bit ARM (MSVC) to use the same implementation of `__builtin_clzll` as ARM and x86 architectures.
      Pull Request resolved: https://github.com/facebook/folly/pull/1191
      
      Test Plan: Imported from GitHub, without a `Test Plan:` line.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D16350573
      
      Pulled By: Orvid
      
      fbshipit-source-id: f25087b3a53de09767f505ee8c7d971a6d957189
      db4dba1b
    • Nick Terrell's avatar
      Improve sorted_vector_types standard compliance · d819b1fe
      Nick Terrell authored
      Summary:
      Note that we only provide the strong exception guarantee for single key insertion and emplacement when `std::is_nothrow_constructible<value_type>::value == true`. We could `static_assert()` that in `sorted_vector_set`, since it seems to hold for all contbuilds. But for `sorted_vector_map` there are quite a few contbuilds broken by that static assert. So I've chosen not to static assert in `sorted_vector_set` for consistency.
      
      `insert()`, `emplace*()` and `erase()` take `const_iterator` in compliance with C++11. `erase()` has an overload that takes an `iterator` in C++17, but since we are backed by a vector I don't think that is necessary.
      
      Add `emplace_hint()` variants.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D16427231
      
      fbshipit-source-id: 4bcf6fd01d9b1320548d12b152d1cef9291c2dd2
      d819b1fe
  7. 25 Jul, 2019 4 commits
    • Chad Austin's avatar
      minor refactoring in folly/stats · 58cbf30c
      Chad Austin authored
      Summary:
      While wrapping my head around the TDigest code, I made a few small
      drive-by clean-ups.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D16478284
      
      fbshipit-source-id: aaf289a57ef633f0f1527263beffb7c0edf596d1
      58cbf30c
    • Nathan Bronson's avatar
      reduce key comparisons in map and set operator== · 11855c21
      Nathan Bronson authored
      Summary:
      The standard requires that operator== for associative containers
      check key equality using operator==, which may be a refinement of the
      container's key_eq.  (The requirement is expressed via equal_range and
      std::is_permutation, but has the same effect.)  The straightforward way to
      implement this results in duplicate key comparisons.  This diff adds a
      containsEqualValue method that can avoid the second check, and uses
      it for map and set operator==.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D16455735
      
      fbshipit-source-id: 8ccd0743f8c11bee5d91c065214cead96dd8b72c
      11855c21
    • Chad Austin's avatar
      break dependency on fboss common/ stubs · a752b25d
      Chad Austin authored
      Summary: Eden no longer depends on fboss/common/ 🌈
      
      Reviewed By: simpkins
      
      Differential Revision: D16062879
      
      fbshipit-source-id: e6cf6eed408ca6e688ff2b9b532b15aa96902ac1
      a752b25d
    • Chad Austin's avatar
      use fb303 repo in open source build · a6569e7a
      Chad Austin authored
      Summary: Add a dependency from the eden open source build to the fb303 open source build and switch EdenServiceHandler to BaseService.
      
      Reviewed By: simpkins
      
      Differential Revision: D15528156
      
      fbshipit-source-id: 2ca5c31dd9fcc9bac43fd399b27f33b6f2c5ebfc
      a6569e7a
  8. 24 Jul, 2019 7 commits
    • Nanshu Chen's avatar
      Python async_generator bridge to folly::coro::AsyncGenerator · 4e3b3415
      Nanshu Chen authored
      Summary: Given a cpp folly::coro::AsyncGenerator, a python async generator/iterator may be built and bridged to it. Users may use `async for ...` syntax to consume data from it.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D16404979
      
      fbshipit-source-id: dd2dfd52d00bd1a3e30e838359a27458744f6461
      4e3b3415
    • Matt Glazar's avatar
      Fix tests with Python 2.7 · ae2d0a61
      Matt Glazar authored
      Summary:
      Some people want to use getdeps with Python 2.7. This looks easy to do, so take a step toward Python 2.7 support by fixing getdeps' tests when run with Python 2.7.
      
      For Python 3, this diff should not change behavior.
      
      This diff should address https://github.com/facebook/bistro/issues/35.
      
      Reviewed By: snarkmaster
      
      Differential Revision: D16435667
      
      fbshipit-source-id: f5c262b12995b609263341c4de26dac7f9b12b70
      ae2d0a61
    • Christian Clauss's avatar
      Remove `sudo: required` from `.travis.yml` (#37) · e730c5f7
      Christian Clauss authored
      Summary:
      This is just https://github.com/facebook/bistro/pull/37/, backported to `fbcode_builder`.
      
      snarkmaster
      Pull Request resolved: https://github.com/facebook/bistro/pull/37
      
      Test Plan: Push and watch Travis
      
      Reviewed By: simpkins
      
      Differential Revision: D16453080
      
      Pulled By: snarkmaster
      
      fbshipit-source-id: a15eaead931f046c41e50f8e3b412ef68b172d65
      e730c5f7
    • Nick Terrell's avatar
      Remove unnecessary copies in dynamic::hash() · 6b849e9d
      Nick Terrell authored
      Summary:
      `dynamic::hash()` would copy every key-value pair in the object accumulator hash because of two bugs in the code:
      1. The lambda took `auto` instead of `auto const&`
      2. The hasher was `hash<pair<dynamic, dynamic>>` not `hash<pair<dynamic const, dynamic>>` meaning a conversion was needed.
      
      These bugs together caused 2 copies for each sub-object. Since the copies are recursive, each object got copied 2*depth times.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D16452213
      
      fbshipit-source-id: 64a55e1640abb022c148183646e9f9720fd8482e
      6b849e9d
    • Alastair Harrison's avatar
      Fix libc++ ASAN failures in resizeWithoutInitialization (#1194) · 0752c055
      Alastair Harrison authored
      Summary:
      This is a proposed fix for issue: https://github.com/facebook/folly/issues/1193
      Using `folly::resizeWithoutInitialization` with libc++ and the address sanitizer causes false positive 'container overflow' failures.
      
      This PR only addresses the problem for resizing `std::vector`. Presumably the version of `folly::resizeWithoutInitialization` for `std::string` has the same problem, but I have not verified this.
      
      ### Potential issues
      This PR assumes that the `__sanitizer_annotate_contiguous_container` is available in libc++, and that the `std::vector` implementation has been annotated with it. The latter occurred in ~2014:
      http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/vector?r1=191987&r2=208319&pathrev=208319
      
      If there are people using C++14 compilers with versions of libc++ predating the addition of the `std::vector<T>::__annotate_contiguous_container` member function then this fix will fail to compile.
      
      I'm not aware of any sane way to detect the exact version of libc++ being used. Perhaps a suitable mitigation for those (few?) people with a C++14 compiler and pre-2015 libc++ implementation would be to provide a `FOLLY_` macro to disable the annotation.
      Pull Request resolved: https://github.com/facebook/folly/pull/1194
      
      Reviewed By: yfeldblum
      
      Differential Revision: D16445890
      
      Pulled By: nbronson
      
      fbshipit-source-id: ef33bbd5cc12c71822985c5174bf8e47e6eb3757
      0752c055
    • Yedidya Feldblum's avatar
      Extract type aliases in LtHash members · 32767e68
      Yedidya Feldblum authored
      Summary: [Folly] Extract type aliases in `LtHash` members to avoid unnatural line breaks and indentation.
      
      Reviewed By: modocache
      
      Differential Revision: D16453375
      
      fbshipit-source-id: 8d68458ba3ba7bf79fef82986f4f170e3b74ddd6
      32767e68
    • Yedidya Feldblum's avatar
      Apply clang-format to folly/experimental/crypto/ · e77bffe8
      Yedidya Feldblum authored
      Summary: [Folly] Apply `clang-format` to `folly/experimental/crypto/`.
      
      Reviewed By: modocache
      
      Differential Revision: D16453122
      
      fbshipit-source-id: 5a24b20dba3ab472cd490afaaa24e7ab1c1295ec
      e77bffe8
  9. 23 Jul, 2019 4 commits
    • Adam Simpkins's avatar
      fix handling of common arguments · 84c30daf
      Adam Simpkins authored
      Summary:
      getdeps allowed common arguments to be specified either before or after
      the subcommand name.  However, the arguments were only actually honored
      if they were specified on the command line after the subcommand name.
      Specifying any of these arguments before the subcommand would simply be
      ignored, and the default value would be used.  This happened since the
      subcommand argument's default value overwrote the value specified by the
      user from the main command parser.
      
      This fixes the behavior by using `argparse.SUPPRESS` so that argparse
      won't set the value at all if it was not specified.  This allows the
      value from the main parser to be used correctly if the argument was not
      seen by the subcommand parser.
      
      Reviewed By: chadaustin
      
      Differential Revision: D16435358
      
      fbshipit-source-id: f3893ef7a27fb018247f249f313d6438472e0140
      84c30daf
    • Nick Terrell's avatar
      Fix memory leak when exception is thrown · 7dfd49f2
      Nick Terrell authored
      Summary: F14NodeSet::insert() leaks memory when construction throws.
      
      Reviewed By: yfeldblum, nbronson
      
      Differential Revision: D16399317
      
      fbshipit-source-id: 4c9385288dd212469dfbd10b3e990b3533dc66d3
      7dfd49f2
    • Dan Melnic's avatar
      eachToTuple: use to<fbstring>(delim) instead of delim · 133d8937
      Dan Melnic authored
      Summary: eachToTuple: use to<fbstring>(delim) instead of delim
      
      Reviewed By: yfeldblum
      
      Differential Revision: D16419866
      
      fbshipit-source-id: 7a57f41ea210c569284f6c619784adc95f03b26e
      133d8937
    • Andrii Grynenko's avatar
      Fix timed_wait to not hold executor keep-alive for too long · dd15371c
      Andrii Grynenko authored
      Reviewed By: yfeldblum
      
      Differential Revision: D16426555
      
      fbshipit-source-id: 0211c58b6919dc412b9cd7a029f0543d0060b40b
      dd15371c
  10. 22 Jul, 2019 4 commits
    • Andrii Grynenko's avatar
      scheduleOn should accept a KeepAlive · 56600ae2
      Andrii Grynenko authored
      Differential Revision: D16368120
      
      fbshipit-source-id: 0511e2f84b3bf8d1affbfbeecd05c04cb0269037
      56600ae2
    • Paul Gossman's avatar
      Add missing include guard to coro/detail/Helpers.h · 931299b7
      Paul Gossman authored
      Summary: This file is included in `coro/TimedWait.h` and `coro/Collect.h`, so inclusion of those two headers is causing redefinition errors.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D16414841
      
      fbshipit-source-id: 103fa87a7c978d256e58eb67089b4cb984d362e4
      931299b7
    • Chad Austin's avatar
      turn off /EHa · a5e8658c
      Chad Austin authored
      Summary:
      The /EHa flag tells MSVC to catch asynchronous (structured) exceptions
      in `catch(...)` blocks. This is generally a bad idea, because
      structured exceptions include page faults, stack overflow, division by
      zero, and illegal instructions, at which point attempting to run
      further arbitrary C++ code will have wonky effects in the best
      case. It would probably also clobber any state required to debug the
      original failure.
      
      Reviewed By: Orvid
      
      Differential Revision: D16390933
      
      fbshipit-source-id: 2997daaf350680dc9d0c7da3cabab8749e8ecb82
      a5e8658c
    • Nick Terrell's avatar
      Only throw std::invalid_argument on parse error · 08fbd1d3
      Nick Terrell authored
      Summary:
      The documentation claims that the constructor only throws
      `std::invalid_argument`, but it could throw a `ConversionError`.
      
      Reviewed By: Orvid
      
      Differential Revision: D16387303
      
      fbshipit-source-id: 887a84f48a49acdc0516605f8204432bfd8ca800
      08fbd1d3
  11. 21 Jul, 2019 2 commits
  12. 19 Jul, 2019 4 commits
    • Adam Simpkins's avatar
      update CMakeBuilder to raise an exception if we cannot find CMake · ca788235
      Adam Simpkins authored
      Summary:
      If `path_search()` returns that CMake is not available, raise an Exception and
      fail the build.  This makes the failure somewhat easier to to identify.
      Without this the code would continue and would try to invoke `subprocess` with
      a value of `None` in the command argument list.  This error is slightly harder
      to debug, since it isn't clear which command argument or environment variable
      is not a string.
      
      Reviewed By: chadaustin
      
      Differential Revision: D16354623
      
      fbshipit-source-id: be972b02cb13bc70db0f867da70e5bf4c6cec46d
      ca788235
    • Adam Simpkins's avatar
      normalize the scratch path · 1d6854a4
      Adam Simpkins authored
      Summary:
      The scratch path is used as part of the hash computation for each project.  We
      need to make sure this path is always normalized to ensure that we compute the
      hashes consistently.
      
      Reviewed By: chadaustin
      
      Differential Revision: D16354624
      
      fbshipit-source-id: 39b5362620bdc247cd7e7f1333dac319b354dc6f
      1d6854a4
    • Adam Simpkins's avatar
      cache results of path_search() · 4c4d3911
      Adam Simpkins authored
      Summary:
      getdeps currently ends up calling `path_search()` repeatedly searching for
      various C/C++ compilers in $PATH.  It ends up doing this multiple times for
      each dependency as it computes the project hashes.  This updates the
      `path_search()` function to cache its results so that we don't keep performing
      the same searches on the file system over and over again.
      
      Reviewed By: chadaustin
      
      Differential Revision: D16354625
      
      fbshipit-source-id: 116293bd2f636632517d26436b2332e6c10624f1
      4c4d3911
    • Dan Melnic's avatar
      Fix mem leak due to observer not being freed · 9b2c712d
      Dan Melnic authored
      Summary: Fix mem leak due to observer not being freed
      
      Reviewed By: yfeldblum
      
      Differential Revision: D16234386
      
      fbshipit-source-id: 54ea9e904cf6cde0e24edf1511c2e3b46a58376f
      9b2c712d