1. 27 Sep, 2019 3 commits
    • Udip Pant's avatar
      function to enable or disable pathmtu discovery · 09ce44b3
      Udip Pant authored
      Summary:
      Allows us to set IPV6_PMTUDISC_PROBE
      See http://man7.org/linux/man-pages/man7/ip.7.html for reference
      
      Reviewed By: yfeldblum
      
      Differential Revision: D17624135
      
      fbshipit-source-id: 46c1e71c768a0a7d0fbab5b728ba5df1b2f781b3
      09ce44b3
    • Maged Michael's avatar
      hazptr: Avoid unnecessary access to domain tagged list · b73bf8c1
      Maged Michael authored
      Summary:
      This diff avoids locking and traversing the domain's tagged list on shutdown of batches that never pushed objects to the list.
      
      This change required batches to keep track of pushing objects to the domain's tagged list.
      This in turn required reclamation of tagged objects to be invoked by the batch rather than using the free function hazptr_cleanup_batch_tag.
      In order to avoid batches keeping track of the associated domain (and adding an extra field), batches are used only with the default domain.
      
      Reviewed By: davidtgoldblatt
      
      Differential Revision: D17416380
      
      fbshipit-source-id: e5a3cd1492c1f1daf499b44fa1cfb4bb822062f7
      b73bf8c1
    • Aditya Kumar's avatar
      Reducing calls to malloc in AsyncSocket · a8f674ce
      Aditya Kumar authored
      Summary:
      Reduce calls to string::operator+.
      Constructing a single string by precalculating the size.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D17573761
      
      fbshipit-source-id: 3918d1774949873fab3ba702d47cdeb80b44ab1d
      a8f674ce
  2. 26 Sep, 2019 2 commits
    • Yedidya Feldblum's avatar
      No need to load test files at runtime in json test · d3f8fa39
      Yedidya Feldblum authored
      Summary: [Folly] No need to load test files at runtime in json test - just embed the content into the test source as usual.
      
      Reviewed By: vitaut
      
      Differential Revision: D17578929
      
      fbshipit-source-id: 65b0bb7fe94f03b3defa9c539c2837c341e042c3
      d3f8fa39
    • Jason Gauci's avatar
      Add boost dependencies from folly · 2aa07752
      Jason Gauci authored
      Reviewed By: yfeldblum
      
      Differential Revision: D17556725
      
      fbshipit-source-id: 693ab8a2288584d3a05298790b6289483814e895
      2aa07752
  3. 25 Sep, 2019 2 commits
    • Yedidya Feldblum's avatar
      Fix stack-use-after-scope in folly::json::serialize · f1fe2fe9
      Yedidya Feldblum authored
      Summary:
      [Folly] Fix stack-use-after-scope in `folly::json::serialize` internals in `std::sort` comparison in `Printer::printObject`.
      
      Also avoid an extra layer of indirection around the comparison function. Possibly useful because the function is called repeatedly within the loop.
      
      Fixes #1190.
      
      Reviewed By: vitaut
      
      Differential Revision: D17560072
      
      fbshipit-source-id: 787584dc1f7d70762a712869788f8d892dd19ed5
      f1fe2fe9
    • Andrew Krieger's avatar
      Avoid -Wundef in ThreadName.cpp · a6306282
      Andrew Krieger authored
      Summary:
      There's already some ifdef for _WIN32 but it's not consistent.
      Also nothing ever sets the define for the supported functions to 0,
      so bail on those.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D17559767
      
      fbshipit-source-id: d0eebea980ef4f2b1288bdcc39547453efd3e9be
      a6306282
  4. 24 Sep, 2019 4 commits
    • Ezequiel Gomez's avatar
      New helper method to set the ciphersuites list of an SSLContext · 2e5c9c92
      Ezequiel Gomez authored
      Summary: Add new helper method setCiphersuites to folly SSLOptions. Same behavior as the templated setCipherSuites that takes in a TSLOptions. Instead of getting the ciphersuites from the static TSLOptions::ciphers(), this method allows use caller to pass in the ciphersuite list.
      
      Reviewed By: mingtaoy
      
      Differential Revision: D17432484
      
      fbshipit-source-id: 8a08b3651e209b5a4dfe4eca2352a9042206a48a
      2e5c9c92
    • Shoaib Meenai's avatar
      Check CachelinePadded alignment requirement dynamically · 8462db08
      Shoaib Meenai authored
      Summary:
      It's possible, but not required, for platforms to support alignment
      requirements greater than std::max_align_t. For example, on some 32-bit
      platforms (e.g. iPhone armv7), std::max_align_t is only 4, but
      std::atomic<unsigned long long> has an alignment requirement of 8. Check
      for alignment at runtime instead of compile time to avoid spurious
      static assertion failures.
      
      Reviewed By: nbronson
      
      Differential Revision: D17488704
      
      fbshipit-source-id: 54cd7c2d7aec4f7f93e5fa6d62f8237f66a6c018
      8462db08
    • John Strizich's avatar
      adding openr to this framework · fff74a54
      John Strizich authored
      Summary:
      this adds `oss-openr-linux-getdeps` to diffs affecting files under openr. With soma going away and the old fbcode_builder job disabled, this will give us the signal we need to keep the cmake build healthy.
      
      [Some Info on Getdeps](https://our.intern.facebook.com/intern/wiki/Test_your_Open_Source_build_with_getdeps.py/)
      
      Michael, this change may require you to bump up some of the dependent libraries and build them with cmake if not already. The main changes to the cmake script are around using package configs instead of `find_library`
      
      Also, for those with more CMake experience: since there are some big changes in the `CmakeLists`, feel free to pour on more suggestions on how I could make it better and more aligned with other facebook OSS
      
      Reviewed By: saifhhasan
      
      Differential Revision: D16010068
      
      fbshipit-source-id: 66f914f1971f826e0868c4130839380639a7e44b
      fff74a54
    • Yedidya Feldblum's avatar
      Add missing template qualification in FunctionRef · 71be50bd
      Yedidya Feldblum authored
      Summary: [Folly] Add missing `template` qualification in `FunctionRef`. Comparable sites in `Function` include the `template` qualification.
      
      Reviewed By: LeeHowes
      
      Differential Revision: D17521726
      
      fbshipit-source-id: 350fd0c2944508fb653239d637516d099184330d
      71be50bd
  5. 23 Sep, 2019 2 commits
    • Lee Howes's avatar
      Additional documentation for Future continuation functions · 98e63e8a
      Lee Howes authored
      Summary: Clarifying doc blocks.
      
      Reviewed By: lbrandy
      
      Differential Revision: D17527404
      
      fbshipit-source-id: 4f5c83a94b511082379d8bbbfea6d37a908bc860
      98e63e8a
    • Nathan Bronson's avatar
      relax allocated-memory tests for libcxx · 05b8b22f
      Nathan Bronson authored
      Summary:
      The current version of libc++ deallocates the existing capacity
      when calling operator=(initializer_list), even if the map is empty. This
      diff relaxes the expectations of F14's allocated memory tests (which
      fall back to the underlying STL std::unordered_map on some platforms)
      to accept this implementation.
      
      Reviewed By: shixiao
      
      Differential Revision: D17527441
      
      fbshipit-source-id: 01da55aaeb6f8328e093251b026052dac365f7b2
      05b8b22f
  6. 22 Sep, 2019 1 commit
  7. 21 Sep, 2019 1 commit
    • Yedidya Feldblum's avatar
      Optimize Function::operator() codegen · 44833c41
      Yedidya Feldblum authored
      Summary:
      [Folly] Optimize `Function::operator()` codegen for size and speed.
      
      * Avoid translating between values and references for trivially-copyable values.
      * Avoid shifting all arguments to make room for the function object address.
      
      In the optimal case, the codegen for calling a `Function` with many arguments translates into just a `jmp`.
      
      See:
      * https://github.com/thecppzoo/zoo/commits/master/inc/zoo/AnyCallable.h
      * https://github.com/bloomberg/bde/blob/3.38.0.1/groups/bsl/bslstl/bslstl_function.h
      * https://github.com/bloomberg/bde/blob/3.38.0.1/groups/bsl/bslmf/bslmf_forwardingtype.h
      
      Given this example code:
      
      ```lang=c++,name=check.cpp
      extern "C" void check_0(folly::Function<void()>& f) { f(); }
      extern "C" void check_1(int i, folly::Function<void(int)>& f) { f(i); }
      extern "C" void check_2(int i, int j, folly::Function<void(int, int)>& f) { f(i, j); }
      extern "C" void check_3(int i, int j, int k, folly::Function<void(int, int, int)>& f) { f(i, j, k); }
      extern "C" void check_4(int i, int j, int k, int l, folly::Function<void(int, int, int, int)>& f) { f(i, j, k, l); }
      ```
      
      Before:
      
      ```name=check.o
      0000000000000000 <check_0>:
         0:   ff 67 30                jmp    QWORD PTR [rdi+0x30]
      0000000000000000 <check_1>:
         0:   55                      push   rbp
         1:   48 89 f0                mov    rax,rsi
         4:   48 89 e5                mov    rbp,rsp
         7:   48 83 ec 10             sub    rsp,0x10
         b:   89 7d fc                mov    DWORD PTR [rbp-0x4],edi
         e:   48 8d 75 fc             lea    rsi,[rbp-0x4]
        12:   48 89 c7                mov    rdi,rax
        15:   ff 50 30                call   QWORD PTR [rax+0x30]
        18:   c9                      leave
        19:   c3                      ret
      0000000000000000 <check_2>:
         0:   55                      push   rbp
         1:   48 89 d0                mov    rax,rdx
         4:   48 89 e5                mov    rbp,rsp
         7:   48 83 ec 10             sub    rsp,0x10
         b:   89 7d f8                mov    DWORD PTR [rbp-0x8],edi
         e:   89 75 fc                mov    DWORD PTR [rbp-0x4],esi
        11:   48 8d 55 fc             lea    rdx,[rbp-0x4]
        15:   48 8d 75 f8             lea    rsi,[rbp-0x8]
        19:   48 89 c7                mov    rdi,rax
        1c:   ff 50 30                call   QWORD PTR [rax+0x30]
        1f:   c9                      leave
        20:   c3                      ret
      0000000000000000 <check_3>:
         0:   55                      push   rbp
         1:   48 89 c8                mov    rax,rcx
         4:   48 89 e5                mov    rbp,rsp
         7:   48 83 ec 10             sub    rsp,0x10
         b:   89 7d f4                mov    DWORD PTR [rbp-0xc],edi
         e:   89 75 f8                mov    DWORD PTR [rbp-0x8],esi
        11:   89 55 fc                mov    DWORD PTR [rbp-0x4],edx
        14:   48 8d 4d fc             lea    rcx,[rbp-0x4]
        18:   48 8d 55 f8             lea    rdx,[rbp-0x8]
        1c:   48 8d 75 f4             lea    rsi,[rbp-0xc]
        20:   48 89 c7                mov    rdi,rax
        23:   ff 50 30                call   QWORD PTR [rax+0x30]
        26:   c9                      leave
        27:   c3                      ret
      0000000000000000 <check_4>:
         0:   55                      push   rbp
         1:   4c 89 c0                mov    rax,r8
         4:   48 89 e5                mov    rbp,rsp
         7:   48 83 ec 10             sub    rsp,0x10
         b:   89 7d f0                mov    DWORD PTR [rbp-0x10],edi
         e:   89 75 f4                mov    DWORD PTR [rbp-0xc],esi
        11:   89 55 f8                mov    DWORD PTR [rbp-0x8],edx
        14:   89 4d fc                mov    DWORD PTR [rbp-0x4],ecx
        17:   4c 8d 45 fc             lea    r8,[rbp-0x4]
        1b:   48 8d 4d f8             lea    rcx,[rbp-0x8]
        1f:   48 8d 55 f4             lea    rdx,[rbp-0xc]
        23:   48 8d 75 f0             lea    rsi,[rbp-0x10]
        27:   48 89 c7                mov    rdi,rax
        2a:   ff 50 30                call   QWORD PTR [rax+0x30]
        2d:   c9                      leave
        2e:   c3                      ret
      ```
      
      After:
      
      ```name=check.o
      0000000000000000 <check_0>:
         0:   ff 67 30                jmp    QWORD PTR [rdi+0x30]
      0000000000000000 <check_1>:
         0:   ff 66 30                jmp    QWORD PTR [rsi+0x30]
      0000000000000000 <check_2>:
         0:   ff 62 30                jmp    QWORD PTR [rdx+0x30]
      0000000000000000 <check_3>:
         0:   ff 61 30                jmp    QWORD PTR [rcx+0x30]
      0000000000000000 <check_4>:
         0:   41 ff 60 30             jmp    QWORD PTR [r8+0x30]
      ```
      
      Reviewed By: mpark, ericniebler, ot, luciang
      
      Differential Revision: D17416587
      
      fbshipit-source-id: cdb76314197f8979339e31435fff997a46f48f1c
      44833c41
  8. 20 Sep, 2019 8 commits
    • Adam Simpkins's avatar
      fbcode_builder: implement automatic project detection from the current repo · 571f3268
      Adam Simpkins authored
      Summary:
      This updates fbcode_builder to try and automatically detect the current
      repository's project name by looking for a `.projectid` file in the repository
      root.  If the project name can be detected:
      - The current repository will automatically be used as the source directory
        for this project (instead of fetching the sources into the scratch
        directory).
      - If an explicit project name was not specified on the command line, the
        current project will be built by default.
      
      This also changes the repository detection logic to use the current working
      directory, rather than the directory where the fbcode_builder code lives.
      This will allow this logic to work even if we move fbcode_builder into its own
      repository in the future, and have projects depend on it using git submodules.
      This does mean that callers need to invoke fbcode_builder.py from inside the
      repository.
      
      Reviewed By: wez
      
      Differential Revision: D17088938
      
      fbshipit-source-id: f14d28fdcfaa330ff837ea52b8bdd4e358b81c61
      571f3268
    • Adam Simpkins's avatar
      improve run_cmake.py on Windows · 233f10ae
      Adam Simpkins authored
      Summary:
      Update the generated `run_cmake.py` script to use `subprocess.run()` instead
      of `os.execve()`.  The `os.execve()` call doesn't really do what we want on
      Windows: this causes the script to exit while CMake is still running,
      resulting in confusing output.  During the build step it also did not work
      correctly with `vcvarsall.bat`, and using `subprocess` also solves this.
      
      Reviewed By: wez
      
      Differential Revision: D17493897
      
      fbshipit-source-id: e0477627fc1824b0efcb1fa5a782d207853bcae8
      233f10ae
    • Adam Simpkins's avatar
      fix calculation of whether a project is cachable · 5dec9568
      Adam Simpkins authored
      Summary:
      Never cache first-party projects that use ShipIt.  Previously the code checked
      the `shipit_fbcode_builder` property, which controlled whether or not
      the `fbcode_builder` sources should be included in the project's ShipIt
      mapping.  This setting is enabled for most but not all projects that use
      ShipIt.
      
      This resulted in projects that use ShipIt but that do not include the fbcode
      builder sources being incorrectly cached.  This caused getdeps.py to not
      run the SimpleShipitTransformerFetcher properly when their sources changed.
      
      Reviewed By: wez
      
      Differential Revision: D17493522
      
      fbshipit-source-id: 57be5ac94ae44f56ccb3ce60ba23fac5d68bce0f
      5dec9568
    • Adam Simpkins's avatar
      the edenfsctl program depends on python-toml · bb96fea7
      Adam Simpkins authored
      Summary:
      Update the getdeps manifest and Eden's CMake files to indicate that the
      edenfsctl program depends on python-toml.
      
      Reviewed By: chadaustin
      
      Differential Revision: D17401215
      
      fbshipit-source-id: f512678d8bca9c7b2b4d25bf9c3ecd7eed825de9
      bb96fea7
    • Zeyi (Rice) Fan's avatar
      getdeps: move manifests · e41b0ce1
      Zeyi (Rice) Fan authored
      Reviewed By: simpkins
      
      Differential Revision: D17403339
      
      fbshipit-source-id: 2a6b2eb073d54e080f6a313948afd2815f58bba9
      e41b0ce1
    • Alex Guzman's avatar
      Fix order of operations ambiguity · 361701c4
      Alex Guzman authored
      Summary: Fixes a warning about ambiguity between & and ==
      
      Reviewed By: knekritz
      
      Differential Revision: D17500996
      
      fbshipit-source-id: 9a3d1da499bf25aff3d97bc3ea40bf5a1d19257d
      361701c4
    • Alex Guzman's avatar
      Fix portable versions of X509_get_extension_flags and X509_get_key_usage · 3a5914c6
      Alex Guzman authored
      Summary:
      These two functions are currently not correctly implemented when compared to the documented behavior.
      
      1. These functions aren't guaranteed to return correct information until you've called X509_check_purpose on the certificate. Before then, these flag fields are uninitialized.
      2. X509_get_key_usage should return UINT32_MAX when the key usage flag isn't present.
      
      This fixes both of these issues
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15767405
      
      fbshipit-source-id: 013bc4c2f694ba7cbd7395626418a0d423d6c1c7
      3a5914c6
    • Alex Guzman's avatar
      Add function for converting ASN1_TIME to std::chrono::system_clock::time_point · 125e0ed6
      Alex Guzman authored
      Summary: As it says on tin.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15409159
      
      fbshipit-source-id: a99b17b54e0c36d79956213655385d234190ff52
      125e0ed6
  9. 19 Sep, 2019 7 commits
    • Zeyi (Rice) Fan's avatar
      getdeps: throw exceptions when found duplicate manifests and name mismatches · a18cdcd5
      Zeyi (Rice) Fan authored
      Summary:
      Throws an exception when:
      
      * The name specified in the manifest mismatches the filename
      * Duplicated manifest -- with the sub-directory support it is now able to have multiple manifest files with the same name
      
      Reviewed By: chadaustin
      
      Differential Revision: D17438460
      
      fbshipit-source-id: ac7ad0b701beb15f0e91bb05cd1ec8fe378ad5b6
      a18cdcd5
    • Zeyi (Rice) Fan's avatar
      getdeps: include subdirectories when searching manifest · 9691120a
      Zeyi (Rice) Fan authored
      Summary: Make getdeps to look for subdirectories for manifest files.
      
      Reviewed By: simpkins
      
      Differential Revision: D17222388
      
      fbshipit-source-id: e13503beccd9edf6d80f78fbc3238b2a8d2053dd
      9691120a
    • Adam Simpkins's avatar
      the libraries in thrift/lib/py depend on six · 0bfa67ca
      Adam Simpkins authored
      Summary:
      The libraries in thrift/lib/py support both Python 2 and Python 3, and rely on
      the Python six module for some of this compatibility support.
      
      Update the getdeps manifest for fbthrift to indicate this dependency, and
      update fbthrift's CMakeLists.txt file to find and reference python-six
      properly.  This will ensure that the python-six code is built into any python
      executable that uses the thrift/lib/py libraries.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D17401218
      
      fbshipit-source-id: 0007dda8974ae9bd87e4d7e256c74908c9a30d8f
      0bfa67ca
    • Adam Simpkins's avatar
      add a builder that can re-package python wheel files · 6e1ff036
      Adam Simpkins authored
      Summary:
      Add a new builder that can extract Python wheel files, and re-package them
      for consumption by our add_fb_python_library() and add_fb_python_executable()
      CMake functions.  This is useful for dependencies on packages from PyPI.
      
      At the moment this code only handles architecture-independent pure-Python
      packages.  It shouldn't be too hard to extend this to handle more complex
      wheels, but for now I only need to use it for some pure-Python wheels and so I
      haven't tested with more complex wheel files.
      
      This also includes two new manifests for python-six and python-toml that take
      use this new builder.
      
      Reviewed By: wez
      
      Differential Revision: D17401216
      
      fbshipit-source-id: d6f74565887c3f004e1c06503dc9ec81599dd697
      6e1ff036
    • Yedidya Feldblum's avatar
      Support -Werror=unused-function · f14e7cb7
      Yedidya Feldblum authored
      Summary: Support `-Werror=unused-function`.
      
      Reviewed By: Orvid, guangyfb
      
      Differential Revision: D17252831
      
      fbshipit-source-id: ccf3829ebaa6992341ff5b1ab84c173922eeae03
      f14e7cb7
    • Adam Simpkins's avatar
      update make_fbpy_archive.py to replace the output on Windows · d4b04b02
      Adam Simpkins authored
      Summary:
      Update the code to use `os.replace()` rather than `os.rename()` so that it
      won't fail on Windows if the destination path already exists.
      
      Reviewed By: chadaustin
      
      Differential Revision: D17462716
      
      fbshipit-source-id: cbc06319ccb2d73868f80ab1874890ebec5a621b
      d4b04b02
    • Maged Michael's avatar
      hazptr: Add microbenchmark for unused tagged obj batch · 3ea63e0b
      Maged Michael authored
      Summary:
      Adds a microbenchmark for the lifetime of an unused tagged hazptr_obj_batch in the presence of unrelated objects in the domain's tagged list.
      
      This diff also makes the calculation of the number of operations and the scalability measure for the cleanup microbenchmark more consistent with those for the other microbenchmarks.
      
      Reviewed By: davidtgoldblatt
      
      Differential Revision: D17416088
      
      fbshipit-source-id: b59fd1b48114d591da5d9432df7910d940683006
      3ea63e0b
  10. 18 Sep, 2019 7 commits
  11. 17 Sep, 2019 3 commits
    • Amol Bhave's avatar
      create unorderedReduceSemiFuture method · 92dd0f71
      Amol Bhave authored
      Summary:
      create a unorderedReduceSemiFuture method that returns a SemiFuture
      instead of just a Future.
      
      Reviewed By: LeeHowes
      
      Differential Revision: D16946582
      
      fbshipit-source-id: e28b4cb055b3a9c67adebb373c60a775f7005762
      92dd0f71
    • Adam Simpkins's avatar
      fix the thrift CMake rules to add dependencies on the thrift compiler · e01c5188
      Adam Simpkins authored
      Summary:
      Update the thrift C++ and Python CMake rules to indicate that the output also
      depends on the thrift compiler itself.
      
      Previously the C++ rule indicated that the output depended on the thrift
      template files, which caught most cases when the thrift compiler was updated,
      but wasn't fully correct.  The thrift templates were also removed and baked
      into the thrift compiler binary in D16356056.
      
      Reviewed By: yfeldblum, chadaustin
      
      Differential Revision: D17401217
      
      fbshipit-source-id: ae5cde7a7e5e07a74406a1b6f4469124187bc12f
      e01c5188
    • Adam Simpkins's avatar
      add a command line option to disable the build cache · c9299818
      Adam Simpkins authored
      Summary:
      This is useful when working on changes to some of the builder functions,
      to skip ever trying to use cached results.
      
      Reviewed By: chadaustin
      
      Differential Revision: D17401219
      
      fbshipit-source-id: fb7d5ea45618653957b9bd6a62eed91d8334824d
      c9299818