- 19 Nov, 2019 6 commits
-
-
Constantin Dolghier authored
Summary: 1) SharedPromise is semantically a regular Promise one can get multiple Futures off. One would expect that all methods which are const in Promise to also be const in SharedPromise - but they are not because their implementations needs using a mutex. 2) Semantically, `SharedPromise::getFuture()` and `SharedPromise::getSemiFuture()` do not change the observable state of the object. 3) As real-life consequence, these non-const `SharedPromise` methods become viral in downstream code which then has to hack around it in downstream `const` methods by marking the SharedPromise instance mutable. That solution leads to the program being less const-correct than it should be, as now the type system allows `const` methods to reassign or `setValue` the SharedPromise. This diff changes `hasResult`, `isFulfilled`, `size()`, `getFuture()` and `getSemiFuture()` to be `const`. In order to achieve that, the private fields `mutex_` and `size_` had to be marked `mutable`. (Note: this ignores all push blocking failures!) Reviewed By: yfeldblum Differential Revision: D18565877 fbshipit-source-id: ff63a48c02235f72c5b0191423ae68f7b7c42fb3
-
Adam Simpkins authored
Summary: On Windows, compile a small C executable to prepend to the zip file, to allow the resulting executable files to be run directly on Windows, without needing to explicitly invoke the Python interpreter to run the output file. Reviewed By: wez Differential Revision: D17733616 fbshipit-source-id: 989a93851412d0bbe1e7857aa9111db082f67a4c
-
generatedunixname89002005287564 authored
Reviewed By: yfeldblum Differential Revision: D18449687 fbshipit-source-id: 6d630cef35132abb157e80d02ad2b6dee7268fce
-
Jason Rahman authored
Summary: Expose the call to folly::Optional::value_or() in the Cython bindings Reviewed By: nanshu Differential Revision: D18526111 fbshipit-source-id: f2694ca589bf73653bc86d5c98b52e15406bed77
-
Jason Rahman authored
Summary: Add basic wrapper to support wrapping C++ APIs that contain folly::Function in their interfaces. Does not support calling operator() from within Cython, but only pass through of folly::Function<> to such APIs. Reviewed By: nanshu Differential Revision: D18526112 fbshipit-source-id: d219d480e59464099a109e5ef30d015151588b1f
-
Jason Rahman authored
Summary: Add new cython wrapper class to expose folly::Expected to other cython_libraries Reviewed By: jkedgar Differential Revision: D18523642 fbshipit-source-id: 0dfb4820b2613361b7c1af05b89b5231a1bfecbc
-
- 18 Nov, 2019 2 commits
-
-
Giuseppe Ottaviano authored
Summary: EliasFanoCoding supports sequences with duplicate values, but there is no test coverage and the behavior of some corner cases (`skipTo` and `jumpTo` from the middle of a run) is not documented. This diff adds coverage and documentation. Reviewed By: yfeldblum Differential Revision: D18496744 fbshipit-source-id: 00e112a902a8b11ac9601520b858172a1d2c0f57
-
Victor Zverovich authored
Summary: Now that fmt is available in Folly builds (D14813810), use it to reduce binary code size in Folly Logger. This is done by moving most of the formatting logic behind the type-erased `vformat` API. Previously it was instantiated for all combinations of formatting argument types used in calls to `FB_LOGF` and `XLOGF` in a program. The effect of this change can be illustrated by looking at symbol sizes as given by `nm -S -td` for the following test function: ``` void test_log() { FB_LOGF(logger, WARN, "num events: {:06d}, duration: {:6.3f}", 1234, 5.6789); } ``` compiled in `opt` mode. `nm` before: ``` 0000000004236736 0000000000000231 T test_log() 0000000004236992 0000000000001002 W std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > folly::LogStreamProcessor::formatLogString<int, double>(folly::Range<char const*>, int const&, double const&) ``` `nm` after: ``` 0000000004237536 0000000000000231 T test_log() 0000000004237792 0000000000000251 W std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > folly::LogStreamProcessor::formatLogString<int, double>(folly::Range<char const*>, int const&, double const&) 0000000004238048 0000000000000740 W folly::LogStreamProcessor::vformatLogString[abi:cxx11](folly::Range<char const*>, fmt::v5::format_args, bool&) ``` Before we had one 1002 byte instantiation of `formatLogString<int, double>`. With this change it was reduced 4x to 251 bytes and non-template function `vformatLogString` was added which is shared among all logging calls. The size of `test_log` remained unchanged. There are even bigger savings from Folly Formatter instantiations which are no longer needed, e.g. ``` 0000000004238032 0000000000001363 W _ZNK5folly13BaseFormatterINS_9FormatterILb0EJRKiRKdEEELb0EJS3_S5_EEclIZNKS7_8appendToINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEENSt9enable_ifIXsr12IsSomeStringIT_EE5valueEvE4typeERSH_EUlNS_5RangeIPKcEEE_EEvSK_ ``` So in total this change results in ~5x per-call/instantiation binary size. It is possible to reduce binary size even further but it is not done in the current diff to keep it manageable. In addition to binary size improvements, switching to fmt will potentially * allow catching errors in format strings at compile time, * simplify future migration to C++20 [`std::format`](http://eel.is/c++draft/format). Reviewed By: simpkins Differential Revision: D15485589 fbshipit-source-id: 06db4436839f11c2c3dbed7b36658e2193343411
-
- 17 Nov, 2019 1 commit
-
-
Wez Furlong authored
Summary: When we detect that we are building out of the fbsource monorepo internal to FB, pre-set some environment variables to help projects detect our internally pinned versions of node and yarn. Previously, the detection logic was deciding that the `yarn` shell script was the executable to invoke, but since that is a bash script it would fail to spawn. Reviewed By: simpkins Differential Revision: D18523871 fbshipit-source-id: b932d2b0ccd7b79d6f9cd74d363bc426c288e38f
-
- 16 Nov, 2019 2 commits
-
-
Maged Michael authored
Summary: Original commit changeset: 6021479ab36c Reviewed By: d4l3k Differential Revision: D18535981 fbshipit-source-id: 4f9e5da29ed6d9bae04f29bcf273b41d39cc5754
-
Maged Michael authored
Summary: Original commit changeset: a1af88dfa1b6 Reviewed By: d4l3k Differential Revision: D18535282 fbshipit-source-id: 16da3084a519f978bf33f197ab7f937b61bb9d07
-
- 15 Nov, 2019 6 commits
-
-
generatedunixname89002005287564 authored
Reviewed By: yfeldblum Differential Revision: D18528940 fbshipit-source-id: 288abb510535540698416ac046c1057e110e4478
-
Yedidya Feldblum authored
Summary: [Folly] Erase the invokers. A catchy title, but forcibly inline the invoker call operators. Reviewed By: vitaut Differential Revision: D18035184 fbshipit-source-id: 5cf57d785523904a5260f7ed24c9ed34148370eb
-
Yedidya Feldblum authored
Summary: [Folly] Fix possible segv in `Function` shared proxy when invoking the (public!) `nullptr`-taking ctor. This proxy is used when converting `folly::Function` to `std::function` with shared state. Reviewed By: ot Differential Revision: D18517365 fbshipit-source-id: c414c1d1ae2b4f30ffa3269b216be07fedbf838c
-
Yedidya Feldblum authored
Summary: [Folly] Avoid overloading other names from within detail namespaces - prefer renaming or at least mangling. Reviewed By: Orvid Differential Revision: D18502700 fbshipit-source-id: a4f455db69396962b298c6291929f1eb152e1576
-
Rosen Penev authored
Summary: The instruction is identical to the x86 one. First introduced in MIPS32r2. Signed-off-by: Rosen Penev <rosenp@gmail.com> Pull Request resolved: https://github.com/facebook/folly/pull/1257 Reviewed By: Orvid Differential Revision: D18467031 Pulled By: yfeldblum fbshipit-source-id: 04b695167184db8ef71df47e82e414793ddb0ab9
-
Yedidya Feldblum authored
Summary: [Folly] `FOLLY_CREATE_FREE_INVOKER` and `FOLLY_CREATE_MEMBER_INVOKER` to replace `FOLLY_CREATE_FREE_INVOKE_TRAITS` and `FOLLY_CREATE_MEMBER_INVOKE_TRAITS`. New approach: just emit an invoker object. For the traits, just use the normal traits instead of rewriting them, or use `invoke_traits` to get an invoke-traits type specialized to the invoker. Reviewed By: vitaut Differential Revision: D18079121 fbshipit-source-id: 8258c36b8ba6ee62a8ecc104cd1b6281d313960f
-
- 14 Nov, 2019 4 commits
-
-
Rosen Penev authored
Summary: Found with modernize-use-auto Signed-off-by: Rosen Penev <rosenp@gmail.com> Pull Request resolved: https://github.com/facebook/folly/pull/1256 Reviewed By: Orvid Differential Revision: D18421629 Pulled By: yfeldblum fbshipit-source-id: c49418a3b3413acd1506c550af44c806332eedb8
-
Maged Michael authored
Summary: This diff adds support for optionally setting an obj batch such that objects retired to the batch bypass the batch and are directly pushed to the domain. This is useful in cases where the benefits of earlier reclamation outweigh the benefits of amortizing the cost of pushing objects to the domain. Reviewed By: davidtgoldblatt Differential Revision: D18114444 fbshipit-source-id: a1af88dfa1b601827b2f71e700fb1dfcb08e513c
-
Dan Melnic authored
Summary: Fix -Wshorten-64-to-32 compile warning treated as error (Note: this ignores all push blocking failures!) Reviewed By: nbronson Differential Revision: D18493255 fbshipit-source-id: 10a2a576c7f587d02a61860285171f2c5f0534ad
-
Phil Willoughby authored
Summary: Allows a category to be configured to selectively propagate messages to its parent category. I preferred this over a simple `true`/`false` filter because it can be useful to have one log file for all DBG logs from a component while still limiting it to `INFO` or whatever in the main application log file. Reviewed By: simpkins Differential Revision: D18360804 fbshipit-source-id: a45098c81fdc8b984e440748880e8943df95acd2
-
- 13 Nov, 2019 3 commits
-
-
Maged Michael authored
Summary: Allow hazptr_obj_batch-es to outlive the default domain. Background: Until now it was expected that batches are destructed before the destruction of the default domain. This may be restrictive to good use cases. This diff removes the above mentioned restriction and gives hazptr_obj_batch::shutdown_and_reclaim() to decide whether or not to access the default domain by supporting a singleton bool in default_hazptr_domain_alive() that could be made to outlive the default domain by calling that function before constructing the user object that may outlive the default domain. Reviewed By: aary Differential Revision: D18297698 fbshipit-source-id: 6021479ab36ce86d2c411fd71974fde47f7502a2
-
Eric Niebler authored
Summary: In a coroutine returning a `coro::Task<T>`, make `co_return {};` return a default-constructed `T` rather than a default-constructed `folly::Try`. Reviewed By: yfeldblum, andriigrynenko Differential Revision: D18466785 fbshipit-source-id: ed20f0f5ad98a0ef8e693e490417a7e36f706822
-
Orvid King authored
Summary: Newer CRT versions have changed how certain definitions were gated, so we need to update to support them. Reviewed By: akrieger, guangyfb Differential Revision: D18435320 fbshipit-source-id: 40ffc57ed1fe0ad1b01ab834aed9762bde5563cb
-
- 12 Nov, 2019 3 commits
-
-
Rosen Penev authored
Summary: Not supported under ARMv6 and below. Pull Request resolved: https://github.com/facebook/folly/pull/1176 Reviewed By: yfeldblum Differential Revision: D18145021 Pulled By: Orvid fbshipit-source-id: 21796e225f650038479d1f5a858313dab0477e66
-
Felix Handte authored
Summary: As title. Reviewed By: yfeldblum Differential Revision: D18351375 fbshipit-source-id: 594270e7b6b7056f7223fa7575ee33fed8f7d266
-
Yedidya Feldblum authored
Summary: [Folly] `is_trivially_copyable_v`, an inline variable helper for `is_trivially_copyable`. Reviewed By: nbronson Differential Revision: D18413171 fbshipit-source-id: e256e40351492ecce8cfd31151569544aadca4e1
-
- 11 Nov, 2019 2 commits
-
-
Chad Austin authored
Summary: Synchronized::operator-> is dangerous and leads to accidentally acquiring locks or accidentally releasing them too soon. Add a deprecated attribute that suggests using explicit locking instead. Reviewed By: yfeldblum Differential Revision: D18351232 fbshipit-source-id: 7bd3702bdd9b58dfa0fc7e8b8b636db9b5d7af8f
-
Genevieve Helsel authored
Summary: From https://en.cppreference.com/w/cpp/thread/condition_variable/wait, predicate should return false if the waiting should be continued. In the current code, the logic is flipped. Reviewed By: yfeldblum Differential Revision: D18413606 fbshipit-source-id: 3b59efe49946a223204ab68fc9fbe3bb98e3b58e
-
- 10 Nov, 2019 1 commit
-
-
Rosen Penev authored
Summary: Found with modernize-deprecated-headers Note that C++14 deprecated these. Signed-off-by: Rosen Penev <rosenp@gmail.com> Pull Request resolved: https://github.com/facebook/folly/pull/1254 Reviewed By: Orvid Differential Revision: D18369623 Pulled By: yfeldblum fbshipit-source-id: e824bc5474f94fa4fe359ac6a4899eeaaddbb13b
-
- 09 Nov, 2019 2 commits
-
-
aloknnikhil authored
Summary: Fixes cases where control would reach the end of the setThreadName function without an explicit return Pull Request resolved: https://github.com/facebook/folly/pull/1250 Reviewed By: Orvid Differential Revision: D18222073 Pulled By: yfeldblum fbshipit-source-id: 09cbefcc7e2ca80a95d61a4394ed74be8ea8ec55
-
generatedunixname89002005287564 authored
Reviewed By: yfeldblum Differential Revision: D18298354 fbshipit-source-id: 683da223956570304a9ba80dacfb4659ff9a114b
-
- 08 Nov, 2019 2 commits
-
-
Lara Lu authored
Summary: We need the ability to dynamically change the priority of an executor when it's executing work. Specifically, we want to de-prioritize a query's work units while it is being executed if it has taken up too much resources. Pass a callback function to ExecutorWithPriority which sets the priority upon every add. Reviewed By: andriigrynenko Differential Revision: D18344806 fbshipit-source-id: c0c59d3982637703e6e7c3793930b9d9fadce6fe
-
Dan Melnic authored
Summary: Add folly::hardware_concurrency (Note: this ignores all push blocking failures!) Reviewed By: yfeldblum Differential Revision: D18342219 fbshipit-source-id: 806ef7b46e52896fa289a79854e45447929ab632
-
- 07 Nov, 2019 5 commits
-
-
Chad Austin authored
Summary: In preparation for adding a deprecation annotation to Synchronized::operator->, ensure that folly builds deprecation-clean. Reviewed By: yfeldblum Differential Revision: D18351118 fbshipit-source-id: f90a230d24a95e3983989d2c3caf7a4383a8226a
-
Felix Handte authored
Summary: If the source IOBuf is not chained, we short-circuit the cloning logic and instead share the existing buffer. This works when we implicitly require the clone to have the same headroom and tailroom requirements as the source IOBuf. However, the API allows setting other values. We need to test that we meet those requirements in order to use the shortcut. This diff adds those checks. Reviewed By: yfeldblum Differential Revision: D18180574 fbshipit-source-id: 31bfaabd7663cf83faf919d8cb242df0a7a2969d
-
Abhinav Rai authored
Summary: Using a ThreadPoolExecutor instead of calling getCPUExecutor() to get one. getCPUExecutor() by default returns an inline executor, which doesn't ensure that sleep is triggered on the same executor as the fiber loop. Reviewed By: andriigrynenko Differential Revision: D18353758 fbshipit-source-id: 6810d11b12de3f62ac5286dba00d2b4a9d447eba
-
John Strizich authored
Summary: We removed this dependency in the code a while ago. Reviewed By: saifhhasan Differential Revision: D18366401 fbshipit-source-id: daf1c7865fe0c312694bdf395f9d7ace99f70395
-
Shai Szulanski authored
Reviewed By: yfeldblum Differential Revision: D18356211 fbshipit-source-id: ad2361c65260a1a09f8536d07e5447cfcf5cc552
-
- 06 Nov, 2019 1 commit
-
-
Maged Michael authored
Summary: Add a fixed single-writer multi-reader hash map that supports: - Copy construction with optional expansion - Concurrent read-only lookup. - Concurrent read-only iteration. The map has fixed size. Higher-level users can manage instances of this map to build a more general unbounded map. Reviewed By: davidtgoldblatt Differential Revision: D17522603 fbshipit-source-id: b4fcfe427a343f7226d216670536f2594f187bf3
-