- 06 Feb, 2014 19 commits
-
-
Nathan Bronson authored
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 authored
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 authored
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 authored
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 authored
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 authored
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 authored
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
-
Louis Brandy authored
Summary: ...and stop lint complaining at everyone. @override-unit-failures Test Plan: Inspection. Build folly. Reviewed By: delong.j@fb.com FB internal diff: D1151216
-
Peter Griess authored
Summary: - In libstdc++, existing code uses the internal std::__ostream_insert() method to write a formatted string that can include '\0' characters. This internal method doesn't exist in libc++. Instead, use the relevant internal bits. Test Plan: - fbconfig -r folly && fbmake runtests - ./configure && make check on Mac OS X Reviewed By: njormrod@fb.com FB internal diff: D1108540
-
Peter Griess authored
Summary: - The fbobjc codebase defines this macro as well, and to the same thing. However, Clang complains on macro redefinitions if paramater names are different, even if the macros expand to the same thing. Normalize the Folly version to 'x', which is what fbobjc uses. Test Plan: - fbconfig -r folly && fbmake runtests - Builds in fbobjc Reviewed By: andrei.alexandrescu@fb.com FB internal diff: D1149985
-
Marcelo Juchem authored
Summary: this is a simple method that allows a folly::Range `[b, e)` to be split on a character at position `i` (where b <= i < e) in an incremental manner. @override-unit-failures Test Plan: unit tests added Reviewed By: andrei.alexandrescu@fb.com FB internal diff: D1145631
-
Peter Griess authored
Summary: - On iOS, off_t is an int64_t, and as such std::min() doesn't compile since the types don't match. Normalize to size_t and fail with an error if this conversion can't be made Test Plan: - fbconfig -r folly && fbmake runtests - Built on iOS Reviewed By: tudorb@fb.com FB internal diff: D1142795
-
Lucian Grijincu authored
Summary: explicit ctor Test Plan: contbuild Reviewed By: andrei.alexandrescu@fb.com FB internal diff: D1134033 Blame Revision: D1133938
-
Adam Simpkins authored
Summary: This restore's format()'s behavior of crashing on invalid format strings, and adds an alternative formatChecked() function to throw instead of crashing. Format strings are commonly programmer defined, and fixed at compile time. Bad format strings are usually programmer errors, and crashing is desirable to help catch these bugs early. However, it is also useful to support dynamic format strings which are not guaranteed to be well formed at compile time. formatChecked() makes it safe to use dynamic format strings, as a bad format strings will not crash the program. This does change the throwing/crashing behavior slightly: the old format() code also used to crash if the format string referred to a non-existent key in one of the argument containers. I removed this, since it seems like the argument containers are likely to be dynamic. I also changed the code to crash on std::range_errors as well. Various problems in format string arguments are caught in the Conv.h code, which throws range_errors. The old crashing code did not crash on these errors, but it seems useful to do so. The only minor concern here is that this may also crash unintentionally if the Output callback throws a range_error. This seems low-risk, but we can remove this behavior if needed. Test Plan: Updated the BogusFormatString test to check both format() and formatChecked(). Reviewed By: tudorb@fb.com FB internal diff: D1144301
-
Adam Simpkins authored
Summary: This reverts 61e20daa, which changed the format code to abort on error. I do plan to restore the crashing behavior, but I plan to make it optional. I will add a formatSafe() function that throws on error, while format() catches these exceptions and crashes. This diff is an intermediate diff to make it easier to review the changes. This is close to a straight revert of 61e20daa and 61a41c9b. However, I did leave the new test case, as well as the FormatArg::errorStr() method added by those diffs. Test Plan: Verified that the existing format tests pass. Also added a handful of new tests for bad format strings. This did catch one bug in the code where it wasn't correctly checking for a null return value from memchr(). Reviewed By: delong.j@fb.com FB internal diff: D1144298
-
Yasser Ganjisaffar authored
Summary: rallocm sets the value of the second argument even if it has failed to allocate the requested size: https://github.com/jemalloc/jemalloc/blob/898960247a8b2e6534738b7a3a244855f379faf9/src/jemalloc.c#L1903-L1906 As a result newAllocatedCapacity was being set to a value less than the original value and the logic was broken. Test Plan: unit tests pass and my code which was crashing before now works! Reviewed By: soren@fb.com FB internal diff: D1144314
-
Philip Pronin authored
Test Plan: fbconfig -r folly/experimental/test && fbmake runtests_opt Reviewed By: chaoyc@fb.com FB internal diff: D1141124
-
Brian Pane authored
Summary: * Added benchmark functions to the checksum unit tests * While in the code, fixed the order of the arguments to the EXPECT_EQ statements so the tests will report the actual and expected values properly upon error Test Plan: fbconfig -r folly && fbmake opt _build/opt/folly/test/checksum_test --benchmark Reviewed By: rajat@fb.com FB internal diff: D1134930
-
Nicholas Ormrod authored
Summary: Removed duplicate #includes. Facebook: The removals were examined by hand: several duplicate includes were not removed because they were/seemed to be in different preprocessor branches of the source. @override-unit-failures Test Plan: arc unit Reviewed By: robbert@fb.com FB internal diff: D1136491
-
- 19 Jan, 2014 7 commits
-
-
Brian Pane authored
Summary: Adjusted the ifdefs to allow the use of the hardware CRC instructions when compiling with gcc-4.7.x Test Plan: Built with gcc-4.7.1, ran the unit tests, verified that they ran the hardware-accelerated code path Reviewed By: saramg@fb.com FB internal diff: D1134567
-
Vladimir Tkachev authored
Summary: Many callers of byLine method use it by providing arguments for File explicit constructors. Added function breaks byLine(file desciptor) use case. Commenting it out until File constructors are made exlicit to fix failing tests. Test Plan: unittest Reviewed By: lucian@fb.com FB internal diff: D1133938 Blame Revision: D1129497
-
Adam Simpkins authored
Summary: Previously, all IOBuf APIs required that IOBufs always be allocated on the heap. The only methods provided to create IOBufs returned unique_ptr<IOBuf>. This adds new methods to support creating IOBufs on the stack. This is useful in cases where the IOBuf will be short-lived, and the overhead of the heap allocation is undesirable. (One use case is to wrap an existing buffer in a short-lived IOBuf so that it can be used with the Cursor API.) I have currently made IOBufs movable but not copyable. (Move operations clearly should move only a single IOBuf, but it is not clear if the copy operators should copy only a single IOBuf or the entire chain.) Test Plan: Updated the unit tests to test the new CREATE, WRAP_BUFFER, TAKE_OWNERSHIP, and COPY_BUFFER constructors, as well as the move constructor and assignment operator. Reviewed By: davejwatson@fb.com FB internal diff: D1067341
-
Nathan Bronson authored
Summary: A Baton allows a thread to block once and be awoken: it captures a single handoff. During its lifecycle (from construction/reset to destruction/reset) a baton must either be post()ed and wait()ed exactly once each, or not at all. Batons may be reused after a call to recycle(). Baton includes no internal padding, and is only 4 bytes in size. Any alignment or padding to avoid false sharing is up to the user. This is basically a stripped-down semaphore that supports only a single call to sem_post. The current posix semaphore sem_t isn't too bad, but this provides more a bit more speed, checking, inlining, smaller size, a guarantee that the implementation won't change, and compatibility with DeterministicSchedule. Baton is directly implemented on top of futex, and takes care to avoid system calls. Test Plan: 1. new unit tests 2. this code has already been in production use in TAO for many months Reviewed By: davejwatson@fb.com FB internal diff: D1130407
-
Alexander Sidorov authored
Summary: -1LL<<63 was passed to folly::to() without '-' so it overflowed. Fixed that Test Plan: tried this: int main() { stringstream s; s << "{\"int\":" << -1LL<<63 << "}"; string str = s.str(); cout << "string to parse: " << endl << str << endl; int64_t sample = folly::parseJson(str.c_str())["int"].asInt(); LOG(INFO) << "test result = " << sample; return 0; } it returns right value. Also tried it with "-Infinity" and double type for sample. In works fine as well. Reviewed By: andrei.alexandrescu@fb.com FB internal diff: D1130155
-
Andrei Alexandrescu authored
Test Plan: unittest Reviewed By: lucian@fb.com FB internal diff: D1129497
-
Marc Horowitz authored
Summary: It is useful when writing additional specializations of of toAppend() and related functions to use IsSomeString, the same way the ones in Conv.h do. Move IsSomeString out of detail, so outside code doesn't access a detail namespace inappropriately. Test Plan: fbmake runtests; arc lint Reviewed By: tudorb@fb.com FB internal diff: D1130910
-
- 16 Jan, 2014 7 commits
-
-
Jordan DeLong authored
Summary: Our script wasn't picking up removed files.
-
Tudor Bosman authored
Summary: A function was getting inlined in opt mode but not in debug mode. Test Plan: ran test Reviewed By: philipp@fb.com FB internal diff: D1130949 @override-unit-failures test fix only
-
Nathan Bronson authored
Summary: Include guard had FOLLY_DETAIL_.. even though code is in folly Test Plan: unit tests Reviewed By: davejwatson@fb.com FB internal diff: D1130269 @override-unit-failures
-
Nathan Bronson authored
Summary: Instances of IndexedMemPool dynamically allocate and then pool their element type (T), returning 4-byte integer indices that can be passed to the pool's operator[] method to access or obtain pointers to the actual elements. Once they are constructed, elements are never destroyed. These two features are useful for lock-free algorithms. The indexing behavior makes it easy to build tagged pointer-like-things, since a large number of elements can be managed using fewer bits than a full pointer. The pooling behavior makes it safe to read from T-s even after they have been recycled Test Plan: 1. unit tests 2. unit tests using DeterministicSchedule 3. this code is moved from tao/queues where it is in production use Reviewed By: davejwatson@fb.com FB internal diff: D1089053
-
Lucian Grijincu authored
Summary: Detailed output is a bit hard to parse visually. Add some colors for clarity (clownyness?). Enabled only when printing stack traces from a signal-handler to TTY. Also: - terse output printed empty lines if it could not find a symbol for an address; fixed by printing "(unknown)". - added a dummy ##Crash## program to test colorization easily Test Plan: n/a Reviewed By: tudorb@fb.com FB internal diff: D1128303
-
Dario Russi authored
Summary: AHM::find checks that the returned SimpleRetT index is >= numMapsAllocated_ but that value may have changed and find pick the first element in the next sub map. Use success instead. @override-unit-failures Test Plan: unit tests Reviewed By: delong.j@fb.com FB internal diff: D1126684
-
Philip Pronin authored
Test Plan: eyeballed it @override-unit-failures Reviewed By: soren@fb.com FB internal diff: D1125180
-
- 06 Jan, 2014 3 commits
-
-
Sara Golemon authored
Summary: The __builtin_ia32_crc[qd]i() functions are GCC >= 4.8 specific folly-config.h includes must be wrapped in a FOLLY_NO_CONFIG guard FOLLY_HAVE_WEAK_SYMBOLS needs to apply to the cpp file as well as the header Closes #44 Closes #42 Test Plan: HHVM builds with recent folly Reviewed By: seanc@fb.com FB internal diff: D1117181
-
Ajit Banerjee authored
Summary: The invariant after Cursor::insert is that the cursor points to the buffer after the insert. That invariant was not followed in the branch where the new buffer was just prepended. This change fixes the bug. Test Plan: Unit test modified, all tests run with fbconfig -r folly && fbmake runtests_opt Reviewed By: davejwatson@fb.com FB internal diff: D1114749
-
Nathan Bronson authored
Summary: timed_mutex::try_lock_for is broken in gcc 4.8 (see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54562), so this diff adds a workaround using try_lock_until. The internal implementation of try_lock_for converts to try_lock_until, but it uses the steady_clock instead of the system_clock as its time base. In some gcc versions these are the same clock so it works okay, but not in all. Test Plan: unit tests Reviewed By: delong.j@fb.com FB internal diff: D1108584
-
- 27 Dec, 2013 2 commits
-
-
Peter Griess authored
Summary: - Remove FOLLY_NORETURN from function definitions, which was causing compilation errors on some platforms. Test Plan: - Compile on Mac OS X with Clang Reviewed By: tudorb@fb.com FB internal diff: D1111416
-
Brian Pane authored
Summary: * Added a new crc32c() function, with a portable implementation and an optimized version for x86 with SSE4.2 Test Plan: New unit test included Reviewed By: tudorb@fb.com FB internal diff: D1111515
-
- 26 Dec, 2013 2 commits
-
-
Jim Meyering authored
Summary: * folly/test/PackedSyncPtrTest.cpp: Avoid an operator new [] vs operator delete mismatch. Test Plan: fbconfig --platform-all=gcc-4.8.1-glibc-2.17 --sanitize=address \ folly/test:packed_sync_ptr_test && fbmake runtests Reviewed By: tudorb@fb.com FB internal diff: D1111227
-
Peter Griess authored
Summary: - Add autoconf check for cplus_demangle_v3_callback() in libiberty and avoid is usage when not available. Clang/libc++ on Mac OS X doesn't support this. Test Plan: - fbconfig -r folly && fbmake runtests - ./configure && make check on Mac OS X Reviewed By: tudorb@fb.com FB internal diff: D1108543
-