@@ -27,7 +27,7 @@ static uint32_t BucketId(uint64_t hash, uint32_t capacity_log) {
2727 return hash >> (64 - capacity_log);
2828}
2929// doesn't possess memory, it should be created and release manually
30- class ISLEntry {
30+ class OAHEntry {
3131 // we can assume that high 12 bits of user address space
3232 // can be used for tagging. At most 52 bits of address are reserved for
3333 // some configurations, and usually it's 48 bits.
@@ -47,9 +47,9 @@ class ISLEntry {
4747 static constexpr size_t kTagMask = 4095ULL << 52 ; // we reserve 12 high bits.
4848
4949 public:
50- ISLEntry () = default ;
50+ OAHEntry () = default ;
5151
52- ISLEntry (std::string_view key, uint32_t expiry = UINT32_MAX) {
52+ OAHEntry (std::string_view key, uint32_t expiry = UINT32_MAX) {
5353 uint32_t key_size = key.size ();
5454
5555 uint32_t expiry_size = (expiry != UINT32_MAX) * sizeof (expiry);
@@ -80,25 +80,25 @@ class ISLEntry {
8080 }
8181
8282 // TODO add initializer list constructor
83- ISLEntry (size_t vector_size) {
83+ OAHEntry (size_t vector_size) {
8484 // TODO rewrite to simple array
85- data_ = reinterpret_cast <char *>(new std::vector<ISLEntry >(vector_size));
85+ data_ = reinterpret_cast <char *>(new std::vector<OAHEntry >(vector_size));
8686 SetVectorBit ();
8787 }
8888
89- ISLEntry (const ISLEntry & e) = delete ;
90- ISLEntry (ISLEntry && e) {
89+ OAHEntry (const OAHEntry & e) = delete ;
90+ OAHEntry (OAHEntry && e) {
9191 data_ = e.data_ ;
9292 e.data_ = nullptr ;
9393 }
9494
9595 // consider manual removing, we waste a lot of time to check nullptr
96- inline ~ISLEntry () {
96+ inline ~OAHEntry () {
9797 Clear ();
9898 }
9999
100- ISLEntry & operator =(const ISLEntry & e) = delete ;
101- ISLEntry & operator =(ISLEntry && e) {
100+ OAHEntry & operator =(const OAHEntry & e) = delete ;
101+ OAHEntry & operator =(OAHEntry && e) {
102102 std::swap (data_, e.data_ );
103103 return *this ;
104104 }
@@ -115,8 +115,8 @@ class ISLEntry {
115115 return (uptr () & kVectorBit ) != 0 ;
116116 }
117117
118- inline std::vector<ISLEntry >& AsVector () {
119- return *reinterpret_cast <std::vector<ISLEntry >*>(Raw ());
118+ inline std::vector<OAHEntry >& AsVector () {
119+ return *reinterpret_cast <std::vector<OAHEntry >*>(Raw ());
120120 }
121121
122122 inline std::string_view Key () const {
@@ -139,11 +139,11 @@ class ISLEntry {
139139 }
140140
141141 // TODO consider another option to implement iterator
142- ISLEntry * operator ->() {
142+ OAHEntry * operator ->() {
143143 return this ;
144144 }
145145
146- inline uint64_t GetExtendedHash () const {
146+ inline uint64_t GetHash () const {
147147 return (uptr () & kExtHashShiftedMask ) >> kExtHashShift ;
148148 }
149149
@@ -154,9 +154,9 @@ class ISLEntry {
154154 uint32_t bucket_id_hash_part = capacity_log > shift_log ? shift_log : capacity_log;
155155 uint32_t bucket_mask = (1 << bucket_id_hash_part) - 1 ;
156156 bucket_id &= bucket_mask;
157- auto stored_hash = GetExtendedHash ();
157+ auto stored_hash = GetHash ();
158158 if (!stored_hash) {
159- stored_hash = SetExtendedHash (Hash (Key ()), capacity_log, shift_log);
159+ stored_hash = SetHash (Hash (Key ()), capacity_log, shift_log);
160160 }
161161 uint32_t stored_bucket_id = stored_hash >> (kExtHashSize - bucket_id_hash_part);
162162 return bucket_id == stored_bucket_id;
@@ -168,16 +168,16 @@ class ISLEntry {
168168 const uint32_t start_hash_bit = capacity_log > shift_log ? capacity_log - shift_log : 0 ;
169169 const uint32_t ext_hash_shift = 64 - start_hash_bit - kExtHashSize ;
170170 const uint64_t ext_hash = (hash >> ext_hash_shift) & kExtHashMask ;
171- auto stored_hash = GetExtendedHash ();
171+ auto stored_hash = GetHash ();
172172 if (!stored_hash && !IsVector ()) {
173- stored_hash = SetExtendedHash (Hash (Key ()), capacity_log, shift_log);
173+ stored_hash = SetHash (Hash (Key ()), capacity_log, shift_log);
174174 }
175175 return stored_hash == ext_hash;
176176 }
177177
178178 // TODO rename to SetHash
179179 // shift_log identify which bucket the element belongs to
180- uint64_t SetExtendedHash (uint64_t hash, uint32_t capacity_log, uint32_t shift_log) {
180+ uint64_t SetHash (uint64_t hash, uint32_t capacity_log, uint32_t shift_log) {
181181 DCHECK (!IsVector ());
182182 const uint32_t start_hash_bit = capacity_log > shift_log ? capacity_log - shift_log : 0 ;
183183 const uint32_t ext_hash_shift = 64 - start_hash_bit - kExtHashSize ;
@@ -195,7 +195,7 @@ class ISLEntry {
195195 uint32_t Rehash (uint32_t current_bucket_id, uint32_t prev_capacity_log, uint32_t new_capacity_log,
196196 uint32_t shift_log) {
197197 DCHECK (!IsVector ());
198- auto stored_hash = GetExtendedHash ();
198+ auto stored_hash = GetHash ();
199199
200200 const uint32_t logs_diff = new_capacity_log - prev_capacity_log;
201201 const uint32_t prev_significant_bits =
@@ -204,7 +204,7 @@ class ISLEntry {
204204
205205 if (!stored_hash || needed_hash_bits > kExtHashSize ) {
206206 auto hash = Hash (Key ());
207- SetExtendedHash (hash, new_capacity_log, shift_log);
207+ SetHash (hash, new_capacity_log, shift_log);
208208 return BucketId (hash, new_capacity_log);
209209 }
210210
@@ -232,7 +232,7 @@ class ISLEntry {
232232 auto * expiry_pos = Raw ();
233233 std::memcpy (expiry_pos, &at_sec, sizeof (at_sec));
234234 } else {
235- *this = ISLEntry (Key (), at_sec);
235+ *this = OAHEntry (Key (), at_sec);
236236 }
237237 }
238238
@@ -266,12 +266,12 @@ class ISLEntry {
266266 }
267267
268268 // TODO refactor, because it's inefficient
269- inline uint32_t Insert (ISLEntry && e) {
269+ inline uint32_t Insert (OAHEntry && e) {
270270 if (Empty ()) {
271271 *this = std::move (e);
272272 return 0 ;
273273 } else if (!IsVector ()) {
274- ISLEntry tmp (2 );
274+ OAHEntry tmp (2 );
275275 auto & arr = tmp.AsVector ();
276276 arr[0 ] = std::move (*this );
277277 arr[1 ] = std::move (e);
@@ -300,7 +300,7 @@ class ISLEntry {
300300 }
301301
302302 // TODO remove, it is inefficient
303- inline ISLEntry & operator [](uint32_t pos) {
303+ inline OAHEntry & operator [](uint32_t pos) {
304304 DCHECK (!Empty ());
305305 if (!IsVector ()) {
306306 DCHECK (pos == 0 );
@@ -312,11 +312,11 @@ class ISLEntry {
312312 }
313313 }
314314
315- ISLEntry Remove (uint32_t pos) {
315+ OAHEntry Remove (uint32_t pos) {
316316 if (Empty ()) {
317317 // I'm not sure that this scenario should be check at all
318318 DCHECK (pos == 0 );
319- return ISLEntry ();
319+ return OAHEntry ();
320320 } else if (!IsVector ()) {
321321 DCHECK (pos == 0 );
322322 return std::move (*this );
@@ -327,7 +327,7 @@ class ISLEntry {
327327 }
328328 }
329329
330- ISLEntry Pop () {
330+ OAHEntry Pop () {
331331 if (IsVector ()) {
332332 auto & arr = AsVector ();
333333 for (auto & e : arr) {
0 commit comments