- 18 Apr, 2014 11 commits
-
-
Elizabeth Smith authored
Summary: Provide translations for gcc noreturn attribute __attribute__((noreturn)) is gcc specific, clang understands it on nix systems, but for msvc __declspec(noreturn) is the compiler specific version, which clang will imitate/use on windows. There was already a FOLLY_NORETURN in portability.h, however because of __declspec limitations it must prefix the declaration, not postfix. The gcc noreturn attribute does not have this limitation and will work prefixed OR postfixed, so to keep from turning code into spaghetti nonsense, the macro was moved to the front of declations where it is currently used. This will allow it to work with the proper definitions on clang, clang on windows, gcc, and msvc Test Plan: fbmake runtests Reviewed By: delong.j@fb.com FB internal diff: D1279466
-
Elizabeth Smith authored
Summary: Provide translations for gcc always_inline and noinline attribute Change to using a macro from portability.h for attributes for using always_inline and noinline for cross platform support Test Plan: fbmake runtests Reviewed By: delong.j@fb.com FB internal diff: D1279652
-
Victor Loh authored
Summary: Using StringPiece makes it easier than std::string Facebook: Motivation for this diff is found in D1253595 Test Plan: Added new unittest fbconfig folly/io/test && fbmake runtests_opt Reviewed By: simpkins@fb.com FB internal diff: D1276185
-
Elizabeth Smith authored
Summary: As part of the windows port, uint is not defined as a type and is not standard, it makes msvc choke, a simple change to unsigned int fixes the issue Test Plan: fbmake runtests Reviewed By: delong.j@fb.com FB internal diff: D1278487
-
Tudor Bosman authored
Test Plan: used it Reviewed By: lucian@fb.com FB internal diff: D1277063 @override-unit-failures
-
Lucian Grijincu authored
Summary: as per discussion from https://phabricator.fb.com/D1274352 After changing the queue length to be a small value (100) I didn't see improvement from cache alignment of atomics (too much noise). Dropping that and just fixing the benchmark. Test Plan: n/a Reviewed By: ngbronson@fb.com FB internal diff: D1276591
-
Nicholas Ormrod authored
Summary: The code originally contained the line EXPECT_EQ((rcount == lineCount), r); // EOF iff at lineCount Which asserted that, on the last iteration, EOF was being read (and thus r was true). This line has been causing errors in contbuild. There seem to be two issues at play. First, the left hand side of the EXPECT_EQ is always false. rcount is incremented three lines down, and the (implicit) loop ends when rcount equals lineCount. This means that, on the last iteration, rcount is actually one less than lineCount. Hence the check is effectively asserting that r is false. The second issue is that r is rarely true. Empirically, a necessary but not sufficient condition is that there be lots of other processes running at the same time (such as when running fbconfig -r folly && fbmake runtests_opt). This would explain why the test passes during development but fails in contbuild. I am guessing that, when there are few processes running, Subprocess is predictably ceasing to read before whichever other process yields EOF, and that this does not always happen when there is resource contention. As an immediate fix, I am asserting that r may only be true on the last iteration. Could someone (cc @tudorb) who is more familiar with the intricacies of Subprocess please check to see if this is an idiosyncrasy of the test, or if there is actually an underlying bug. Test Plan: Before the change, run fbconfig -r folly && fbmake runtests_opt repeatedly. Notice that most of the iterations yield an error from line 376 (which is consistent with contbuild error logs). After the change, notice that the error disappears. Reviewed By: andrewjcg@fb.com FB internal diff: D1269124
-
Lucian Grijincu authored
Summary: same as map, but runs it's argument in parallel over a number of threads. @override-unit-failures Test Plan: added test Reviewed By: tjackson@fb.com FB internal diff: D1258364
-
Alexey Spiridonov authored
Summary: Changing the parent's WD is prone to race conditions of various sorts, and needlessly alters parent state. Python's subprocess also has this feature. Test Plan: fbmake dbg _bin/folly/test/subprocess_test ; ../_bin/folly/test/subprocess_test Reviewed By: agoder@fb.com FB internal diff: D1269526
-
Jim Meyering authored
Summary: * folly/test/CacheLocalityTest.cpp (contentionAtWidth): Work around clang's prohibition against using flexible arrays in a lambda. Test Plan: fbconfig --clang --with-project-version clang:dev folly/test \ && fbmake runtests Reviewed By: ngbronson@fb.com FB internal diff: D1263620
-
Philip Pronin authored
Summary: Allow specifying custom alignment. Test Plan: fbconfig -r folly/test && fbmake opt -j32 @override-unit-failures Reviewed By: lucian@fb.com FB internal diff: D1264851
-
- 09 Apr, 2014 11 commits
-
-
ptarjan authored
-
Philip Pronin authored
Summary: D1261546 introduced regression in `sizeof(ConcurrentSkipList)`. In case of `NodeAlloc = folly::SysAlloc`, size of an empty `NodeAlloc` struct is 1 byte, due to the alignment requirements of the next field, it got translated into wasting 8 bytes. Test Plan: fbconfig -r folly/test && fbmake opt -j32 @override-unit-failures Reviewed By: lucian@fb.com FB internal diff: D1264730
-
Jim Meyering authored
Summary: * folly/folly-config.h (FOLLY_HAVE_CONSTEXPR_STRLEN): Define to zero when compiling with clang, since clang's strlen is not constexpr. Test Plan: Run this: fbconfig --clang --with-project-version clang:dev folly/test && fbconfig dbg and observe that the following no longer strikes: folly/test/RangeTest.cpp:304:25: error: constexpr variable 'hello1' must be initialized by a constant expression I also tried using clang-3.4 (the current default), fbconfig --clang folly/test && fbmake dbg with these results: https://phabricator.fb.com/P8583443 Reviewed By: pgriess@fb.com FB internal diff: D1262840
-
Dave Watson authored
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 authored
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 authored
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 authored
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 authored
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 authored
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 authored
Summary: For use with Thrift::Frozen, especially. Test Plan: Unit tests Reviewed By: philipp@fb.com FB internal diff: D1255257
-
Nicholas Ormrod authored
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
-
- 04 Apr, 2014 6 commits
-
-
Hans Fugal authored
Summary: These were required to build folly on OSX. Test Plan: build Reviewed By: davejwatson@fb.com FB internal diff: D1256856
-
Hans Fugal authored
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 authored
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 authored
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 authored
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 authored
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
-
- 31 Mar, 2014 9 commits
-
-
Hannes Roth authored
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 authored
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 authored
Test Plan: Unit tests Reviewed By: marcelo.juchem@fb.com FB internal diff: D1236630
-
Tudor Bosman authored
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 authored
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 authored
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 authored
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 authored
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 authored
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
-
- 18 Mar, 2014 3 commits
-
-
Tom Jackson authored
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 authored
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 authored
Test Plan: fbconfig -r folly/experimental/symbolizer && fbmake runtests_opt && fbmake runtests Reviewed By: simpkins@fb.com FB internal diff: D1224552 @override-unit-failures
-