Dave Watson [Fri, 4 Apr 2014 19:17:54 +0000 (12:17 -0700)]
Fix make check
Summary: Fix make check. Benchmark.cpp was included twice, eventfd doesn't exist anymore.
Test Plan: autoreconf -i; ./configure; make check on ubuntu
Reviewed By: pgriess@fb.com
FB internal diff:
D1259706
Dave Watson [Thu, 3 Apr 2014 20:40:58 +0000 (13:40 -0700)]
fix automake
Summary:
Automake complains there are two Malloc.cpp rules - rename one of them.
Facebook: Actually this file doesn't even build in fbconfig - is it still necessary?
Test Plan: autoreconf -i on ubuntu doens't fail
Reviewed By: pgriess@fb.com
FB internal diff:
D1257372
Hans Fugal [Mon, 7 Apr 2014 16:57:42 +0000 (09:57 -0700)]
(wangle) codegen then() variant tests
Summary:
When all the variants I am dreaming of work, there's a little more than
100 tests generated.
Test Plan: fbmake runtests
Reviewed By: hannesr@fb.com
FB internal diff:
D1258754
Hannes Roth [Mon, 7 Apr 2014 16:44:38 +0000 (09:44 -0700)]
(Folly/FBString) Fix compilation time of test with opt
Summary: Now compiles in 18 seconds. Took two minutes before.
Test Plan: `fbmake runtests_opt`
Reviewed By: smith@fb.com
FB internal diff:
D1243689
Philip Pronin [Sat, 5 Apr 2014 21:54:37 +0000 (14:54 -0700)]
configurable node allocator for ConcurrentSkipList
Summary:
Allow specifying `SimpleAllocator` to use for node allocation.
Added optimizations for arena allocators.
Test Plan: fbconfig -r folly/test && fbmake opt -j32
Reviewed By: soren@fb.com
FB internal diff:
D1261546
Philip Pronin [Sat, 5 Apr 2014 04:50:27 +0000 (21:50 -0700)]
make ConcurrentSkipList ctor public
Summary:
There is no reason to force heap allocation for
`ConcurrentSkipList`.
Test Plan: fbconfig -r unicorn/test && fbmake opt -j32
@override-unit-failures
Reviewed By: lucian@fb.com
FB internal diff:
D1261183
Tom Jackson [Fri, 4 Apr 2014 23:55:09 +0000 (16:55 -0700)]
Adding support for signed integers
Summary: For use with Thrift::Frozen, especially.
Test Plan: Unit tests
Reviewed By: philipp@fb.com
FB internal diff:
D1255257
Nicholas Ormrod [Fri, 4 Apr 2014 03:02:55 +0000 (20:02 -0700)]
Bugfix in iterator emplace
Summary:
Subtle bugfix to fbvector
Reproduction requirements:
- emplace into a vector at a non-end position
- the vector has enough capacity for the extra elements
- the value type's internal state is poisoned after a move
What should happen, explained by picture:
INITIAL SETUP
abc1234XY____
^
want to insert two elements here
FIRST STEP: uninitialized move-construction
x and y are initialized, but could be in an invalid state
abc1234xyXY__
SECOND STEP: move-assignment, in reverse order
abc123xy4XY__
abc12xy34XY__
abc1xy234XY__
abcxy1234XY__
What actually happens:
An indexing error causes the entire tail (##1234xy##) to be
move-assigned, instead of the intended head of the tail (##1234##).
If the data type's move operator does not invalidate its own data (i.e.
move is essentially a copy, as is the case with atomic types) then the
move assignment of ##y## onto ##Y## and ##x## onto ##X## is basically a
no-op. However, for types that do invalidate their own data when being
the source of a move (e.g. non-empty vectors and fbvectors), then the
end result will have bad data in place of ##X## and ##Y##.
Detection:
This bug has lain dormant for a while.
Very few people emplace into a vector, and those few who do could be
saved by using a copy-movable type like int.
The original test case did not use a data type which poisoned itself
after being the source of a move, so the tests did not notice any
oddities.
A new testsuite, which does poison itself, did notice.
Test Plan:
re-enable the test/stl_test mega-test. Run it. All tests
pass.
fbconfig -r folly && fbmake runtests_opt
Run fbvector through the new test suite (which initially caught the
error). It now passes.
Reviewed By: robbert@fb.com
FB internal diff:
D1257258
Hans Fugal [Thu, 3 Apr 2014 18:05:32 +0000 (11:05 -0700)]
A few missing includes
Summary: These were required to build folly on OSX.
Test Plan: build
Reviewed By: davejwatson@fb.com
FB internal diff:
D1256856
Hans Fugal [Thu, 3 Apr 2014 15:48:29 +0000 (08:48 -0700)]
(wangle) Use an atomic_flag to make FutureObject threadsafe
Summary:
There are two operations on `FutureObject` (the backing object that both `Future` and `Promise` front), which are not threadsafe currently. Those are `setContinuation` and `fulfil`. They're not threadsafe because they have a race condition between checking to see whether they should run the continuation and the other side making its modification. This diff introduces a `std::atomic_flag` variable to avoid the race and make these threadsafe.
NB Making `Future`/`Promise` threadsafe does not make this pattern safe:
f1.via(...).then(...).then(...)
(In a hypothetical world where `Future::via` is another name for `executeWithSameThread`)
There is a race between the future from `via` and the call of `then` (and between the first and second `then`s), so the `then`s could execute in the far thread as intended, or they could execute in the current thread (probably not what was intended). This diff does not solve that semantic problem of which thread this runs in. But it does make it safer, in that all those continuations will always execute, just maybe not in the thread you had intended.
You may ask what is the benefit if that semantic problem still exists? That's up for debate. I think the safety is worth it: at least everything a n00b throws at it will *work*. The question of thread semantics can iterate. If we end up with thread semantics that really don't need locks (e.g. maybe because we move to an Rx/Later style "launch" at the end of a chain) we can always toss this atomic.
How does this affect performance? I'm doing some experiments and going to write up my findings. Early results indicate that outlier performance is impacted but not by a lot, but don't count those chickens until I hatch them. Part of the reason for sending this diff out is to run windtunnel experiments.
Test Plan: tests, benchmark, close inspection
Reviewed By: davejwatson@fb.com
FB internal diff:
D1241822
Louis Kruger [Tue, 1 Apr 2014 20:22:42 +0000 (13:22 -0700)]
Fix TIMED_SYNCHRONIZED_CONST bug
Summary:
TIMED_SYNCHRONIZED_CONST is acquiring a read-write lock but releasing a shared lock. Chaos ensues.
@override-unit-failures
Test Plan: Add unit test, test times out before fix, passes after fix.
Reviewed By: andrei.alexandrescu@fb.com
FB internal diff:
D1251518
Blame Revision:
D327492
Tudor Bosman [Tue, 1 Apr 2014 17:36:27 +0000 (10:36 -0700)]
Add ability to silence callbacks for Subprocess::communicate
Summary:
Subprocess::communicate callbacks are level-triggered, which makes writing
"chatty" communication protocols difficult -- you often want to silence the
write callback until you read the expected message. Add
Subprocess::enableNotifications() for this purpose.
Test Plan: test added
Reviewed By: lucian@fb.com
FB internal diff:
D1251564
@override-unit-failures
Stepan Palamarchuk [Mon, 31 Mar 2014 21:19:54 +0000 (14:19 -0700)]
Add loopOnce() method to folly::EventBase
Summary: Add loopOnce() method which provides functionality similar to event_base_loop(base, EVLOOP_ONCE);
Test Plan: fbmake
Reviewed By: simpkins@fb.com
FB internal diff:
D1249753
Mikhail Okunev [Mon, 31 Mar 2014 18:51:55 +0000 (11:51 -0700)]
Utility that converts from prettyPrint format back to double (e.g. 10M = 10 000 000)
Summary: Utility is doing reverse of prettyPrint. This is a first sketch.
Test Plan:
1) We can reverse all tests from prettyPrint test and use for our function. For now I just reversed several of them
2) We can also test prettyPrint and prettyToDouble together by checking whether prettyToDouble(prettyPrint(X)) == X. This is implemented.
Reviewed By: marcelo.juchem@fb.com
FB internal diff:
D1159879
Hannes Roth [Thu, 27 Mar 2014 21:47:00 +0000 (14:47 -0700)]
(Folly/FBString) Use a lambda to throw an exception for NULL input
Summary:
This should be standard compliant. `__PRETTY_FUNCTION__` seems
unnecessary, it just prints `basic_fbstring`, might as well use that and
simplify the code.
Test Plan:
`fbconfig --platform-all=gcc-4.8.1-glibc-2.17-fb folly/test`
`fbmake runtests_dbg`
`fbmake runtests_opt`
`fbconfig --platform-all=gcc-4.7.1-glibc-2.14.1 folly/test`
`fbmake runtests_dbg`
`fbmake runtests_opt`
`fbconfig --clang folly/test`
`...`
Reviewed By: andrei.alexandrescu@fb.com
FB internal diff:
D1243670
Nicholas Ormrod [Wed, 26 Mar 2014 09:33:48 +0000 (02:33 -0700)]
NULL -> nullptr
Summary:
Change NULLs to nullptrs.
Facebook:
I was tired of seeing lint errors for NULL -> nullptr, so I
fixed it.
How: modified flint's tokenizer to output lines of the form
sed -i '__LINE__s|\<NULL\>|nullptr|g' __FILE__
for each NULL token encountered.
Ran the sed lines, restricted to filepaths with extensions
h,hpp,cc,cpp,tcc. Did not apply to FacebookUpdate, due to weird
formatting; hphp, to be done in a separate diff; payment, due to a large
number of generated text which didn't play well with my flow; and
memcache, which has lots of .h's that cannot contain nullptr's because
they are included from .c's.
@bypass-lint
Test Plan:
fbconfig -r common folly && fbmake opt && fbmake runtests_opt
^ of the 4k+ test cases, about two dozen are failing. Slightly more
failed in master than with my diff applied.
arc unit
Reviewed By: andrei.alexandrescu@fb.com
FB internal diff:
D1234261
Tom Jackson [Mon, 24 Mar 2014 18:54:02 +0000 (11:54 -0700)]
Range::contains(x)
Test Plan: Unit tests
Reviewed By: marcelo.juchem@fb.com
FB internal diff:
D1236630
Tudor Bosman [Thu, 20 Mar 2014 20:53:44 +0000 (13:53 -0700)]
Optionally specify page size in MemoryMapping ctor
Summary:
For proper rounding, and also so memOpInChunks doesn't try to mlock / munlock /
madvise / munmap in chunks smaller than the page size.
Test Plan: memory_mapping_test
Reviewed By: lucian@fb.com
FB internal diff:
D1232153
Hannes Roth [Thu, 20 Mar 2014 17:11:14 +0000 (10:11 -0700)]
(Wangle) Sanity check for the small_vector test
Summary:
Let's double check that `small_vector` is doing the right thing. So
it doesn't just accidentally work.
Test Plan:
`fbconfig folly/wangle && fbmake runtests`
`fbconfig --clang folly/wangle && fbmake runtests`
Reviewed By: marccelani@fb.com
FB internal diff:
D1231360
Dave Watson [Thu, 13 Mar 2014 17:18:56 +0000 (10:18 -0700)]
EventBase cleanup
Summary: Moar c++11 features. marccelani's comments in
D1195393, but in a separate diff.
Test Plan:
contbuild
fbconfig thrift/lib/cpp/test/
fbmake runtests
Reviewed By: rajat@fb.com
FB internal diff:
D1219158
Nima Aghdaii [Tue, 11 Mar 2014 00:58:29 +0000 (17:58 -0700)]
Performance Improvement for AsciiCaseInsensitive
Summary:
This implementation improves the performance of AsciiCaseInsensitive.
AsciiCaseInsensitive uses toupper, and it's slow.
Since toupper only works for ascii characters and this function does exactly the same thing over the range of [0..256), we can gain 3x performance here.
Test Plan: unit test and benchmark
Reviewed By: lucian@fb.com
FB internal diff:
D1217596
@override-unit-failures
Hannes Roth [Wed, 19 Mar 2014 23:45:58 +0000 (16:45 -0700)]
(Wangle) Fix tests for clang
Summary: `std::async` doesn't play nicely with our clang. Replace it with `std::thread`.
Test Plan: `fbconfig --clang folly/wangle && fbmake runtests`
Reviewed By: marccelani@fb.com
FB internal diff:
D1230197
Tudor Bosman [Wed, 19 Mar 2014 04:57:17 +0000 (21:57 -0700)]
Harden usingJEMalloc()
Summary:
In a shared library, we're using whichever memory allocator the main program
uses, but we may still believe we're using jemalloc if we load libjemalloc.so
(because rallocm is defined). This means we'll pass to rallocm pointers that
were not allocated by jemalloc, which is bad.
Test Plan: tests added
Reviewed By: ngbronson@fb.com
FB internal diff:
D1228483
Tom Jackson [Wed, 12 Mar 2014 23:31:41 +0000 (16:31 -0700)]
range(), for making Range<T*> from arrays and std::vector
Summary: So people can more easily write functions which take contiguous values from memory.
Test Plan: Unit tests
Reviewed By: tudorb@fb.com
FB internal diff:
D1217809
Tianjiao Yin [Tue, 18 Mar 2014 00:33:48 +0000 (17:33 -0700)]
Add constexpr specifier for small_vector::max_size
Summary: Now we could use small_vector::max_size in constant expressions
Test Plan: unittest
Reviewed By: delong.j@fb.com
FB internal diff:
D1224274
Tudor Bosman [Mon, 17 Mar 2014 20:24:07 +0000 (13:24 -0700)]
Unbreak Symbolizer with small ElfCache
Test Plan: fbconfig -r folly/experimental/symbolizer && fbmake runtests_opt && fbmake runtests
Reviewed By: simpkins@fb.com
FB internal diff:
D1224552
@override-unit-failures
Alexey Spiridonov [Mon, 17 Mar 2014 22:59:25 +0000 (15:59 -0700)]
Move commited bits out of folly
Summary: Preparing to land the other diffs. No code changes here, just moving files around.
Test Plan: fbconfig bistro/common/cron/test bistro/common/cron/utils/test ; fbmake runtests
Reviewed By: yinwang@fb.com
FB internal diff:
D1225159
Marc Celani [Mon, 17 Mar 2014 16:17:50 +0000 (09:17 -0700)]
sorted_vector_types have move inserts
Summary: sorted_vector_types were missing move inserts that come with std::map in c++11. This prevents me from using move iterators in folly::merge use case.
Test Plan: unit tests
Reviewed By: delong.j@fb.com
FB internal diff:
D1223426
Marc Celani [Sun, 16 Mar 2014 03:04:47 +0000 (20:04 -0700)]
folly::merge() - std::merge() with stronger guarantees (probably same implementation in practice)
Summary:
std::merge() does not guarantee the ordering when equal elements belong in two ranges(comparator(it_a, it_b) == comparator(it_b, it_a) == 0). For maps, it is important that we can specify the ordering (see array_merge in php, where we guarantee which array's value will be present in the output if a key is present in both inputs).
Also removes folly::merge that is specfic for sorted_vector_map since this will not be needed. NOTE: I expect this to break feed, will fix in a separate non-folly diff.
Test Plan: This implementation is directly ripped from cppreference.com, but unit tests added none-the-less. Specifically, one is added where the output is a std::map to demonstrate its usefulness.
Reviewed By: delong.j@fb.com
FB internal diff:
D1223401
@override-unit-failures
Marc Celani [Sun, 16 Mar 2014 03:00:45 +0000 (20:00 -0700)]
sorted_vector_types does not work with std::inserter
Summary:
The signature of insert(hint, const val& v) is wrong. It should return an iterator, not pair<iterator, bool>. This breaks std::inserter, making it impossible to use this for std::merge. I plan to create folly::merge (std::merge with stronger semantics when equal values are present in the two input ranges), so I need this fixed.
Given that the documentation claims this is a "drop in replacement" for std::map, I figure we should fix this.
Test Plan: reran unit tests
Reviewed By: delong.j@fb.com
FB internal diff:
D1223396
Marc Celani [Fri, 14 Mar 2014 02:52:09 +0000 (19:52 -0700)]
Introduce a merge() function for folly::sorted_vector_map
Summary:
Feed spends a non trivial amount of time merging two sorted_vector_maps. Writing code for this efficiently is actually a little tricky, and its much easier to maintain the simpler code. This adds merge() to folly so that its easy for feed and fast. Benchmarks with large input sizes show this is a gigantic win (moving from O(n^2) to O(n).
Test Plan: unit tests, benchmark
Reviewed By: delong.j@fb.com
FB internal diff:
D1221725
@override-unit-failures
Marcus Holland-Moritz [Thu, 13 Mar 2014 00:27:09 +0000 (17:27 -0700)]
Make sure folly::dynamic arrays can be used with folly::gen
Summary:
Define a value_type for folly::dynamic to make arrays work with
folly::gen::from.
Test Plan:
- added new unit test
- fbconfig folly/test && fbmake runtests
Reviewed By: tjackson@fb.com
FB internal diff:
D1216358
Dave Watson [Wed, 12 Mar 2014 16:25:43 +0000 (09:25 -0700)]
Move thrift/lib/cpp/async to folly.
Summary:
Move the minimum amount of stuff and still have everything compile. Would like to move TAsyncSocket/ServerSocket/SSL/UDP eventually, but not this round.
thrift async is used very widely now: thrift, proxygen, newer mysql async interface, even trying it out in memcache. A common complaint is that it doesn't get wide enough notice under thrift/, so let's move it to folly/. After moving TAsyncSocket, both HHVM and proxygen could avoid a dep on thrift as well.
Changes:
* mv files to folly/io/async
* remove 'T' prefix on classes/filenames
* change namespace to 'folly'
* remove any thrift references.
Tried this before in
D470080, this time doesn't attempt to abstract libevent
@override-unit-failures
Test Plan:
fbconfig -r thrift; fbmake dev.
Will iterate on any other contbuild failures
Reviewed By: pgriess@fb.com
FB internal diff:
D1195393
Philip Pronin [Wed, 12 Mar 2014 08:00:52 +0000 (01:00 -0700)]
update FOLLY_IS_TRIVIALLY_COPYABLE
Summary:
Let's make sure that boost version is intented to mean exactly
the same as `std::is_trivially_copyable` (see 9 [class] / 6) to avoid any
confusion (current boost path is more close to
`std::is_trivially_copy_constructible` than to
`std::is_trivially_copyable`; UPD: unfortunately, old versions of boost
don't support `boost::has_trivial_move_constructor` and friends, so I
can't completely mimic `std::is_trivially_copyable` here).
As mentioned in the original comment, `__has_trivial_copy` returns 1 in
case of deleted copy ctor in clang (contradicts 12.8 [class.copy] / 13 +
8.4.2 [dcl.fct.def.default] / 4), which makes `FOLLY_IS_TRIVIALLY_COPYABLE`
accept `std::unique_ptr<>`; using `boost::has_trivial_destructor` would
at least save us from the problems in this case.
Alternative "solution" may be to rename `FOLLY_IS_TRIVIALLY_COPYABLE` to
`FOLLY_IS_TRIVIALLY_COPY_CONSTRUCTIBLE`, and make sure
`folly::small_vector` won't call dtor when memcopies the data around.
Test Plan: fbconfig --clang folly/test:small_vector_test && fbmake runtests_opt (fails in trunk, passes with this diff)
Reviewed By: pgriess@fb.com
FB internal diff:
D1216158
David Vickrey [Mon, 10 Mar 2014 22:55:41 +0000 (15:55 -0700)]
Add control of floating point serialization to JSON serialization
Summary: Title. Note that this is a no-op with default parameters because folly::toAppend(double, &dest) calls folly::toAppend(double, &dest, DtoaMode, numDigits) with DtoaMode = SHORTEST and numDigits = 0.
Test Plan: Tested new functionality in
D1212547.
Reviewed By: kelarini@fb.com
FB internal diff:
D1212617
Adam Simpkins [Thu, 6 Mar 2014 00:28:09 +0000 (16:28 -0800)]
fix Cursor's copy constructor
Summary:
The Cursor class didn't provide a copy constructor accepting a
"const Cursor&". The existing constructor only accepted references to
non-const Cursor.
This updates the constructor to also accept "const Cursor&". I also
made the template parameter checking more strict, so that it only
accepts other CursorBase classes. This prevents the compiler from
thinking that a Cursor can be constructed from any other possible type
when performing overload resolution.
Test Plan: Ran all of the folly cursor tests.
Reviewed By: davejwatson@fb.com
FB internal diff:
D1208428
Marcus Holland-Moritz [Mon, 10 Mar 2014 18:35:00 +0000 (11:35 -0700)]
Support numeric types as targets for folly::split
Summary:
This extends the fixed version of folly::split to support numeric types
as targets in addition to string pieces. I was almost certain this was
already possible when I recently reviewed some code that did
folly::StringPiece source, target, strFrequency;
int frequency;
if (folly::split('\t', line, source, target, strFrequency) &&
(frequency = folly::to<unsigned int>(strFrequency)) > 0)
and was about to suggest changing the above into:
folly::StringPiece source, target;
int frequency;
if (folly::split('\t', line, source, target, frequency) && frequency > 0)
I double checked and saw that only splitting to string pieces was supported.
In the meantime I came across this pattern again and decided to just make
it work because it's really convenient.
The implementation should be fully backwards compatible.
Test Plan:
- New unit tests
- fbconfig -r folly && fbmake runtests
- Applied to github release, ./configure && make check
Reviewed By: andrei.alexandrescu@fb.com
FB internal diff:
D1187004
Will Hodges [Mon, 10 Mar 2014 17:15:35 +0000 (10:15 -0700)]
Add setPort() to folly::URI class.
Summary:
Add setPort() method to URI class for easy port replacement in
URIs.
Facebook:
Perform port replacement in WriteProcessor.cpp in a way that
supports URI schemes. Add setPort() method to URI class to replace
the port number in the authority portion of the URI.
Test Plan: Test in debugger for dfsrouter changes.
Reviewed By: tudorb@fb.com
FB internal diff:
D1209120
Philip Pronin [Fri, 7 Mar 2014 08:49:24 +0000 (00:49 -0800)]
folly/experimental/Bits.h + ASan
Summary: Allow disabling ASan for `folly::Bits`.
Test Plan: [fb-only]
Reviewed By: soren@fb.com
FB internal diff:
D1208584
Andrey Goder [Fri, 7 Mar 2014 22:50:07 +0000 (14:50 -0800)]
Fix comment
Summary: This should be 'docs' not 'doc'. Too bad now it exceeds 80 chars :(.
Test Plan: n/a
Reviewed By: simpkins@fb.com
FB internal diff:
D1209738
@override-unit-failures
Hannes Roth [Fri, 7 Mar 2014 16:02:11 +0000 (08:02 -0800)]
(Wangle) Support .then(function pointer) syntax
Summary:
Support `.then(&static_function)`, `.then(&static_member_function)`, `.then(&Class::static_member_function)`, `.then(instance, &Class::member_function)` in Wangle.
C++ does not allow `.then(instance, &member_function)`, sadly.
This implementation just creates the closure for you and defers to the existing `then` implementations.
Test Plan: Added a test.
Reviewed By: hans@fb.com
FB internal diff:
D1204954
Philip Pronin [Thu, 6 Mar 2014 01:45:28 +0000 (17:45 -0800)]
use 0666 as the default permissions for new files
Summary: Seems like there is no real need to restrict permissions by default?
Test Plan: fbconfig -r folly/test && fbmake runtests_opt
@override-unit-failures
Reviewed By: tudorb@fb.com
FB internal diff:
D1205527
Hannes Roth [Thu, 6 Mar 2014 01:39:47 +0000 (17:39 -0800)]
(Wangle) Remove some early returns in tests
Summary:
I guess they sneaked in when testing.
Also remove an `EXPECT_NE` that depended on `std::move` actually moving.
Test Plan: All the tests.
Reviewed By: hans@fb.com
FB internal diff:
D1204971
Hannes Roth [Wed, 5 Mar 2014 17:50:28 +0000 (09:50 -0800)]
(Wangle) Actually support the universal reference used in whenAll
Summary:
Need to use `std::decay` to actually support the universal reference.
The futures are moved in, and invalidated.
Test Plan: Test; does not compile before.
Reviewed By: hans@fb.com
FB internal diff:
D1199841
Shuo Li [Tue, 4 Mar 2014 19:55:59 +0000 (11:55 -0800)]
Replace random_device/mt19937 with folly/Random
Summary: Replace random_device/mt19937 with folly/Random to increase hygiene of using Random
Test Plan:
For each file is changed, fbmake -opt is run; except one file: stealing_test.cc, since the TARGETS file is not under the path.
All fbmake are successfully passing
Reviewed By: bmaurer@fb.com
FB internal diff:
D1199483
Blame Revision: v1
Hannes Roth [Mon, 3 Mar 2014 22:45:10 +0000 (14:45 -0800)]
(Wangle) whenAll should take rvalue references instead of references
Summary: Don't need to keep the old futures around.
Test Plan: `FutureTest.cpp`
Reviewed By: hans@fb.com
FB internal diff:
D1197360
Yedidya Feldblum [Mon, 3 Mar 2014 22:33:02 +0000 (14:33 -0800)]
Fix off-by-one affecting benchmark numbers in folly/io.
Summary: Fix off-by-one affecting benchmark numbers in folly/io.
Test Plan:
$ fbconfig -r folly/io/test
$ fbmake --fast opt
$ _build/opt/folly/io/test/iobuf_cursor_test --benchmark
$ _build/opt/folly/io/test/iobuf_network_bench --benchmark
Reviewed By: simpkins@fb.com
FB internal diff:
D1199679
Blame Revision:
D344018
Hans Fugal [Mon, 3 Mar 2014 20:57:29 +0000 (12:57 -0800)]
Add Wangle README.md
Summary:
Facebook:
Moving from Dex.
Transliteration from whatever wiki format Dex uses to Markdown
Some minor corrections/additions.
Test Plan: Pasted into a private gist and it looks reasonable on github.
Reviewed By: davejwatson@fb.com
FB internal diff:
D1199510
Marc Celani [Mon, 3 Mar 2014 19:36:05 +0000 (11:36 -0800)]
Make it easy to wrap pre-existing cob-style async apis
Summary:
Tao neesd a way to wrap its c-style async apis with Later. Although my comments suggest that you can do this, it turns out I never got around to implementing it. Well, here is the implementation.
Basically, we supply the callback to the pre-existing api, and that callback will fulfill a promise that is used internally within Later. This is thread safe because the async call is not made until the starter is fired, and we can use the future immediately for chaining then() calls.
Test Plan: unit test
Reviewed By: hannesr@fb.com
FB internal diff:
D1197721
Marcelo Juchem [Wed, 26 Feb 2014 23:46:51 +0000 (15:46 -0800)]
Making folly/Benchmark.cpp clangable
Summary: trunk fails to compile under clang: https://phabricator.fb.com/P6426175
Test Plan: ran some benchmarks and checked output
Reviewed By: andrei.alexandrescu@fb.com
FB internal diff:
D1192933
Hannes Roth [Mon, 3 Mar 2014 17:18:59 +0000 (09:18 -0800)]
(Folly) Fix error when compiling with clang
Summary:
folly/Benchmark.cpp:427:9: error: logical not is only applied to the left hand side of this comparison
if (!strcmp(get<1>(benchmarks[i]), "-") == 0) {
Since the `!` binds to `strcmp`, removing both the `!` and the `== 0`
should be equivalent.
Reviewers of diff that introduced this line:
D490324
Test Plan: I compiled `tao/client` with/without this diff.
Reviewed By: delong.j@fb.com
FB internal diff:
D1196452
Blame Revision: rFBCODE6f5eea5fcd23044a5c579b040bf45d17006b4adf
Peter Griess [Tue, 25 Feb 2014 23:54:23 +0000 (15:54 -0800)]
Make Folly cpp_library targets more granular
Summary:
- Some users of Folly don't want to pull in the entire library just to
use one feature (e.g. folly::to<T>). Throw those users a bone by
breaking Folly up into a few discrete chunks: :uri, :range, :string,
:format, etc. Leave the top-level :folly target alone so that existing
users don't have to be changed.
- Update some Thrift and Proxygen users to use the more granular
targets.
Test Plan: - Phabricator contbuild
Reviewed By: tudorb@fb.com
FB internal diff:
D1192765
Paul Tarjan [Fri, 28 Feb 2014 09:25:57 +0000 (01:25 -0800)]
kill unused vars in folly
Summary: these print as errors when compiling hhvm opensource
Test Plan: none
Reviewed By: tudorb@fb.com
FB internal diff:
D1195649
Anton Likhtarov [Thu, 27 Feb 2014 01:51:49 +0000 (17:51 -0800)]
Easy: fix signed/unsigned comparisons
Test Plan: build with -Wsign-compare, no warnings
Reviewed By: njormrod@fb.com
FB internal diff:
D1193502
Nathan Bronson [Thu, 27 Feb 2014 17:32:50 +0000 (09:32 -0800)]
make FB_LOG_EVERY_MS thread safe
Summary:
Use compare_exchange_strong to update the previous time so that
there is no race. This diff also adds microbenchmarks.
Test Plan: unit tests
Reviewed By: andrei.alexandrescu@fb.com
FB internal diff:
D1191217
Hans Fugal [Sat, 22 Feb 2014 00:22:15 +0000 (16:22 -0800)]
(wangle) more comment tweaks
Test Plan: eyeballs
Reviewed By: hannesr@fb.com
FB internal diff:
D1185813
Hans Fugal [Fri, 21 Feb 2014 18:52:22 +0000 (10:52 -0800)]
(wangle) comment cleanup
Summary: Cleaning up some inaccuracies, adding just a little detail in a few places, and trying very hard not to get OCD about the commenting style.
Test Plan: still builds
Reviewed By: hannesr@fb.com
FB internal diff:
D1184910
Hans Fugal [Fri, 21 Feb 2014 18:33:24 +0000 (10:33 -0800)]
s/valueTry/getTry/
Summary: This is a better name
Test Plan: unit tests. fbgs shows no external usage of this.
Reviewed By: hannesr@fb.com
FB internal diff:
D1184905
Hans Fugal [Fri, 21 Feb 2014 18:15:31 +0000 (10:15 -0800)]
(wangle) remove Future::wait
Summary: pulling the trigger
Test Plan: Unit tests. Wait for contbuild and dependent unit tests
Reviewed By: hannesr@fb.com
FB internal diff:
D1184842
Hans Fugal [Fri, 21 Feb 2014 18:10:03 +0000 (10:10 -0800)]
Try Contains enum as an enum class
Summary: Somebody set us up the enum
Test Plan: Unit tests still build and pass. Will see if dependencies build and their unit tests pass. But I don't think anyone uses this outside of `Try` (they shouldn't anyway).
Reviewed By: hannesr@fb.com
FB internal diff:
D1184839
Stepan Palamarchuk [Tue, 25 Feb 2014 22:42:55 +0000 (14:42 -0800)]
Add method, that constructs Try<T> based on the result of functor.
Summary:
Usually we construct Try<T> as a result of execution of some functor.
And we need to treat void and non-void functors in similar way, but that requires different, yet similar pieces of code.
This diff simplifies future usage of Try.
Test Plan: compile only
Reviewed By: andrii@fb.com
FB internal diff:
D1190296
Adam Simpkins [Thu, 20 Feb 2014 23:28:50 +0000 (15:28 -0800)]
add operator +, ==, and != to Cursor classes
Summary:
Add operator+, which returns a new Cursor pointing the specified number
of bytes ahead. Cursor already implemented a += operator.
Also add == and != operators for checking to see if two cursors are
pointing to the same location. Note that some derived cursor classes do
contain additional state, and we don't consider that state when
comparing for equality. For instance, two Appenders pointing to the
same location will compare as equal, even if they are configured with
different growth parameters. It seems like this is the behavior most
users will expect, but let me know if you have concerns about this.
Test Plan: Updated the unit tests to exercise the new operators.
Reviewed By: davejwatson@fb.com
FB internal diff:
D1183537
Andrew Gallagher [Tue, 25 Feb 2014 22:18:00 +0000 (14:18 -0800)]
folly: install missing headers from Makefile.am
Test Plan: Built folly on ubuntu 13.04 and 13.10
Reviewed By: davejwatson@fb.com
FB internal diff:
D1190155
Andrew Gallagher [Tue, 25 Feb 2014 19:53:29 +0000 (11:53 -0800)]
Fix inclusions of double-conversion to use proper path
Summary: Will commit in tandem with
D1171409.
Test Plan: built folly
Reviewed By: tudorb@fb.com
FB internal diff:
D1189713
Ben Maurer [Tue, 25 Feb 2014 18:40:58 +0000 (10:40 -0800)]
Fix random tests
Summary: Was broken but didn't notice it in all the random test failures
Test Plan: fbmake runtests
Reviewed By: njormrod@fb.com
FB internal diff:
D1189113
Dave Watson [Fri, 21 Feb 2014 20:59:25 +0000 (12:59 -0800)]
Move wangle to folly
Summary:
* git mv
* codemod facebook::wangle folly::wangle
* Change 'runnable' to be a base class in wangle instead of thrift
Justification:
* std::future doesn't have then, whenall, etc.
* boost::future doesn't support executors
@override-unit-failures
Test Plan: contbuild and pray
Reviewed By: hans@fb.com
FB internal diff:
D1185194
Tudor Bosman [Mon, 24 Feb 2014 23:39:46 +0000 (15:39 -0800)]
Leak ELF file cache that the signal handler uses
Summary: so we can still handle signals during global destruction. (d'oh)
Test Plan: unittests
Reviewed By: philipp@fb.com
FB internal diff:
D1188159
Tudor Bosman [Mon, 24 Feb 2014 22:56:23 +0000 (14:56 -0800)]
Harden failure signal handler in the face of memory corruptions
Summary:
@mhorowitz got
*** Aborted at
1393267847 (Unix time, try 'date -d @
1393267847') ***
*** Signal 11 (SIGSEGV) (0x0) received by PID 12652 (TID 0x7f59cbfff700), stack trace: ***
pure virtual method called
terminate called without an active exception
Entered fatal signal handler recursively. We're in trouble.
in a test, and no stack trace.
The first time we enter recursively (ie. the second time overall), try to dump
without symbolization. The next time, give up.
Test Plan: folly/experimental/symbolizer/test, ran crash with a modified dumpStackTrace to force it to enter recursively
Reviewed By: lucian@fb.com
FB internal diff:
D1187942
Ben Maurer [Tue, 25 Feb 2014 02:37:24 +0000 (18:37 -0800)]
Random number generator utilities for folly
Summary:
In looking at how people were using common/base/Random, I noticed
a number of issues with our current usage of random number generators
1) People would simply declare a RandomInt32 without seeding it. This
results in a predictable seed
2) We initialize a Mersenne Twister RNG from a single int32. This
causes us to have a more predictable starting sequence of numbers
3) People aren't consistently using thread-local RNGs
4) Many of the APIs lack consistency. For example random32 takes a
max parameter that is exclusive while uniformRandom32 uses inclusive
boundries
I'm hoping a better API can fix this. thread_prng implements the Generator
concept with result_type = int32. It isn't actually a random number generator,
but it uses a thread local to point to a real generator. An advantage
of this is that it can be used in existing APIs but that it doesn't expose
the implementation of the RNG via the header file. One thing that's a bit
weird about it is that if you copy the object across threads it could
cause an error.
The Random class provides utilities that take any type of random number
generator. This has the advantage of allowing the user to pass a RNG
meant for testing or a secure RNG based on /dev/random. Another advnatage
is if you're woried about the performance of TLS lookups, you can
cache a local thread_prng which memoizes the TLS lookup.
If available, we use a SIMD optimized MT API
Some open questions:
1) What functions should be in random
2) Should the default RNG be a 64 or 32 bit based RNG
Test Plan: Benchmark runs
Reviewed By: simpkins@fb.com
FB internal diff:
D1181864
Tom Conerly [Tue, 18 Feb 2014 07:10:21 +0000 (23:10 -0800)]
Fix clang folly::to failure
Summary:
Converting an enum class to a string fails with clang.
Adfinder clang build failure is http://ci-fbcode.fb.com:8080/builders/project/builds/146520/steps/build/logs/stdio
Our version of clang supports std::underlying_type so use that implementation instead.
Test Plan:
fbconfig -r folly && fbmake runtests (only failure is folly/experimental/symbolizer/test:symbolizer_test which failed before this diff)
fbconfig --clang folly/test:conv_test && fbmake runtests (fbconfig -r --clang folly fails and fbconfig --clang folly/test && fbmake has some unrelated compile errors)
Build adfinder with clang
Reviewed By: delong.j@fb.com
FB internal diff:
D1178770
Nicholas Ormrod [Mon, 24 Feb 2014 20:53:47 +0000 (12:53 -0800)]
Fix FBString's new includes
Summary:
The headers <ext/hash*> were being included but not used when
_LIBSTDCXX_FBSTRING is defined. They have been relocated to within the
appropiate header block.
Test Plan:
fbconfig -r folly && fbmake runtests_opt
copy FBString and Malloc into libgcc, then
tp2_build libgcc/4.8.1/gcc-4.8.1-glibc-2.17-fb
Reviewed By: pgriess@fb.com
FB internal diff:
D1187345
Nicholas Ormrod [Mon, 24 Feb 2014 18:40:39 +0000 (10:40 -0800)]
Remove disallowed &* of FwdIterator
Summary:
Iterators are not required to dereference into lvalues, so
taking the address of the dereferenced value of a general iterator
may cause a compile-time error.
This bug was observed when compiling clang-3.4. Clang uses a custom
iterator type when calling fbstring::replace, whose dereference operator
returns a char (instead of the 'expected' const char&).
FBString takes the address of the dereference in order to test if the
iterator is actually an iterator referencing its own data. This protects
the string from data trampling in certain cases. See the added test case
for an example.
For sequence containers, the standard specifies that supplying interal
iterators for such operations is forbidden. The standard also states
that the iterators passed into containers will be dereferenced at each
location exactly once. The standard (from by too-brief inspection) does
not specify either of these restrictions for strings, which I find odd.
As a compromise between safety and strict compliance, the offending code
is now only run when the iterator type is either fbstring::iterator or
fbstring::const_iterator. In these cases, we know that it is safe to
both dereference the iterator multiple times and to take its
dereference's address.
While fixing this error, I noticed that fbstring::replaceImpl was
public. It is now private.
Test Plan:
Added a new test case to FBStringTest.cpp.
fbconfig -r folly && fbmake opt && fbmake runtests_opt
Reviewed By: delong.j@fb.com
FB internal diff:
D1185655
Peter Griess [Sat, 1 Feb 2014 04:08:02 +0000 (20:08 -0800)]
Try again to fix hash<fbstring> namespacing
Summary:
- Unfortunately when
D1152140 broke the Android build, which uses the
Bionic C++ standard library, and which Boost doesn't auto-detect. Deal
with this by manually picking namespaces for template specialization
based on #defines.
Test Plan:
- fbconfig -r folly/ unicorn/utils/ && fbmake runtests
- Build Liger on iOS and Android
Reviewed By: andrei.alexandrescu@fb.com
FB internal diff:
D1154569
Blame Revision:
D1152140
Alexey Spiridonov [Thu, 20 Feb 2014 00:39:17 +0000 (16:39 -0800)]
Part 2: Crontab selector
Summary: See docblock in CrontabSelector.h.
Test Plan: unit test
Reviewed By: agoder@fb.com
FB internal diff:
D1181803
Tudor Bosman [Thu, 20 Feb 2014 21:20:00 +0000 (13:20 -0800)]
Better support for folly::Range with non-const iterators underneath
Summary:
Implicitly construct Range<To> from Range<From> if From is implicitly
convertible to To.
Explicitly construct Range<To> from Range<From> if To is (explicitly)
constructible from From.
Add special-cases for Range<char*>, Range<unsigned char*> similar to the
ones for Range<const char*>, Range<const unsigned char*>.
Test Plan: test added
Reviewed By: philipp@fb.com
FB internal diff:
D1182999
Alexey Spiridonov [Thu, 20 Feb 2014 00:17:58 +0000 (16:17 -0800)]
Part 1: Local time label <=> UTC timestamp conversion
Summary: See the block comment in date_time_utils.h -- the actual Cron code comes in later diffs.
Test Plan: unit tests
Reviewed By: agoder@fb.com
FB internal diff:
D1181554
Omry Yadan [Thu, 20 Feb 2014 01:33:43 +0000 (17:33 -0800)]
allow folly Cursor to read and write floats
Summary: and doubles!
Test Plan: none really, will test later for now it compiles
Reviewed By: tudorb@fb.com
FB internal diff:
D1175021
Tudor Bosman [Wed, 19 Feb 2014 04:20:15 +0000 (20:20 -0800)]
Make IOBuf support 64-bit length and capacity
Summary:
Remove type_ (unused), pack flags in least significant bits of sharedInfo_.
sizeof(IOBuf) remains 56 bytes.
Test Plan: folly/io/test with -opt and -dbg; iobuf*_test with asan as well.
Reviewed By: simpkins@fb.com
FB internal diff:
D1179993
Bo Liu [Tue, 18 Feb 2014 23:25:13 +0000 (15:25 -0800)]
add clone() of stack allocated memory for folly::Cursor and folly::IOBuf
Summary: as title
Test Plan: fbconfig folly/io/test/ && fbmake runtests
Reviewed By: simpkins@fb.com
FB internal diff:
D1176922
Andrei Alexandrescu [Sat, 15 Feb 2014 01:41:14 +0000 (17:41 -0800)]
Use standard variadic macros instead of gcc-specific ones
Summary: We've intentionally eliminated support for gcc's old variadic macro syntax so as to bring our close in line with compatbile standards. This diff enables folly to build using warp.
Test Plan: built folly
Reviewed By: delong.j@fb.com
FB internal diff:
D1176956
Peter Griess [Wed, 29 Jan 2014 17:46:29 +0000 (09:46 -0800)]
Use #if rather than #ifdef for FOLLY_HAVE_WEAK_SYMBOLS
Summary:
- We need to be able to disable FOLLY_HAVE_WEAK_SYMBOLS via
-DFOLLY_HAVE_WEAK_SYMBOLS=0. Switch the #ifdef checks to #if.
Test Plan:
- fbconfig -r folly && fbmake runtests
- Build in fbobjc
Reviewed By: andrei.alexandrescu@fb.com
FB internal diff:
D1150036
Jim Meyering [Sat, 8 Feb 2014 00:21:17 +0000 (16:21 -0800)]
folly: avoid false-positive ASAN-abort from SignalHandlerTest
Summary:
Without this change, the sig-handling test's deliberate
invalid access would trigger an ASAN-abort, which differed
from the expected SEGV. Skip this test when ASAN is enabled.
* folly/experimental/symbolizer/test/SignalHandlerTest.cpp: Include
CPortability.h for definion of FOLLY_SANITIZE_ADDRESS.
(SignalHandler) [FOLLY_SANITIZE_ADDRESS]: Provide a different
regexp to match the first line of output from an ASAN-enabled binary.
Test Plan:
fbconfig --sanitize=address --platform-all=gcc-4.8.1-glibc-2.17 \
folly/experimental/symbolizer/test:signal_handler_test \
&& fbmake --fast runtests \
&& fbmake --fast runtests_opt
Sample output, before this change: https://phabricator.fb.com/P5428975
(search down to first AddressSanitizer abort.
With this change, expect that test to pass.
Reviewed By: lucian@fb.com
FB internal diff:
D1164768
Tom Jackson [Fri, 7 Feb 2014 18:55:14 +0000 (10:55 -0800)]
Removing redirects
Test Plan: contbuild
Reviewed By: philipp@fb.com
FB internal diff:
D1164211
Qingyuan Deng [Fri, 7 Feb 2014 22:03:19 +0000 (14:03 -0800)]
<Thrift perftest> folly: modify Histogram const, add substract
Summary:
This diff is a split from
D1157286 for folly part;
adds a substract function which substracts a histogram data from another;
modifies some of the const specifiers in the Histogram class.
Test Plan: tested on the thrift perftest by adding x-th percentile latency stats
Reviewed By: andrei.alexandrescu@fb.com
FB internal diff:
D1158270
Sean Cannella [Fri, 7 Feb 2014 14:25:43 +0000 (06:25 -0800)]
Fix OS X compilation
Summary: Fix OS X compilation
Test Plan: compiled on OS X
Reviewed By: delong.j@fb.com
FB internal diff:
D1163199
Jim Meyering [Fri, 7 Feb 2014 05:01:36 +0000 (21:01 -0800)]
folly: ASAN-exempt scanHaystackBlock, to avoid an FP buffer overrun
Summary:
scanHaystackBlock may read-overrun the needle.data() buffer by
up to 15 bytes, but that overrun will never cross a page boundary.
The fix is to turn off ASAN-checking for this function, but since
that attribute is accompanied by a "noinline" one (which conflicts
with the function's own "inline"), I have also removed the "inline"
attribute on both decl and defn. That is a good thing, regardless:
these days, there are very few cases in which we should be trying to
tell the compiler to inline.
Test Plan:
Before, this would elicit an ASAN abort. Now it passes 100%:
fbconfig --platform-all=gcc-4.8.1-glibc-2.17 --sanitize=address \
folly/test:range_test && fbmake runtests
Reviewed By: philipp@fb.com
FB internal diff:
D1162982
Tudor Bosman [Thu, 6 Feb 2014 04:13:40 +0000 (20:13 -0800)]
Cache open ELF files in Symbolizer
Summary:
Rather than opening and closing Elf files every time we symbolize them, we open
the first time and cache.
We're using two caches: one for the signal handler (fixed size, slow, but
async-signal-safe) and one for exception tracing and general use.
Also, unrelated, removed two useless frames from the stack trace dump in the
signal handler.
Test Plan: tests added
Reviewed By: lucian@fb.com
FB internal diff:
D1161444
Philip Pronin [Thu, 6 Feb 2014 08:09:22 +0000 (00:09 -0800)]
fix missing change from
D1156950
Test Plan: fbconfig -r folly/experimental/test:eliasfano_test && fbmake runtests_opt
Reviewed By: lucian@fb.com
FB internal diff:
D1161670
Tom Jackson [Wed, 5 Feb 2014 02:15:58 +0000 (18:15 -0800)]
Codemod following promotion
Summary:
Changing all the include paths following
D1151911.
Depends on
D1151911
Test Plan: contbuild
Reviewed By: ldbrandy@fb.com
FB internal diff:
D1159003
Facebook:
Contbuild is mostly passed, remaining failures are unrelated. I'm confident other failures are unrelated.
@override-unit-failures
Tom Jackson [Wed, 29 Jan 2014 21:50:24 +0000 (13:50 -0800)]
Promoting out of experimental
Summary:
At long last, promoting this out of experimental. Also, while I'm at
it, I've separated the tests and benchmarks into their corresponding parts.
Redirect headers provided.
Test Plan: Unit tests, contbuild.
Reviewed By: marcelo.juchem@fb.com
FB internal diff:
D1151911
Yan Wu [Wed, 5 Feb 2014 09:31:38 +0000 (01:31 -0800)]
raise error when parsing object with NaN or INF to JSON
Summary:
NaN or INF is not allowed according to JSON specification.
This will cause problems when other places try to encode the output
of toJson with NaN or INF.
raise error when parsing object with NaN or INF to JSON.
Test Plan: manually test, raise error for object w/ NaN
Reviewed By: delong.j@fb.com
FB internal diff:
D1143853
Dhruv Matani [Wed, 5 Feb 2014 06:15:15 +0000 (22:15 -0800)]
Replace CHECK_GT with DCHECK_GT in folly::Range::operator[]
Summary: Since I don't want to pay the cost when we access array elements. If I did, I would just use Java.
Test Plan: fbconfig folly/test/ && fbmake runtests
Reviewed By: andrei.alexandrescu@fb.com
FB internal diff:
D1158505
Tudor Bosman [Wed, 5 Feb 2014 00:23:43 +0000 (16:23 -0800)]
Fix rare corruption in StaticMeta::head_ list around fork
Summary:
In a rare case, the current thread's would be inserted in the StaticMeta linked
list twice, causing the list to be corrupted, leading to code spinning forever.
After a fork, in the child, only the current thread survives, so all other threads
must be forcefully removed from StaticMeta. We do that by clearing the list
and re-adding the current thread, but we didn't check whether the current thread
was already there. It is possible for the current thread to not be in the list
if it never used any ThreadLocalPtr objects with the same tag.
Now, when the thread in the child tries to use a ThreadLocalPtr with the same
tag, it adds itself to the list (##if (prevCapacity == 0)
meta.push_back(threadEntry)##), but it had already been added by the post-fork
handler, boom.
Fix by adding the necessary check in onForkChild.
Test Plan: @durham's test case, also added new test for this
Reviewed By: delong.j@fb.com
FB internal diff:
D1158672
@override-unit-failures
Nathan Bronson [Thu, 16 Jan 2014 05:20:03 +0000 (21:20 -0800)]
Baton - flushing of thread-local memory during a long wait
Summary:
This diff causes Baton to reduce a thread's memory footprint when it
blocks for an extended period (by default 5 to 7.5 seconds). Reductions
are achieved by flushing the thread-local jemalloc caches (if jemalloc
is in use) and by calling madvise(MADV_DONTNEED) on the portion of the
thread's stack that isn't active. Once the thread resumes execution
both of these resources will be reallocated. Configuration is via
system-wide default.
Test Plan:
1. new unit tests
2. manual execution of existing unit tests with very low idleTimeout
3. peek and poke with gdb to observe madvise discarding the page
Reviewed By: davejwatson@fb.com
FB internal diff:
D1146966
Nathan Bronson [Tue, 4 Feb 2014 20:26:36 +0000 (12:26 -0800)]
FB_LOG_EVERY_MS should use wall time instead of cpu time
Summary:
FB_LOG_EVERY_MS was using clock() as its source of time, which
measures the elapsed CPU time of the process. The name and the docs
suggest that wall time was intended, so that's what this diff does.
Test Plan: new unit test
Reviewed By: andrei.alexandrescu@fb.com
FB internal diff:
D1157926
Philip Pronin [Tue, 4 Feb 2014 02:01:17 +0000 (18:01 -0800)]
tune EF coding
Summary:
Change the way forward / skip pointers are encoded, so we can
expect that `uint32_t` will be enough to address ~4B elements instead
of ~2B as it is now.
Test Plan:
Ran benchmarks for both versions, saw no significant
difference.
Added tests.
Reviewed By: lucian@fb.com
FB internal diff:
D1156950
Peter Griess [Fri, 31 Jan 2014 20:21:15 +0000 (12:21 -0800)]
Specialize hash<basic_fbstring> in correct namespaces
Summary:
- Use the BOOST_STD_EXTENSION_NAMESPACE macro to pick the namespace to
use for hash specializations
Test Plan:
- fbconfig -r unicorn/utils/ && fbmake opt
- fbconfig -r folly && fbmake runtests
- Build in fbobjc with libc++
@override-unit-failures
Reviewed By: rajatr@fb.com
FB internal diff:
D1153422
Blame Revision:
D1152140
Adam Simpkins [Thu, 30 Jan 2014 21:25:08 +0000 (13:25 -0800)]
add additional formatChecked() and vformatChecked() wrappers
Summary:
Add wrapper functions for directly appending to a string, similar to the
existing format() and vformat() wrappers.
Test Plan:
Converted some existing code using these format() and vformat() wrappers
to use formatChecked() and vformatChecked().
Reviewed By: jon.coens@fb.com
FB internal diff:
D1151496
@override-unit-failures
Peter Griess [Fri, 31 Jan 2014 00:15:48 +0000 (16:15 -0800)]
Use C++11 unordered collections instead of libstdc++ extensions
Summary:
- The fbobjc builds complain about use of deprecated <ext/hash_set> and
friends, and then fail because of -Werror. Just use the C++ standard
collections.
Test Plan:
- fbconfig -r folly && fbmake runtests
- Build for iOS and Android
@override-unit-failures
Reviewed By: andrei.alexandrescu@fb.com
FB internal diff:
D1152140
Peter Griess [Wed, 29 Jan 2014 18:32:02 +0000 (10:32 -0800)]
Update folly-config.h for iOS/Apple
Summary: - Update the pre-computed folly-config.h file for Apple builds
Test Plan:
- fbconfig -r folly && fbmake runtests
- Build in fbobjc
Reviewed By: delong.j@fb.com
FB internal diff:
D1150188