1. 04 Aug, 2019 1 commit
  2. 03 Aug, 2019 7 commits
    • Andrii Grynenko's avatar
      Support co_return Try<T> from Task<T> · 115fe40f
      Andrii Grynenko authored
      Summary: This can be useful to avoid the cost of re-throwing exceptions.
      
      Reviewed By: yfeldblum, LeeHowes
      
      Differential Revision: D16628722
      
      fbshipit-source-id: 434842d99369d0293c4eeb894e6feac15ec16173
      115fe40f
    • Lee Howes's avatar
      Support inline defer 5/n - Make defer use inline forms of then internally · 4785adac
      Lee Howes authored
      Summary: Defer uses inline continuations by default, if bound executors match.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D15300706
      
      fbshipit-source-id: fc17c70ed9956442007a1cc2f6a082f75c555ad4
      4785adac
    • Lee Howes's avatar
      Support inline defer 4/n - Use variant of KeepAlive<> and DeferredExecutor in Core · ea6ee538
      Lee Howes authored
      Summary:
      After this diff, DeferredExecutor participates consistently in executor inline behaviour by being special cased in the core.
      
      DeferredExecutor is no longer an executor, and is hence no longer special cased in the Future code. This is replaced with a variant of DeferredExecutor and Executor in Core.
      
      Reviewed By: yfeldblum, andriigrynenko
      
      Differential Revision: D15836529
      
      fbshipit-source-id: 8324ba1de57e85fc757ecc3b431bf71858868a0d
      ea6ee538
    • Lee Howes's avatar
      Support inline defer 3/n - Move DeferredExecutor into Core.h · 0c0aeccc
      Lee Howes authored
      Summary: Simple code reorg. DeferredExecutor class moved into Core as it is later becoming functionality of Core rather than of the Future.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D15836530
      
      fbshipit-source-id: 5a14a6c9332666b275e39796cae5f32c96edacd5
      0c0aeccc
    • Lee Howes's avatar
      Support inline defer 2/n - Add addFrom to DeferredExecutor · 4066afa9
      Lee Howes authored
      Summary: addFrom on DeferredExecutor allows the DeferredExecutor to know what executor is running the work enqueuing to it, which it can check against its internal state to run the work inline if the executors match.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D15836532
      
      fbshipit-source-id: 40c35d976b90072c88bb544360b059c1b151d4d0
      4066afa9
    • Lee Howes's avatar
      Support inline defer 1/n - Add and use r-value add on KeepAlive · b619a10f
      Lee Howes authored
      Summary:
      Allows adding directly to a KeepAlive if the KeepAlive is consumed in the process.
      
      This allows simultaneous consumption and propagation of the KeepAlive into the callback, propagating information about the executor running the callback without the cost of reference counting the KeepAlive.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D15836528
      
      fbshipit-source-id: 8f9e6f6ec47ad294391741d25fce68a85a429919
      b619a10f
    • Yedidya Feldblum's avatar
      cacheline_align_t, cacheline_align_v · 51ad358e
      Yedidya Feldblum authored
      Summary: [Folly] `cacheline_align_t`, `cacheline_align_v` - since it is theoretically possible on some platforms for `alignas(hardware_destructive_interference_size)` to be a compile-time error.
      
      Reviewed By: aary
      
      Differential Revision: D16598497
      
      fbshipit-source-id: d0dfe99b726cec5dba96e26147e73e494e62a895
      51ad358e
  3. 02 Aug, 2019 6 commits
    • Yedidya Feldblum's avatar
      Add unsafe-unlocked getter to Synchronized · a93eb033
      Yedidya Feldblum authored
      Summary:
      [Folly] Add unsafe-unlocked getter to `Synchronized`.
      
      Provided as a backdoor for call-sites where it is known safe to be used. For example, when it is known that only one thread has access to the `Synchronized` instance.
      
      To be used with care - this method explicitly overrides the normal safety guarantees provided by the rest of the `Synchronized` API.
      
      Reviewed By: chadaustin, simpkins
      
      Differential Revision: D8178205
      
      fbshipit-source-id: 648ee392a43a06333452f72d992ec42ba4a1a73c
      a93eb033
    • Yedidya Feldblum's avatar
      Fix visibility attributes that gcc objects to in xlog · 47fa124a
      Yedidya Feldblum authored
      Summary: [Folly] Fix visibility attributes that gcc objects to in xlog by moving them from lambdas to proper functions.
      
      Reviewed By: nbronson
      
      Differential Revision: D16578895
      
      fbshipit-source-id: 021fd10ef01bb610dc6f20d9a9a98a5a8e11df71
      47fa124a
    • Rui Zhang's avatar
      Wrap TSX intrinsics with checks on compiler and architecture support for TSX. · def0359e
      Rui Zhang authored
      Summary: The TSX intrinsics should only be compiled and used when compilers and platforms support them. This diff wraps the intrinsics and adds checks on TSX support to server this purpose.
      
      Reviewed By: nbronson
      
      Differential Revision: D16585187
      
      fbshipit-source-id: 6490c0da7f6221caaa4529bfcebb261cfd99cc7d
      def0359e
    • Jifan Zhang's avatar
      Test and Fix IOBuf Python Iterable on Fragmented Data · 06a2d529
      Jifan Zhang authored
      Summary:
      The Python chained `IOBuf` has undesirable behavior on cyclic pattern data. For example, when we have a data chain with
      ```
      chain = make_chain([IOBuf(b"aaa"), IOBuf(b"aaaa")])
      ```
      `b"".join(chain)` will yield `b"aaa"` rather than `b"aaaaaaa"`.
      
      The root cause to this bug is because in the `__iter__` method of the Python `IOBuf`, the original code checks whether the circular chain has been traversed by the `!=` operator (`self != next`), which has been overridden by `__richcmp__` function. The rich comparator then invokes the comparator in C++, which compares the underlying data in a `IOBuf` chain rather than their reference locations. In the above example, therefore, `chain == chain.next` would return `True`. However, in `__iter__`, in order to check whether the traversal is back to the head of the chain, we should compare by reference rather value.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D16589600
      
      fbshipit-source-id: 3b03c4d502bdc385edca3502949be03440543a21
      06a2d529
    • Yedidya Feldblum's avatar
      Extract Executor::KeepAlive constants to a base class · 21680794
      Yedidya Feldblum authored
      Summary: [Folly] Extract Executor::KeepAlive bitmask constants to a non-template base class so that they can be used from elsewhere.
      
      Reviewed By: LeeHowes
      
      Differential Revision: D16617648
      
      fbshipit-source-id: eb3ceddfa8c492bb4ddd7de0046bb5c2c6b4e762
      21680794
    • Andrii Grynenko's avatar
      Cleanup coroutine code to not use InlineExecutor · b479a5dd
      Andrii Grynenko authored
      Reviewed By: yfeldblum
      
      Differential Revision: D16594071
      
      fbshipit-source-id: 78755bc64f22b28f89958064184c1fdf35b1bb85
      b479a5dd
  4. 01 Aug, 2019 11 commits
    • John Strizich's avatar
      add manifest for re2 · 97307b40
      John Strizich authored
      Summary: needed for openr
      
      Reviewed By: simpkins
      
      Differential Revision: D16010070
      
      fbshipit-source-id: 6d485fa7e4e321e6cd23d9894b38c1ecc7574665
      97307b40
    • Jay Edgar's avatar
      Use a static exception where it makes sense · ec4b2e04
      Jay Edgar authored
      Summary: Don't constanly rebuild exceptions that are always the same.
      
      Reviewed By: jrahman
      
      Differential Revision: D16016383
      
      fbshipit-source-id: b0b24ed39e6c41f95c61369c90a3ac83abfd1a66
      ec4b2e04
    • Adam Simpkins's avatar
      have CMakeBuilder emit a script to allow invoking CMake manually · 7b691d80
      Adam Simpkins authored
      Summary:
      While developing on a project it is often convenient to be able to invoke its
      build manually, rather than always needing to re-run `getdeps.py`.  This
      updates the CMakeBuilder to also emit a script that can be used to manually
      run CMake outside of `getdeps.py`.
      
      The CMakeBuilder is the only builder that this really matters for right now,
      as pretty much all of the projects where we do first-party development use
      CMake for their build system.
      
      Reviewed By: pkaush
      
      Differential Revision: D16477399
      
      fbshipit-source-id: c8a14af158af7b32d6c799ef685b037e68b748ff
      7b691d80
    • Adam Simpkins's avatar
      move project hash computation to ManifestLoader · 95457419
      Adam Simpkins authored
      Summary:
      Move code that computes project hashes to ManifestLoader.  ManifestLoader is
      the only class that has all of the information necessary to compute the
      project hashes correctly.  The ManifestLoader object can also cache previously
      computed hashes, so that we don't have to keep computing hashes for projects
      over and over again.  Previously the `BuildOptions.compute_dirs()` function
      would end up re-computing hashes for all dependencies each time it was called.
      
      Reviewed By: strager
      
      Differential Revision: D16477401
      
      fbshipit-source-id: ce03642114f91ce4f859f612e6b2e747cf1653be
      95457419
    • Adam Simpkins's avatar
      add a create_fetcher() method to ManifestLoader · 53753410
      Adam Simpkins authored
      Summary:
      The ManifestLoader contains all of the state needed to create a fetcher
      object, so define a helper method on this object to create a fetcher.
      
      Reviewed By: strager
      
      Differential Revision: D16477395
      
      fbshipit-source-id: 6de0942fe6b8de26c18c82bf99343f5467dc006a
      53753410
    • Adam Simpkins's avatar
      add a new ManifestLoader class · b2c3257c
      Adam Simpkins authored
      Summary:
      Add a new ManifestLoader class to handle loading manifests and computing
      dependencies.
      
      For now the main thing this class does is maintain the `manifest_by_name`
      mapping.  In subsequent diffs we should be able to move some additional logic
      into this class, which will help clean up the code and eliminate some redudant
      work.  In particular, we can have this class cache project hashes, which will
      avoid re-computing hashes over and over again for the same projects as we do
      in many cases today.  We should also be able to save and re-use some of the
      project dependency ordering computation in some cases as well.
      
      Reviewed By: strager
      
      Differential Revision: D16477400
      
      fbshipit-source-id: f06f62f77d8443fccaa69fe4c1306e39c395b325
      b2c3257c
    • Adam Simpkins's avatar
      use the correct project-specific context when computing hashes · c0c0f5cf
      Adam Simpkins authored
      Summary:
      Update `BuildOpts.compute_dirs()` to use the correct project-specific manifest
      context when computing project hashes.  Previously it was incorrectly using
      the initial project's context when evaluating all dependencies.  This would
      result in some projects potentially seeing the wrong values for variables that
      may change from project to project (like `test`).
      
      Reviewed By: pkaush
      
      Differential Revision: D16477398
      
      fbshipit-source-id: 6c23f5e5e19b2402000a138b3920b79044446041
      c0c0f5cf
    • Adam Simpkins's avatar
      add a ManifestContext and ContextGenerator class · 4e2e55c6
      Adam Simpkins authored
      Summary:
      Add a ContextGenerator class so that we actually use the correct per-project
      context when loading projects and computing dependencies.
      
      Previously commands like `build` and `test` would change the contexts for each
      project as they iterated through and performed the build.  However, they did
      not do this when first loading the projects.  This could cause them to use
      different context values when loading dependencies than when performing the
      build.  For instance, this could cause issues if a project depends on
      `googletest` only when testing is enabled, as the code previously did not set
      the "test" parameter when evaluating dependencies.
      
      Reviewed By: pkaush
      
      Differential Revision: D16477396
      
      fbshipit-source-id: c1e055f07de1cb960861d19594e3bda20a2ccd87
      4e2e55c6
    • Adam Simpkins's avatar
      fail if unknown variables are used in a manifest · 7cde7f20
      Adam Simpkins authored
      Summary:
      Check that all variable names are valid when loading manifest files.
      This ensures that getdeps.py will error out if someone makes a typo in a
      variable name, rather than treating it as never equal to anything.
      
      Reviewed By: pkaush
      
      Differential Revision: D16477397
      
      fbshipit-source-id: 030e0642ff4a08db8eb74a0a0223e03d53e4880f
      7cde7f20
    • Tristan Rice's avatar
      ExceptionTracerLib: allow overriding the deleter method for thrown exceptions · 2a068f41
      Tristan Rice authored
      Summary:
      This allows us to use a custom deleter to track the lifetime of exceptions in
      the case of smart pointers which may be persisted outside catch blocks.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D16572937
      
      fbshipit-source-id: ad2f0a981a2b31ef4b17a902719b684f538c29c7
      2a068f41
    • Amir Livneh's avatar
      Remove extra space in comment · dd239cec
      Amir Livneh authored
      Reviewed By: JunqiWang
      
      Differential Revision: D16497024
      
      fbshipit-source-id: aa0e42b4bfba3c70769514131daa30df84851126
      dd239cec
  5. 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
  6. 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
  7. 29 Jul, 2019 1 commit
  8. 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
  9. 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
  10. 25 Jul, 2019 1 commit
    • 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