Michael Lee [Thu, 2 Jul 2015 14:49:15 +0000 (07:49 -0700)]
Add an exception for building on OSX.
Summary: The Homebrew setup fails to compile on OSX.
Reviewed By: @paulbiss
Differential Revision:
D2212084
Yedidya Feldblum [Thu, 2 Jul 2015 01:39:41 +0000 (18:39 -0700)]
folly::Unit::Drop.
Summary: [Folly] folly::Unit::Drop.
Antisymmetric to folly::Unit::Lift.
Reviewed By: @fugalh
Differential Revision:
D2211725
Hans Fugal [Thu, 2 Jul 2015 01:21:28 +0000 (18:21 -0700)]
minor Timekeeper bug
Summary: Fix so `Timekeeper::at(now() - something)` works. Also introduce a test which explicitly tests when <= now codepath, which wasn't broken per se here, but which test also tickled this bug.
Reviewed By: @jsedgwick
Differential Revision:
D2209166
Hans Fugal [Thu, 2 Jul 2015 01:18:53 +0000 (18:18 -0700)]
Discourage Duration in code comments and tests
Reviewed By: @yfeldblum
Differential Revision:
D2209095
Hans Fugal [Wed, 1 Jul 2015 22:42:50 +0000 (15:42 -0700)]
Future<Unit> global fixup
Summary: This is three codemods:
* `(folly::(Future|Promise|Try))<void>` -> `\1<folly::Unit>`
* `(Future|Promise|Try)<void>` -> `\1<Unit>`
* add `using folly::Unit` statements where needed
Then
* undo false positives in javascript files and fibers::Promise
cf
D2201259, which this will land with
Reviewed By: @djwatson
Differential Revision:
D2201801
Hans Fugal [Wed, 1 Jul 2015 22:42:30 +0000 (15:42 -0700)]
Future<Unit> wangle fixup
Summary: Mostly this is `s/(Promise|Future|Try)<void>/\1<Unit>/`
Reviewed By: @djwatson
Differential Revision:
D2201272
Hans Fugal [Wed, 1 Jul 2015 22:42:23 +0000 (15:42 -0700)]
Nuke Future<void> (folly/futures)
Summary: Nuke Future<void> in favor of Future<Unit>, for the `folly/futures` subdirectory.
Reviewed By: @djwatson
Differential Revision:
D2201259
Sara Golemon [Wed, 1 Jul 2015 21:56:12 +0000 (14:56 -0700)]
Do an explicit test for XSI strerror_r
Summary: The current #if directive is a laundry list of
"strerror_r defaults to XSI style on these platforms",
and we keep missing some, so let's just do a proper test
and simplify the code directives.
Closes #232
Reviewed By: @paulbiss
Differential Revision:
D2208843
Hans Fugal [Wed, 1 Jul 2015 22:07:31 +0000 (15:07 -0700)]
(easy) wrong test suite name
Reviewed By: @yfeldblum
Differential Revision:
D2209197
Vignesh Gowda [Wed, 1 Jul 2015 21:07:37 +0000 (14:07 -0700)]
Implement a BitVector-based list
Summary: Implemented a BitVector Encoder and BitVector Reader with the same interface as EliasFanoCoding.h
Reviewed By: @ot, @philippv
Differential Revision:
D2198935
Andrey Goder [Wed, 1 Jul 2015 17:37:34 +0000 (10:37 -0700)]
fix? AutoTimerTest
Summary: Apparently this test sometimes fails. @Gownta suggests it's because we're
storing temproaries in StringPiece. Change it to store in a std::string, which
should hopefully fix it.
Reviewed By: @Gownta
Differential Revision:
D2208643
Hans Fugal [Wed, 1 Jul 2015 17:24:18 +0000 (10:24 -0700)]
make it really clear that wangle/rx is deprecated
Summary: More people are starting to use Rx. Yay! But they're trying to use `wangle/rx`. So make sure there's no doubt about its deprecated status.
Reviewed By: @yfeldblum
Differential Revision:
D2196273
Sara Golemon [Wed, 1 Jul 2015 16:00:48 +0000 (09:00 -0700)]
Add missing include for flock()
Summary: flock() expects sys/file.h which on many platforms
is getting included as a side-effect, but on at least one
this isn't the case.
Add the explicit include to fix builds on those platforms.
Closes #232
Facebook
Unrelated runtime failures.
Reviewed By: @JoelMarcey
Differential Revision:
D2196306
Marc Horowitz [Tue, 30 Jun 2015 19:39:50 +0000 (12:39 -0700)]
make folly/detail/FunctionalExcept.* work if FOLLY_HAVE_BITS_FUNCTEXCEPT_H is set or not
Summary: When doing android development, we need to compile with
FOLLY_HAVE_BITS_FUNCTEXCEPT_H set for some flavors, and
FOLLY_HAVE_BITS_FUNCTEXCEPT_H unset for others (primarily for tests
run in the local (xcode) development platform). This diff adds some
more conditionals so it all works.
In this repro, these files are never used, so this is more or less a
noop, but this is the upstream so I'm making these changes here.
Reviewed By: @Gownta
Differential Revision:
D2202107
Woo Xie [Tue, 30 Jun 2015 16:21:08 +0000 (09:21 -0700)]
check ReadCallback before using it
Summary: before the first setReadCallback(), the readCallback_ is nullptr. Thanks @siyengar for pointing out this!
Reviewed By: @siyengar
Differential Revision:
D2203489
Woo Xie [Mon, 29 Jun 2015 23:43:14 +0000 (16:43 -0700)]
move the socket setting into setReadCB()
Summary: refactor
D2201181
Reviewed By: @afrind
Differential Revision:
D2202245
Sara Golemon [Mon, 29 Jun 2015 18:01:35 +0000 (11:01 -0700)]
Bump version to 48:0
Kjell Schubert [Mon, 29 Jun 2015 15:33:54 +0000 (08:33 -0700)]
a subset of folly now compiles with Windows mingw64 toolchain
Summary: a subset of folly now compiles with Windows mingw64 toolchain
Reviewed By: @djwatson
Differential Revision:
D2171872
Philip Pronin [Sun, 28 Jun 2015 01:09:24 +0000 (18:09 -0700)]
cleanup includes in folly/Format.h
Summary: `folly/Format.h` pulls in `folly/small_vector.h` and
`folly/FBVector.h`, which (according to @oleksandr's analysis)
are the most expensive includes for multiple fbcode projects.
Reviewed By: @ot
Differential Revision:
D2198904
Tom Jackson [Fri, 26 Jun 2015 20:30:07 +0000 (13:30 -0700)]
Fix resplit | batch
Summary: Resplit violated the contract of `apply()`; it returned `false` even though the input sequence was fully consumed.
Reviewed By: @philippv
Differential Revision:
D2195889
Mike Arpaia [Fri, 26 Jun 2015 18:37:16 +0000 (11:37 -0700)]
Remove double-conversion as a source dep in OS X script
Summary: double-conversion was recently added to homebrew, making it the last
folly dependency to do so. this diff modifies the existing OS X
bootstrap tool to account for that. I also added an rm for the gtest
wget, so there wasn't a leftover zip file in your repo. alternatively,
we could remove that and add it to the gitignore.
Reviewed By: @fugalh
Differential Revision:
D2196000
Pulled By: @sgolemon
Alex Landau [Wed, 24 Jun 2015 23:20:08 +0000 (16:20 -0700)]
Fix passing RequestContext to executor thread
Summary: If x->add() executes its lambda on a different thread and
doesn't pass the context on its own, the callback wouldn't
have the correct context set.
Reviewed By: @djwatson
Differential Revision:
D2189318
Dave Watson [Fri, 26 Jun 2015 16:19:32 +0000 (09:19 -0700)]
Fix stop_ thread race
Summary: make it std::atomic
Reviewed By: @tudor
Differential Revision:
D2191861
Yedidya Feldblum [Fri, 26 Jun 2015 06:11:30 +0000 (23:11 -0700)]
to_shared_ptr.
Summary: [Folly] to_shared_ptr.
So you can write this:
auto sptr = to_shared_ptr(getSomethingUnique<T>());
Instead of this:
auto sptr = shared_ptr<T>(getSomethingUnique<T>());
Useful when `T` is long, such as `T = foobar::cpp2::FooBarServiceAsyncClient`.
Reviewed By: @meyering
Differential Revision:
D2193572
Woo Xie [Fri, 26 Jun 2015 03:11:55 +0000 (20:11 -0700)]
opt proxygen with newly added OpenSSL functions
Summary: this taks advantage of SSL_write_iovec and SSL_read_buf functions to improve CPU. This eliminates one malloc+memcpy+free operation for all HTTPS traffic, and save up to two for small packets.
It saves 10~15% CPU
https://fburl.com/
99681397
https://fburl.com/
99427544
Reviewed By: @djwatson
Differential Revision:
D1993764
Tom Jackson [Thu, 25 Jun 2015 23:39:22 +0000 (16:39 -0700)]
GroupBy
Reviewed By: @ot
Differential Revision:
D2188740
Hans Fugal [Thu, 25 Jun 2015 19:17:51 +0000 (12:17 -0700)]
(easy) remove cruft comment
Summary: We have this now.
Reviewed By: @jsedgwick
Differential Revision:
D2191642
Hannes Roth [Thu, 25 Jun 2015 15:44:29 +0000 (08:44 -0700)]
(Wangle) Fix possible race in updating FSM state
Summary: Storing the new state could be a memory race according to C++ (but wasn't in practice). I only checked GCC though.
Reviewed By: @nbronson
Differential Revision:
D2189287
Hannes Roth [Thu, 25 Jun 2015 15:41:28 +0000 (08:41 -0700)]
(Wangle) Clean up some data races in tests
Summary: Not 100% about the `ThreadWheelTimekeeper` test. It makes TSAN happy
though.
Reviewed By: @yfeldblum
Differential Revision:
D2187901
Hannes Roth [Thu, 25 Jun 2015 15:38:14 +0000 (08:38 -0700)]
(Wangle) Fix bug with CrappyExecutors, and bad PriorityExecutor
Summary: 1) We forgot to `--attached_` if `x` throws an exception
2) `PriorityExecutor` didn't execute `Func`, causing leaks in the test (not a bug in Futures)
3) I moved up the initialization for an empty `Core` into the constructor to make it easier to see
Reviewed By: @jsedgwick
Differential Revision:
D2187343
Sara Golemon [Wed, 24 Jun 2015 17:48:20 +0000 (10:48 -0700)]
Don't hardcode thread limit in ServerBootstrap
Summary: This was set to 32 which probably works fine for the
majority of FB servers, but not everyone's system is so endowed.
Closes #119
Reviewed By: @fredemmott
Differential Revision:
D2187008
Hannes Roth [Wed, 24 Jun 2015 17:20:39 +0000 (10:20 -0700)]
(Wangle) Remove unnecessary constructor argument to CollectAnyContext
Summary: See title.
Reviewed By: @fugalh
Differential Revision:
D2186833
Sara Golemon [Wed, 24 Jun 2015 16:31:49 +0000 (09:31 -0700)]
Fix tests for glog and gflags
Summary: The existing tests were trying to find undocumented
symbols in glog/glags which aren't guaranteed to be there on all
platforms.
Use AC_RUN_IFELSE() to try building and executing some code
typical of the usage of these libraries.
Closes #117
Reviewed By: @JoelMarcey
Differential Revision:
D2183526
Sara Golemon [Wed, 24 Jun 2015 16:32:24 +0000 (09:32 -0700)]
Change visibility of folly::Arena constructors to public
Summary: In the case of the copy constructor, this change
doesn't really matter, since it's deleted anyway.
In the case of the move constructor, it fixes what was probably
an unintentional hiding. The class certainly looks like
it supports moving.
Closes #121
Reviewed By: @yfeldblum
Differential Revision:
D2184131
Sara Golemon [Wed, 24 Jun 2015 16:32:42 +0000 (09:32 -0700)]
Fix copy/pasta in docs
Summary: svformat explicitly takes a container for direct indexing,
but the format string used is per-arg, which corresponds to format/sformat.
Closes #228
Reviewed By: @JoelMarcey
Differential Revision:
D2184334
Sara Golemon [Wed, 24 Jun 2015 16:33:02 +0000 (09:33 -0700)]
Update README.md to refer to homebrew Formula
Summary: Release builds should probably favor using
@marpaia's brew Formula to get a release build.
Leave the boostrap script around to simplify building
from master.
Closes #229
Reviewed By: @jwatzman
Differential Revision:
D2184416
Hannes Roth [Wed, 24 Jun 2015 15:55:44 +0000 (08:55 -0700)]
(Wangle) Possibly undefined behavior in collect
Summary: Not sure if this is really undefined behavior or whether UBSAN is just super paranoid. Will try to read up on it later.
I also changed some other `std::atomic` initialization to always follow the same pattern, let me know if I should revert those. I couldn't resist, OCD kicked in.
idonthaveocd
Reviewed By: @fugalh
Differential Revision:
D2181074
Sara Golemon [Tue, 23 Jun 2015 22:44:37 +0000 (15:44 -0700)]
Provide backfill s6_addr16 on BSD platforms
Summary: Extend the MacOS s6_addr16 hack to Net/Open/FreeBSD
Closes #106
Reviewed By: @JoelMarcey
Differential Revision:
D2182912
Anton Likhtarov [Tue, 23 Jun 2015 02:31:17 +0000 (19:31 -0700)]
Futex: ignore errors on wake
Summary: See the comment for details
Reviewed By: @nbronson
Differential Revision:
D2181231
James Sedgwick [Tue, 23 Jun 2015 18:21:34 +0000 (11:21 -0700)]
rearrange Pipeline to have more functionality in PipelineBase
Summary: This way, handlers can carry out more complex manipulations of the pipeline via ctx->getPipeline() without knowing the R/W types
Reviewed By: @djwatson
Differential Revision:
D2158736
191919 [Tue, 23 Jun 2015 16:59:11 +0000 (09:59 -0700)]
Fix for clang (llvm 3.7.0+)
Summary: Roughly described in https://github.com/facebook/hhvm/issues/5344.
Closes #206
Reviewed By: @yfeldblum
Differential Revision:
D2170803
Pulled By: @sgolemon
Igor Sugak [Tue, 23 Jun 2015 16:01:38 +0000 (09:01 -0700)]
Remove -Wno-inconsistent-missing-override suppression in folly
Summary: It is fixed in gmock. No need to suppress it in sources.
Reviewed By: @meyering
Differential Revision:
D2181564
Yedidya Feldblum [Tue, 23 Jun 2015 03:29:35 +0000 (20:29 -0700)]
instance Eq Unit
Summary: [Folly] instance Eq Unit
Unit::operator==(const Unit&)
Unit::operator!=(const Unit&)
Reviewed By: @Gownta
Differential Revision:
D2179384
Igor Sugak [Mon, 22 Jun 2015 23:40:19 +0000 (16:40 -0700)]
Add missing override and remove redundant virtual in folly
Summary: Running clang-tidy to fix this problem, using script
D2171334.
I noticed that even without this change clang dev build succeeds for folly and opened a separate task to investigate why.
Reviewed By: @markisaa
Differential Revision:
D2179299
Mike Kaplinskiy [Mon, 22 Jun 2015 23:15:24 +0000 (16:15 -0700)]
Add ./configure check for vsnprintf returning negative on error
Summary: This is slightly more correct than assuming that
__APPLE__ is the only place this assumption breaks.
Pulled from relevant section of folly-PR#95, other sections
are either already applied by other fixes, or have been code-moved.
Closes #95
Reviewed By: @jwatzman
Differential Revision:
D2178439
Adriano Melo [Mon, 22 Jun 2015 17:15:46 +0000 (10:15 -0700)]
Building instructions for MAC OS X (MacPorts)
Summary: Tested on Mac OS X 10.10.3 and MacPorts 2.3.3.
Closes #227
Reviewed By: @yfeldblum
Differential Revision:
D2176700
Pulled By: @sgolemon
Sara Golemon [Sun, 21 Jun 2015 18:59:51 +0000 (11:59 -0700)]
Bump version to 47:0
Yoni Lavi [Sat, 20 Jun 2015 14:45:56 +0000 (07:45 -0700)]
new small_vector tests that fail on trunk and uncover a bug in emplace_back on references to memory inside the vector + a fix + perf improvement to const lvalue push_back
Summary: emplace_back() on a small_vector applied on data inside the vector doesn't work properly.
In standard vectors, this usage is required to work properly, but I'm not sure whether it should in small_vector. Consider fixing / adding a lint rule.
Reviewed By: @yfeldblum
Differential Revision:
D2122931
Ananth Jasty [Fri, 19 Jun 2015 02:16:22 +0000 (19:16 -0700)]
ARM64 assembler fixes for Folly.
Summary: Wrap asm("pause") in an inline so that it becomes
asm("wfe") on aarch64.
Closes #187
Closes #190
Reviewed By: @yfeldblum
Differential Revision:
D2152868
Pulled By: @sgolemon
Sam Merat [Thu, 18 Jun 2015 18:42:07 +0000 (11:42 -0700)]
then() ropagates exceptions properly
Summary: fixed then() exceptions propagation and added unit-test
Reviewed By: @fugalh
Differential Revision:
D2159075
Vignesh Gowda [Thu, 18 Jun 2015 17:00:51 +0000 (10:00 -0700)]
Move folly::compression::Instructions to a separate file
Summary: Moved abstraction layer for platform-specific bit-manipulation instructions from the EliasFanoCoding.h to Instructions.h since we will need to use it also for BitVectors:
Reviewed By: @ot
Differential Revision:
D2165314
Nathan Bronson [Wed, 17 Jun 2015 21:27:06 +0000 (14:27 -0700)]
move SharedMutex from folly/experimental to folly
Summary: SharedMutex has been in heavy production use for a while with no
bugs reported and no API changes requested, it is no longer experimental.
Reviewed By: @yfeldblum
Differential Revision:
D2165275
Marc Horowitz [Wed, 17 Jun 2015 18:06:45 +0000 (11:06 -0700)]
Check array get for < 0
Summary: dynamic's integer type is signed, so make sure array indices
are not negative.
(See https://our.intern.facebook.com/intern/tasks/?t=
7445055)
Reviewed By: @Gownta
Differential Revision:
D2145689
James Sedgwick [Tue, 16 Jun 2015 17:31:02 +0000 (10:31 -0700)]
use Unit in Pipeline
Summary: Instead of the one-off Nothing struct
Reviewed By: @yfeldblum
Differential Revision:
D2158621
James Sedgwick [Tue, 16 Jun 2015 17:30:18 +0000 (10:30 -0700)]
various perf improvements
Summary: Three strategies
1. Optimistic locking
2. Acquire-release memory ordering instead of full sequential consistency
3. Some low-hanging branch miss optimizations
Please review carefully; the dogscience is strong with this one
```
Before:
============================================================================
folly/futures/test/Benchmark.cpp relative time/iter iters/s
============================================================================
constantFuture 127.99ns 7.81M
promiseAndFuture 94.89% 134.89ns 7.41M
withThen 28.40% 450.63ns 2.22M
----------------------------------------------------------------------------
oneThen 446.68ns 2.24M
twoThens 58.35% 765.55ns 1.31M
fourThens 31.87% 1.40us 713.41K
hundredThens 1.61% 27.78us 35.99K
----------------------------------------------------------------------------
no_contention 4.63ms 216.00
contention 80.79% 5.73ms 174.52
----------------------------------------------------------------------------
throwAndCatch 10.91us 91.64K
throwAndCatchWrapped 127.14% 8.58us 116.51K
throwWrappedAndCatch 178.22% 6.12us 163.32K
throwWrappedAndCatchWrapped 793.75% 1.37us 727.38K
----------------------------------------------------------------------------
throwAndCatchContended 1.35s 741.33m
throwAndCatchWrappedContended 139.18% 969.23ms 1.03
throwWrappedAndCatchContended 169.51% 795.76ms 1.26
throwWrappedAndCatchWrappedContended 17742.23% 7.60ms 131.53
----------------------------------------------------------------------------
complexUnit 127.50us 7.84K
complexBlob4 100.14% 127.32us 7.85K
complexBlob8 100.16% 127.30us 7.86K
complexBlob64 96.45% 132.19us 7.57K
complexBlob128 92.83% 137.35us 7.28K
complexBlob256 87.79% 145.23us 6.89K
complexBlob512 81.64% 156.18us 6.40K
complexBlob1024 72.54% 175.76us 5.69K
complexBlob2048 58.52% 217.89us 4.59K
complexBlob4096 32.54% 391.78us 2.55K
============================================================================
After:
============================================================================
folly/futures/test/Benchmark.cpp relative time/iter iters/s
============================================================================
constantFuture 85.28ns 11.73M
promiseAndFuture 88.63% 96.22ns 10.39M
withThen 30.46% 279.99ns 3.57M
----------------------------------------------------------------------------
oneThen 231.18ns 4.33M
twoThens 60.57% 381.70ns 2.62M
fourThens 33.52% 689.71ns 1.45M
hundredThens 1.49% 15.48us 64.58K
----------------------------------------------------------------------------
no_contention 3.84ms 260.19
contention 88.29% 4.35ms 229.73
----------------------------------------------------------------------------
throwAndCatch 10.63us 94.06K
throwAndCatchWrapped 127.17% 8.36us 119.61K
throwWrappedAndCatch 179.83% 5.91us 169.15K
throwWrappedAndCatchWrapped 1014.48% 1.05us 954.19K
----------------------------------------------------------------------------
throwAndCatchContended 1.34s 749.03m
throwAndCatchWrappedContended 140.66% 949.16ms 1.05
throwWrappedAndCatchContended 164.87% 809.77ms 1.23
throwWrappedAndCatchWrappedContended 49406.39% 2.70ms 370.07
----------------------------------------------------------------------------
complexUnit 86.83us 11.52K
complexBlob4 97.42% 89.12us 11.22K
complexBlob8 96.63% 89.85us 11.13K
complexBlob64 92.53% 93.84us 10.66K
complexBlob128 90.85% 95.57us 10.46K
complexBlob256 82.56% 105.17us 9.51K
complexBlob512 74.13% 117.12us 8.54K
complexBlob1024 63.67% 136.37us 7.33K
complexBlob2048 50.25% 172.79us 5.79K
complexBlob4096 26.63% 326.05us 3.07K
============================================================================
```
Reviewed By: @djwatson
Differential Revision:
D2139822
Praveen Kumar [Tue, 16 Jun 2015 17:02:00 +0000 (10:02 -0700)]
Using emplace_back to avoid temporary
Summary: Directly pass the arguments to respective constructors.
Instead of first making temporary and then pass that.
Closes #218
Reviewed By: @yfeldblum
Differential Revision:
D2156978
Pulled By: @sgolemon
Sara Golemon [Tue, 16 Jun 2015 03:24:49 +0000 (20:24 -0700)]
Bump version to 46:0
Sarang Masti [Mon, 15 Jun 2015 23:29:11 +0000 (16:29 -0700)]
Fix leaks in tests
Summary: Fix leaks in unit tests
Reviewed By: @djwatson
Differential Revision:
D2153681
Giuseppe Ottaviano [Mon, 15 Jun 2015 22:52:25 +0000 (15:52 -0700)]
Implement previousValue on EliasFanoReader
Summary: It is often useful to retrieve the value preceding the current value
in an Elias-Fano iterator, for example when the list represents
adjacent ranges. This diff implements a new method `previousValue` in
`EliasFanoReader`.
It also adds a new `kUnchecked` boolean template argument to
`EliasFanoReader` which skips bounds checking.
Reviewed By: @philippv
Differential Revision:
D2155049
James Sedgwick [Mon, 15 Jun 2015 19:12:28 +0000 (12:12 -0700)]
pipeline handler removal, fix service test
Summary: add remove<T>, remove(Handler*), removeFront(), removeBack() to Pipeline
employ these to fix up reusing client pipelines with client dispatchers, which in turn fixes the broken ServiceTest
Reviewed By: @djwatson
Differential Revision:
D2152636
Nathan Bronson [Mon, 15 Jun 2015 15:29:44 +0000 (08:29 -0700)]
Move AtomicUnorderedInsertMap to folly.
Summary: AtomicUnorderedInsertMap is a concurrent hash table that firmly
at the performance end of the generality <-> performance spectrum.
If you don't need updates (or can use your own concurrency control when
overwriting values), you never need to delete, and you can predict your
capacity perfectly, then you will get wait-free reads, lock-free inserts,
safe concurrent iteration, and excellent cache and performance outlier
behavior. Arbitrary key and value types are supported.
Reviewed By: @yfeldblum
Differential Revision:
D2145281
Woo Xie [Sun, 14 Jun 2015 16:41:03 +0000 (09:41 -0700)]
do not suppurt compress and expand
Summary: the openssl improvement does not support compression and decompression.
Reviewed By: @Invalid auth token., @afrind
Differential Revision:
D2151003
Sara Golemon [Sat, 13 Jun 2015 02:11:17 +0000 (19:11 -0700)]
Revert "Using emplace_back to avoid temporary"
Summary: This reverts commit
0968dcc2f0e02998fa53007853e0c0aad0a423b7.
Reverts
D2151582
Reviewed By: @iainb
Differential Revision:
D2153840
Sarang Masti [Tue, 9 Jun 2015 18:17:12 +0000 (11:17 -0700)]
Check readCallback before calling handleRead
Summary: Since readCallback_ could be uninstalled in any of callbacks,
we need to ensure that readCallback_ != nullptr before calling
handleRead.
Reviewed By: @djwatson
Differential Revision:
D2140054
Tudor Bosman [Fri, 12 Jun 2015 23:57:02 +0000 (16:57 -0700)]
ExceptionWrapper: use std::decay in implicit constructor
Summary: Because Ex resolves to SomeException&, and then all the tests in optimize<>
fail.
Reviewed By: @yfeldblum
Differential Revision:
D2152893
Sara Golemon [Mon, 15 Jun 2015 20:31:59 +0000 (13:31 -0700)]
Merge pull request #225 from wb14123/dup
Remove duplicate header file
Somehow this was already correct in the internal repo, but not the external one.
Thanks!
Bin Wang [Mon, 15 Jun 2015 07:37:02 +0000 (15:37 +0800)]
Remove duplicate header file
Praveen Kumar [Fri, 12 Jun 2015 21:44:00 +0000 (14:44 -0700)]
Using emplace_back to avoid temporary
Summary: Directly pass the arguments to respective constructors.
Instead of first making temporary and then pass that.
Closes #218
Reviewed By: @JoelMarcey
Differential Revision:
D2151582
Pulled By: @sgolemon
Praveen Kumar [Fri, 12 Jun 2015 21:44:21 +0000 (14:44 -0700)]
Get *=default*ed default constructors
Summary: Defaulted (*=default*ed) default constructors are better
because they can be constexpr and/or noexcept when C++ Standard
thinks it is right to do so. And they remain user-declared rather
than user-provided. Regarding *=default*ed default constructor,
benifit is that the work might be done during compilation and we
might not need to worry about exception paths. And for destructors,
apart from that that =defaulted definition is in sync with defaulted
default constructor we might discover that in some cases "() {}" might
be ill-formed when "= default;" compiltion indicates so. If =defaulted
definition for destructor doesn't do any harm then why not go for it.
Closes #216
Reviewed By: @yfeldblum
Differential Revision:
D2145322
Pulled By: @sgolemon
Praveen Kumar [Fri, 12 Jun 2015 21:44:14 +0000 (14:44 -0700)]
Needless temporary gone
Summary: We might be doing:
1) Create a temporary
2) Copy/Move out of it
3) Destroy that temporary.
Which isn't needed in many places.
And copy/move elision doesn't work for a temporary
bound to a reference.
We can forward arguments, directly.
To get the work done three constructors were added.
Closes #222
Reviewed By: @JoelMarcey, @yfeldblum
Differential Revision:
D2151731
Pulled By: @sgolemon
Misha Shneerson [Fri, 12 Jun 2015 20:55:05 +0000 (13:55 -0700)]
Added fiber supported mutex to folly
Summary: To be able to use fiber lock in thrift
Reviewed By: @brianwatling, @yfeldblum
Differential Revision:
D2149936
Yablonskyy@axilera.com [Fri, 12 Jun 2015 20:13:15 +0000 (13:13 -0700)]
Add EOS checking to 'parseLeadingNumber' function.
Summary: parseLeadingNumber does not contain EOS validation and raise an exception when '/sys/devices/system/cpu/cpu0/index0/shared_cpu_list' contains only one number like '0'.
Closes #207
Reviewed By: @yfeldblum
Differential Revision:
D2148015
Pulled By: @sgolemon
Hans Fugal [Fri, 12 Jun 2015 20:11:35 +0000 (13:11 -0700)]
apple-gate ThreadLocal in fibers code
Summary: Some internal malloc shims broke on using folly::ThreadLocal, so only do that for `__APPLE__`.
Reviewed By: @brianwatling
Differential Revision:
D2151318
Nicholas Ormrod [Fri, 12 Jun 2015 17:49:08 +0000 (10:49 -0700)]
Suppress clang memcpy warnings
Summary: Clang warns when types with vtables are memcpy'd. If the type
has declared itself to be relocatable, then this is the desired
behavior. If the type has not declared itself to be relocatable, then
the memcpy codepath is dead. However, the dead codepath is still
instantiated (it's inside an if block with a static check, but c++
doesn't have static-if), so the compiler spits out a nasty warning
anyways.
Each memcpy reference inside of fbvector has been void-ified. I have
looked at all the codepaths leading to the memcpys, and see that they
have isRelocatable or isTriviallyCopyable checks.
Reviewed By: @markisaa
Differential Revision:
D2148286
Alan Frindell [Fri, 12 Jun 2015 17:21:18 +0000 (10:21 -0700)]
Temporarily disable performWriteIovec
Summary: As in title
Reviewed By: @djwatson
Differential Revision:
D2151092
Nicholas Ormrod [Fri, 12 Jun 2015 16:13:33 +0000 (09:13 -0700)]
Recycle heap on assignment
Summary: For standard containers, assignment tries to reuse heap space.
Dynamic assignment does not - it calls destroy(), and then reconstructs
a new dynamic. In the case that the old and new types are the same (eg
assigning a dynamic-vector to a dynamic-vector) we can call through to
the underlying type's assignment operator.
Reviewed By: @jdelong
Differential Revision:
D2148093
Woo Xie [Thu, 11 Jun 2015 23:49:29 +0000 (16:49 -0700)]
opt proxygen with new SSL_write_iovec function
Summary: this taks advantage of the SSL_write_iovec function to improve CPU. According our testing, it saves 10+% CPU.
Reviewed By: @djwatson
Differential Revision:
D2119223
Fifi Lyu [Thu, 11 Jun 2015 21:32:09 +0000 (14:32 -0700)]
fix for Boost >= 1.56
Summary: Folly still continue to build and work on earlier boost versions(boost < 1.56).
**boost::context::make_fcontext() change history:**
* __1.55:__ fcontext_t * make_fcontext( void * sp, std::size_t size, void(* fn)(intptr_t) );
* __1.56:__ fcontext_t make_fcontext(void* sp,std::size_t size,void(*fn)(intptr_t));
**boost doc:**
http://www.boost.org/doc/libs/1_55_0/libs/context/doc/html/context/context/boost_fcontext.html
http://www.boost.org/doc/libs/1_56_0/libs/context/doc/html/context/context/boost_fcontext.html
Closes #205
Closes #210
Reviewed By: @jwatzman
Differential Revision:
D2148069
Pulled By: @sgolemon
Sara Golemon [Thu, 11 Jun 2015 21:06:38 +0000 (14:06 -0700)]
Check for python in configure
Summary: Some OSs have python named according to a version ID
e.g. `python2.7` without a symlink from plain `python`
Use autotool's AM_PATH_PYTHON to search for a suitable interpreter
and use that to generate the *Tables.cpp files.
Closes #109
Reviewed By: @yfeldblum
Differential Revision:
D2147977
Alexander Böhn / FI [Thu, 11 Jun 2015 21:05:37 +0000 (14:05 -0700)]
Keep Makefile.am from double-installing detail/Clock.h
Summary: On non-Linux systems, the autotools-based build system conditionally appends `detail/Clock.h` to `libfollybase_la_SOURCES` – even though that file is in there statically no matter what (as per [line 46](https://github.com/facebook/folly/blob/master/folly/Makefile.am#L46)), which causes the `install` command to error out trying to install the file twice, during `make install`… this patch takes out the conditional append.
Closes #201
Reviewed By: @yfeldblum
Differential Revision:
D2148004
Pulled By: @sgolemon
Hans Fugal [Thu, 11 Jun 2015 20:53:21 +0000 (13:53 -0700)]
Replace thread_local with FOLLY_TLS
Summary: OSX doesn't support C++11's `thread_local`. :-/ (yet? http://stackoverflow.com/questions/
28094794/why-does-apple-clang-disallow-c11-thread-local-when-official-clang-supports/
29929949#
29929949)
We have `FOLLY_TLS` in `Portability.h` https://github.com/facebook/folly/blob/master/folly/Portability.h#L163-L175
So replace the usages of `thread_local` with `FOLLY_TLS`. But `__thread` is not drop-in compatible with `thread_local`, specifically the former requires global storage and needs a constexpr initializer, and a trivial destructor.
`futures/QueuedImmediateExecutor` now uses `folly::ThreadLocal` (because `std::queue` has a non-trivial destructor). It might end up in one more alloc, per thread. I also rearranged the code to clarify the fact that although there may be many `QueuedImmediateExecutor`s, they all share the same queue per thread.
I didn't use `folly::ThreadLocal` for fibers, because I thought it might be too expensive. But now I'm not so sure. I had to do the "check for default and then initialize" thing because of the requirement for constexpr initialization for `__thread` (and therefore `FOLLY_TLS`).
Reviewed By: @jsedgwick
Differential Revision:
D2140369
Hans Fugal [Thu, 11 Jun 2015 20:35:49 +0000 (13:35 -0700)]
disable ThreadExecutor in FutureTest.cpp, on OSX
Summary: Something's broken here, will track fixing in #
7372389
Reviewed By: @jsedgwick
Differential Revision:
D2144077
Hans Fugal [Thu, 11 Jun 2015 20:35:40 +0000 (13:35 -0700)]
Build and run futures tests on OSX
Summary: They don't pass, but they build!
Reviewed By: @jsedgwick
Differential Revision:
D2141717
Hans Fugal [Thu, 11 Jun 2015 20:28:57 +0000 (13:28 -0700)]
Future::unit()
Summary: Discard a result but propagate an exception. cf https://www.facebook.com/groups/
715931878455430/permalink/
879624552086161/
Reviewed By: @sammerat
Differential Revision:
D2144567
Woo Xie [Thu, 11 Jun 2015 20:25:03 +0000 (13:25 -0700)]
refactor the interpretation of SSL errors into a function
Summary: This fucntion will be re-used for different SSL write functions in future.
Reviewed By: @djwatson
Differential Revision:
D2117529
Hans Fugal [Thu, 11 Jun 2015 18:52:33 +0000 (11:52 -0700)]
use LifoSem instead of sem_t for ManualExecutor
Summary: OSX apparently knows better than all of us plebes, and got rid of anonymous semaphores. Rather than try to work around that directly, I just switched to folly::LifoSem, which seems like a not-terrible idea anyway.
Reviewed By: @jsedgwick
Differential Revision:
D2143566
Hans Fugal [Thu, 11 Jun 2015 18:51:06 +0000 (11:51 -0700)]
folly::via(Executor*, Func)
Summary: ((not yet) more performant) sugar for `via(&x).then(func)`
Reviewed By: @hannesr
Differential Revision:
D2131246
Tudor Bosman [Thu, 11 Jun 2015 18:18:41 +0000 (11:18 -0700)]
Make IOBuf copyable
Summary: Give IOBuf a copy constructor, which clones the whole chain. (IOBufs have
shared pointer semantics). You could argue for cloning one single IOBuf,
but cloning the whole chain has the nice side effect of making Thrift
structures with IOBufs in them copyable, so there's that.
Reviewed By: @djwatson
Differential Revision:
D2127209
James Sedgwick [Thu, 11 Jun 2015 17:42:18 +0000 (10:42 -0700)]
RequestEventBaseCache -> IOObjectCache
Summary: Next step towards killing RequestEventBase hackery.
Use EBs from global IO executor instead
Reviewed By: @fugalh
Differential Revision:
D2123142
James Sedgwick [Thu, 11 Jun 2015 17:41:43 +0000 (10:41 -0700)]
wangle::getEventBase()
Summary: this is going to be a really common pattern, so I'm providing a shortcut
Reviewed By: @fugalh
Differential Revision:
D2146008
James Sedgwick [Wed, 10 Jun 2015 23:29:08 +0000 (16:29 -0700)]
optimize makeFuture and Future<T>::Future()
Summary: No reason to go through the whole Promise rigamarole. Add an appropriate Core ctor and use that to make a completed Future with just the core alloc
Note the big win in the `constantFuture` benchmark.
```
Before:
============================================================================
folly/futures/test/Benchmark.cpp relative time/iter iters/s
============================================================================
constantFuture 120.50ns 8.30M
promiseAndFuture 91.99% 130.98ns 7.63M
withThen 28.17% 427.77ns 2.34M
----------------------------------------------------------------------------
oneThen 430.48ns 2.32M
twoThens 58.03% 741.86ns 1.35M
fourThens 31.85% 1.35us 739.97K
hundredThens 1.61% 26.80us 37.32K
----------------------------------------------------------------------------
no_contention 4.58ms 218.48
contention 83.70% 5.47ms 182.86
----------------------------------------------------------------------------
throwAndCatch 8.09us 123.55K
throwAndCatchWrapped 94.43% 8.57us 116.67K
throwWrappedAndCatch 154.69% 5.23us 191.12K
throwWrappedAndCatchWrapped 614.06% 1.32us 758.70K
----------------------------------------------------------------------------
throwAndCatchContended 967.54ms 1.03
throwAndCatchWrappedContended 103.48% 935.04ms 1.07
throwWrappedAndCatchContended 148.24% 652.70ms 1.53
throwWrappedAndCatchWrappedContended 14313.28% 6.76ms 147.94
============================================================================
After:
============================================================================
folly/futures/test/Benchmark.cpp relative time/iter iters/s
============================================================================
constantFuture 69.11ns 14.47M
promiseAndFuture 55.12% 125.37ns 7.98M
withThen 16.49% 419.18ns 2.39M
----------------------------------------------------------------------------
oneThen 370.39ns 2.70M
twoThens 55.11% 672.05ns 1.49M
fourThens 29.00% 1.28us 782.89K
hundredThens 1.23% 30.22us 33.09K
----------------------------------------------------------------------------
no_contention 4.56ms 219.46
contention 82.82% 5.50ms 181.77
----------------------------------------------------------------------------
throwAndCatch 8.30us 120.42K
throwAndCatchWrapped 96.40% 8.61us 116.08K
throwWrappedAndCatch 162.66% 5.11us 195.89K
throwWrappedAndCatchWrapped 680.39% 1.22us 819.36K
----------------------------------------------------------------------------
throwAndCatchContended 979.17ms 1.02
throwAndCatchWrappedContended 103.09% 949.84ms 1.05
throwWrappedAndCatchContended 153.55% 637.71ms 1.57
throwWrappedAndCatchWrappedContended 10468.47% 9.35ms 106.91
============================================================================
```
Reviewed By: @fugalh, @hannesr
Differential Revision:
D2144664
Praveen Kumar [Wed, 10 Jun 2015 22:21:07 +0000 (15:21 -0700)]
Fix libc++ use
Summary: Use of std::max from libc++ resulted in error.
std::max found type of its arguments diffrent
whereas it expected them to be same.
This diff fix the error.
Closes #223
Reviewed By: @yfeldblum
Differential Revision:
D2144639
Pulled By: @sgolemon
Yadwinder Grewal [Wed, 10 Jun 2015 21:19:33 +0000 (14:19 -0700)]
Fix capitalization error in README.md
Summary: Closes #211
Reviewed By: @Gownta, @lbrandy
Differential Revision:
D2144702
Pulled By: @sgolemon
Austin McKinley [Wed, 10 Jun 2015 21:25:41 +0000 (14:25 -0700)]
Fixing typos in README.md
Summary: Closes #202
Reviewed By: @paulbiss
Differential Revision:
D2144850
Pulled By: @sgolemon
Ed Baunton [Wed, 10 Jun 2015 21:24:55 +0000 (14:24 -0700)]
Update FBVector.md
Summary: Minor typo when referencing `std::allocator`
Closes #84
Reviewed By: @yfeldblum
Differential Revision:
D2144830
Pulled By: @sgolemon
Stewart Henderson [Wed, 10 Jun 2015 20:56:44 +0000 (13:56 -0700)]
Update github.com/floitsch/double-conversion to new location
Summary: Closes #212
Reviewed By: @JoelMarcey, @paulbiss
Differential Revision:
D2144749
Pulled By: @sgolemon
Praveen Kumar [Wed, 10 Jun 2015 21:13:43 +0000 (14:13 -0700)]
fix Baton.h typo
Summary: checked the sense
Closes #224
Reviewed By: @paulbiss
Differential Revision:
D2144508
Pulled By: @sgolemon
Hannes Roth [Wed, 10 Jun 2015 16:06:50 +0000 (09:06 -0700)]
(Wangle) Re-add race test
Summary: I figured this test would be useless since it tests a check added before
everything was converted to FSM. But since it appears to fail on Mac OS
X, it might be useful to have after all.
Reviewed By: @fugalh
Differential Revision:
D2143500
woo [Tue, 9 Jun 2015 23:12:18 +0000 (16:12 -0700)]
Bump version to 45:0
James Sedgwick [Tue, 9 Jun 2015 20:27:00 +0000 (13:27 -0700)]
fix typo in SharedPromise comment
Summary: ^
Test Plan: OK
Reviewed By: yfeldblum@fb.com
Subscribers: folly-diffs@, jsedgwick, yfeldblum, chalfant
FB internal diff:
D2140212
Signature: t1:
2140212:
1433877717:
86b7bf372091b455cdb25a377451e1ed4e21f50d