- 09 May, 2017 2 commits
-
-
Philipp Unterbrunner authored
Summary: C++ up to and including C++17 lacks an alternative to std::back_inserter() that uses emplace_back() instead of push_back(). This causes unnecessary temporary objects in some cases, when using std::back_inserter() together with STL functions such as std::copy() or std::transform(). The same holds for std::front_inserter() and std::inserter(). This diff introduces folly::back_emplacer(), folly::front_emplacer(), folly::emplacer(), and related iterator classes, which call emplace_back(), emplace_front(), and emplace() respectively, with perfect forwarding of any arguments to the output iterator's operator=. Includes support for variadic emplacement / multi-argument constructors through a utility function folly::make_emplace_args() which packs its arguments into a special tuple for use with operator=. Reviewed By: ericniebler Differential Revision: D4897174 fbshipit-source-id: c85c30c457e0c946938051819baa662d1a0b8ca1
-
Christopher Dykes authored
Summary: There are still some upstream references to `folly::make_unique` that need to be removed before it can be full killed, but this gets it most of the way there. Reviewed By: yfeldblum Differential Revision: D5024310 fbshipit-source-id: 6cfe8ea93662be18bb55588c8200dec72946e205
-
- 08 May, 2017 3 commits
-
-
Jim Meyering authored
Summary: Change every instance of EXPECT_EQ(false, ... to the simpler/shorter EXPECT_FALSE(... Likewise, convert each EXPECT_EQ(true, ... to EXPECT_TRUE(... Differential Revision: D5019004 fbshipit-source-id: 0203f10fa47237f869a75a057ac4456ef03e1f53
-
Anirudh Ramachandran authored
Summary: There's nothing io/async/ssl-specific in this file. Moving to the top-level directory will help this be more discoverable. Part of general cleanup for io/async/ssl Reviewed By: yfeldblum Differential Revision: D5005566 fbshipit-source-id: 66a05a2139ee80a6d63791d1851da3f1858e8abf
-
Dave Watson authored
Summary: A faster crc32 impl for folly. Similar to crc32c, except intel doesn't provide crc32 directly in hardware - instead, pclmul can be used, which is ~2x slower than crc32c, but still ~5-10x faster than software implementation. Reviewed By: Orvid, yfeldblum Differential Revision: D4994761 fbshipit-source-id: ad8ba856649eea6dc7b541d561329ff7d7fe2d60
-
- 06 May, 2017 3 commits
-
-
Andrii Grynenko authored
Summary: std::call_once implementation is broken if function throws. This fixes folly::call_once to not depend on std::call_once. Reviewed By: yfeldblum Differential Revision: D5015897 fbshipit-source-id: bcbda68becf0930cdbf0b09125cbee61d75c2015
-
Yedidya Feldblum authored
Summary: [Folly] Mark future-core get-state members as `const noexcept`. Reviewed By: andrewjcg Differential Revision: D5014358 fbshipit-source-id: e39b0b63c59267a4ecfab5aac02e6d96ce2e7e00
-
Yedidya Feldblum authored
Summary: [Folly] Stop trying to `setrlimit(RLIMIT_AS)` in ASAN builds. ASAN needs to reserve plenty of memory outside of the limited address space imposed by the call to `setrlimit`. Reviewed By: andriigrynenko Differential Revision: D5014679 fbshipit-source-id: 2ab71b1cca9297d3a276cf72154fac30a2057f86
-
- 05 May, 2017 6 commits
-
-
Eric Niebler authored
Summary: It should be possible to perform simple comparison operations between a FixedString and a std::string. By adding asymmetric comparison operators with FixedString and Range, we make FixedString comparable with anything convertible to Range, including std::string. Reviewed By: yfeldblum Differential Revision: D5007704 fbshipit-source-id: fee89d8807ac2d5378eec0d0a51eb8684976a271
-
Christopher Dykes authored
Summary: OSX was sad. Now it should be happy. Reviewed By: mzlee Differential Revision: D5011751 fbshipit-source-id: 77f22ff461036d8530d8f650396d8e12503448e7
-
Yedidya Feldblum authored
Summary: [Folly] Control the number of threads in `TestExecutor`. Let the caller control the number of threads to use in each given case. Reviewed By: spacedentist Differential Revision: D4999699 fbshipit-source-id: 4acf68cf17fbca14f0779daf0268d54c5606e4a8
-
Sven Over authored
Summary: We have tests that check that the Future implementation deals cleanly with executors discarding tasks. The existing tests destroy the tasks immediately when they are passed to Executor::add. This diff adds corresponding tests for the scenario where the task is not destroyed right away, but after the call to Future::then has completed. This diff also adds a mechanism to detect that the passed callback function is actually destroyed. We have tested already that the promise returned by folly::then will be set to a BrokenPromise exception when the executor discards the task. However, the task passed to the executor is not only the callback we pass to folly::then, as the Future implementation wraps it with some code that stores the return value in a Promise. Existing tests check that this Promise is destroyed. The added mechanism in this diff checks that the orignal callback function itself gets destroyed. Reviewed By: Krigpl Differential Revision: D5002100 fbshipit-source-id: 4155f61b075d9fe8d1869ad229f4d350571ff4c6
-
Yedidya Feldblum authored
Summary: [Folly] Add full `noexcept` annotations to `Indestructible`. And do it without requiring `<type_traits>`. Reviewed By: Orvid Differential Revision: D4999243 fbshipit-source-id: f3521237ef4d03d2b187e9ebd6d0c90887872c42
-
Christopher Dykes authored
Summary: This can only ever be used unsafely, so delete it. Reviewed By: yfeldblum Differential Revision: D4951294 fbshipit-source-id: bbc266d1550fceb48946c7c48e76af07292b4a53
-
- 04 May, 2017 4 commits
-
-
Christopher Dykes authored
Summary: The setThreadName API is in the process of being changed to not accept a thread id, which means the thread itself needs to set the name. There are times where a `ScopedEventBaseThread` needs to be named, and this makes that possible. Reviewed By: yfeldblum Differential Revision: D4916781 fbshipit-source-id: dab05b520a715183ce069151ed16864fa1331abc
-
Christopher Dykes authored
Summary: It's primarily for use in testing, but is useful for log output as well. Reviewed By: yfeldblum Differential Revision: D4943072 fbshipit-source-id: 0ca259d6c90f439e733a6179e7cba85dcd1ec9e7
-
Maged Michael authored
Summary: This template uses flat combining and takes any sequential priority queue implementation that supports the `std::priority_queue` interface (`empty()`, `size()`, `push()`, `top()`, `pop()`) and any lock that meets the standard //Lockable// requirements to implement a thread-safe priority queue that supports arbitrary priorities. The template supports both unbounded and bounded size, and blocking, non-blocking, and timed variants of push, pop, and peek operations. Reviewed By: djwatson Differential Revision: D4873602 fbshipit-source-id: 96e1548b4f7427ecd2ee2ead7a19993df4441b33
-
Eric Niebler authored
Summary: Access the RTTI of the incomming exception before it is potentially moved from when testing for slicing Reviewed By: yfeldblum Differential Revision: D4999189 fbshipit-source-id: 3e6c0a9f10a27810484330e9b37a5b0ec450ff88
-
- 03 May, 2017 9 commits
-
-
Aravind Anbudurai authored
Summary: folly::File's throwing constructor results in many try-catches in the callsites or bugs where the exception is not caught. This is a helper method to return an Expected with system_error wrapped into an exception_wrapper. Reviewed By: yfeldblum Differential Revision: D4995702 fbshipit-source-id: be0e22b37c21c35bf157ada598916b05dfd32631
-
Giuseppe Ottaviano authored
Summary: No need to store the pointers to forward and skip arrays if they're not used. Reviewed By: luciang Differential Revision: D4977014 fbshipit-source-id: 2ed13fdcd1561da1a294f5895f3a5e1b77f1701c
-
Giuseppe Ottaviano authored
Summary: Shrink the reader type if less than 64 bits are sufficient for sizes. Do the same for `BitVectorCoding`, where we don't need an extra template parameter because the size is limited by the value domain. Reviewed By: philippv, luciang Differential Revision: D4976756 fbshipit-source-id: 685047da81a556d049fb924c612f99cea3056a82
-
Giuseppe Ottaviano authored
Summary: It is not used anywhere except for `previousValue`, but there it can be computed from the other fields. This reduces the `EliasFanoReader` size by 8 bytes. Reviewed By: philippv, yfeldblum Differential Revision: D4976704 fbshipit-source-id: 62bc63248b66649e483b59cb9ddf48dfd2c0e992
-
Giuseppe Ottaviano authored
Summary: Computing the mask on access has negligible cost as it can be hoisted out of the linear search loop, and furthermore on Haswell we can use the the `BZHI` instruction. I also experimented with `BEXTR` but it ended up being slower because computing the pattern operand requires a shift and an or (it's probably meant for when the pattern is precomputed). Reviewed By: philippv Differential Revision: D4976657 fbshipit-source-id: e4c4ca5f0a785595587e6d6ad4676f5b216291cf
-
Dave Watson authored
Summary: If a retired object's destructor retire()s other hazard pointers, currently these are not cleaned up correctly when the domain destructs. Retired pointers must be cleaned up before destroying hazptr_recs, and must be done iteratively until no more garbage is generated. Reviewed By: magedm Differential Revision: D4987333 fbshipit-source-id: bcdd61abb47caca0892a8c4dbb864d17d4f2fa30
-
Christopher Dykes authored
Summary: The first issue is that I was missing a `G` in `LIBGFLAGS_INCLUDE_DIR` meaning that it always claimed it couldn't find gflags even though it did, and worked just fine anyways. The second issue is that it was passing `/permissive-` to MSVC 2015 builds, even though MSVC 2015 doesn't support the permissive flag. Reviewed By: yfeldblum Differential Revision: D4988813 fbshipit-source-id: f1ea009226baee54032409ce7add3c41f1fe7a19
-
Christopher Dykes authored
Summary: I was bad and didn't follow through on my previous test plan, and so didn't check that it completely fixed the issue, instead only fixing one of the two problems. This fixes the other one. Reviewed By: yfeldblum Differential Revision: D4988408 fbshipit-source-id: 44389bc67bcb7d6db984075f3600948460fa8c5a
-
Christopher Dykes authored
Summary: Besides this code being utterly bizzare, it doesn't work under MSVC 2015 Update 3, so rather than doing a `static_cast<bool>(std::conjunction<>())` just do `std::conjunction<>::value`. Reviewed By: yfeldblum Differential Revision: D4988341 fbshipit-source-id: ededdbf3f3d945d9e2f140f4e87643ec3c0d4239
-
- 02 May, 2017 3 commits
-
-
Christopher Dykes authored
Summary: MSVC 2015 Update 3 is even worse in this particular case, and requires it to be explicitly referenced as being within the `folly` namespace >_>... Reviewed By: ot, yfeldblum Differential Revision: D4988025 fbshipit-source-id: dea311dd42f40b442951b8df3c5f68cf70d13769
-
Christopher Dykes authored
Summary: I broke things, so now I have to fix them. Reviewed By: yfeldblum Differential Revision: D4981674 fbshipit-source-id: 7df4d78cf4f984df158051a3a8b277a0bcad583b
-
Christopher Dykes authored
Summary: MSVC requires the declaration to match a bit closer than GCC does. Reviewed By: yfeldblum, ot Differential Revision: D4981404 fbshipit-source-id: 92ee40c40f66725c09a3087e49d99ebae222c2f2
-
- 01 May, 2017 2 commits
-
-
Andrii Grynenko authored
Summary: In the subscribe callback It's possible that we lock the Context shared_ptr and while update is running, all other shared_ptr's are released. This will result in Context to be destroyed from the wrong thread (thread runnning subcribe callback), which is not desired. Reviewed By: yfeldblum Differential Revision: D4964605 fbshipit-source-id: 285327a6873ccb7393fa3067ba7e612c29dbc454
-
Anirudh Ramachandran authored
Summary: A bunch of changes to make fbcode targets build with OpenSSL 1.1.0 Reviewed By: ivmaykov Differential Revision: D4949822 fbshipit-source-id: 35eda632d8335c4194352196264afeff69d87519
-
- 30 Apr, 2017 1 commit
-
-
Ted Percival authored
Summary: Superseded by `<folly/portability/Constexpr.h>`'s `constexpr_strlen()`. Closes https://github.com/facebook/folly/pull/585 Reviewed By: yfeldblum Differential Revision: D4973136 Pulled By: Orvid fbshipit-source-id: ada9bedf53ce219b0924c3f7aaad75bce9605f0f
-
- 28 Apr, 2017 1 commit
-
-
Alexey Spiridonov authored
Summary: - `FunctionScheduler` and `EventBase` are great for sharing one thread for many functions, but one-function-per-thread is messy. - Both of those implementations are complicated, but `FunctionThreads` is dead-simple. - I made it even simpler by eliminating the former `incrementalSleep` in favor of `std::future::wait_for`, which allows instant interruption without a tweakable param. h/t aru777 for suggesting `std::future` instead of `std::condition_variable`. Reviewed By: yfeldblum Differential Revision: D4742134 fbshipit-source-id: b520bbcd5f218b2276200ffe8926722ae8a8d6ca
-
- 27 Apr, 2017 6 commits
-
-
Giuseppe Ottaviano authored
Reviewed By: yfeldblum Differential Revision: D4965608 fbshipit-source-id: db8d67ca7174e0296fbd8da2e1fe90cbbcef9496
-
Philipp Unterbrunner authored
Summary: Class template that wraps a reference to an rvalue. Similar to std::reference_wrapper but with three important differences: 1) folly::rvalue_reference_wrappers can only be moved, not copied; 2) the get() function and the conversion-to-T operator are destructive and not const, they invalidate the wrapper; 3) the constructor-from-T is explicit. These restrictions are designed to make it harder to accidentally create a a dangling rvalue reference, or to use an rvalue reference multiple times. (Using an rvalue reference typically implies invalidation of the target object, such as move-assignment to another object.) Reviewed By: yfeldblum Differential Revision: D4931483 fbshipit-source-id: 68453553bf4656ec41976699669a4491fcab79c9
-
Philip Pronin authored
Summary: `cpuid` uses all of `eax`, `ebx`, `ecx`, `edx` for output, but we aren't providing such information to GCC in a couple of cases, which might result in incorrect code being produced; GCC (unlike clang) doesn't allow the same register to appear both in input and clobber list, so put `eax` into output list where required. Reviewed By: ot, lbrandy Differential Revision: D4961841 fbshipit-source-id: 07ca1977373496bfd794d3b0c8a4ba21333820e4
-
Otto Ebeling authored
Summary: There's a gotcha case for IOBufQueue::split when n==0, it will then return an unique_ptr wrapping a nullptr, which many call sites do not expect. Reviewed By: meyering Differential Revision: D4868228 fbshipit-source-id: 418256dba8ca3bcfbae420b6099baa240055b9bb
-
Maged Michael authored
Summary: Added a lock holder with deferred option for cases where the caller may want to call try_lock() later. Reviewed By: djwatson Differential Revision: D4949736 fbshipit-source-id: 31e0dc349dc3af9d04a33878e26cef1e48cce674
-
Yedidya Feldblum authored
Summary: [Folly] Casing consistency for `exception_wrapper::throw_exception`. Reviewed By: Orvid Differential Revision: D4944818 fbshipit-source-id: 72056fb24ab6362e9a0319f73b5bbf8c92d658ca
-