Commit 89367c60 by Evan Brown Committed by Copybara-Service

Rename CommonFields::slots_ptr to slot_array to match the name of the…

Rename CommonFields::slots_ptr to slot_array to match the name of the corresponding function in raw_hash_set.

PiperOrigin-RevId: 549379884
Change-Id: I305745dbea2c15821b2092441c9b4546fc7aabbe
parent 47d467e4
...@@ -140,7 +140,7 @@ static inline void* PrevSlot(void* slot, size_t slot_size) { ...@@ -140,7 +140,7 @@ static inline void* PrevSlot(void* slot, size_t slot_size) {
void DropDeletesWithoutResize(CommonFields& common, void DropDeletesWithoutResize(CommonFields& common,
const PolicyFunctions& policy, void* tmp_space) { const PolicyFunctions& policy, void* tmp_space) {
void* set = &common; void* set = &common;
void* slot_array = common.slots_ptr(); void* slot_array = common.slot_array();
const size_t capacity = common.capacity(); const size_t capacity = common.capacity();
assert(IsValidCapacity(capacity)); assert(IsValidCapacity(capacity));
assert(!is_small(capacity)); assert(!is_small(capacity));
...@@ -248,7 +248,7 @@ void ClearBackingArray(CommonFields& c, const PolicyFunctions& policy, ...@@ -248,7 +248,7 @@ void ClearBackingArray(CommonFields& c, const PolicyFunctions& policy,
c.infoz().RecordStorageChanged(0, c.capacity()); c.infoz().RecordStorageChanged(0, c.capacity());
} else { } else {
void* set = &c; void* set = &c;
(*policy.dealloc)(set, policy, c.backing_array_start(), c.slots_ptr(), (*policy.dealloc)(set, policy, c.backing_array_start(), c.slot_array(),
c.capacity()); c.capacity());
c.set_control(EmptyGroup()); c.set_control(EmptyGroup());
c.set_generation_ptr(EmptyGeneration()); c.set_generation_ptr(EmptyGeneration());
......
...@@ -916,7 +916,7 @@ class CommonFields : public CommonFieldsGenerationInfo { ...@@ -916,7 +916,7 @@ class CommonFields : public CommonFieldsGenerationInfo {
// Explicitly copying fields into "this" and then resetting "that" // Explicitly copying fields into "this" and then resetting "that"
// fields generates less code then calling absl::exchange per field. // fields generates less code then calling absl::exchange per field.
control_(that.control()), control_(that.control()),
slots_(that.slots_ptr()), slots_(that.slot_array()),
capacity_(that.capacity()), capacity_(that.capacity()),
compressed_tuple_(that.size(), std::move(that.infoz())) { compressed_tuple_(that.size(), std::move(that.infoz())) {
that.set_control(EmptyGroup()); that.set_control(EmptyGroup());
...@@ -935,7 +935,7 @@ class CommonFields : public CommonFieldsGenerationInfo { ...@@ -935,7 +935,7 @@ class CommonFields : public CommonFieldsGenerationInfo {
} }
// Note: we can't use slots() because Qt defines "slots" as a macro. // Note: we can't use slots() because Qt defines "slots" as a macro.
void* slots_ptr() const { return slots_; } void* slot_array() const { return slots_; }
void set_slots(void* s) { slots_ = s; } void set_slots(void* s) { slots_ = s; }
// The number of filled slots. // The number of filled slots.
...@@ -1302,7 +1302,7 @@ inline void ResetCtrl(CommonFields& common, size_t slot_size) { ...@@ -1302,7 +1302,7 @@ inline void ResetCtrl(CommonFields& common, size_t slot_size) {
std::memset(ctrl, static_cast<int8_t>(ctrl_t::kEmpty), std::memset(ctrl, static_cast<int8_t>(ctrl_t::kEmpty),
capacity + 1 + NumClonedBytes()); capacity + 1 + NumClonedBytes());
ctrl[capacity] = ctrl_t::kSentinel; ctrl[capacity] = ctrl_t::kSentinel;
SanitizerPoisonMemoryRegion(common.slots_ptr(), slot_size * capacity); SanitizerPoisonMemoryRegion(common.slot_array(), slot_size * capacity);
ResetGrowthLeft(common); ResetGrowthLeft(common);
} }
...@@ -1315,7 +1315,7 @@ inline void SetCtrl(const CommonFields& common, size_t i, ctrl_t h, ...@@ -1315,7 +1315,7 @@ inline void SetCtrl(const CommonFields& common, size_t i, ctrl_t h,
const size_t capacity = common.capacity(); const size_t capacity = common.capacity();
assert(i < capacity); assert(i < capacity);
auto* slot_i = static_cast<const char*>(common.slots_ptr()) + i * slot_size; auto* slot_i = static_cast<const char*>(common.slot_array()) + i * slot_size;
if (IsFull(h)) { if (IsFull(h)) {
SanitizerUnpoisonMemoryRegion(slot_i, slot_size); SanitizerUnpoisonMemoryRegion(slot_i, slot_size);
} else { } else {
...@@ -1374,7 +1374,7 @@ ABSL_ATTRIBUTE_NOINLINE void InitializeSlots(CommonFields& c, Alloc alloc) { ...@@ -1374,7 +1374,7 @@ ABSL_ATTRIBUTE_NOINLINE void InitializeSlots(CommonFields& c, Alloc alloc) {
// a workaround while we plan the exact guarantee we want to provide. // a workaround while we plan the exact guarantee we want to provide.
const size_t sample_size = const size_t sample_size =
(std::is_same<Alloc, std::allocator<char>>::value && (std::is_same<Alloc, std::allocator<char>>::value &&
c.slots_ptr() == nullptr) c.slot_array() == nullptr)
? SizeOfSlot ? SizeOfSlot
: 0; : 0;
...@@ -2708,7 +2708,7 @@ class raw_hash_set { ...@@ -2708,7 +2708,7 @@ class raw_hash_set {
ctrl_t* control() const { return common().control(); } ctrl_t* control() const { return common().control(); }
slot_type* slot_array() const { slot_type* slot_array() const {
return static_cast<slot_type*>(common().slots_ptr()); return static_cast<slot_type*>(common().slot_array());
} }
HashtablezInfoHandle& infoz() { return common().infoz(); } HashtablezInfoHandle& infoz() { return common().infoz(); }
......
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