Andrii Grynenko [Fri, 19 Feb 2016 19:19:18 +0000 (11:19 -0800)]
Fix EventBaseOnDestructionCallback to loop FiberManager
Summary: EventBase loop should do it as well, but it's possible for LoopCallback to be removed before EventBaseOnDestructionCallback.
Reviewed By: pavlo-fb
Differential Revision:
D2951303
fb-gh-sync-id:
43f5a91e7ecffa7ab7feec32fa45e01b28db66a3
shipit-source-id:
43f5a91e7ecffa7ab7feec32fa45e01b28db66a3
Andrii Grynenko [Fri, 19 Feb 2016 19:02:35 +0000 (11:02 -0800)]
Fix folly::Singleton to work in dynamically linked binaries
Summary:This implements StaticSingletonManager which is then used to create all leaked Meyers singletons.
StaticSingletonManager is a singleton itself, which is created in a separate compilation unit (Singleton.cpp) and so we can be sure that other compilation units will always see a single instance of StaticSingletonManager, even if linked dynamically.
StaticSingletonManager then keeps a dictionary of typeid -> object pointer, which is used to de-duplicate same singleton being re-created from different compilation units (linked dynamically), usually because of code inlining.
override-unit-failures
Reviewed By: yfeldblum
Differential Revision:
D2913027
fb-gh-sync-id:
1f5015a79a7a8297ebf5f0fe3fd0cc7eb44f706b
shipit-source-id:
1f5015a79a7a8297ebf5f0fe3fd0cc7eb44f706b
Tianjiao Yin [Fri, 19 Feb 2016 18:40:46 +0000 (10:40 -0800)]
fix dangling pointer bug in IPAddressV6
Summary: `mask(numBits)` returns a temporary variable. After its lifetime ends, subbytes becomes a dangling pointer.
Reviewed By: yfeldblum
Differential Revision:
D2953699
fb-gh-sync-id:
5d5a35716ecaa1b3d96edb5a459615756848b92f
shipit-source-id:
5d5a35716ecaa1b3d96edb5a459615756848b92f
Yedidya Feldblum [Fri, 19 Feb 2016 07:10:20 +0000 (23:10 -0800)]
Indestructible
Summary:[Folly] `Indestructible`.
For when you need a Meyers singleton that will never be destructed, even at program exit.
Good for large data structures with many heap allocations, as long as they have no behavior. No point in ever destructing them.
HT: Proxygen, and Orvid.
Reviewed By: andriigrynenko
Differential Revision:
D2947959
fb-gh-sync-id:
7dd1f725edf137ba81fbf4032a0819fd7c627261
shipit-source-id:
7dd1f725edf137ba81fbf4032a0819fd7c627261
Lucian Grijincu [Fri, 19 Feb 2016 02:46:44 +0000 (18:46 -0800)]
folly: symbolizer: slow address->{file+line-number} lookup if `.debug_aranges` is missing (e.g. --strip-debug-non-line)
Summary:Binaries linked with `gold` and `--strip-debug-non-line` don't have an `.debug_aranges` section
We still want to map `address->{file+line-number}` to get nice stack
traces even though this might be slower (linear search all compilation unit entries in `.debug_info`).
Before:
```
$ # link with gold + --strip-debug-non-line
$ folly/experimental/exception_tracer/exception_tracer_test
E0217 15:02:13.694947
1321814 ExceptionTracer.cpp:179] Exception type: std::runtime_error (9 frames)
@
000000000040ad2d __cxa_throw
@
0000000000409df3 bar()
@
0000000000409eab baz()
@
0000000000407c77 main
@
00007f00dd9860f5 __libc_start_main
@
000000000040991b (unknown)
```
After (similar to the output without `--strip-debug-non-line`):
```
E0217 18:37:37.579596
1583124 ExceptionTracer.cpp:179] Exception type: std::runtime_error (9 frames)
@
000000000040ad6d __cxa_throw
./folly/experimental/exception_tracer/ExceptionTracerLib.cpp:57
@
0000000000409e33 bar()
./folly/experimental/exception_tracer/ExceptionTracerTest.cpp:24
@
0000000000409eeb baz()
./folly/experimental/exception_tracer/ExceptionTracerTest.cpp:51
@
0000000000407c87 main
./folly/experimental/exception_tracer/ExceptionTracerTest.cpp:96
@
00007f1d16ff80f5 __libc_start_main
@
000000000040995b (unknown)
```
Differential Revision:
D2947965
fb-gh-sync-id:
e517bab324b1dcb70cadc9a5211ce794e35c83a5
shipit-source-id:
e517bab324b1dcb70cadc9a5211ce794e35c83a5
Christopher Dykes [Thu, 18 Feb 2016 23:24:48 +0000 (15:24 -0800)]
Don't use a VLA for the double->string buffer.
Summary: MSVC is actually smarter about this than GCC, as MSVC doesn't support VLAs, it tries to eval the length at compile time. GCC on the other hand doesn't try to eval it at compile time, resulting in compiles via CMake telling us that this is a VLA.
Reviewed By: yfeldblum
Differential Revision:
D2911929
fb-gh-sync-id:
ffaa133bcf4129a3e02f7e875966d3ae6a97be6a
shipit-source-id:
ffaa133bcf4129a3e02f7e875966d3ae6a97be6a
Sven Over [Thu, 18 Feb 2016 13:31:22 +0000 (05:31 -0800)]
folly/ApplyTuple.h: fix const-correctness & other issues, simplify
Summary:The existing implementation of folly::applyTuple does not support
mutable callables (such as mutable lambdas and other functor objects
that only implement non-const operator()).
This commit adds a few more unit tests and changes the implementation
so that new and existing tests pass.
Reviewed By: yfeldblum
Differential Revision:
D2942622
fb-gh-sync-id:
82478f290e9fd2020358ff79ef0a6bcf8a43738c
shipit-source-id:
82478f290e9fd2020358ff79ef0a6bcf8a43738c
Yedidya Feldblum [Wed, 17 Feb 2016 23:30:46 +0000 (15:30 -0800)]
Sort the Makefile headers a bit
Summary:[Folly] Sort the `Makefile` headers a bit.
Just manually moving a few obviously out-of-order entries.
Reviewed By: Orvid
Differential Revision:
D2945668
fb-gh-sync-id:
604976d25e5913ef01d591e23737d61dacfbfc86
shipit-source-id:
604976d25e5913ef01d591e23737d61dacfbfc86
Nathan Bronson [Wed, 17 Feb 2016 22:20:19 +0000 (14:20 -0800)]
clang-format some code in preparation for real changes
Reviewed By: djwatson
Differential Revision:
D2945770
fb-gh-sync-id:
9e4ee3b052b0bbb33ef796b8070edd24c6942589
shipit-source-id:
9e4ee3b052b0bbb33ef796b8070edd24c6942589
Lovro Puzar [Wed, 17 Feb 2016 13:22:40 +0000 (05:22 -0800)]
Add call_once, wrapper around std::call_once with a fast path
Summary: std::call_once is a nice API but the current GCC implementation is slower than it needs to be. Adding a header-only wrapper with an additional atomic bool.
Reviewed By: luciang
Differential Revision:
D2938884
fb-gh-sync-id:
5939c94fe62a1523053dcff26c880ecaec9e1150
shipit-source-id:
5939c94fe62a1523053dcff26c880ecaec9e1150
Michael Lee [Wed, 17 Feb 2016 04:38:20 +0000 (20:38 -0800)]
Handle wrapvFull when IOV_MAX is not defined.
Summary:--Perhaps this should move to Portability.h instead. There is another instance of this in io/async/AsyncSocket.cpp.--
Added `portability/SysUio.h` to handle the c-macro conversion into a usable value.
Reviewed By: yfeldblum
Differential Revision:
D2940778
fb-gh-sync-id:
897e44b430c02e5a7d826f3e8da9e4979b7b898c
shipit-source-id:
897e44b430c02e5a7d826f3e8da9e4979b7b898c
Anirudh Ramachandran [Wed, 17 Feb 2016 01:28:22 +0000 (17:28 -0800)]
ECDSA async/offloading support for proxygen
Summary: Minor changes to AsyncSSLSocket for async crypto
Reviewed By: siyengar
Differential Revision:
D2516765
fb-gh-sync-id:
354baeb94e6f63e8d5cdf8455ff5ca49a6aa479c
shipit-source-id:
354baeb94e6f63e8d5cdf8455ff5ca49a6aa479c
Iaroslav Tverdokhlib [Tue, 16 Feb 2016 18:21:35 +0000 (10:21 -0800)]
Fix wrapvFull for the case when iovec* has size more than 1024
Summary: `folly::wrapvFull` fail if the passed in `iovec*` has more than 1024 (`IOV_MAX`) elements. In particular, it returns -1 with errno 22 [Invalid argument]. The fix is to limit maximum size of iovec* to IOV_MAX that is passed in to `readv/writev/...` in a single iteration of outer loop.
Reviewed By: yfeldblum
Differential Revision:
D2935540
fb-gh-sync-id:
6c0a073ac0b59db3d53fb4269b13ddfcc479efb1
shipit-source-id:
6c0a073ac0b59db3d53fb4269b13ddfcc479efb1
Brett Simmers [Tue, 16 Feb 2016 05:51:35 +0000 (21:51 -0800)]
folly::Optional<T> should be trivially destructible when T is
Summary:There doesn't appear to be a way to use std::enable_if on a
destructor, so conditionally select from one of two storage types.
Reviewed By: yfeldblum
Differential Revision:
D2923902
fb-gh-sync-id:
2def8d1031d70379fd84e8eb555dad9d2b4996f2
shipit-source-id:
2def8d1031d70379fd84e8eb555dad9d2b4996f2
Lee Howes [Mon, 15 Feb 2016 21:22:30 +0000 (13:22 -0800)]
Modification to futures to remove deadlock in certain use cases for getVia(executor).
Summary: If getVia was called on a future modified using via, getVia could deadlock if the original future was updated to a new executor and there was no callback chained after the call to via. In effect: f.via(executor).getVia(executor); deadlocks. This can be a problem if the code is hidden in a library and the precise semantics are unclear. This diff adds a test that exposes the problem and a fix by forcing waitVia to add a callback that will satisfy the new exector, ensuring that drive() has a callback to trigger once the future is satisfied.
Reviewed By: andriigrynenko
Differential Revision:
D2906858
fb-gh-sync-id:
a3105079530f15d7a7d39a9381c4078665b721a7
shipit-source-id:
a3105079530f15d7a7d39a9381c4078665b721a7
Andrii Grynenko [Mon, 15 Feb 2016 19:32:24 +0000 (11:32 -0800)]
Unify runInMainContext for void and non-void
Summary: This also fixes a bug where exception was not re-thrown for functions returning void.
Reviewed By: spalamarchuk
Differential Revision:
D2936887
fb-gh-sync-id:
9828dec131203528c27eae874aba147168f40d0d
shipit-source-id:
9828dec131203528c27eae874aba147168f40d0d
Michael Lee [Mon, 15 Feb 2016 14:00:09 +0000 (06:00 -0800)]
Make Gold more like Core.
Summary:Adding padding for Android was wrong, instead, we should have
used `std::aligned_storage`.
Reviewed By: fugalh
Differential Revision:
D2934566
fb-gh-sync-id:
f541b89309be70791fced48f63b6b5aecc49bfbb
shipit-source-id:
f541b89309be70791fced48f63b6b5aecc49bfbb
Igor Sugak [Fri, 12 Feb 2016 23:54:28 +0000 (15:54 -0800)]
folly/test/json_test: fix heap-buffer-overflow in Json.PrintTo test
Summary:Json.PrintTo test if failing with heap-buffer-overflow asan abort. The problem here comes up
when values of `std::string` and `std::ostrstring::str()` are compared. `std::ostrstring::str()` returns
*non null* terminated array of `char`s. When compared with `std::string` a read from memory after
the end that array is made. Fixing the test by replacing `std::ostrstream` with `std::ostringstream`,
that does append `\0`.
Reviewed By: yfeldblum
Differential Revision:
D2934352
fb-gh-sync-id:
c6a5d765c9951716b8a14715702cf3d940c6d723
shipit-source-id:
c6a5d765c9951716b8a14715702cf3d940c6d723
Andrii Grynenko [Fri, 12 Feb 2016 22:34:00 +0000 (14:34 -0800)]
Convert Thrift1(2)RequestDispatcher::sendMessage()
Summary:This depends on
D2897095.
The main goal here is to start moving onRequestSuccess and onRequestFailure calls higher in the stack.
Reviewed By: mmcduff
Differential Revision:
D2899959
fb-gh-sync-id:
4e074c2d734f88f5be56000095b892c6d47c0dcc
shipit-source-id:
4e074c2d734f88f5be56000095b892c6d47c0dcc
Mark Isaacson [Fri, 12 Feb 2016 20:56:41 +0000 (12:56 -0800)]
folly copyright 2015 -> copyright 2016
Summary: Update copyright for 2016
Reviewed By: igorsugak
Differential Revision:
D2828047
fb-gh-sync-id:
8638188aeb694c3ca2a615cc2bc3bc9d251e388d
shipit-source-id:
8638188aeb694c3ca2a615cc2bc3bc9d251e388d
Andrii Grynenko [Fri, 12 Feb 2016 18:22:25 +0000 (10:22 -0800)]
Fix Singleton/ThreadLocal destruction order crashes in buck dev builds
Summary: This adds a folly::Singleton->folly::ThreadLocal dependency to make sure folly::ThreadLocal is always loaded first. Otherwise PthreadKeyUnregister singleton is created after folly::Singleton storage, even though it has higher priority.
Reviewed By: andrewjcg
Differential Revision:
D2931170
fb-gh-sync-id:
36392d76e98201f2b4416b4bbef451d6c0e8c69d
shipit-source-id:
36392d76e98201f2b4416b4bbef451d6c0e8c69d
Drew Hoskins [Thu, 11 Feb 2016 23:53:21 +0000 (15:53 -0800)]
Fix MultiLevelTimeseries::getRate()
Summary:I hit a landmine where rate() returned 0 for my tests where fewer than 60 items were added per minute. This was because it was truncating it. And yet, countRate() was working.
It doesn't make sense for a rate (value accumulated per time period) to be integral.
Folly: I changed rate() to return a double by default for folly, as was done by avg() and countRate(). Looked like a typo to me.
Common wrapper: I changed getRate() to allow you to override and make it double, as was done by getAvg(). Defaulting to int (which is usually the value type) is a bad call IMO but it's a riskier change to change it to double, and I want to be consistent with getAvg().
Reviewed By: tracelog
Differential Revision:
D2921061
fb-gh-sync-id:
00875f2ab7963ef3ba2db475aedaf6ebd413b38f
shipit-source-id:
00875f2ab7963ef3ba2db475aedaf6ebd413b38f
Michael Lee [Thu, 11 Feb 2016 04:22:20 +0000 (20:22 -0800)]
fix -Wshadowing in String.cpp
Summary: Didn't check this with -Wshadow when I first wrote it.
Reviewed By: ranjeeth
Differential Revision:
D2926047
fb-gh-sync-id:
8391986dee2d6b5698491bd2995f039468ec684d
shipit-source-id:
8391986dee2d6b5698491bd2995f039468ec684d
Michael Lee [Thu, 11 Feb 2016 04:04:28 +0000 (20:04 -0800)]
Fix typo in StringTest
Summary: It should be UL instead of ULL.
Reviewed By: siyengar
Differential Revision:
D2926005
fb-gh-sync-id:
d2387eb601c50d9820907c831277aa6f8e938cbb
shipit-source-id:
d2387eb601c50d9820907c831277aa6f8e938cbb
Michael Lee [Thu, 11 Feb 2016 02:51:43 +0000 (18:51 -0800)]
Switch stripLeftMargin to not use boost::regex
Summary: Remove boost regex from `stripLeftMargin`. We can shrink some binaries by not including it in the core folly library.
Reviewed By: yfeldblum
Differential Revision:
D2922415
fb-gh-sync-id:
cee89164c650706f0e5c07eed3d40500831918cd
shipit-source-id:
cee89164c650706f0e5c07eed3d40500831918cd
Andrii Grynenko [Thu, 11 Feb 2016 02:02:27 +0000 (18:02 -0800)]
Add MAX_STATIC_CONSTRUCTOR_PRIORITY to PthreadKeyUnregister
Summary: We want onThreadExit to be canceled as late as possible. Otherwise accessAllThreads() may crash on shutdown (because ThreadEntry is destroyed, but not removed from the global list).
Reviewed By: igorsugak
Differential Revision:
D2923435
fb-gh-sync-id:
3a8eef05844bb547c06db33cb96734df1169852a
shipit-source-id:
3a8eef05844bb547c06db33cb96734df1169852a
Michael Lee [Thu, 11 Feb 2016 00:05:12 +0000 (16:05 -0800)]
Compensate for -m32 platforms.
Summary:
When compiled for -m32, this test fails because of the
difference between longs.
Reviewed By: yfeldblum
Differential Revision:
D2924626
fb-gh-sync-id:
8ee863fa2b6df8519bd52d0d3144697a297780bb
shipit-source-id:
8ee863fa2b6df8519bd52d0d3144697a297780bb
Giuseppe Ottaviano [Wed, 10 Feb 2016 20:17:35 +0000 (12:17 -0800)]
Minor optimizations in ExceptionCounterLib
Summary: Avoid allocation and logging inside the throw handler, and some other minor tweaks.
Reviewed By: bort, luciang
Differential Revision:
D2921073
fb-gh-sync-id:
4491ab2f85a4251e59ba9394bba5abef0bdf7a10
shipit-source-id:
4491ab2f85a4251e59ba9394bba5abef0bdf7a10
Andrii Grynenko [Wed, 10 Feb 2016 19:14:26 +0000 (11:14 -0800)]
Fix EventBase destruction race in FiberManagerMap
Summary:
Previously we could be reading from thread-local FiberManagerMap while it was modified.
This is now fixed by keeping a per-thread list of EventBases which need to be removed from local maps. On the fast-path no action is taken, since list will be empty.
This is second try, since
D2853921 got reverted.
The new implementation is simpler and does not rely on AtomicLinkedList.
Reviewed By: yfeldblum
Differential Revision:
D2908018
fb-gh-sync-id:
4d7aed974c19761f7e2732ddbf8694af57c69bd6
shipit-source-id:
4d7aed974c19761f7e2732ddbf8694af57c69bd6
Yedidya Feldblum [Wed, 10 Feb 2016 00:28:21 +0000 (16:28 -0800)]
stripLeftMargin
Summary:
[Folly] `stripLeftMargin`.
So you can do:
TEST(MyClass, doSomethingWithString) {
// Multiline string literal is indented properly inside the test case
// instead of being aligned all the way to the left, which would make
// the test case read poorly.
auto input = folly::stripLeftMargin(R"TEXT(
first line
second line
third line
)TEXT");
auto expected = //...
auto actual = MyClass::doSomethingWithString(input);
EXPECT_EQ(expected, actual);
}
Reviewed By: markisaa
Differential Revision:
D2909736
fb-gh-sync-id:
ebb07da05e1a788535064cfcd9e07f617a007800
shipit-source-id:
ebb07da05e1a788535064cfcd9e07f617a007800
Alan Frindell [Tue, 9 Feb 2016 17:44:21 +0000 (09:44 -0800)]
Relax HHWheelTimer::destroy assertion to accommodate SharedPtr
Summary:
HHWheelTimer's auto-pointers are kind of funny. You can do something like this:
```
HHWheelTimer::UniquePtr p = ...;
// create a SharedPtr from UniquePtr
HHWheelTimer::SharedPtr s(p);
// create another SharedPtr from raw ptr
HHWheelTimer::SharedPtr s(p.get());
// No problem.
If you do this:
HHWheelTimer::SharedPtr p = ....;
// this leaks
```
Why? Because SharedPtr is only have of std::shared_ptr. It's the refcounting half. But when the last SharedPtr goes out of scope, it **does not** invoke HHWheelTimer::destroy().
So code like this is possible/expected:
```
MySweetObj::MySweetObj(HHWheelTimer::SharedPtr s) {
s_ = s;
s_.scheduleTimeout(a, b);
}
{
HHWheelTimer::UniquePtr p = ...;
obj = MySweetObj(p)
// But what if I decide to kill p:
p.reset();
}
```
Since MySweetObj takes a SharedPtr and holds it, it can reasonbly expect that it can schedule timeouts on it, and the HHWheelTimer will not be deleted until it releases the SharedPtr. This is true, but the above code would hit the assert that count_ == 0.
Instead, relase the check that count_ == 0 only if there are no extra outstanding SharedPtrs.
Reviewed By: viswanathgs, chadparry
Differential Revision:
D2908729
fb-gh-sync-id:
9abd4a7d692fe952c5514dbb8d85dfbad95a3cac
shipit-source-id:
9abd4a7d692fe952c5514dbb8d85dfbad95a3cac
Michael Lee [Mon, 8 Feb 2016 20:53:55 +0000 (12:53 -0800)]
Fix bad merge.
Summary:
FBStringTest.cpp was refactored, but the TestUtil and
TemporaryFile was not properly removed.
Reviewed By: yfeldblum
Differential Revision:
D2913045
fb-gh-sync-id:
710c3f5b808acb634dfcd65219484ddc257ed52c
Yedidya Feldblum [Mon, 8 Feb 2016 02:14:17 +0000 (18:14 -0800)]
Fix Build: conditionally_existent_test in folly/test/Makefile.am
Summary:
[Folly] Fix Build: `conditionally_existent_test` in `folly/test/Makefile.am`.
HT: https://github.com/shindo.
Reviewed By: meyering
Differential Revision:
D2910782
fb-gh-sync-id:
9593f026e7c58b8644abc5996da65005bcc2d095
Sven Over [Sun, 7 Feb 2016 13:24:01 +0000 (05:24 -0800)]
folly/futures: fix early release of non-embedded callbacks
Summary:
folly::Future (more precisely folly::detail::Core) can store
callback functors (typically lambdas) up to a certain size
(8*sizeof(void*)) inside the main object. Only bigger functors
are stored in the std::function object in folly::detail::Core,
which will put them on the heap.
The behaviour of folly::Future is slightly different depending
on whether the callback can be embedded in the main object
or not. Small functors will be destructed after the callback
is executed. Functors too big to fit in the lambda space in
the Core object will be deleted when Core is deleted.
Some code assumes that functor objects are deleted as soon
as the callback has been executed. The implementations of
folly::Future::collect and variants do so. If you switch
off this optimisation temporarily (which can be done easily
by setting lambdaBufSize in folly/futures/detail/Core.h to
0), a number of unit tests fail.
Given that the lambda buffer is reasonably large, most
functors can be stored in the Core object. The different
behaviour for very large lambdas may not have been observed.
This diff fixes the inconsitent behaviour.
Firstly, it changes the unit test Future:finish to explicitly
check that the callback functor is deleted after the callback
has been executed. This should be tested, because this
behaviour is assumed in other parts of the futures
implementation (e.g. Future::collect et al.).
Secondly, it adds another unit test Future:finishBigLambda,
similar to Future:finish. The lambda captures much more data
to make sure the lambda won't be stored in the Core object,
but in the std::function object inside Core. The test verifies
that the behaviour is the same, i.e. the callback functor
is destructed after the callback has been executed.
Thirdly, it fixes Core and makes sure that functors of any
size are destructued after the callback has been called. The
new unit test fails without this.
Reviewed By: fugalh
Differential Revision:
D2883772
fb-gh-sync-id:
21a410f6592b3e090772a7b55bef6729d8739922
Den Raskovalov [Sat, 6 Feb 2016 05:31:32 +0000 (21:31 -0800)]
Call destructor for non-trivial destructors if arena allocator is used in ConcurrentSkipList.
Reviewed By: philippv
Differential Revision:
D2900534
fb-gh-sync-id:
c711a160d541d937ada24f2b524016dbceb40ee2
Francis Ma [Fri, 5 Feb 2016 23:00:39 +0000 (15:00 -0800)]
Loosen restriction to get folly::future::CoreTest pass on android
Summary: Due to different way of padding, CoreTest failed on android. Loosen the check to make it pass.
Reviewed By: mzlee
Differential Revision:
D2907987
fb-gh-sync-id:
81d715725d6908ec7b259b0a67789a91ed63df71
Francis Ma [Fri, 5 Feb 2016 22:42:28 +0000 (14:42 -0800)]
Make folly/future portable on android
Summary: Some small changes to port folly/futures onto android
Reviewed By: mzlee
Differential Revision:
D2787564
fb-gh-sync-id:
8c161942c24c2b7b0484339eaa51c5a356f17de5
Yedidya Feldblum [Fri, 5 Feb 2016 20:27:56 +0000 (12:27 -0800)]
ConditionallyExistent<typename>
Summary:
[Folly] `ConditionallyExistent<typename>`.
For when we need extra member fields in dbg builds, but want to save the space in opt builds. Or other situations along similar lines, but with perhaps another the statically-known condition.
Conditional compilation can have some nasty side-effects. Best to avoid it. Let the compiler see everything, rather than having the preprocessor ruin our day. Let the optimizer remove code that will never be called, after the compiler has seen it. Let us have a single AST in our source file, not one AST for dbg and one for opt, or other statically-known conditions.
Reviewed By: andriigrynenko
Differential Revision:
D2879397
fb-gh-sync-id:
d631141a984eebd46674f27a40a97f670eb33f54
Andrii Grynenko [Fri, 5 Feb 2016 20:01:26 +0000 (12:01 -0800)]
Revert
D2853921
Summary: This was causing memory leaks. I assume that happens if FiberManager was once requested from a thread (so that thread local was initialized), but the thread was never used since then, accumulating EventBase* in the queue.
Reviewed By: simonmar
Differential Revision:
D2906752
fb-gh-sync-id:
71ab14cb051a9cee3684a30eaf6729ef65888a52
Michael Lee [Fri, 5 Feb 2016 15:27:02 +0000 (07:27 -0800)]
Turn off a FBStringTest for Android.
Summary:
The wstring support on KitKat is not exactly working. Works
on Lollipop though.
Reviewed By: markisaa
Differential Revision:
D2901732
fb-gh-sync-id:
97b57fb4d8c645192be62dca25d8fb1b2397ad7d
Louis Brandy [Fri, 5 Feb 2016 01:23:56 +0000 (17:23 -0800)]
Greatly expand the components overview in Overview.md
Summary: See title. This is create a big flat mess, which I may clean up in a follow on to highlight the biggest and most generally useful libraries.
Reviewed By: fugalh
Differential Revision:
D2902152
fb-gh-sync-id:
028633448ab97f47a3419f31fa58c79b77a89e52
Louis Brandy [Fri, 5 Feb 2016 00:55:29 +0000 (16:55 -0800)]
promote a bunch of high level txt to the main Readme.md
Summary: See title
Reviewed By: snarkmaster
Differential Revision:
D2901817
fb-gh-sync-id:
5b9ede7b941cf18e7be352a93ec5686e6f1f50a7
Lee Howes [Fri, 5 Feb 2016 00:19:09 +0000 (16:19 -0800)]
Adding addTaskFuture and addTaskRemoteFuture to FiberManager.
Summary: Adds functionality to fibermanager to add tasks locally and remotely that will return futures. As a side effect, also wraps the function in addTaskRemote in a move wrapper so that it behaves correctly with move-only types such as promises.
Reviewed By: andriigrynenko, yfeldblum
Differential Revision:
D2892898
fb-gh-sync-id:
1666c103db35d9c149c36f8b8c3058cd6e0465fc
Andrii Grynenko [Thu, 4 Feb 2016 21:58:25 +0000 (13:58 -0800)]
Improve RequestContext::getStaticContext() perf
Summary: Avoid using folly::ThreadLocal on the fast-path. This uses the fact that it is a static object.
Reviewed By: yfeldblum
Differential Revision:
D2873374
fb-gh-sync-id:
978108da0c9e8576fda6849058b0262478c2841e
Neel Goyal [Thu, 4 Feb 2016 18:43:06 +0000 (10:43 -0800)]
Allow SSLSessionCallbacks to be used on SSL* that isn't attached to AsyncSSLSocket
Summary: The session callbacks assumed that the SSL* was associated with a folly::AsyncSSLSocket when it didn't need to. This enables apps that manage their own SSL* to use these callbacks.
Reviewed By: yfeldblum
Differential Revision:
D2896426
fb-gh-sync-id:
c51df6b4cb3f4cc188a6411c1f3e7e89e96e8a67
Giuseppe Ottaviano [Thu, 4 Feb 2016 01:32:42 +0000 (17:32 -0800)]
Build workaround for nvcc in Malloc.h
Summary: See comment.
Reviewed By: juancarabina, luciang
Differential Revision:
D2896262
fb-gh-sync-id:
cb884651d47b86c0a5b3c2c22f421b2b1f39dc35
Alan Frindell [Tue, 2 Feb 2016 23:31:32 +0000 (15:31 -0800)]
Make HHWheelTimer take a TimeoutManager rather than EventBase
Summary: TimeoutManager is a Mockable parent class
Reviewed By: maxgeorg
Differential Revision:
D2892671
fb-gh-sync-id:
d20635b18a7c748009ce4880c80a13ac23b9222a
Peter Griess [Tue, 2 Feb 2016 23:27:21 +0000 (15:27 -0800)]
Add MockTimeoutManager
Summary: - Add new MockTimeoutManager mock. For testing.
Reviewed By: yfeldblum
Differential Revision:
D2891814
fb-gh-sync-id:
6d15feb533e5a8984484d1efdf58d2c77b7b3f49
Wez Furlong [Tue, 2 Feb 2016 22:54:56 +0000 (14:54 -0800)]
folly: add bser encode/decode for dynamic
Summary:
To support consuming Watchman from within fbcode and hhvm
in particular, these functions add a BSER serialization for the
folly::dynamic data type.
Reviewed By: bhamiltoncx
Differential Revision:
D2876539
fb-gh-sync-id:
bc49d6bc453cc66cebda7185a5907a6f70970b24
Denis Samoylov [Tue, 2 Feb 2016 22:38:25 +0000 (14:38 -0800)]
fixed Ubuntu 12 build script dependencies
Summary: added missed boost dependency and changed CMake build order
Reviewed By: snarkmaster, yfeldblum
Differential Revision:
D2878880
fb-gh-sync-id:
2a5cded97afde4fd0d741168c3296f2c71426374
Martin Martin [Tue, 2 Feb 2016 22:12:48 +0000 (14:12 -0800)]
Add some quick comments about folly::fiber implementation classes.
Summary: Add some quick comments about folly::fiber implementation classes.
Reviewed By: yfeldblum
Differential Revision:
D2891940
fb-gh-sync-id:
b9899bb63df03f32763f93a5dae8dff94c8e354e
Giuseppe Ottaviano [Tue, 2 Feb 2016 18:27:10 +0000 (10:27 -0800)]
Kill writeTerminator in fbstring
Summary:
`writeTerminator` needs to determine the string category, and in the small case, also its size. This information is often known, but the compiler cannot optimize it away especially if `capacity_` was just overwritten. Also, some occurrences are just redundant. We can remove the latter and specialize the former.
Small operations such as `push_back` are up to 40% faster.
Before/after:
```
$ ./fbstring_benchmark_using_jemalloc --bm_regex '_fbstring' --bm_min_usec 200000 --bm_max_secs 2
============================================================================ ===================
./folly/test/FBStringTestBenchmarks.cpp.h relative time/iter iters/s time/iter iters/s
============================================================================ ===================
BM_initRNG_fbstring(0) 0.00fs Infinity 0.00fs Infinity
BM_defaultCtor_fbstring(0) 6.82us 146.60K 6.26us 159.74K
BM_copyCtor_fbstring(32768) 16.86ns 59.32M 15.50ns 64.52M
BM_ctorFromArray_fbstring(32768) 2.25us 444.78K 2.12us 471.58K
BM_ctorFromTwoPointers_fbstring(0) 9.76ns 102.44M 7.85ns 127.35M
BM_ctorFromTwoPointers_fbstring(7) 9.68ns 103.32M 8.10ns 123.47M
BM_ctorFromTwoPointers_fbstring(15) 9.77ns 102.34M 8.12ns 123.17M
BM_ctorFromTwoPointers_fbstring(23) 9.46ns 105.68M 8.78ns 113.88M
BM_ctorFromTwoPointers_fbstring(24) 31.23ns 32.02M 30.71ns 32.56M
BM_ctorFromChar_fbstring(
1048576) 40.04ns 24.97M 35.68ns 28.03M
BM_assignmentOp_fbstring(256) 66.76ns 14.98M 63.93ns 15.64M
BM_assignmentFill_fbstring(0) 8.23ns 121.47M 7.02ns 142.49M
BM_resize_fbstring(524288) 4.09us 244.63K 3.94us 253.84K
BM_equality_fbstring(65536) 2.47ms 404.63 2.19ms 455.92
BM_replace_fbstring(256) 172.36ns 5.80M 159.10ns 6.29M
BM_push_back_fbstring(1) 9.32ns 107.27M 7.79ns 128.40M
BM_push_back_fbstring(23) 252.44ns 3.96M 158.31ns 6.32M
BM_push_back_fbstring(127) 721.50ns 1.39M 515.08ns 1.94M
BM_push_back_fbstring(1024) 5.21us 191.87K 3.14us 318.03K
BM_short_append_fbstring(23) 431.71ns 2.32M 335.74ns 2.98M
BM_short_append_fbstring(1024) 11.96us 83.64K 9.19us 108.78K
BM_getline_fbstring(23) 57.06ns 17.53M 39.78ns 25.14M
BM_getline_fbstring(1000) 232.26ns 4.31M 203.24ns 4.92M
============================================================================ ===================
```
(`find` benchmarks were removed due to high variance caused by randomness)
Reviewed By: luciang
Differential Revision:
D2879646
fb-gh-sync-id:
10fd8573495d285220ae98858d11de9ec6d97e54
Orvid King [Tue, 2 Feb 2016 17:49:08 +0000 (09:49 -0800)]
Allow building without JEMalloc under MSVC
Summary: This was falling back to a hard depency on JEMalloc, and MSVC doesn't have proper weak linkage, so emulate it with some linker magic to get things building.
Reviewed By: yfeldblum
Differential Revision:
D2887695
Pulled By: Orvid
fb-gh-sync-id:
50c812a07c4e4e5bbe71263b86386783bf76ba82
Lucian Grijincu [Tue, 2 Feb 2016 01:00:24 +0000 (17:00 -0800)]
folly: #define UNDEFINED_SANITIZER in ubsan mode
Summary:
Undefined Sanitizer doesn't define any macro to detect that it's active.
The build system should provide `-DUNDEFINED_SANITIZER` when building
with -fsanitize=undefined or any of the other flags from
http://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
FWIW: Chrome defines the same preprocessor symbol:
https://chromium.googlesource.com/chromium/src/+/
ac18f489dca8c902e4dfaa1a28d716b7914121d0%5E%21/build/common.gypi
Reviewed By: andrewjcg
Differential Revision:
D2885167
fb-gh-sync-id:
e1129c0863bfde5d032c32e7d5cea7c43d82009f
Dmitry Pleshkov [Mon, 1 Feb 2016 23:35:18 +0000 (15:35 -0800)]
Implementing callback functionality for exception routines
Summary: Depends on
D2865911
Reviewed By: luciang
Differential Revision:
D2742158
fb-gh-sync-id:
3e7866a742575ee4f7501cff0abbd5c21e26a46e
Lucian Grijincu [Mon, 1 Feb 2016 23:19:55 +0000 (15:19 -0800)]
folly: ubsan: Benchmark: avoid division by zero (fsanitize=float-divide-by-zero)
Reviewed By: philippv
Differential Revision:
D2886132
fb-gh-sync-id:
a845d657fb920847df52fe5ec077e91554544f5b
Igor Sugak [Mon, 1 Feb 2016 22:35:10 +0000 (14:35 -0800)]
folly: fix one more -Wunused-parameter
Summary: The usage is guarded by a preprocessor macro, and I didn't noticed this earlier.
Reviewed By: yfeldblum
Differential Revision:
D2887016
fb-gh-sync-id:
791c4d16475aab77235792953997a281354018e9
Scott Wolchok [Mon, 1 Feb 2016 21:17:55 +0000 (13:17 -0800)]
Remove unnecessary includes from Optional.h
Summary:
I want to be able to include this in
fbobjc/xplat/folly:headers_only, but it currently pulls in a boost
header and Portability.h. Fortunately, neither of those includes are
needed.
Reviewed By: ddrcoder, yfeldblum, mhorowitz
Differential Revision:
D2880443
fb-gh-sync-id:
409561b8fb555ac3946d59cd6657c6c643b67c86
Christopher Dykes [Mon, 1 Feb 2016 20:36:43 +0000 (12:36 -0800)]
Support constexpr_strlen under MSVC.
Summary: MSVC doesn't support evaluating strlen at compile time, so implement our own version instead.
Reviewed By: yfeldblum, lbrandy
Differential Revision:
D2856926
fb-gh-sync-id:
22222350b57d9eff6a06c9d0f37d43a3cb1f2534
Lucian Grijincu [Mon, 1 Feb 2016 19:51:51 +0000 (11:51 -0800)]
folly: Hash: use loadUnassigned to avoid UB in hsieh_hash32_buf (fsanitize=alignment)
Reviewed By: philippv
Differential Revision:
D2886152
fb-gh-sync-id:
64c3543db831c72c7f4cf307867223270293066e
Lucian Grijincu [Mon, 1 Feb 2016 19:45:53 +0000 (11:45 -0800)]
folly: ubsan: HashTest: avoid invalid shift (sanitize=shift)
Summary:
[ RUN ] Hash.TWang_Unmix64
folly/test/HashTest.cpp:125:20: runtime error: shift exponent 32 is too large for 32-bit type 'unsigned int'
Reviewed By: philippv
Differential Revision:
D2886144
fb-gh-sync-id:
8d7963c087c9db34b08c07451d35e5568c750520
Igor Sugak [Mon, 1 Feb 2016 18:44:42 +0000 (10:44 -0800)]
folly: fix clang -Wmissing-field-initializers
Summary: Fix a few `-Wmissing-field-initializers` exposed by clang.
Reviewed By: yfeldblum
Differential Revision:
D2881902
fb-gh-sync-id:
67fdffd39d3ccca64f84055adae1f3b47fdec633
Neel Goyal [Mon, 1 Feb 2016 13:52:01 +0000 (05:52 -0800)]
Comments for SSLVerifyPeerEnum
Summary:
Document what the enum settings mean since they can be
somewhat confusing.
Reviewed By: shamdor-fb
Differential Revision:
D2882929
fb-gh-sync-id:
74ec30132bf5d2dce42f51a0b7b30cf2fae12dbf
Igor Sugak [Fri, 29 Jan 2016 23:53:26 +0000 (15:53 -0800)]
folly: fix -Wunused-parameter in opt mode
Summary: Fix a few remaining unused parameters, that are exposed only in opt build.
Reviewed By: markisaa
Differential Revision:
D2878865
fb-gh-sync-id:
d0d9761362220973cda14d99ab7342fbe8b1a469
Igor Sugak [Fri, 29 Jan 2016 23:33:50 +0000 (15:33 -0800)]
folly: fix clang build with -Wunused-const-variable
Summary: Fix a few unused const variables exposed by clang's `-Wunused-const-variable`.
Reviewed By: yfeldblum
Differential Revision:
D2878944
fb-gh-sync-id:
f5500fda4782eac2964761c0398d016d57716269
Orvid King [Fri, 29 Jan 2016 22:37:19 +0000 (14:37 -0800)]
Adjust AsyncServerSocket to not use getsockname before it's connected
Summary:
Winsock doesn't like it when you try to call getsockname on a socket that hasn't yet been connected or bound, because that socket doesn't have a name yet.
This only occurred because we were trying to get the family of the socket.
To solve this, I just passed the family in from the parent methods that already knew what the family was.
Reviewed By: yfeldblum
Differential Revision:
D2871859
Pulled By: Orvid
fb-gh-sync-id:
7674f565a968aa0258355fc977c185a416e4fbe4
Michael Lee [Fri, 29 Jan 2016 18:32:31 +0000 (10:32 -0800)]
Handle tmp dir on Android
Summary:
There is no universally accessible tmpdir on Android which
means mkstemp fails. This diff calls a function that the test runner
should provide to fill a valid temporary directory.
Reviewed By: yangchi
Differential Revision:
D2842034
fb-gh-sync-id:
9b826757bd750af016a18adccd5a21174be644d6
Denis Samoylov [Fri, 29 Jan 2016 18:18:01 +0000 (10:18 -0800)]
Make advanced init function for test optional
Summary: In order to avoid mandatory dependncy on elf, dwarf, unwind made new init function optional
Reviewed By: markisaa
Differential Revision:
D2878545
fb-gh-sync-id:
f66d3884a531dcf56fc1432330325ab45b149d7f
Michael Lee [Fri, 29 Jan 2016 15:23:19 +0000 (07:23 -0800)]
Exclude based on __APPLE__
Summary: This was showing up on a Linux compile to my sadness.
Reviewed By: francis-ma
Differential Revision:
D2876010
fb-gh-sync-id:
f638d593712c0aeb50177d96aaacb26575820359
Giuseppe Ottaviano [Fri, 29 Jan 2016 15:02:58 +0000 (07:02 -0800)]
Optimize getline(istream&, fbstring&) implementation
Summary:
Current `getline` implementation in `fbstring` always allocates, even if the passed string is already large enough. Furthermore, the growing strategy relies on outdated assumptions about the allocator.
This implementation reuses the existing allocation as much as possible, then uses exponential growth.
Reviewed By: luciang, philippv
Differential Revision:
D2871976
fb-gh-sync-id:
8db9512030be3f4953efa8f008747827504c032c
Denis Samoylov [Thu, 28 Jan 2016 19:18:54 +0000 (11:18 -0800)]
A common init function for binaries and a default main function for tests
Summary: Added initialization routines to test main function that can help with debugging tests
Reviewed By: markisaa, yfeldblum
Differential Revision:
D2839759
fb-gh-sync-id:
71cad45f3747336c8c7f8706db139cd060e1442b
Lucian Grijincu [Thu, 28 Jan 2016 19:07:44 +0000 (11:07 -0800)]
folly: ubsan: replace undefined call through reinterpret-cast fn-pointer with std::function
Summary:
This code casts function pointers to void(*fn)(void*) and calls
functions through that type. Calling functions through a different
pointer type is undefined behavior. Casts were used to avoid memory
allocations.
`std::bind` needs a memory allocation - so it's avoided in EventBase.
std::function<void()> x = std::bind(fn, args);
`std::function` should use small object optimizations when possible and embed the functor in the body of `std::function`.
On GCC 5.0 and forward small lambdas don't need memory allocations
(lambdas being tiny structures - two pointers in this case - and a
function operator).
std::function<void()> y = [=] { fn(args); };
On GCC 4.7 .. 4.9 functors for which __is_location_invariant<Func> is
true also don't need memory allocations.
Remove undefined behavior by using a `SmallFunctor` which leverages `std::function`'s small object optimization.
Reviewed By: philippv
Differential Revision:
D2864895
fb-gh-sync-id:
ab40f60b3519ce38f43fecebf88ccdbf09d9bea9
Michael Lee [Thu, 28 Jan 2016 18:52:42 +0000 (10:52 -0800)]
Add (void)ssl back to SSLContext for -Wunused-parameter
Summary:
I'm not sure what accepted practice is to make the
-Wunused-parameter not balk.
Reviewed By: igorsugak
Differential Revision:
D2874705
fb-gh-sync-id:
8765bae504fd90dfd8896857f4bf865ca8f64a8a
Marcus Holland-Moritz [Thu, 28 Jan 2016 16:05:32 +0000 (08:05 -0800)]
Fix unused parameter errors under -Werror
Summary:
D2872406 enables -Werror=unused-parameter, which in conjunction with mode/opt
(which eliminates asserts) causes two files in folly/io/async to fail to compile.
This change works around the error.
Reviewed By: vchalyshev
Differential Revision:
D2874625
fb-gh-sync-id:
97104679f964390c5df88ee7831af7df243a152a
Igor Sugak [Thu, 28 Jan 2016 03:34:02 +0000 (19:34 -0800)]
folly: build with -Wunused-parameter
Summary: Mechanical changes (using custom clang-tidy) to fix all of the `-Wunused-parameter` violations in folly.
Reviewed By: yfeldblum
Differential Revision:
D2872406
fb-gh-sync-id:
bdb1941f3dadf6ab854e7a9f271f50fda93f9480
Igor Sugak [Thu, 28 Jan 2016 03:32:21 +0000 (19:32 -0800)]
folly/test/FBVectorTestBenchmarks.cpp.h: remove unused argument
Summary: Remove unused argument `iters`.
Reviewed By: meyering
Differential Revision:
D2872551
fb-gh-sync-id:
0989e5b256d4d80dd3ad02401e3fc65d0f749ba6
Francis Ma [Thu, 28 Jan 2016 00:33:36 +0000 (16:33 -0800)]
Fix FOLLY_TLS under macosx and clang
Summary: Only include guard iphone simulator and iphone devices for folly_tls
Reviewed By: ldemailly
Differential Revision:
D2872383
fb-gh-sync-id:
00fb8c1ee03a97037e92d20aeda75f2435d71f5a
Igor Sugak [Thu, 28 Jan 2016 00:12:47 +0000 (16:12 -0800)]
folly: use -Wheader-hygiene with clang
Summary: `-Wheader-hygiene` warns on using namespace directive in global context in header. Fix all of the violations.
Reviewed By: yfeldblum
Differential Revision:
D2867655
fb-gh-sync-id:
46840f8ece99e7af262058e631635d870bd51149
Andrii Grynenko [Thu, 28 Jan 2016 00:08:08 +0000 (16:08 -0800)]
Fix EventBase destruction race in FiberManagerMap
Summary:
Previously we could be reading from thread-local FiberManagerMap while it was modified.
This is now fixed by keeping a per-thread list of EventBases which need to be removed from local maps. On the fast-path no action is taken, since list will be empty.
Reviewed By: yfeldblum
Differential Revision:
D2853921
fb-gh-sync-id:
f05e1924dd2b97bfb359537de1909bbe193e0cb9
Francis Ma [Wed, 27 Jan 2016 22:37:05 +0000 (14:37 -0800)]
Make folly::detail::CacheLocality portable on apple
Summary:
This is one of the series steps to port folly::future on ios. Apple doesn't support __thread. Adding a HashingThreadId as a fallback
on apple.
Reviewed By: nbronson
Differential Revision:
D2832068
fb-gh-sync-id:
c3389245f3c0bbd36de6260680f7ac6110b3206c
Lucian Grijincu [Wed, 27 Jan 2016 22:33:34 +0000 (14:33 -0800)]
folly: ubsan: reduce vector size to avoid UBSAN timeout
Summary:
Based on diff where this was introduced in {
D360195} it seems like
```
// This value should we multiple of word size.
static size_t const kHeapifyCapacitySize = sizeof(
typename std::aligned_storage<
sizeof(InternalSizeType),
alignof(value_type)
>::type);
// Threshold to control capacity heapifying.
static size_t const kHeapifyCapacityThreshold =
100 * kHeapifyCapacitySize;
```
So anything above 100*sizeof(SizeType) should do.
Reviewed By: philippv
Differential Revision:
D2871422
fb-gh-sync-id:
a69e47286c53887ac05e89dab565b9d609e183a0
Orvid King [Wed, 27 Jan 2016 21:57:12 +0000 (13:57 -0800)]
Implement a generalized mechanism for pushing/popping warnings
Summary: Folly synchronized requires disabling the shadow warning in a macro, but that doesn't work under MSVC, so abstract a mechansim out that allows them to be handled gracefully.
Reviewed By: yfeldblum
Differential Revision:
D2870357
Pulled By: Orvid
fb-gh-sync-id:
a4b0e425736ddd5293f020b360244554571d397f
Maxim Georgiev [Wed, 27 Jan 2016 21:08:50 +0000 (13:08 -0800)]
Add mechanizm for caching local and peer addresses in AsyncSSLSocket.
Summary: This change adds a flag to AsyncSSLSocket which forces the socket to cache local and remote addresses right after TCP connection is established. Cached address values will be available after the connection is closed. Caching addresses can be halpful in SSL handshake failure investigations.
Reviewed By: yfeldblum
Differential Revision:
D2863274
fb-gh-sync-id:
d7b415292988c2fb187a80422e8ccbf8ba8ab0e3
Giuseppe Ottaviano [Wed, 27 Jan 2016 09:54:59 +0000 (01:54 -0800)]
Fix typo in comment
Reviewed By: yfeldblum
Differential Revision:
D2869494
fb-gh-sync-id:
889957a92dd7f59c4b9564d1946e9f4058293839
Yedidya Feldblum [Wed, 27 Jan 2016 07:18:09 +0000 (23:18 -0800)]
Extract endianness checks into Portability.h
Summary: [Folly] Extract endianness checks into Portability.h.
Reviewed By: fugalh
Differential Revision:
D2857924
fb-gh-sync-id:
23ecd2a3cad661024acb62769cd85df394786c59
Christopher Dykes [Tue, 26 Jan 2016 16:59:32 +0000 (08:59 -0800)]
Use FOLLY_DEPRECATED rather than directly using GCC specific attributes.
Summary: Without this MSVC can't compile.
Reviewed By: lbrandy
Differential Revision:
D2856598
fb-gh-sync-id:
0e146afe844b0ce5d3782528ed9c3de53f7c8b05
Arjen Roodselaar [Tue, 26 Jan 2016 01:39:11 +0000 (17:39 -0800)]
Debian DEBs build script
Summary:
This scripts uses fpm to build a somewhat reproducible set of debs which can be deployed to Ubuntu 14.04 hosts. The main library package carries the Folly major version number, allowing multiple versions to be installed alongside. The -dev deb is simply called libfolly-dev and will be upgraded as Folly moves forward. In accordance to the Debian packaging policies the shared libraries have their (debug) symbols stripped and saved to external symbol files, contained in the -dev deb.
sgolemon, yfeldblum you guys are my best guess to review this. Feel free to suggest additional folks if needed.
Reviewed By: yfeldblum
Differential Revision:
D2806082
fb-gh-sync-id:
42605acccdec781f7a6b59a925121e6ed7c7cdf5
Christopher Dykes [Mon, 25 Jan 2016 20:21:24 +0000 (12:21 -0800)]
Initialize LifoSem's padding to allow for its constexpr constructor.
Summary: MSVC correctly gives an error about the constexpr constructor not initializing all members.
Reviewed By: yfeldblum
Differential Revision:
D2856806
fb-gh-sync-id:
cef97639906dd3c39e3d3dc2ba939021e15edcb9
Michael Bejda [Mon, 25 Jan 2016 17:45:49 +0000 (09:45 -0800)]
Thread-safe RequestContext putIfAbsent operation
Summary:
Adds a thread-safe putIfAbsent operation to the RequestContext. The current setContextData() is not sufficent to do it safely.
Just like setContextData, this method is unfair, as a high volume of reads will block the spinlock.
Reviewed By: fugalh
Differential Revision:
D2850752
fb-gh-sync-id:
2ff22ea9e9bd8f27f6ae7a57214a6dbc4fdcd4c5
David Callahan [Fri, 22 Jan 2016 21:34:32 +0000 (13:34 -0800)]
avoid aggressive optimization
Summary: GCC will now dead-code eliminate the folly-based version of this test without a mechanisms to force the result to be live.
Reviewed By: ttsugriy
Differential Revision:
D2854633
fb-gh-sync-id:
0e3841ed22c040fda7653bcfb5a3f19ca3d1f835
Tom Jackson [Thu, 21 Jan 2016 22:19:37 +0000 (14:19 -0800)]
Add PrintTo for dynamic
Summary: Making `EXPECT_EQ(dyn1, dyn2)` easier to debug
Reviewed By: luciang, ot, yfeldblum
Differential Revision:
D2848318
fb-gh-sync-id:
0c7cdd292665a493f2b792798df4e6966c1f28db
Kyle Nekritz [Thu, 21 Jan 2016 21:54:28 +0000 (13:54 -0800)]
Add getPeerCert() to AsyncTransport.
Reviewed By: elindsey
Differential Revision:
D2850760
fb-gh-sync-id:
60dbc3117e658d2fd083a87884892924bf313019
Kyle Nekritz [Thu, 21 Jan 2016 21:54:26 +0000 (13:54 -0800)]
Adding OpenSSLPtrTypes.h.
Summary:
So that these deleter and unique_ptr types don't have to be redeclared every single place they are used.
To be expanded on.
Reviewed By: mzlee
Differential Revision:
D2850376
fb-gh-sync-id:
e7f8bba320163b8b12a93b5cf3cd9a5921d38edc
Dmitry Pleshkov [Thu, 21 Jan 2016 06:23:30 +0000 (22:23 -0800)]
Haswell-specific implementation of Select64 routine.
Summary: k-th bit selection could be efficiently implemented via new BMI2 instruction set.
Reviewed By: ot, philippv
Differential Revision:
D2843311
fb-gh-sync-id:
4c0cf52176a03422aef276ce5f677080f67f5fdf
Michael Lee [Wed, 20 Jan 2016 15:10:31 +0000 (07:10 -0800)]
Move StringTest benchmarks into StringBenchmark.cpp
Summary: StringTest.cpp is a mix of benchmarks and normal unittests. Fixing this.
Reviewed By: yfeldblum
Differential Revision:
D2840804
fb-gh-sync-id:
d3efc357f5f09385e9f69b70e38b64d59045ff0d
Michael Lee [Wed, 20 Jan 2016 15:09:04 +0000 (07:09 -0800)]
Remove unecessary main functions.
Summary: Starting with this, but I will keep digging through these. The tests will be compiled into one combined test with a single main.
Reviewed By: yfeldblum
Differential Revision:
D2841391
fb-gh-sync-id:
78fd153e282f1ca2dbe7ada942dc04fc8ba5d42d
Alan Frindell [Tue, 19 Jan 2016 22:21:15 +0000 (14:21 -0800)]
Add Range::erase
Summary: Needed to use StringPiece with boost::algorithm::trim()
Reviewed By: yfeldblum
Differential Revision:
D2833657
fb-gh-sync-id:
3430b1a2540279b2f69f04c871df3bca748f2cb1
Alexey Spiridonov [Fri, 15 Jan 2016 20:53:27 +0000 (12:53 -0800)]
Print null correctly
Summary: Null by itself was printing as 0, now it prints as null, which is consistent with the 'pseudo json' output.
Reviewed By: yfeldblum
Differential Revision:
D2789284
fb-gh-sync-id:
f318b8d0f8349f4b36f868c419842fb50bee9517
Aaron Balsara [Fri, 15 Jan 2016 20:02:40 +0000 (12:02 -0800)]
Fix buck build for SSLContext
Summary:
D2800746 broke buck with an unsigned/signed compare
Reviewed By: dkgi
Differential Revision:
D2835102
fb-gh-sync-id:
a0b8311b38a199e089d3ed5a69b12f8f8abe38b1
Aaron Balsara [Fri, 15 Jan 2016 18:50:33 +0000 (10:50 -0800)]
Allow SSLContext to read certificates and keys from memory
Summary: Added the ability for SSLContext to load X509 Certificates and private keys from memory
Reviewed By: yfeldblum
Differential Revision:
D2800746
fb-gh-sync-id:
14cad74f8d761b9b0f07e2827b155cec9ba27f50