Export of internal Abseil changes.

--
008301e65c323ea0b78e4a92221bf43f7f01e358 by Abseil Team <absl-team@google.com>:

Add k...Pad17 through 20 PadSpec enum values.

PiperOrigin-RevId: 223371590

--
ad0580b0a215257044e090181630793b7e5e9ab0 by Jon Cohen <cohenjon@google.com>:

Make the table in the prefetch check not fit in L2 cache.  This should help deflake the test.

PiperOrigin-RevId: 223224646

--
77c76690626b89944946d01da5e3428b763103e8 by Abseil Team <absl-team@google.com>:

Fixed typo in container by replacing asbl::Hash with absl::Hash.

PiperOrigin-RevId: 223083789
GitOrigin-RevId: 008301e65c323ea0b78e4a92221bf43f7f01e358
Change-Id: I81399f09cd82fbb27bcfec4c1517bb5d2fd07f3b
This commit is contained in:
Abseil Team 2018-11-29 10:43:56 -08:00 committed by vslashg
parent 13327debeb
commit 926bfeb9ff
7 changed files with 18 additions and 9 deletions

View file

@ -70,7 +70,7 @@ struct FlatHashMapPolicy;
// By default, `flat_hash_map` uses the `absl::Hash` hashing framework. // By default, `flat_hash_map` uses the `absl::Hash` hashing framework.
// All fundamental and Abseil types that support the `absl::Hash` framework have // All fundamental and Abseil types that support the `absl::Hash` framework have
// a compatible equality operator for comparing insertions into `flat_hash_map`. // a compatible equality operator for comparing insertions into `flat_hash_map`.
// If your type is not yet supported by the `asbl::Hash` framework, see // If your type is not yet supported by the `absl::Hash` framework, see
// absl/hash/hash.h for information on extending Abseil hashing to user-defined // absl/hash/hash.h for information on extending Abseil hashing to user-defined
// types. // types.
// //

View file

@ -67,7 +67,7 @@ struct FlatHashSetPolicy;
// By default, `flat_hash_set` uses the `absl::Hash` hashing framework. All // By default, `flat_hash_set` uses the `absl::Hash` hashing framework. All
// fundamental and Abseil types that support the `absl::Hash` framework have a // fundamental and Abseil types that support the `absl::Hash` framework have a
// compatible equality operator for comparing insertions into `flat_hash_map`. // compatible equality operator for comparing insertions into `flat_hash_map`.
// If your type is not yet supported by the `asbl::Hash` framework, see // If your type is not yet supported by the `absl::Hash` framework, see
// absl/hash/hash.h for information on extending Abseil hashing to user-defined // absl/hash/hash.h for information on extending Abseil hashing to user-defined
// types. // types.
// //

View file

@ -390,7 +390,8 @@ TEST(Table, Prefetch) {
!defined(UNDEFINED_BEHAVIOR_SANITIZER) !defined(UNDEFINED_BEHAVIOR_SANITIZER)
const auto now = [] { return absl::base_internal::CycleClock::Now(); }; const auto now = [] { return absl::base_internal::CycleClock::Now(); };
static constexpr int size = 1000000; // Make size enough to not fit in L2 cache (16.7 Mb)
static constexpr int size = 1 << 22;
for (int i = 0; i < size; ++i) t.insert(i); for (int i = 0; i < size; ++i) t.insert(i);
int64_t no_prefetch = 0, prefetch = 0; int64_t no_prefetch = 0, prefetch = 0;

View file

@ -72,7 +72,7 @@ class NodeHashMapPolicy;
// By default, `node_hash_map` uses the `absl::Hash` hashing framework. // By default, `node_hash_map` uses the `absl::Hash` hashing framework.
// All fundamental and Abseil types that support the `absl::Hash` framework have // All fundamental and Abseil types that support the `absl::Hash` framework have
// a compatible equality operator for comparing insertions into `node_hash_map`. // a compatible equality operator for comparing insertions into `node_hash_map`.
// If your type is not yet supported by the `asbl::Hash` framework, see // If your type is not yet supported by the `absl::Hash` framework, see
// absl/hash/hash.h for information on extending Abseil hashing to user-defined // absl/hash/hash.h for information on extending Abseil hashing to user-defined
// types. // types.
// //

View file

@ -68,7 +68,7 @@ struct NodeHashSetPolicy;
// By default, `node_hash_set` uses the `absl::Hash` hashing framework. // By default, `node_hash_set` uses the `absl::Hash` hashing framework.
// All fundamental and Abseil types that support the `absl::Hash` framework have // All fundamental and Abseil types that support the `absl::Hash` framework have
// a compatible equality operator for comparing insertions into `node_hash_set`. // a compatible equality operator for comparing insertions into `node_hash_set`.
// If your type is not yet supported by the `asbl::Hash` framework, see // If your type is not yet supported by the `absl::Hash` framework, see
// absl/hash/hash.h for information on extending Abseil hashing to user-defined // absl/hash/hash.h for information on extending Abseil hashing to user-defined
// types. // types.
// //

View file

@ -97,6 +97,10 @@ enum PadSpec : uint8_t {
kZeroPad14, kZeroPad14,
kZeroPad15, kZeroPad15,
kZeroPad16, kZeroPad16,
kZeroPad17,
kZeroPad18,
kZeroPad19,
kZeroPad20,
kSpacePad2 = kZeroPad2 + 64, kSpacePad2 = kZeroPad2 + 64,
kSpacePad3, kSpacePad3,
@ -113,6 +117,10 @@ enum PadSpec : uint8_t {
kSpacePad14, kSpacePad14,
kSpacePad15, kSpacePad15,
kSpacePad16, kSpacePad16,
kSpacePad17,
kSpacePad18,
kSpacePad19,
kSpacePad20,
}; };
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------

View file

@ -427,7 +427,7 @@ void CheckHex(IntType v, const char* nopad_format, const char* zeropad_format,
snprintf(expected, sizeof(expected), nopad_format, v); snprintf(expected, sizeof(expected), nopad_format, v);
EXPECT_EQ(expected, actual) << " decimal value " << v; EXPECT_EQ(expected, actual) << " decimal value " << v;
for (int spec = absl::kZeroPad2; spec <= absl::kZeroPad16; ++spec) { for (int spec = absl::kZeroPad2; spec <= absl::kZeroPad20; ++spec) {
std::string actual = std::string actual =
absl::StrCat(absl::Hex(v, static_cast<absl::PadSpec>(spec))); absl::StrCat(absl::Hex(v, static_cast<absl::PadSpec>(spec)));
snprintf(expected, sizeof(expected), zeropad_format, snprintf(expected, sizeof(expected), zeropad_format,
@ -435,7 +435,7 @@ void CheckHex(IntType v, const char* nopad_format, const char* zeropad_format,
EXPECT_EQ(expected, actual) << " decimal value " << v; EXPECT_EQ(expected, actual) << " decimal value " << v;
} }
for (int spec = absl::kSpacePad2; spec <= absl::kSpacePad16; ++spec) { for (int spec = absl::kSpacePad2; spec <= absl::kSpacePad20; ++spec) {
std::string actual = std::string actual =
absl::StrCat(absl::Hex(v, static_cast<absl::PadSpec>(spec))); absl::StrCat(absl::Hex(v, static_cast<absl::PadSpec>(spec)));
snprintf(expected, sizeof(expected), spacepad_format, snprintf(expected, sizeof(expected), spacepad_format,
@ -453,7 +453,7 @@ void CheckDec(IntType v, const char* nopad_format, const char* zeropad_format,
snprintf(expected, sizeof(expected), nopad_format, v); snprintf(expected, sizeof(expected), nopad_format, v);
EXPECT_EQ(expected, actual) << " decimal value " << v; EXPECT_EQ(expected, actual) << " decimal value " << v;
for (int spec = absl::kZeroPad2; spec <= absl::kZeroPad16; ++spec) { for (int spec = absl::kZeroPad2; spec <= absl::kZeroPad20; ++spec) {
std::string actual = std::string actual =
absl::StrCat(absl::Dec(v, static_cast<absl::PadSpec>(spec))); absl::StrCat(absl::Dec(v, static_cast<absl::PadSpec>(spec)));
snprintf(expected, sizeof(expected), zeropad_format, snprintf(expected, sizeof(expected), zeropad_format,
@ -463,7 +463,7 @@ void CheckDec(IntType v, const char* nopad_format, const char* zeropad_format,
<< "' digits " << (spec - absl::kZeroPad2 + 2); << "' digits " << (spec - absl::kZeroPad2 + 2);
} }
for (int spec = absl::kSpacePad2; spec <= absl::kSpacePad16; ++spec) { for (int spec = absl::kSpacePad2; spec <= absl::kSpacePad20; ++spec) {
std::string actual = std::string actual =
absl::StrCat(absl::Dec(v, static_cast<absl::PadSpec>(spec))); absl::StrCat(absl::Dec(v, static_cast<absl::PadSpec>(spec)));
snprintf(expected, sizeof(expected), spacepad_format, snprintf(expected, sizeof(expected), spacepad_format,