Ben Maurer [Mon, 12 Oct 2015 18:06:53 +0000 (11:06 -0700)]
Move digits_to into .cpp
Summary: objdump was showing that the shiftXXX tables are being generated each
time this file is included. For example, HHVM has about 200 of each
of the 4 tables. Since each one is 512 bytes this is 400 KB. I'm not
quite sure why this was happening -- I'd think that the linker would
combine a constant table that was identical.
I think the best thing to do here is just to use extern template. This
way you there's only one copy of the table and you don't have to parse
all of this code in every file
Reviewed By: @yfeldblum
Differential Revision:
D2506571
fb-gh-sync-id:
b01a522c536a2ff4136340245cacaa33897afefb
Yedidya Feldblum [Sat, 10 Oct 2015 02:09:42 +0000 (19:09 -0700)]
Fix Build: GCC 4.9 has std::make_unique but not __cplusplus >= 201402L
Summary: [Folly] Fix Build: GCC 4.9 has `std::make_unique` but not `__cplusplus >= 201402L`.
Reviewed By: @igorsugak
Differential Revision:
D2528584
fb-gh-sync-id:
9ad0567429698fb1320ad4066ee06add31acbd57
Hans Fugal [Fri, 9 Oct 2015 20:15:35 +0000 (13:15 -0700)]
Merge pull request #331 from vbuslov/config_fix
Fix configure script bug on Mac OS X
Steve O'Brien [Thu, 8 Oct 2015 22:03:22 +0000 (15:03 -0700)]
aggregator: fix `doEagerInitVia`
Summary: Allow notification upon async eager initialization completion.
Reviewed By: @luciang
Differential Revision:
D2518925
fb-gh-sync-id:
95f96da2afa6e5953630dd935d74819521716e5f
软件工程师李飛 [Thu, 8 Oct 2015 20:02:35 +0000 (13:02 -0700)]
Fix incorrect variable in dynamic examples
Summary: Fixes facebook/folly#323
Reviewed By: @JoelMarcey
Differential Revision:
D2518882
Pulled By: @fredemmott
fb-gh-sync-id:
fc0a07d925945f7d7e1cddb7302c8bf18e0130ab
Vlad Buslov [Fri, 9 Oct 2015 12:50:09 +0000 (15:50 +0300)]
Changed AC_LANG from PROGRAM to SOURCE to prevent double definition of main
Orvid King [Thu, 8 Oct 2015 16:52:15 +0000 (09:52 -0700)]
Use alloca rather than C99 stack allocated arrays
Summary: Because MSVC doesn't support the latter.
Closes https://github.com/facebook/folly/pull/271
Reviewed By: @meyering, @fredemmott
Differential Revision:
D2283975
fb-gh-sync-id:
d021f739ceead9998b8fedbbd95f22ec9fe949b2
Bruno Goncalves [Wed, 7 Oct 2015 22:02:56 +0000 (15:02 -0700)]
Fixed #317 - unresolved reference to __atomic_is_lock_free
Summary: Tested in:
Distro: Fedora 20 - x86_64
kernel: 3.19
compiler: gcc version 4.8.3
Closes https://github.com/facebook/folly/pull/320
Reviewed By: @sgolemon
Differential Revision:
D2519083
fb-gh-sync-id:
07b1437326c393c99feeb6e0764d664d3e22faea
Steve O'Brien [Wed, 7 Oct 2015 20:11:06 +0000 (13:11 -0700)]
Singleton: remove dependency on Future
Summary: Singletons requires Futures, and Futures indirectly (via HHWheelTimeKeeper) require Singletons. This breaks the dependency. It removes a Future-using API which will be replaced with a better alternative.
Reviewed By: @luciang
Differential Revision:
D2517807
fb-gh-sync-id:
93df371a74d0f80dc8c55fb0eadd0b688b27b525
Steve O'Brien [Wed, 7 Oct 2015 13:23:01 +0000 (06:23 -0700)]
Singleton: un-inline initialization-time-only methods
Summary: Move some methods which are generally only used during initialization time (registration, eager-init functions) from the header to the .cpp file
Reviewed By: @luciang
Differential Revision:
D2513043
fb-gh-sync-id:
58d1f6e0d158d805a12b8d267421927b3cfc6118
Yedidya Feldblum [Wed, 7 Oct 2015 05:22:49 +0000 (22:22 -0700)]
Remove evil using statements from AsyncSSLSocket.h
Summary: [Folly] Remove evil `using` statements from `AsyncSSLSocket.h`.
`using` in headers is frowned upon.
Consider this diff a frown.
Reviewed By: @alandau
Differential Revision:
D2509810
fb-gh-sync-id:
4a752b9f4a5be6ac4ca7c498c0168ffad5c35d7f
Lucian Grijincu [Tue, 6 Oct 2015 19:40:23 +0000 (12:40 -0700)]
folly: Singleton: update doc to match new Strict vs Relaxed types
Summary: smallandbroken
Reviewed By: @fugalh
Differential Revision:
D2509021
fb-gh-sync-id:
5e379b82615117df89cbc12943fdbe92511c067e
Adrian Zgorzalek [Tue, 6 Oct 2015 18:19:22 +0000 (11:19 -0700)]
Use attribute(no_sanitize) instead of no_sanitize_address to prevent clang-3.7 from ICE
Summary: Stacktraces and more details can be found in the associated task
http://clang.llvm.org/docs/AttributeReference.html#no-sanitize-clang-no-sanitize seems to be the new hotness to disable sanitizers.
Reviewed By: @yfeldblum
Differential Revision:
D2510320
fb-gh-sync-id:
01cce68733509a6f5bcf9dbe3a4af6fc2792a43b
Tom Jackson [Mon, 5 Oct 2015 22:09:57 +0000 (15:09 -0700)]
Add byLine tests for empty cases
Summary: It works fine, this proves it.
Reviewed By: @yfeldblum, @jkron
Differential Revision:
D2509771
fb-gh-sync-id:
28805a1e1db433d3d9a44b9d33f81e30333e44ab
Kyle Nekritz [Mon, 5 Oct 2015 20:28:42 +0000 (13:28 -0700)]
Check if handshake timeout is set in AsyncSSLSocket::isDetachable().
Summary: If it is, return false.
Reviewed By: @siyengar
Differential Revision:
D2503765
fb-gh-sync-id:
36b5e2e8cabc2a5157735637be6ca3414005da81
Giuseppe Ottaviano [Mon, 5 Oct 2015 04:22:12 +0000 (21:22 -0700)]
Improve performance of fbstring copy and move ctors on small strings
Summary: The move constructor of `fbstring` generates a large amount of code, preventing it to be inlined, and it is inefficient for small strings. This diff fixes both problems.
Reviewed By: @yfeldblum
Differential Revision:
D2505762
Pavlo Kushnir [Sun, 4 Oct 2015 02:40:46 +0000 (19:40 -0700)]
Fix build
Summary: title
Reviewed By: @yfeldblum
Differential Revision:
D2506703
Andre Pinto [Sat, 3 Oct 2015 19:47:55 +0000 (12:47 -0700)]
Fix async readme
Summary: AsyncPipe is already open source
Reviewed By: @yfeldblum
Differential Revision:
D2506476
Yedidya Feldblum [Sat, 3 Oct 2015 06:08:39 +0000 (23:08 -0700)]
Fix Build: folly/Range.h for build platforms missing SSE42 headers
Summary: [Folly] Fix Build: `folly/Range.h` for build platforms missing SSE42 headers.
We make the assumption that if the compiler defines the appropriate symbols indicating SSE42, that the corresponding intrinsics headers are available.
We also remove `Range.cpp` from `Makefile.am`, which we forgot to do in the blamed diff.
Reviewed By: @nbronson
Differential Revision:
D2504934
Alexey Spiridonov [Sat, 3 Oct 2015 05:30:41 +0000 (22:30 -0700)]
Add "consume all captured output" callback to CaptureFD
Summary: I noticed myself trying to fake this kind of callback for a log-based test I was writing. It seems much nicer to add the callback to `CaptureFD` than roll ugly wrappers around it to do the same thing.
Reviewed By: @yfeldblum
Differential Revision:
D2506106
Yedidya Feldblum [Sat, 3 Oct 2015 04:47:38 +0000 (21:47 -0700)]
Converge folly::make_unique to C++14's std::make_unique
Summary: [Folly] Converge `folly::make_unique` to C++14's `std::make_unique`.
The primary use-case of ther deleter variety of `folly::make_unique` is `DelayedDestruction`. Let the classes matching this use-case define their own factories.
Reviewed By: @fugalh
Differential Revision:
D2495718
Yedidya Feldblum [Fri, 2 Oct 2015 08:52:56 +0000 (01:52 -0700)]
Support SSE-enabled Range functions under Clang
Summary: [Folly] Support SSE-enabled `Range` functions under Clang.
Basically, we remove GCC-only -isms. In particular, we use only names from the `<emmintrins.h>` and `<smmintrins.h>` headers, instead of the GCC-specific SSE builtins that the original code uses.
But in order to get this to work, we must split out the SSE-enabled functions into their own sources and compile them with the `-msse4.2` flag. There is a way to get around this in GCC by marking individual functions as SEE-enabled, but that technique is not supported in Clang. This is the new `RangeSse42` module.
And in order to do that, we must split out the code that is called by both the original `Range` and the new SSE-enabled functions into yet a third module, `RangeCommon`.
Ahhhhhh, dependencies.
Note that we always compile the SSE-enabled functions, but we only run them on architectures supporting SSE. The original code tests the CPU's capabilities before running any SSE-enabled functions; this change retains that check.
Reviewed By: @nbronson
Differential Revision:
D2428983
Nathan Bronson [Fri, 2 Oct 2015 01:39:47 +0000 (18:39 -0700)]
fix compiler warnings from gcc-4.9 + -Wunused-variable
Summary: This diff fixes the compiler warnings emitted by gcc-4.9's
stricter -Wsigned-comparison check, as well as those revealed by
-Wunused-variable.
Reviewed By: @meyering, @yfeldblum
Differential Revision:
D2494514
Alex Landau [Thu, 1 Oct 2015 22:35:37 +0000 (15:35 -0700)]
thrift-tls: Expose client common name in connection context
Summary: Server can find out client's common name through
Cpp2ConnContext::getPeerCommonName
Reviewed By: @siyengar
Differential Revision:
D2469588
Alecs King [Thu, 1 Oct 2015 19:19:18 +0000 (12:19 -0700)]
fix build
Summary: fix typo
jenkins and oss build (e.g. travis) failing.
Reviewed By: @pavlo-fb
Differential Revision:
D2499462
Mohammad Husain [Wed, 30 Sep 2015 21:32:33 +0000 (14:32 -0700)]
APIs to determine which end of the socket has closed it
Reviewed By: @afrind
Differential Revision:
D2466921
Steve O'Brien [Wed, 30 Sep 2015 21:06:22 +0000 (14:06 -0700)]
folly Symbolizer: fix destruction-order fiasco problem
Summary: On a (broken) unit test there is a bad `CHECK` during destruction time. This triggers an ABRT, goes through the signal handler, and in the process ends up doing a use-after-free.
Moved some globals inside the functions in which they are used (w/ little duplication, as they are used in one place, mostly).
Reviewed By: @luciang, @meyering
Differential Revision:
D2494046
Dave Watson [Wed, 30 Sep 2015 14:42:24 +0000 (07:42 -0700)]
UpdateableSharedPtr in folly
Summary: This diff adds UpdateableSharedPtr and FastUpdateableSharedPtr classes to folly. They are efficiet RCU-style holders for a shared_ptr. See the comment at the top of UpdateableSharedPtr.h for a more detailed description and benchmark results.
All the added files are copied from logdevice code with (almost) no changes (`logdevice/common/` on branch `origin/logdevice-latest`). We've been using them in logdevice for a few months.
D1821723 introduced it.
Reviewed By: @bmaurer
Differential Revision:
D1919702
Yedidya Feldblum [Wed, 30 Sep 2015 08:29:59 +0000 (01:29 -0700)]
Extract SparseByteSet into its own module
Summary: [Folly] Extract `SparseByteSet` into its own module.
`SparseByteSet`, formerly `FastByteSet`, is actually a generic, fully standalone class. It does not need to be embedded in `Range.cpp`.
Reviewed By: @bmaurer
Differential Revision:
D2460180
Ranjeeth Dasineni [Wed, 30 Sep 2015 00:57:06 +0000 (17:57 -0700)]
add callback to specify a client next protocol filter
Summary: From the client perspective, we set the list in order of
preference once and call into openssl to do the selection. This adds
a little more flexibility in that client optionally can customize the
selection for each negotiation. added tests for the no-op case and the
customized case. Feel free to suggest improvements.
Reviewed By: @afrind
Differential Revision:
D2489142
Subodh Iyengar [Tue, 29 Sep 2015 22:09:36 +0000 (15:09 -0700)]
Pre-prune iobufs from clone
Summary: It's pretty common during parsing protocols with cursors
that there will be empty iobufs along the way.
This changes it so that we prune empty IOBufs in the cloned
output before returning it to the user.
Reviewed By: @djwatson
Differential Revision:
D2464488
Andre Pinto [Tue, 29 Sep 2015 21:13:54 +0000 (14:13 -0700)]
Open source AsyncPipe
Summary: AsyncPipeReader and AsyncPipeWriter are classes to asynchronously
read and write to pipes.
Reviewed By: @djwatson
Differential Revision:
D2479514
Yedidya Feldblum [Tue, 29 Sep 2015 19:04:29 +0000 (12:04 -0700)]
CodeMod apache::thrift::async::TEventBase to folly::EventBase (remainder)
Summary: [Thrift] CodeMod `apache::thrift::async::TEventBase` to `folly::EventBase` (remainder).
A few straggler bits left out of
D2349828.
Reviewed By: @Gownta
Differential Revision:
D2489063
Ben Maurer [Mon, 28 Sep 2015 18:46:44 +0000 (11:46 -0700)]
Broke build
Summary: sorry
Reviewed By: @chiunlin
Differential Revision:
D2485925
Ben Maurer [Mon, 28 Sep 2015 17:58:44 +0000 (10:58 -0700)]
Easy SIOF-proofing
Summary: These classes are likely to be used as static variables and can
easily be constructed with constexpr.
One that we really ought to fix is SpinLock. Sadly we have a bunch of
implementations of it some of which need initialization.
Reviewed By: @meyering
Differential Revision:
D2459355
Steve O'Brien [Fri, 25 Sep 2015 18:02:46 +0000 (11:02 -0700)]
Singleton: refine "eager" initialization
Summary: * `registrationComplete` has a slightly different interface (uses enums now)
* `void doEagerInit()` method initializes synchronously; `Future<Unit> doEagerInitVia(Executor*)` now available.
Reviewed By: @luciang, @meyering
Differential Revision:
D2463464
Justin Gibbs [Thu, 24 Sep 2015 16:44:07 +0000 (09:44 -0700)]
emplace() support for AtomicHashArray/Map
Summary: Allow objects that only support in-place construction (no copy/move
constructor) to be stored in AtomicHashMap and AtomicHashArray via the
emplace() method. This uses variadic template parameters and perfect
forwarding to allow the arguments for any valid constructor for the
object to be used during insertion.
Reviewed By: @nbronson
Differential Revision:
D2458152
Yedidya Feldblum [Wed, 23 Sep 2015 23:10:09 +0000 (16:10 -0700)]
A qfind_first_byte_of using a bitset in folly/Range.cpp
Summary: [Folly] A `qfind_first_byte_of` using a `bitset` in `folly/Range.cpp`.
With additions to the existing benchmark program.
Reviewed By: @nbronson
Differential Revision:
D2465890
James Sedgwick [Wed, 23 Sep 2015 21:17:46 +0000 (14:17 -0700)]
revert
D2379210
Summary: This broke EventBase tests, which I managed not to run because they're marked as extended for some reason :( I don't have time to take another stab at this at the moment so I'm reverting for now
Reviewed By: @djwatson
Differential Revision:
D2467789
Yedidya Feldblum [Wed, 23 Sep 2015 08:31:53 +0000 (01:31 -0700)]
CpuIdTest.cpp does not need glog
Summary: [Folly] `CpuIdTest.cpp` does not need `glog`.
Reviewed By: @@philippv
Differential Revision:
D2470503
Yedidya Feldblum [Wed, 23 Sep 2015 05:22:20 +0000 (22:22 -0700)]
Search unpadded strings in Range benchmarks
Summary: [Folly] Search unpadded strings in `Range` benchmarks.
`vstr` has padding to adjust alignment. `vstrp` is a view into `vstr` that skips the padding, so that searches start out unaligned.
Before this diff, haystack is 8-byte aligned: `uintptr_t(haystack.begin()) % 8 == 0`. After this diff, it is not.
Reviewed By: @@nbronson
Differential Revision:
D2468934
Yedidya Feldblum [Wed, 23 Sep 2015 05:06:25 +0000 (22:06 -0700)]
Use constexpr for folly::dynamic::TypeInfo static fields
Summary: [Folly] Use constexpr for folly::dynamic::TypeInfo static fields
These things are compile-time values. So yeah.
Reviewed By: @@JoelMarcey
Differential Revision:
D2466270
Yedidya Feldblum [Tue, 22 Sep 2015 21:03:09 +0000 (14:03 -0700)]
Fully clean up before each round of benchmarks in RangeFindBenchmark.cpp
Summary: [Folly] Fully clean up before each round of benchmarks in `RangeFindBenchmark.cpp`.
The `vstr` and `vstrp` globals need to be cleaned up before each round of benchmarks.
Reviewed By: @@nbronson
Differential Revision:
D2467254
Chip Turner [Mon, 21 Sep 2015 22:58:03 +0000 (15:58 -0700)]
Move definition of strlcpy to outside an #if
Summary: Looks like some platforms fail to build (open source, not internal) due to #if conditional.
Reviewed By: @ldemailly
Differential Revision:
D2464555
Subodh Iyengar [Mon, 21 Sep 2015 22:38:25 +0000 (15:38 -0700)]
Fix potential delete behavior of guard
Summary: There is a potential double free in destructor guard
if someone calls a method which takes a DG in the destructor
of the DG.
This is potential in the case when someone is holding onto
a DG while calling destroy() on the object.
Reviewed By: @djwatson
Differential Revision:
D2463113
Chip Turner [Mon, 21 Sep 2015 20:42:50 +0000 (13:42 -0700)]
Make strlcpy available in folly, second attempt
Summary: strncpy is bad. strlcpy is somewhat less bad. We already had
this function, but let's move it somewhere more reasonable.
This would make sense to live in String.h, but then we have circular
dependencies. Since String.h includes Demangle.h, though, you get
strlcpy by including it, so this should be okay enough.
Reviewed By: @lbrandy
Differential Revision:
D2097590
Marc Horowitz [Mon, 21 Sep 2015 16:42:44 +0000 (09:42 -0700)]
make to<bool> skip range check
Summary: to<bool>(42) should return true, not throw an exception.
Reviewed By: @yfeldblum
Differential Revision:
D2459766
Yedidya Feldblum [Sun, 20 Sep 2015 04:51:15 +0000 (21:51 -0700)]
Use string for benchmark names to support computed names
Summary: [Folly] Use string for benchmark names to support computed names.
A benchmark program might call `folly::addBenchmark` with a computed benchmark name without wishing to maintain the lifetime of the string. Support this case.
Reviewed By: @philippv
Differential Revision:
D2460621
Philip Pronin [Sat, 19 Sep 2015 06:38:39 +0000 (23:38 -0700)]
implement ThreadCachedArena::totalSize()
Summary: Semantics matches `Arena<>::totalSize()`.
Reviewed By: @luciang, @ot
Differential Revision:
D2456388
James Sedgwick [Fri, 18 Sep 2015 22:24:53 +0000 (15:24 -0700)]
move ThreadWheelTimekeeper out of detail
Summary: This can be useful on its own, will use in twagent
Reviewed By: @fugalh
Differential Revision:
D2457778
Yedidya Feldblum [Fri, 18 Sep 2015 08:37:13 +0000 (01:37 -0700)]
Support MSVC, which does not have VLAs, in folly/io/async/AsyncSocket.cpp
Summary: [Folly] Support MSVC, which does not have VLAs, in `folly/io/async/AsyncSocket.cpp`.
We use VLAs in compilers that have them, and fixed-size arrays in compilers that do not.
Reviewed By: @JoelMarcey
Differential Revision:
D2450689
Steve O'Brien [Thu, 17 Sep 2015 13:30:23 +0000 (06:30 -0700)]
folly Singleton: "eager" option to initialize upfront
Summary: Instead of the default lazy-loading behavior (still the default) some singletons might need to get initialized at startup time. This would be for singletons which take a long time for the instance's constructor to run, e.g. expensive initialization by reading some large dataset, talking to an outside service, and so on.
Provides a way for singletons to opt-in to this, and get populated at the time `registrationComplete()` is called, instead of lazily.
Some notes about the way I implemented here, mainly, why I did this as a "builder-pattern" kind of thing and not some other way. I could probably be convinced to do otherwise. :)
* Changing the constructor: the constructor's already slightly fiddly with the two optional -- well, one optional construct function, and another optional-but-only-if-construct-provided, destruct function. Didn't want to pile more into the ctor.
* New superclass called `EagerLoadedSingleton`; just didn't want to add more classes, esp. if it's just to add one more option.
* Method like `void setEagerLoad()` that makes this eager-load; not sure where one would write the `shouldEagerLoad()` call, probably in some central initialization spot in `main()`, but all the maintenance would have to go there. I like that it's "attached" to the singleton being defined. (Though you can still do this.) Bonus #2; the rule that builds the cpp containing "main" doesn't need to import this dependency and the cpp doesn't have to include Singleton just to do this eager-load call, nor the header for the type itself.
* Omitting this altogether and just saying `folly::Singleton<Foo>::get_weak()` to "ping" the singleton and bring into existence: see last point. Still might need to have the file containing this initialization decorum include/link against Foo, as well as have one place to maintain the list of things to load up-front.
Reviewed By: @meyering
Differential Revision:
D2449081
Lucian Grijincu [Thu, 17 Sep 2015 03:20:29 +0000 (20:20 -0700)]
folly: clock: remove static globals, replace with meyers singleton
Reviewed By: @yfeldblum
Differential Revision:
D2446000
Yedidya Feldblum [Wed, 16 Sep 2015 21:15:19 +0000 (14:15 -0700)]
Compatibility: libevent: accessors for struct event
Summary: [Folly] Compatibility: libevent: accessors for `struct event`.
Some libevent fields in `struct event` moved between `v1.4` and `v2`. Add some accessors which are defined per-libevent-version.
Reviewed By: @JoelMarcey
Differential Revision:
D2447537
Lucian Grijincu [Wed, 16 Sep 2015 18:37:49 +0000 (11:37 -0700)]
folly: gen: remove static member
Summary: there's no need for this static member, but it does get
generated. We're only curious about it's type. Replace with Meyer's
singleton to get the same effect.
Reviewed By: @ddrcoder, @yfeldblum
Differential Revision:
D2446131
Lucian Grijincu [Wed, 16 Sep 2015 18:32:54 +0000 (11:32 -0700)]
folly: ProgramOptions: avoid static init fiasco by using meyer's singleton
Reviewed By: @elsteveogrande
Differential Revision:
D2446056
Sara Golemon [Wed, 16 Sep 2015 18:26:52 +0000 (11:26 -0700)]
Limit declaration of GroupVarint tables to SSE >= 2
Summary: __m128i is only available in SSE 2 and later.
We technically only use it in folly/GroupVarint.h for SSE 3+,
but that's due to various other intrinsics and we could
potentially lower the requirement in certain contexts,
so do the right thing in the generated table.
Revisit the uses in folly/GroupVarint.h later.
Reviewed By: @yfeldblum
Differential Revision:
D2445798
James Sedgwick [Wed, 16 Sep 2015 17:38:01 +0000 (10:38 -0700)]
use HHWheelTimer for EventBase::runAfterDelay
Summary: For the perfs - big improvement on one fd per timeout.
Reviewed By: @djwatson, @fugalh
Differential Revision:
D2379210
Lucian Grijincu [Wed, 16 Sep 2015 17:05:52 +0000 (10:05 -0700)]
folly: io: SSLContext/AsyncSSLSocket: drop global static mutex (siof)
Reviewed By: @yfeldblum
Differential Revision:
D2446538
Lucian Grijincu [Tue, 15 Sep 2015 22:54:00 +0000 (15:54 -0700)]
folly: async: fix SIOF in test
Summary: avoid sillyness:
```
$ _build/opt/folly/io/async/test/async_test --gtest_list_tests
ASAN:SIGSEGV
=================================================================
==
3245135==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000010 (pc 0x000000583444 sp 0x7fff17ba0c40 bp 0x7fff17ba0c80 T0)
#0 0x583443 in std::_Rb_tree<int, std::pair<int const, folly::SSLContext::SSLLockType>, std::_Select1st<std::pair<int const, folly::SSLContext::SSLLockType> >, std::less<int>, std::allocator<std::pair<int const, folly::SSLContext::SSLLockType> > >::operator=(std::_Rb_tree<int, std::pair<int const, folly::SSLContext::SSLLockType>, std::_Select1st<std::pair<int const, folly::SSLContext::SSLLockType> >, std::less<int>, std::allocator<std::pair<int const, folly::SSLContext::SSLLockType> > > const&) third-party2/libgcc/4.9.x/gcc-4.9-glibc-2.20-fb/
024dbc3/include/c++/4.9.x/bits/stl_tree.h:1138
#1 0x583443 in std::map<int, folly::SSLContext::SSLLockType, std::less<int>, std::allocator<std::pair<int const, folly::SSLContext::SSLLockType> > >::operator=(std::map<int, folly::SSLContext::SSLLockType, std::less<int>, std::allocator<std::pair<int const, folly::SSLContext::SSLLockType> > > const&) third-party2/libgcc/4.9.x/gcc-4.9-glibc-2.20-fb/
024dbc3/include/c++/4.9.x/bits/stl_map.h:295
#2 0x583443 in folly::SSLContext::setSSLLockTypes(std::map<int, folly::SSLContext::SSLLockType, std::less<int>, std::allocator<std::pair<int const, folly::SSLContext::SSLLockType> > >) folly/io/async/SSLContext.cpp:682
#3 0x40e028 in Initializer folly/io/async/test/AsyncSSLSocketTest2.cpp:143
#4 0x40e028 in __static_initialization_and_destruction_0 folly/io/async/test/AsyncSSLSocketTest2.cpp:146
#5 0x40e028 in _GLOBAL__sub_I__ZN5folly47AsyncSSLSocketTest2_AttachDetachSSLContext_Test10test_info_E folly/io/async/test/AsyncSSLSocketTest2.cpp:147
#6 0x66cf2e in __libc_csu_init /home/engshare/third-party2/glibc/2.20/src/glibc-2.20/csu/elf-init.c:88
#7 0x7f7145600084 in __libc_start_main (/usr/local/fbcode/gcc-4.9-glibc-2.20-fb/lib/libc.so.6+0x20084)
#8 0x410be5 (/data/users/lucian/fbcode2/_build/opt/folly/io/async/test/async_test+0x410be5)
AddressSanitizer can not provide additional info.
AAAAAAASUMMARY: AddressSanitizer: SEGV third-party2/libgcc/4.9.x/gcc-4.9-glibc-2.20-fb/
024dbc3/include/c++/4.9.x/bits/stl_tree.h:1138 std::_Rb_tree<int, std::pair<int const, folly::SSLContext::SSLLockType>, std::_Select1st<std::pair<int const, folly::SSLContext::SSLLockType> >, std::less<int>, std::allocator<std::pair<int const, folly::SSLContext::SSLLockType> > >::operator=(std::_Rb_tree<int, std::pair<int const, folly::SSLContext::SSLLockType>, std::_Select1st<std::pair<int const, folly::SSLContext::SSLLockType> >, std::less<int>, std::allocator<std::pair<int const, folly::SSLContext::SSLLockType> > > const&)
==
3245135==ABORTING
```
Reviewed By: @philippv
Differential Revision:
D2440796
Kevin Hurley [Tue, 15 Sep 2015 21:06:07 +0000 (14:06 -0700)]
Add unit test for update_missing
Summary: Forgot to add a test for this when I added update_missing. This adds a test for it
Reviewed By: @yfeldblum
Differential Revision:
D2441612
Yedidya Feldblum [Tue, 15 Sep 2015 20:34:26 +0000 (13:34 -0700)]
Prefer constexpr to preprocessor macros in FBString.h
Summary: [Folly] Prefer `constexpr` to preprocessor macros in `FBString.h`.
Reviewed By: @JoelMarcey
Differential Revision:
D2441709
Yedidya Feldblum [Tue, 15 Sep 2015 20:21:25 +0000 (13:21 -0700)]
No need to export global instances of folly::AsciiCase(Ins|S)ensitive
Summary: [Folly] No need to export global instances of `folly::AsciiCaseInsensitive` and `folly::AsciiCaseSensitive`.
Calling code may simply construct instances at will - the compiler will optimize away the object construction since it has only the default ctor/dtor, no storage, and no vtable.
Reviewed By: @fugalh
Differential Revision:
D2437419
Yedidya Feldblum [Tue, 15 Sep 2015 05:48:41 +0000 (22:48 -0700)]
Drop support for GCC < 4.8 in folly/FBString.h
Summary: [Folly] Drop support for GCC < 4.8 in `folly/FBString.h`.
Can't stay indefinitely backcompat with older compilers.
Reviewed By: @JoelMarcey
Differential Revision:
D2441747
Orvid King [Mon, 14 Sep 2015 22:53:54 +0000 (15:53 -0700)]
Implement clock_getres for Windows
Summary: Because the windows version of pthread very definitely does not implement the clock. The Cygwin and MinGW headers might, so let them still fall back to the pthread includes.
Closes https://github.com/facebook/folly/pull/280
Reviewed By: @yfeldblum
Differential Revision:
D2419067
Pulled By: @JoelMarcey
Giuseppe Ottaviano [Mon, 14 Sep 2015 21:07:26 +0000 (14:07 -0700)]
Add benchmarks for SpookyHashV2 and constify SpookyHashV2::Final
Summary: `Final` is idempotent, no reason for it not to be `const`. Checked with a benchmark that the new version does not affect performance.
Reviewed By: @yfeldblum
Differential Revision:
D2397377
Yedidya Feldblum [Mon, 14 Sep 2015 19:57:14 +0000 (12:57 -0700)]
CodeMod: Drop FOLLY_OVERRIDE and FOLLY_FINAL
Summary: [Folly] CodeMod: Drop `FOLLY_OVERRIDE` and `FOLLY_FINAL`. These were to support GCC 4.6 and earlier, and MSVC 2008 and earlier.
Reviewed By: @philippv
Differential Revision:
D2438309
Yedidya Feldblum [Mon, 14 Sep 2015 19:51:19 +0000 (12:51 -0700)]
Lift the test for ext/random and sfmt19937
Summary: [Folly] Lift the test for `<ext/random>` and `__gnu_cxx::sfmt19937`.
Put an actual check in `folly/configure.ac` and use the result in `folly/Random.h`.
Reviewed By: @Gownta
Differential Revision:
D2438420
Orvid King [Mon, 14 Sep 2015 17:53:41 +0000 (10:53 -0700)]
MSVC 2015 constexpr in Bits.h
Summary: MSVC 2015 supports constexpr intrinsics, and, as the GCC builtins are implemented by #287, we can remove all the MSVC specific intrinsic stuff that isn't constexpr supported.
Closes https://github.com/facebook/folly/pull/288
Reviewed By: @yfeldblum
Differential Revision:
D2419064
Pulled By: @JoelMarcey
Orvid King [Mon, 14 Sep 2015 17:54:21 +0000 (10:54 -0700)]
Don't use weird format specifiers
Summary: MSVC doesn't like it when you use `%1$s`, and actually emits a warning at compile time, so pass the second arugment twice instead.
Closes https://github.com/facebook/folly/pull/302
Reviewed By: @yfeldblum
Differential Revision:
D2371262
Pulled By: @JoelMarcey
Christopher Cole [Mon, 14 Sep 2015 17:47:12 +0000 (10:47 -0700)]
Port fbstring_core to big-endian architectures.
Summary: There's 2 ways this could be implemented - either as a series of preprocessor blocks depending on target architecture (as I have implemented it here), or by encapsulating access to MediumLarge::capacity_ within getters/setters as in a similar manner to setSmallSize() and smallSize(). The first option makes the code a bit harder to read, but the second option changes the existing control flow a bit which could slightly alter performance.
I opted for the first so as to keep the existing amd64 flow untouched, but can easily change the pull request to the second option to keep code readability a priority.
Closes https://github.com/facebook/folly/pull/244
Reviewed By: @Gownta
Differential Revision:
D2306568
Pulled By: @JoelMarcey
Orvid King [Mon, 14 Sep 2015 17:47:08 +0000 (10:47 -0700)]
Handle MSVC correctly in detail/IPAddress.h
Summary: Winsock's structures don't have a member named `s6_addr16`, so use the name for Winsock's structure.
Closes https://github.com/facebook/folly/pull/279
Reviewed By: @yfeldblum
Differential Revision:
D2284223
Pulled By: @JoelMarcey
Yedidya Feldblum [Mon, 14 Sep 2015 17:21:23 +0000 (10:21 -0700)]
Support unique_ptr instances with custom deleters in to_shared_ptr
Summary: [Folly] Support `unique_ptr` instances with custom deleters in `to_shared_ptr`.
We now support `unique_ptr<T, D>` rather than just `unique_ptr<T>`.
Reviewed By: @lbrandy
Differential Revision:
D2438217
Yedidya Feldblum [Sun, 13 Sep 2015 23:44:39 +0000 (16:44 -0700)]
The ' in folly/configure.ac messes with Vim's highlighting
Summary: [Folly] The ' in `folly/configure.ac` messes with Vim's highlighting.
Reviewed By: @JoelMarcey
Differential Revision:
D2438280
Orvid King [Sun, 13 Sep 2015 23:06:37 +0000 (16:06 -0700)]
Use .string() not .native() when working with boost::filesystem
Summary: Because .native() produces a wstring under MSVC.
Closes #306
Reviewed By: @yfeldblum
Differential Revision:
D2419043
Pulled By: @JoelMarcey
Yedidya Feldblum [Sun, 13 Sep 2015 20:23:17 +0000 (13:23 -0700)]
Drop support for GCC < 4.8 in folly/experimental/Bits.h
Summary: [Folly] Drop support for GCC < 4.8 in folly/experimental/Bits.h
Can't stay indefinitely backcompat with older compilers.
Reviewed By: @meyering
Differential Revision:
D2420133
Leonardo Bianconi [Sun, 13 Sep 2015 16:47:49 +0000 (09:47 -0700)]
Port Folly to PPC64
Summary: This patch adds PPC64 specific code in order to support this architecture and be able to be used by HHVM.
Closes #299
Reviewed By: @simpkins
Differential Revision:
D2340723
Pulled By: @JoelMarcey
Giuseppe Ottaviano [Sat, 12 Sep 2015 00:37:20 +0000 (17:37 -0700)]
Add support for std::string in folly::Hash
Reviewed By: @liviu
Differential Revision:
D2436705
Bryce Redd [Fri, 11 Sep 2015 22:46:05 +0000 (15:46 -0700)]
Typing changes in the LockFreeRingBuffer to support 64/32 bit iOS architectures.
Summary: The capacity variable changed types, and turn function needed an explicit cast.
Reviewed By: @BurntBrunch
Differential Revision:
D2421421
Kevin Hurley [Fri, 11 Sep 2015 17:25:14 +0000 (10:25 -0700)]
Add ability to merge dynamic objects
Summary: Adding ability to merge dynamic objects with another object. It will just overwrite duplicate keys
Reviewed By: @yfeldblum
Differential Revision:
D2413628
Maxim Georgiev [Fri, 11 Sep 2015 16:38:28 +0000 (09:38 -0700)]
Marking a bunch of AsyncSSLSocket methods as "const".
Summary: folly::AsyncSSLSocket class has a number of "get..." methods which don't change the object's state, but are not marked as "const". As a result these methods can't be called on objects passed through const pointer or referrence. Adding "const" modificator for these methods.
Reviewed By: @yfeldblum
Differential Revision:
D2430134
Sara Golemon [Fri, 11 Sep 2015 15:18:59 +0000 (08:18 -0700)]
Revert "use thread_local instead of ThreadLocal for some statics in Random"
This reverts commit
6caa3d95ee837703f8f094ffbff5592627417711.
Lucian Grijincu [Fri, 11 Sep 2015 05:10:42 +0000 (22:10 -0700)]
folly: fix EmplaceIterCtor test
Reviewed By: @yfeldblum
Differential Revision:
D2433146
Yedidya Feldblum [Fri, 11 Sep 2015 03:22:21 +0000 (20:22 -0700)]
Use type-parameterized test cases in folly/test/SynchronizedTest.cpp
Summary: [Folly] Use type-parameterized test cases in `folly/test/SynchronizedTest.cpp`.
And some cleanups.
Reviewed By: @nbronson
Differential Revision:
D2428287
Yedidya Feldblum [Fri, 11 Sep 2015 03:21:30 +0000 (20:21 -0700)]
Fix Build: IPv6: SocketAddressTest.SetFromStrings and AsyncSocketTest.ConnectTimeout failing
Summary: [Folly] Fix Build: IPv6: `SocketAddressTest.SetFromStrings` and `AsyncSocketTest.ConnectTimeout` failing
On IPv6-only machines, the `SocketAddressTest.SetFromStrings` example in `folly/test/SocketAddressTest.cpp` was failing because it tries to resolve `127.0.0.1` with `AI_ADDRCONFIG` set. Fix it by detecting which of IPv6 and IPv4 are enabled, and picking an appropriate loopback address.
On IPv6-only machines, the `AsyncSocketTest.ConnectTimeout` example in `folly/io/async/test/AsyncSocketTest2.cpp` was failing because it tries to connect `8.8.8.8`, which is IPv4. Fix it by detecting which of IPv6 and IPv4 are enabled, and picking an approprate remote address.
Reviewed By: @chipturner
Differential Revision:
D2429109
Mark McDuff [Thu, 16 Jul 2015 23:27:21 +0000 (16:27 -0700)]
use thread_local instead of ThreadLocal for some statics in Random
Summary: Exit synchronization is the worst! The worst!
Reviewed By: @bmaurer
Differential Revision:
D2253073
Giuseppe Ottaviano [Thu, 10 Sep 2015 15:26:36 +0000 (08:26 -0700)]
Make EliasFanoReader and BitVectorReader API more consistent
Summary: This diff introduces a few breaking API changes to both EliasFanoReader and BitVectorReader in order to fix some inconsistencies:
- As initalized, `EliasFanoReader` and `BitVectorReader` held a value of `0`, thus if `0` is present in the list `skipTo(0)` would not update the position to `0`, as it happens with any other `skipTo(<first element>)`. This fixes `jumpTo` accordingly.
- `jump(i + 1)` would go at position `i`. Now `reader.jump(i)`'s postcondition is `reader.position() == i`.
- It is now illegal to retrieve `value()` from a reader in an out-of-bounds position (before-the-begin or past-the-end). Validity of a reader can be checked with `valid()`.
Reviewed By: @philippv
Differential Revision:
D2420023
Elliott Clark [Thu, 10 Sep 2015 07:31:47 +0000 (00:31 -0700)]
Add SharedPromise<T>::isFulfilled
Summary: Promise<T> has isFulFilled. This patch adds the corresponding functionality to shared promise.
Reviewed By: @jsedgwick
Differential Revision:
D2417631
Lucian Grijincu [Thu, 10 Sep 2015 00:22:27 +0000 (17:22 -0700)]
folly: small_vector: emplace_back for iterator constructor (compat with std::vector)
Summary: This works:
std::vector<T*> v;
std::vector<std::unique_ptr<T>> uv(v.begin(), v.end())
Make it work for small_vector as well.
Reviewed By: @ot, @Gownta
Differential Revision:
D2426919
Eugene Pekurovsky [Wed, 9 Sep 2015 19:33:59 +0000 (12:33 -0700)]
folly::FunctionScheduler: Adding support for uniform interval distribution
Summary: 1) Added uniform interval distribution functionality.
2) Added a generic API for custom interval distribution algorithms.
3) Fixed an issue with removing a canceled function.
4) Did some code cleanup along the way.
Reviewed By: @kaanb
Differential Revision:
D2339911
Tom Jackson [Wed, 9 Sep 2015 19:23:51 +0000 (12:23 -0700)]
Handle take(-1) better
Summary: It's easy to accidentally pass a negative value to ##take()##, which leads to underflow on conversion to ##size_t##.
Reviewed By: @rosephilip, @philippv
Differential Revision:
D2421459
Yedidya Feldblum [Wed, 9 Sep 2015 01:48:54 +0000 (18:48 -0700)]
Drop support for GCC < 4.8 in folly/Conv.h
Summary: [Folly] Drop support for GCC < 4.8 in folly/Conv.h.
Can't stay indefinitely backcompat with older compilers.
Reviewed By: @Gownta, @JoelMarcey
Differential Revision:
D2422369
Yedidya Feldblum [Tue, 8 Sep 2015 22:24:42 +0000 (15:24 -0700)]
Drop support for GCC < 4.8 in folly/test/FBStringTest.cpp
Summary: [Folly] Drop support for GCC < 4.8 in folly/test/FBStringTest.cpp.
Can't stay indefinitely backcompat with older compilers.
Reviewed By: @tudor
Differential Revision:
D2422425
Giuseppe Ottaviano [Tue, 8 Sep 2015 19:20:36 +0000 (12:20 -0700)]
Implement assume()
Summary: In some cases hinting the compiler about conditions that are guaranteed
to be true can help it generate better code. For instance, remove
unnecessary bound checks. Clang has `__builtin_assume` and on GCC we
can simulate it with `__builtin_unreachable`, so better just abstract
both into a function.
Reviewed By: @philippv
Differential Revision:
D2419937
Orvid King [Tue, 8 Sep 2015 01:23:38 +0000 (18:23 -0700)]
Switch a local from long to size_t for MSVC
Summary: Because MSVC would try to calculate the mmapLength as a long value, which isn't correct, and MSVC issues multiple warnings if you try to do it.
Closes #289
Reviewed By: @yfeldblum
Differential Revision:
D2419061
Pulled By: @JoelMarcey
Tom Hughes [Tue, 8 Sep 2015 01:23:00 +0000 (18:23 -0700)]
Implement adjacent_tokens_only() for GFlagValueSemanticBase
Summary: Needed for boost 1.59.0 which added this as a pure virtual function
in the value_semantic base class. Fixes #314.
Closes #315
Reviewed By: @yfeldblum
Differential Revision:
D2419035
Pulled By: @JoelMarcey
Christopher Dolan [Tue, 8 Sep 2015 01:18:45 +0000 (18:18 -0700)]
Declare missing environ variable
Summary: Declaring `extern char** environ` in `experimental/TestUtil.cpp` fixes a compilation issue on OS X 10.10.
Closes #311
Reviewed By: @yfeldblum
Differential Revision:
D2419037
Pulled By: @JoelMarcey
Yedidya Feldblum [Mon, 7 Sep 2015 05:32:50 +0000 (22:32 -0700)]
Dead Code: GCC-v4.6 Back Compat: folly/Chrono.h
Summary: [Folly] Dead Code: GCC-v4.6 Back Compat: folly/Chrono.h
Reviewed By: @philippv
Differential Revision:
D2419086
James Sedgwick [Fri, 4 Sep 2015 21:09:39 +0000 (14:09 -0700)]
fix SharedPromise<T>::setWith
Summary: was using the renamed/nonexistent makeTryFunction
Reviewed By: @elliottneilclark
Differential Revision:
D2416178
Jason Evans [Fri, 4 Sep 2015 16:12:18 +0000 (09:12 -0700)]
Fix MemoryIdler::flushLocalMallocCaches() regression.
Summary: Fix MemoryIdler::flushLocalMallocCaches() to use the correct type when querying
jemalloc's "opt.narenas" mallctl.
Reviewed By: @jobenber
Differential Revision:
D2414309