1. 04 May, 2016 4 commits
    • Marcus Holland-Moritz's avatar
      Unpoison stack memory before deallocation · 6959fbe7
      Marcus Holland-Moritz authored
      Summary:
      This is a workaround (maybe even the correct fix if it turns out that ASan
      can't detect this FP case) for the problem described in
      
        https://llvm.org/bugs/show_bug.cgi?id=27627
      
      where a memory region previously allocated by a fiber stack can overlap with
      the region of an mmap'd file. Accessing parts of the mmap'd file close to
      the stack region will trigger a false positive ASan error.
      
      This change makes sure each fiber explicitly unpoisons its stack memory by
      calling __asan_unpoison_memory_region in an ASan-enabled build.
      
      Reviewed By: yhfung
      
      Differential Revision: D3257924
      
      fb-gh-sync-id: 484062e80af67dfd39d2eaf3cbb52fa3483924eb
      fbshipit-source-id: 484062e80af67dfd39d2eaf3cbb52fa3483924eb
      6959fbe7
    • Pavlo Kushnir's avatar
      Optimize copy/move · 1c523f26
      Pavlo Kushnir authored
      Summary: this diff provides methods that allow to avoid temporaries while cloning IOBufs. Also optimizes move constructor a bit - there is no need to call `decrementRefCount`, check for self assignment, etc.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D3250456
      
      fb-gh-sync-id: 32b0180c28f36151c6786dba6f511b491b224200
      fbshipit-source-id: 32b0180c28f36151c6786dba6f511b491b224200
      1c523f26
    • Yedidya Feldblum's avatar
      Let via take a functor by universal reference · d0ed1890
      Yedidya Feldblum authored
      Summary:
      [Folly] Let `via` take a functor by universal reference.
      
      And perfect-forward the functor to the call to `then`.
      
      Reviewed By: fugalh
      
      Differential Revision: D3255684
      
      fb-gh-sync-id: 1b46a70fb9de88d21d785c0ce4d9dd3078829f13
      fbshipit-source-id: 1b46a70fb9de88d21d785c0ce4d9dd3078829f13
      d0ed1890
    • Christopher Dykes's avatar
      Create the sockets portability header · f253e1e4
      Christopher Dykes authored
      Summary: The one header that doesn't split well. This is the last piece of the portability headers for Windows and is also the piece that has had the most thought put into it's design so-as to be as unintrusive as possible.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D3046525
      
      fb-gh-sync-id: 761a5e359bc130b95585608ee18fda94a30dae2c
      fbshipit-source-id: 761a5e359bc130b95585608ee18fda94a30dae2c
      f253e1e4
  2. 03 May, 2016 3 commits
    • Marcelo Juchem's avatar
      More useful logging upon failed AsyncServerSocket::bind() · 0d8402e0
      Marcelo Juchem authored
      Summary: `AsyncServerSocket::bind()` would not give information like port or family name when failing to bind a socket. This diff addresses that by including this information in the exception. Two additional helper methods were added to `SocketAddress` to retrieve both the port and the family name from a `sockaddr` structure.
      
      Reviewed By: ckwalsh, yfeldblum
      
      Differential Revision: D3249778
      
      fb-gh-sync-id: 4edb28af5c211b7bf8d525b40844a5b0b6261e07
      fbshipit-source-id: 4edb28af5c211b7bf8d525b40844a5b0b6261e07
      0d8402e0
    • Sven Over's avatar
      fix passing move-only types to via(Executor*, Func) · 32623e8e
      Sven Over authored
      Summary: This diff fixes a problem with passing move-only types to folly::via.
      
      Reviewed By: ericniebler
      
      Differential Revision: D3254906
      
      fb-gh-sync-id: 8a9c703a8db0ccf20b9fb4fe9b80ad6cdcb3e388
      fbshipit-source-id: 8a9c703a8db0ccf20b9fb4fe9b80ad6cdcb3e388
      32623e8e
    • Yedidya Feldblum's avatar
      Deprecate boost::mpl · 6bdad19f
      Yedidya Feldblum authored
      Summary:
      [Folly] Deprecate `boost::mpl`.
      
      The `std` has equivalents; prefer them.
      
      Reviewed By: Gownta
      
      Differential Revision: D3247294
      
      fb-gh-sync-id: 873697b7ea3ad069ff14662bc458a2e1cc840339
      fbshipit-source-id: 873697b7ea3ad069ff14662bc458a2e1cc840339
      6bdad19f
  3. 02 May, 2016 5 commits
    • Michael Lee's avatar
      Use portability for SYS_gettid · 7c5318a4
      Michael Lee authored
      Summary: It's there for a reason, so use it.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D3249849
      
      fb-gh-sync-id: e9fe330693a173acd987e0c8fd1f03a982c8e082
      fbshipit-source-id: e9fe330693a173acd987e0c8fd1f03a982c8e082
      7c5318a4
    • Christopher Dykes's avatar
      Don't try to use the malloc_usable_size portability implementation if we have JEMalloc · 8d4965ca
      Christopher Dykes authored
      Summary:
      This is only an issue for the OSS HHVM build on OSX, where we have JEMalloc headers included directly.
      In the OSS HHVM build, we define `USE_JEMALLOC` globally if we have JEMalloc, so gate the portability implementation behind that.
      
      Reviewed By: mzlee
      
      Differential Revision: D3237449
      
      fb-gh-sync-id: 07cf9b31114723ffd9f2b29cf449bee0ed8f5703
      fbshipit-source-id: 07cf9b31114723ffd9f2b29cf449bee0ed8f5703
      8d4965ca
    • Neel Goyal's avatar
      Set the appropriate AsyncSocketExceptionType from SSLException · a0a4a68d
      Neel Goyal authored
      Summary:
      We should use the appropriate AsyncSocketExceptionType when firing SSLExceptions.  This derives the type from the constructor args, and introduces a `NETWORK_ERROR` exception type.  Open to suggestions on reusing something there.
      
      Additionally, rename getType() to getSSLError() to prevent hiding the AsyncSocketException::getType.
      
      Reviewed By: siyengar
      
      Differential Revision: D3241204
      
      fb-gh-sync-id: de631dfb3554177d5bd561f4b91e767c882767d3
      fbshipit-source-id: de631dfb3554177d5bd561f4b91e767c882767d3
      a0a4a68d
    • Anirudh Ramachandran's avatar
      Simplify CryptoSSLRequestManager using unified futures API · ad8a8cb5
      Anirudh Ramachandran authored
      Summary:
      This diff unifies the nearly-replicated call paths for ECDSA and RSA
      sign request/response/fallback/etc. into one generic futures-based sign API.
      Once this is tested, we should be able to remove ~500 lines of code from
      CryptoSSLRequestManager
      
      Depends on D3094660
      
      Reviewed By: siyengar
      
      Differential Revision: D3116535
      
      fb-gh-sync-id: 11c50d81dab39e5426679b5a172c1ece2039fc10
      fbshipit-source-id: 11c50d81dab39e5426679b5a172c1ece2039fc10
      ad8a8cb5
    • Yedidya Feldblum's avatar
      Avoid glog when warning about Singleton double-registration · 7dd60842
      Yedidya Feldblum authored
      Summary:
      [Folly] Avoid glog when warning about `Singleton` double-registration.
      
      Because registration happens at static initialization time, long before main, and possibly long before glog is initialized.
      
      This makes a difference because, in some cases of double-registration, we can get a SIGSEGV with no message, because we are attempting to `LOG(FATAL)` when glog is uninitialized. What we would much rather have is a SIGABRT with a message.
      
      Reviewed By: meyering
      
      Differential Revision: D3245047
      
      fb-gh-sync-id: 4c5dd9d25025f197d7c490ffbb429af5ccb82182
      fbshipit-source-id: 4c5dd9d25025f197d7c490ffbb429af5ccb82182
      7dd60842
  4. 30 Apr, 2016 1 commit
    • Andrii Grynenko's avatar
      Don't require folly::Unit in addTaskFinally · ebc7dd0d
      Andrii Grynenko authored
      Summary:
      In D3241498 addTaskFuture was fixed to work with function returning void. This however changed addTaskFinally API to not allow finally functor which accepts Try<void>.
      
      folly::fibers generally supports Try<void> so there's no reason to force users to use folly::Unit instead of void for addTaskFinally too.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D3243893
      
      fb-gh-sync-id: d1df54738157d2019120103956f59b3971ba25ff
      fbshipit-source-id: d1df54738157d2019120103956f59b3971ba25ff
      ebc7dd0d
  5. 29 Apr, 2016 3 commits
    • Martin Martin's avatar
      Make addTask[Remote]Future() work for functions returning void. · b31eb722
      Martin Martin authored
      Summary:
      There's no Future<void>, you're supposed to use Future<Unit>
      instead.  Unit has a "Lift" template to do the conversion.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D3241498
      
      fb-gh-sync-id: db12d4f343685bc613b701e023c860c2c903ed4c
      fbshipit-source-id: db12d4f343685bc613b701e023c860c2c903ed4c
      b31eb722
    • Martin Martin's avatar
      Clang-format in preparation for other change · 0a2b61fd
      Martin Martin authored
      Summary: Clang-format in preparation for other change
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D3241297
      
      fb-gh-sync-id: b7b26812e9e61c291d5c7bdb523df8f28f2d9b4f
      fbshipit-source-id: b7b26812e9e61c291d5c7bdb523df8f28f2d9b4f
      0a2b61fd
    • Philip Pronin's avatar
      don't destory defaultElfCache in exit handlers · 78b48f15
      Philip Pronin authored
      Summary:
      As it might be used during global destruction (for example, to
      symbolize unhandled exception happened at that time).
      
      Reviewed By: luciang, ot
      
      Differential Revision: D3238303
      
      fb-gh-sync-id: 39d8a6f99d95e700586349436e961f3624c95718
      fbshipit-source-id: 39d8a6f99d95e700586349436e961f3624c95718
      78b48f15
  6. 28 Apr, 2016 11 commits
    • Eric Niebler's avatar
      use std::forward instead of std::move on objects whose types have been... · f73c7249
      Eric Niebler authored
      use std::forward instead of std::move on objects whose types have been deduced; don't take the sizeof incomplete types
      
      Summary: Pretty sure std::forward is needed here instead of std::move. If you trace the call chain to see where the types of the objects come from, you'll see they can be deduced to be lvalues, so std::forward is the right choice. Also, moved some dicey looking code that appeared to be taking the size of some incomkplete types.
      
      Reviewed By: spacedentist
      
      Differential Revision: D3214199
      
      fb-gh-sync-id: 778190ffb25a648b839760a3dddfad8dc6d41c88
      fbshipit-source-id: 778190ffb25a648b839760a3dddfad8dc6d41c88
      f73c7249
    • Andrew Birchall's avatar
      Create ReadHolder::unlock · 95e7a3ba
      Andrew Birchall authored
      Summary:
      Currently you need to depend on the destructor of `ReadHolder` (using closures as in code block #1 below or empty assignment as in code block #2 below) to ensure that a `ReadHolder` goes out of scope (and unlocks) in order to subsequently acquire a write lock via `WriteHolder` without deadlocking.
      This diff introduces a way of unlocking a `ReadHolder` while it's still in scope such that a `WriteHolder` can be acquired. This makes the code more straight forward (reducing the risk of deadlock due to a programmer's misunderstanding of how `SharedMutex` / the holder framework works) => see code block # 3 below
      Also add some documentation about why `WriteHolder::WriteHolder(ReadHolder&&)` doesn't exist
      
      Code Block #1 : Use of closures
      ```
      class foo {
       public:
        std::string getMemoizedData() {
          {
            folly::SharedMutex::ReadHolder readHolder(lock_);
            if (!data_.empty()) {
              // important to return by value, otherwise caller might access
              // data_ after we release the read lock
              return data_;
            }
          }
          {
            // try again with a write lock
            folly::SharedMutex::WriteHolder writeHolder(lock_);
            if (data_.empty()) {
              data_ = "my awesome string";
            }
            return data_;
          }
        }
      
       private:
        folly::SharedMutex lock_;
        std::string data_;
      };
      ```
      
      Code Block #2 : Use of empty assignment
      ```
      class foo {
       public:
        std::string getMemoizedData() {
          folly::SharedMutex::ReadHolder readHolder(lock_);
          if (!data_.empty()) {
            // important to return by value, otherwise caller might access
            // data_ after we release the read lock
            return data_;
          }
          readHolder = {};
      
          // try again with a write lock
          folly::SharedMutex::WriteHolder writeHolder(lock_);
          if (data_.empty()) {
            data_ = "my awesome string";
          }
          return data_;
        }
      
       private:
        folly::SharedMutex lock_;
        std::string data_;
      };
      ```
      
      Code Block #3 : Use of unlock()
      ```
      class foo {
       public:
        std::string getMemoizedData() {
          folly::SharedMutex::ReadHolder readHolder(lock_);
          if (!data_.empty()) {
            // important to return by value, otherwise caller might access
            // data_ after we release the read lock
            return data_;
          }
          readHolder->unlock();
      
          // try again with a write lock
          folly::SharedMutex::WriteHolder writeHolder(lock_);
          if (data_.empty()) {
            data_ = "my awesome string";
          }
          return data_;
        }
      
       private:
        folly::SharedMutex lock_;
        std::string data_;
      };
      ```
      
      Reviewed By: yfeldblum
      
      Differential Revision: D3176025
      
      fb-gh-sync-id: c7d47ca71df08673c7c1f1fd5ed9e01a663c1797
      fbshipit-source-id: c7d47ca71df08673c7c1f1fd5ed9e01a663c1797
      95e7a3ba
    • Lucian Grijincu's avatar
      folly: Function: in-class init, drop (void*) casts · ab389fe4
      Lucian Grijincu authored
      Summary: A few code cleanups, no functionality changes.
      
      Reviewed By: ericniebler
      
      Differential Revision: D3231369
      
      fb-gh-sync-id: 1a1c8508aab6dce7279e9dfc3f3da6add5496c67
      fbshipit-source-id: 1a1c8508aab6dce7279e9dfc3f3da6add5496c67
      ab389fe4
    • Subodh Iyengar's avatar
      Better exception types to SSLexception · 0d9217b4
      Subodh Iyengar authored
      Summary:
      Better enum exception types for SSLException.
      These enum types are fairly high level, and more
      info can be gleaned from the error.what()
      
      Reviewed By: knekritz
      
      Differential Revision: D3234501
      
      fb-gh-sync-id: 7cd4fbccd7f4367354dc3bd1fe4cd480d58d6173
      fbshipit-source-id: 7cd4fbccd7f4367354dc3bd1fe4cd480d58d6173
      0d9217b4
    • Subodh Iyengar's avatar
      Stop abusing errno · 4708133f
      Subodh Iyengar authored
      Summary:
      We abuse errno to propagate exceptions from AsyncSSLSocket.
      Stop doing this and propagate exceptions correctly.
      
      This also formats the exception messages better.
      
      Reviewed By: anirudhvr
      
      Differential Revision: D3226808
      
      fb-gh-sync-id: 15a5e67b0332136857e5fb85b1765757e548e040
      fbshipit-source-id: 15a5e67b0332136857e5fb85b1765757e548e040
      4708133f
    • Subodh Iyengar's avatar
      Strict validation for certs · 38c0b1ab
      Subodh Iyengar authored
      Summary: Add X509 param types
      
      Reviewed By: knekritz
      
      Differential Revision: D3230008
      
      fb-gh-sync-id: 660a2f5bdc9355f5b42c2ccfb1d7cab83df34fc2
      fbshipit-source-id: 660a2f5bdc9355f5b42c2ccfb1d7cab83df34fc2
      38c0b1ab
    • Nicholas Ormrod's avatar
      Fix asan build · 9c29a759
      Nicholas Ormrod authored
      Summary:
      The array-bounds checker in gcc complains that r could be -1 after leaving CHECK_ERR in ASAN mode. Switch to DCHECK to avoid this possibility. The code was not initially compiling; now it does.
      
      Error from gcc:
        array subscript is below array bounds [-Werror=array-bounds]
      
      Reviewed By: yfeldblum
      
      Differential Revision: D3232694
      
      fb-gh-sync-id: 17f579eb152b661a8e5e4ed29ef91eec405fb90a
      fbshipit-source-id: 17f579eb152b661a8e5e4ed29ef91eec405fb90a
      9c29a759
    • Christopher Dykes's avatar
      Use the portability header for malloc_usable_size in small_vector.h · 22fa7571
      Christopher Dykes authored
      Summary: `small_vector.h` had it's own thing being defined inline, and it was breaking the OSX build of HHVM, so have it use the portability header instead.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D3232885
      
      fb-gh-sync-id: 2078a54d1ec9700e81e0a9f4baed8e2d623fa5f3
      fbshipit-source-id: 2078a54d1ec9700e81e0a9f4baed8e2d623fa5f3
      22fa7571
    • Andrii Grynenko's avatar
      Fix races in TLRefCount · bccbb102
      Andrii Grynenko authored
      Summary:
      This fixes 2 races in TLRefCount:
      1. Thread-local constructor race, exposed by the stress test. It was possible for LocalRefCount to be created (grabbing collectGuard), but not be added to the thread-local list, so that accessAllThreads wasn't collecting it. collectAll() was then blocking waiting on baton to be posted, causing a dead-lock.
      2. LocalRefCount::count_ has to be made atomic, because otherwise += operation may be not flushed (nbronson explained the race in D3133443).
      
      Reviewed By: djwatson
      
      Differential Revision: D3166956
      
      fb-gh-sync-id: 17d58a215ebfc572f8316ed46bafaa5e6a9e2368
      fbshipit-source-id: 17d58a215ebfc572f8316ed46bafaa5e6a9e2368
      bccbb102
    • Giuseppe Ottaviano's avatar
      Further Function simplification · 68cf03b1
      Giuseppe Ottaviano authored
      Summary:
      Use tag dispatching instead of `enable_if`: it is clearer, it
      sidesteps the GCC mangling bug, and more importantly the conditional
      doesn't leak into the symbol, making stack traces and profiles more
      readable.
      
      Testing on a compilation unit with 1000 `Function`s from simple lambdas.
      Before:
      ```
      folly::impl::Function<int (), false>::Function<main::{lambda()#1}, {lambda()#1}>(main::{lambda()#1}&&, std::enable_if<std::integral_constant<bool, ((sizeof (std::decay<main::{lambda()#1}>::type))<=(sizeof folly::detail::function::Data::small))&&std::is_nothrow_move_constructible<std::decay<main::{lambda()#1}> >::value>::value, folly::detail::Tag>::type)::Ops::call(folly::detail::function&)
      ```
      After:
      ```
      folly::impl::Function<int (), false>::OpsSmall<main::{lambda()#1}>::call(folly::detail::function::Data&)
      ```
      Note that the function type is repeated 5 times before, and only once after. This makes a large difference with long namespaces.
      
      Binary size is almost unaffected, compile times slightly better:
      Before:
      GCC opt: 22.3 seconds, 4435232 bytes
      Clang dev: 7.7 seconds, 5257344 bytes
      
      After:
      GCC opt: 18.6 seconds, 4493920 bytes
      Clang dev: 7.2 seconds, 5469136 bytes
      
      Reviewed By: ericniebler
      
      Differential Revision: D3231530
      
      fb-gh-sync-id: 6aa76e7f780a8afdbfed8a378f257ceb86dce704
      fbshipit-source-id: 6aa76e7f780a8afdbfed8a378f257ceb86dce704
      68cf03b1
    • Pavlo Kushnir's avatar
      Faster onDestroy · 33344a23
      Pavlo Kushnir authored
      Summary: there is no need to call `std::function::invoke` for every DestructorGuard.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D3229345
      
      fb-gh-sync-id: c42f8cd05576d56b6a9b2f9d06878d9b01a36e94
      fbshipit-source-id: c42f8cd05576d56b6a9b2f9d06878d9b01a36e94
      33344a23
  7. 27 Apr, 2016 7 commits
    • Christopher Dykes's avatar
      Have the GFlags portability header stick things in namespaces · b609f8ee
      Christopher Dykes authored
      Summary:
      Just like the real thing does.
      This was causing some issues when trying to link against glog, which expects the flags to be namespaced like this.
      
      Reviewed By: mzlee
      
      Differential Revision: D3230630
      
      fb-gh-sync-id: a73ab3044560d561a39eb91ceee1588c147a46c5
      fbshipit-source-id: a73ab3044560d561a39eb91ceee1588c147a46c5
      b609f8ee
    • Eric Niebler's avatar
      Reimplement folly::Function to improve compile times. · 5022d546
      Eric Niebler authored
      Summary:
      folly::Function is causing significant compile time regressions. Reimplement it in a simpler way.
      
      These are the times for a file containing 1000 instantiations of folly::Fuction (old), folly::Function (new), and std::function with **g++ 4.8 -O3** on my CentOS7 server.
      
      |        | Old `folly::Function` | `std::function` | New `folly::Function` |
      |--------|-----------------------|-----------------|-----------------------|
      | Time   | 10m37s                | 0m16.81s        | 0m14.75s              |
      
      And for the executable size:
      
      |        | Old `folly::Function` | `std::function` | New `folly::Function` |
      |--------|-----------------------|-----------------|-----------------------|
      | Size   | 10,409,504            | 732,150         | 562,781               |
      
      That's a **43X** improvement in compile times and an **18X** reduction in executable bloat over the old implementation.
      
      The times for **clang (trunk)** are very different:
      
      |       | Old `folly::Function` | `std::function` | New `folly::Function` |
      |-------|-----------------------|-----------------|-----------------------|
      | Time  | 4m6s                  | 0m45.27s        | 0m11.78s              |
      
      That's a **20X** improvement over the old implementation and almost a **4X** improvement over `std::function`.
      
      For **gcc-5.3.0**, compile times are again different:
      
      |       | Old `folly::Function` | `std::function` | New `folly::Function` |
      |-------|-----------------------|-----------------|-----------------------|
      | Time  | 2m49s                 | 0m18.99s        | 0m20.70s              |
      
      With gcc-5.3, the new implementation "only" compiles 8x faster than the old one, and is roughly the same as `std::function`.
      
      Reviewed By: spacedentist, ot, luciang
      
      Differential Revision: D3199985
      
      fb-gh-sync-id: b97982a9dc3a63140510babea34988932e89f2d9
      fbshipit-source-id: b97982a9dc3a63140510babea34988932e89f2d9
      5022d546
    • Kyle Nekritz's avatar
      Add recursion limit to folly::parseJson. · 9383e1ca
      Kyle Nekritz authored
      Summary: Without this, malicious inputs can crash anything using folly::parseJson.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D3219036
      
      fb-gh-sync-id: 3604a060170c0201473c420035b21b018383789c
      fbshipit-source-id: 3604a060170c0201473c420035b21b018383789c
      9383e1ca
    • Subodh Iyengar's avatar
      Remove dead code in AsyncSSLSocket · a503da60
      Subodh Iyengar authored
      Summary: Remove dead code in AsyncSSLSocket.
      
      Reviewed By: knekritz
      
      Differential Revision: D3226948
      
      fb-gh-sync-id: e85823f311de2539c6aa2d6bcc3ff3aee07045bf
      fbshipit-source-id: e85823f311de2539c6aa2d6bcc3ff3aee07045bf
      a503da60
    • Sven Over's avatar
      fix access-after-free bug in ProducerConsumerQueueTest · 1cf18564
      Sven Over authored
      Summary: This bug causes failure when the test is run under ASAN.
      
      Reviewed By: meyering
      
      Differential Revision: D3229494
      
      fb-gh-sync-id: a43c8332cc45f7892ac86cd0abb799616bca7779
      fbshipit-source-id: a43c8332cc45f7892ac86cd0abb799616bca7779
      1cf18564
    • Pavlo Kushnir's avatar
      Cheaper bumpHandlingTime · 15c9b35a
      Pavlo Kushnir authored
      Summary: no need in virtual call from EventHandler.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D3226960
      
      fb-gh-sync-id: eb9c191630e1a1ac022666201100e3778eb7b611
      fbshipit-source-id: eb9c191630e1a1ac022666201100e3778eb7b611
      15c9b35a
    • Jon Maltiel Swenson's avatar
      Optimize away IOBuf clones on hot path · 4aa901d0
      Jon Maltiel Swenson authored
      Summary:
      'get' is the most frequent memcached operation. On a get reply, we should go to heap
      as little as possible.  This diff optimizes for this scenario, where replies
      have only one IOBuf field.
      
      Reviewed By: pavlo-fb
      
      Differential Revision: D3226592
      
      fb-gh-sync-id: 92e1a1fac5735bd268691cf11990a96ae6fa8309
      fbshipit-source-id: 92e1a1fac5735bd268691cf11990a96ae6fa8309
      4aa901d0
  8. 26 Apr, 2016 6 commits
    • Aditya Muttur's avatar
      Adding a constructor to UTF8Range that uses std::string · 545134d1
      Aditya Muttur authored
      Summary:
      Currently UTF8Range has a constructor that allows you construct an object of type UTF8Range using only an object of type folly::Range. Adding a constructor so that we can construct an UTF8Range object using a std::string.
      
      Currently,
        void sampleMethod(UTF8StringPiece sp) {...}
        /*
        ...
        */
        std::string str = "example";
        folly::UTF8Range utf8Range(str);
        folly::StringPiece sp(str);
        sampleMethod(utf8Range); // works
        sampleMethod(sp); // works
        sampleMethod(str); // doesn't work
      
      This diff hopes to fix this issue.
      
      Reviewed By: ddrcoder
      
      Differential Revision: D3221144
      
      fb-gh-sync-id: dd6ec4d7790d4602dccb3b63a4861d358aed3608
      fbshipit-source-id: dd6ec4d7790d4602dccb3b63a4861d358aed3608
      545134d1
    • Mirek Klimos's avatar
      API to set folly::RequestContext for current scope, try 2 · 0be0a8cd
      Mirek Klimos authored
      Summary: same as D3156698, without changes in Cpp2Connection (which was the only real change in the diff)
      
      Reviewed By: haijunz
      
      Differential Revision: D3222792
      
      fb-gh-sync-id: 245c7add837c0fc6d0bc84aa7d80b929ba2ce386
      fbshipit-source-id: 245c7add837c0fc6d0bc84aa7d80b929ba2ce386
      0be0a8cd
    • Christopher Dykes's avatar
      Define DECLARE_VARIABLE in portability/GFlags.h · 4cace13a
      Christopher Dykes authored
      Summary: If we don't, then anywhere we include `glog/logging.h` after the portability header will get the `DECLARE_*` and `DEFINE_*` macros undefined -_-....
      
      Reviewed By: mzlee
      
      Differential Revision: D3220797
      
      fb-gh-sync-id: 52907ddcd6b222fb1c6423034ea999eac5ce09ab
      fbshipit-source-id: 52907ddcd6b222fb1c6423034ea999eac5ce09ab
      4cace13a
    • Michael Lee's avatar
      Remove extra dependency on Portability.h · e16f91ff
      Michael Lee authored
      Summary: This dependency is in the wrong order.
      
      Reviewed By: knekritz
      
      Differential Revision: D3224312
      
      fb-gh-sync-id: 98d2c58b75cf5f16892d462ae1b877d06bce3faa
      fbshipit-source-id: 98d2c58b75cf5f16892d462ae1b877d06bce3faa
      e16f91ff
    • Pavlo Kushnir's avatar
      Use std::string in folly::dynamic · 7dbf6903
      Pavlo Kushnir authored
      Summary: Why not kill fbstring entirely? There are some legitimate use cases. For example, `folly::IOBuf` supports `moveToFbstring()` method which is impossible to implement with `std::string`.
      
      Reviewed By: joeg, snarkmaster
      
      Differential Revision: D3189410
      
      fb-gh-sync-id: 9bb9090ca6012ac32ba9fb79041b26ec4888781f
      fbshipit-source-id: 9bb9090ca6012ac32ba9fb79041b26ec4888781f
      7dbf6903
    • Yedidya Feldblum's avatar
      Retire BOOST_STATIC_ASSERT in favor of static_assert · 43d56a22
      Yedidya Feldblum authored
      Summary:
      Retire `BOOST_STATIC_ASSERT` in favor of `static_assert`.
      
      `static_assert` is part of C++ now, so we don't need workarounds like `BOOST_STATIC_ASSERT` anymore.
      
      Partially automated:
      
          hg grep -lw BOOST_STATIC_ASSERT | xargs perl -pi -e 's~\bBOOST_STATIC_ASSERT\(([^;]*)\);~static_assert(\1, "");~g'
          hg grep -lw 'boost/static_assert.hpp' | xargs perl -pi -e 's,^#include <boost/static_assert\.hpp>\n,,gm'
      
      Caught most instances. Formatting and remaining instances addressed manually.
      
      Reviewed By: meyering
      
      Differential Revision: D3215944
      
      fb-gh-sync-id: f4552d5d9bfc416ce283923abe880437a4d0cba5
      fbshipit-source-id: f4552d5d9bfc416ce283923abe880437a4d0cba5
      43d56a22