Commit 787dc636 authored by Nathan Bronson's avatar Nathan Bronson Committed by Facebook Github Bot

remove unnecessary folly:: qualification in F14

Summary: F14 code inside namespace folly doesn't need folly::

Reviewed By: yfeldblum

Differential Revision: D8772565

fbshipit-source-id: 720fa683b7ec9be9a096559191240ef7e672fe3e
parent c1c59c5b
...@@ -150,10 +150,8 @@ class F14BasicMap { ...@@ -150,10 +150,8 @@ class F14BasicMap {
typename Policy::Hasher, typename Policy::Hasher,
typename Policy::KeyEqual, typename Policy::KeyEqual,
K>::value && K>::value &&
!std::is_same<typename Policy::Iter, folly::remove_cvref_t<K>>:: !std::is_same<typename Policy::Iter, remove_cvref_t<K>>::value &&
value && !std::is_same<typename Policy::ConstIter, remove_cvref_t<K>>::value,
!std::is_same<typename Policy::ConstIter, folly::remove_cvref_t<K>>::
value,
T>; T>;
public: public:
...@@ -497,7 +495,7 @@ class F14BasicMap { ...@@ -497,7 +495,7 @@ class F14BasicMap {
std::piecewise_construct_t, std::piecewise_construct_t,
std::tuple<Args1...>&& first_args, std::tuple<Args1...>&& first_args,
std::tuple<Args2...>&& second_args) { std::tuple<Args2...>&& second_args) {
auto key = folly::make_from_tuple<key_type>( auto key = make_from_tuple<key_type>(
std::tuple<Args1&&...>(std::move(first_args))); std::tuple<Args1&&...>(std::move(first_args)));
return table_.tryEmplaceValue( return table_.tryEmplaceValue(
key, key,
...@@ -1005,16 +1003,12 @@ class F14VectorMap ...@@ -1005,16 +1003,12 @@ class F14VectorMap
typename Policy::Hasher, typename Policy::Hasher,
typename Policy::KeyEqual, typename Policy::KeyEqual,
K>::value && K>::value &&
!std::is_same<typename Policy::Iter, folly::remove_cvref_t<K>>:: !std::is_same<typename Policy::Iter, remove_cvref_t<K>>::value &&
!std::is_same<typename Policy::ConstIter, remove_cvref_t<K>>::value &&
!std::is_same<typename Policy::ReverseIter, remove_cvref_t<K>>::
value && value &&
!std::is_same<typename Policy::ConstIter, folly::remove_cvref_t<K>>:: !std::is_same<typename Policy::ConstReverseIter, remove_cvref_t<K>>::
value && value,
!std::is_same<
typename Policy::ReverseIter,
folly::remove_cvref_t<K>>::value &&
!std::is_same<
typename Policy::ConstReverseIter,
folly::remove_cvref_t<K>>::value,
T>; T>;
public: public:
...@@ -1129,7 +1123,7 @@ class F14VectorMap ...@@ -1129,7 +1123,7 @@ class F14VectorMap
static_cast<uint32_t>(tailIndex)}); static_cast<uint32_t>(tailIndex)});
tail.item() = index; tail.item() = index;
auto p = std::addressof(values[index]); auto p = std::addressof(values[index]);
folly::assume(p != nullptr); assume(p != nullptr);
this->table_.transfer(a, std::addressof(values[tailIndex]), p, 1); this->table_.transfer(a, std::addressof(values[tailIndex]), p, 1);
} }
} }
......
...@@ -146,7 +146,7 @@ class F14BasicSet { ...@@ -146,7 +146,7 @@ class F14BasicSet {
typename Policy::Hasher, typename Policy::Hasher,
typename Policy::KeyEqual, typename Policy::KeyEqual,
K>::value && K>::value &&
!std::is_same<typename Policy::Iter, folly::remove_cvref_t<K>>::value, !std::is_same<typename Policy::Iter, remove_cvref_t<K>>::value,
T>; T>;
public: public:
...@@ -797,11 +797,8 @@ class F14VectorSet ...@@ -797,11 +797,8 @@ class F14VectorSet
typename Policy::Hasher, typename Policy::Hasher,
typename Policy::KeyEqual, typename Policy::KeyEqual,
K>::value && K>::value &&
!std::is_same<typename Policy::Iter, folly::remove_cvref_t<K>>:: !std::is_same<typename Policy::Iter, remove_cvref_t<K>>::value &&
value && !std::is_same<typename Policy::ReverseIter, remove_cvref_t<K>>::value,
!std::is_same<
typename Policy::ReverseIter,
folly::remove_cvref_t<K>>::value,
T>; T>;
public: public:
...@@ -917,7 +914,7 @@ class F14VectorSet ...@@ -917,7 +914,7 @@ class F14VectorSet
static_cast<uint32_t>(tailIndex)}); static_cast<uint32_t>(tailIndex)});
tail.item() = index; tail.item() = index;
auto p = std::addressof(values[index]); auto p = std::addressof(values[index]);
folly::assume(p != nullptr); assume(p != nullptr);
this->table_.transfer(a, std::addressof(values[tailIndex]), p, 1); this->table_.transfer(a, std::addressof(values[tailIndex]), p, 1);
} }
} }
......
...@@ -488,7 +488,7 @@ class ValueContainerPolicy : public BasePolicy< ...@@ -488,7 +488,7 @@ class ValueContainerPolicy : public BasePolicy<
static constexpr bool destroyItemOnClear() { static constexpr bool destroyItemOnClear() {
return !std::is_trivially_destructible<Item>::value || return !std::is_trivially_destructible<Item>::value ||
!folly::AllocatorHasDefaultObjectDestroy<Alloc, Item>::value; !AllocatorHasDefaultObjectDestroy<Alloc, Item>::value;
} }
// inherit constructors // inherit constructors
...@@ -529,7 +529,7 @@ class ValueContainerPolicy : public BasePolicy< ...@@ -529,7 +529,7 @@ class ValueContainerPolicy : public BasePolicy<
void void
constructValueAtItem(std::size_t /*size*/, Item* itemAddr, Args&&... args) { constructValueAtItem(std::size_t /*size*/, Item* itemAddr, Args&&... args) {
Alloc& a = this->alloc(); Alloc& a = this->alloc();
folly::assume(itemAddr != nullptr); assume(itemAddr != nullptr);
AllocTraits::construct(a, itemAddr, std::forward<Args>(args)...); AllocTraits::construct(a, itemAddr, std::forward<Args>(args)...);
} }
...@@ -556,7 +556,7 @@ class ValueContainerPolicy : public BasePolicy< ...@@ -556,7 +556,7 @@ class ValueContainerPolicy : public BasePolicy<
// location), but it seems highly likely that it will also cause // location), but it seems highly likely that it will also cause
// the compiler to drop such assumptions that are violated due // the compiler to drop such assumptions that are violated due
// to our UB const_cast in moveValue. // to our UB const_cast in moveValue.
destroyItem(*folly::launder(std::addressof(src))); destroyItem(*launder(std::addressof(src)));
} else { } else {
destroyItem(src); destroyItem(src);
} }
...@@ -769,17 +769,17 @@ class NodeContainerPolicy ...@@ -769,17 +769,17 @@ class NodeContainerPolicy
void void
constructValueAtItem(std::size_t /*size*/, Item* itemAddr, Args&&... args) { constructValueAtItem(std::size_t /*size*/, Item* itemAddr, Args&&... args) {
Alloc& a = this->alloc(); Alloc& a = this->alloc();
folly::assume(itemAddr != nullptr); assume(itemAddr != nullptr);
new (itemAddr) Item{AllocTraits::allocate(a, 1)}; new (itemAddr) Item{AllocTraits::allocate(a, 1)};
auto p = std::addressof(**itemAddr); auto p = std::addressof(**itemAddr);
folly::assume(p != nullptr); assume(p != nullptr);
AllocTraits::construct(a, p, std::forward<Args>(args)...); AllocTraits::construct(a, p, std::forward<Args>(args)...);
} }
void moveItemDuringRehash(Item* itemAddr, Item& src) { void moveItemDuringRehash(Item* itemAddr, Item& src) {
// This is basically *itemAddr = src; src = nullptr, but allowing // This is basically *itemAddr = src; src = nullptr, but allowing
// for fancy pointers. // for fancy pointers.
folly::assume(itemAddr != nullptr); assume(itemAddr != nullptr);
new (itemAddr) Item{std::move(src)}; new (itemAddr) Item{std::move(src)};
src = nullptr; src = nullptr;
src.~Item(); src.~Item();
...@@ -985,10 +985,9 @@ class VectorContainerPolicy : public BasePolicy< ...@@ -985,10 +985,9 @@ class VectorContainerPolicy : public BasePolicy<
private: private:
static constexpr bool valueIsTriviallyCopyable() { static constexpr bool valueIsTriviallyCopyable() {
return folly::AllocatorHasDefaultObjectConstruct<Alloc, Value, Value>:: return AllocatorHasDefaultObjectConstruct<Alloc, Value, Value>::value &&
value && AllocatorHasDefaultObjectDestroy<Alloc, Value>::value &&
folly::AllocatorHasDefaultObjectDestroy<Alloc, Value>::value && is_trivially_copyable<Value>::value;
folly::is_trivially_copyable<Value>::value;
} }
public: public:
...@@ -1139,10 +1138,10 @@ class VectorContainerPolicy : public BasePolicy< ...@@ -1139,10 +1138,10 @@ class VectorContainerPolicy : public BasePolicy<
std::memcpy(dst, src, n * sizeof(Value)); std::memcpy(dst, src, n * sizeof(Value));
} else { } else {
for (std::size_t i = 0; i < n; ++i, ++src, ++dst) { for (std::size_t i = 0; i < n; ++i, ++src, ++dst) {
folly::assume(dst != nullptr); assume(dst != nullptr);
AllocTraits::construct(a, dst, Super::moveValue(*src)); AllocTraits::construct(a, dst, Super::moveValue(*src));
if (kIsMap) { if (kIsMap) {
AllocTraits::destroy(a, folly::launder(src)); AllocTraits::destroy(a, launder(src));
} else { } else {
AllocTraits::destroy(a, src); AllocTraits::destroy(a, src);
} }
...@@ -1164,7 +1163,7 @@ class VectorContainerPolicy : public BasePolicy< ...@@ -1164,7 +1163,7 @@ class VectorContainerPolicy : public BasePolicy<
} else { } else {
for (std::size_t i = 0; i < size; ++i, ++src, ++dst) { for (std::size_t i = 0; i < size; ++i, ++src, ++dst) {
try { try {
folly::assume(dst != nullptr); assume(dst != nullptr);
AllocTraits::construct(a, dst, constructorArgFor(*src)); AllocTraits::construct(a, dst, constructorArgFor(*src));
} catch (...) { } catch (...) {
for (Value* cleanup = std::addressof(values_[0]); cleanup != dst; for (Value* cleanup = std::addressof(values_[0]); cleanup != dst;
...@@ -1347,8 +1346,8 @@ class VectorContainerPolicy : public BasePolicy< ...@@ -1347,8 +1346,8 @@ class VectorContainerPolicy : public BasePolicy<
if (underlying.atEnd()) { if (underlying.atEnd()) {
return linearEnd(); return linearEnd();
} else { } else {
folly::assume(values_ + underlying.item() != nullptr); assume(values_ + underlying.item() != nullptr);
folly::assume(values_ != nullptr); assume(values_ != nullptr);
return Iter{values_ + underlying.item(), values_}; return Iter{values_ + underlying.item(), values_};
} }
} }
...@@ -1359,7 +1358,7 @@ class VectorContainerPolicy : public BasePolicy< ...@@ -1359,7 +1358,7 @@ class VectorContainerPolicy : public BasePolicy<
Item iterToIndex(ConstIter const& iter) const { Item iterToIndex(ConstIter const& iter) const {
auto n = iter.index(); auto n = iter.index();
folly::assume(n <= std::numeric_limits<Item>::max()); assume(n <= std::numeric_limits<Item>::max());
return static_cast<Item>(n); return static_cast<Item>(n);
} }
......
...@@ -132,8 +132,7 @@ struct StdNodeReplica< ...@@ -132,8 +132,7 @@ struct StdNodeReplica<
V, V,
H, H,
std::enable_if_t< std::enable_if_t<
!StdIsFastHash<H>::value || !StdIsFastHash<H>::value || !is_nothrow_invocable<H, K>::value>> {
!folly::is_nothrow_invocable<H, K>::value>> {
void* next; void* next;
V value; V value;
std::size_t hash; std::size_t hash;
...@@ -200,9 +199,8 @@ struct EligibleForHeterogeneousFind< ...@@ -200,9 +199,8 @@ struct EligibleForHeterogeneousFind<
Hasher, Hasher,
KeyEqual, KeyEqual,
ArgKey, ArgKey,
folly::void_t< void_t<typename Hasher::is_transparent, typename KeyEqual::is_transparent>>
typename Hasher::is_transparent, : std::true_type {};
typename KeyEqual::is_transparent>> : std::true_type {};
template < template <
typename TableKey, typename TableKey,
...@@ -221,7 +219,7 @@ template < ...@@ -221,7 +219,7 @@ template <
typename... KeyArgs> typename... KeyArgs>
using KeyTypeForEmplaceHelper = std::conditional_t< using KeyTypeForEmplaceHelper = std::conditional_t<
sizeof...(KeyArgs) == 1 && sizeof...(KeyArgs) == 1 &&
(std::is_same<folly::remove_cvref_t<KeyArg0OrBool>, TableKey>::value || (std::is_same<remove_cvref_t<KeyArg0OrBool>, TableKey>::value ||
EligibleForHeterogeneousFind< EligibleForHeterogeneousFind<
TableKey, TableKey,
Hasher, Hasher,
...@@ -258,7 +256,7 @@ FOLLY_ALWAYS_INLINE static void prefetchAddr(T const* ptr) { ...@@ -258,7 +256,7 @@ FOLLY_ALWAYS_INLINE static void prefetchAddr(T const* ptr) {
template <typename T> template <typename T>
FOLLY_ALWAYS_INLINE static unsigned findFirstSetNonZero(T mask) { FOLLY_ALWAYS_INLINE static unsigned findFirstSetNonZero(T mask) {
folly::assume(mask != 0); assume(mask != 0);
if (sizeof(mask) == sizeof(unsigned)) { if (sizeof(mask) == sizeof(unsigned)) {
return __builtin_ctz(static_cast<unsigned>(mask)); return __builtin_ctz(static_cast<unsigned>(mask));
} else { } else {
...@@ -340,8 +338,7 @@ class DenseMaskIter { ...@@ -340,8 +338,7 @@ class DenseMaskIter {
if (mask == 0) { if (mask == 0) {
count_ = 0; count_ = 0;
} else { } else {
count_ = count_ = popcount(static_cast<uint32_t>(((mask >> 32) << 2) | mask));
folly::popcount(static_cast<uint32_t>(((mask >> 32) << 2) | mask));
if (LIKELY((mask & 1) != 0)) { if (LIKELY((mask & 1) != 0)) {
index_ = 0; index_ = 0;
} else { } else {
...@@ -458,8 +455,8 @@ class LastOccupiedInMask { ...@@ -458,8 +455,8 @@ class LastOccupiedInMask {
} }
unsigned index() const { unsigned index() const {
folly::assume(mask_ != 0); assume(mask_ != 0);
return (folly::findLastSet(mask_) - 1) / kMaskSpacing; return (findLastSet(mask_) - 1) / kMaskSpacing;
} }
}; };
...@@ -691,12 +688,12 @@ struct alignas(kRequiredVectorAlignment) F14Chunk { ...@@ -691,12 +688,12 @@ struct alignas(kRequiredVectorAlignment) F14Chunk {
Item& item(std::size_t i) { Item& item(std::size_t i) {
FOLLY_SAFE_DCHECK(this->occupied(i), ""); FOLLY_SAFE_DCHECK(this->occupied(i), "");
return *folly::launder(itemAddr(i)); return *launder(itemAddr(i));
} }
Item const& citem(std::size_t i) const { Item const& citem(std::size_t i) const {
FOLLY_SAFE_DCHECK(this->occupied(i), ""); FOLLY_SAFE_DCHECK(this->occupied(i), "");
return *folly::launder(itemAddr(i)); return *launder(itemAddr(i));
} }
static F14Chunk& owner(Item& item, std::size_t index) { static F14Chunk& owner(Item& item, std::size_t index) {
...@@ -822,7 +819,7 @@ class PackedChunkItemPtr<T*> { ...@@ -822,7 +819,7 @@ class PackedChunkItemPtr<T*> {
public: public:
PackedChunkItemPtr(T* p, std::size_t i) noexcept { PackedChunkItemPtr(T* p, std::size_t i) noexcept {
uintptr_t encoded = i >> (kIndexBits - kAlignBits); uintptr_t encoded = i >> (kIndexBits - kAlignBits);
folly::assume((encoded & ~kAlignMask) == 0); assume((encoded & ~kAlignMask) == 0);
raw_ = reinterpret_cast<uintptr_t>(p) | encoded; raw_ = reinterpret_cast<uintptr_t>(p) | encoded;
FOLLY_SAFE_DCHECK(p == ptr(), ""); FOLLY_SAFE_DCHECK(p == ptr(), "");
FOLLY_SAFE_DCHECK(i == index(), ""); FOLLY_SAFE_DCHECK(i == index(), "");
...@@ -879,10 +876,10 @@ class F14ItemIter { ...@@ -879,10 +876,10 @@ class F14ItemIter {
: itemPtr_{std::pointer_traits<ItemPtr>::pointer_to(chunk->item(index))}, : itemPtr_{std::pointer_traits<ItemPtr>::pointer_to(chunk->item(index))},
index_{index} { index_{index} {
FOLLY_SAFE_DCHECK(index < Chunk::kCapacity, ""); FOLLY_SAFE_DCHECK(index < Chunk::kCapacity, "");
folly::assume( assume(
std::pointer_traits<ItemPtr>::pointer_to(chunk->item(index)) != std::pointer_traits<ItemPtr>::pointer_to(chunk->item(index)) !=
nullptr); nullptr);
folly::assume(itemPtr_ != nullptr); assume(itemPtr_ != nullptr);
} }
FOLLY_ALWAYS_INLINE void advanceImpl(bool checkEof, bool likelyDead) { FOLLY_ALWAYS_INLINE void advanceImpl(bool checkEof, bool likelyDead) {
...@@ -1020,11 +1017,11 @@ struct SizeAndPackedBegin<SizeType, ItemIter, false> { ...@@ -1020,11 +1017,11 @@ struct SizeAndPackedBegin<SizeType, ItemIter, false> {
SizeType size_{0}; SizeType size_{0};
[[noreturn]] typename ItemIter::Packed& packedBegin() { [[noreturn]] typename ItemIter::Packed& packedBegin() {
folly::assume_unreachable(); assume_unreachable();
} }
[[noreturn]] typename ItemIter::Packed const& packedBegin() const { [[noreturn]] typename ItemIter::Packed const& packedBegin() const {
folly::assume_unreachable(); assume_unreachable();
} }
}; };
...@@ -1529,7 +1526,7 @@ class F14Table : public Policy { ...@@ -1529,7 +1526,7 @@ class F14Table : public Policy {
void insertAtBlank(ItemIter pos, HashPair hp, Args&&... args) { void insertAtBlank(ItemIter pos, HashPair hp, Args&&... args) {
try { try {
auto dst = pos.itemAddr(); auto dst = pos.itemAddr();
folly::assume(dst != nullptr); assume(dst != nullptr);
this->constructValueAtItem(size(), dst, std::forward<Args>(args)...); this->constructValueAtItem(size(), dst, std::forward<Args>(args)...);
} catch (...) { } catch (...) {
eraseBlank(pos, hp); eraseBlank(pos, hp);
...@@ -1595,8 +1592,8 @@ class F14Table : public Policy { ...@@ -1595,8 +1592,8 @@ class F14Table : public Policy {
// partial failure should not occur. Sorry for the subtle invariants // partial failure should not occur. Sorry for the subtle invariants
// in the Policy API. // in the Policy API.
if (folly::is_trivially_copyable<Item>::value && if (is_trivially_copyable<Item>::value && !this->destroyItemOnClear() &&
!this->destroyItemOnClear() && bucket_count() == src.bucket_count()) { bucket_count() == src.bucket_count()) {
// most happy path // most happy path
auto n = chunkAllocSize(chunkMask_ + 1, bucket_count()); auto n = chunkAllocSize(chunkMask_ + 1, bucket_count());
std::memcpy(&chunks_[0], &src.chunks_[0], n); std::memcpy(&chunks_[0], &src.chunks_[0], n);
...@@ -1631,7 +1628,7 @@ class F14Table : public Policy { ...@@ -1631,7 +1628,7 @@ class F14Table : public Policy {
auto&& srcArg = auto&& srcArg =
std::forward<T>(src).buildArgForItem(srcChunk->item(srcI)); std::forward<T>(src).buildArgForItem(srcChunk->item(srcI));
auto dst = dstChunk->itemAddr(dstI); auto dst = dstChunk->itemAddr(dstI);
folly::assume(dst != nullptr); assume(dst != nullptr);
this->constructValueAtItem( this->constructValueAtItem(
0, dst, std::forward<decltype(srcArg)>(srcArg)); 0, dst, std::forward<decltype(srcArg)>(srcArg));
dstChunk->setTag(dstI, srcChunk->tag(srcI)); dstChunk->setTag(dstI, srcChunk->tag(srcI));
...@@ -2190,7 +2187,7 @@ class F14Table : public Policy { ...@@ -2190,7 +2187,7 @@ class F14Table : public Policy {
F14TableStats computeStats() const { F14TableStats computeStats() const {
F14TableStats stats; F14TableStats stats;
if (folly::kIsDebug && Policy::kEnableItemIteration) { if (kIsDebug && Policy::kEnableItemIteration) {
// validate iteration // validate iteration
std::size_t n = 0; std::size_t n = 0;
ItemIter prev; ItemIter prev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment