MCPcopy Create free account
hub / github.com/bytedance/bolt / fullProbe

Method fullProbe

bolt/exec/HashTable.cpp:193–285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191
192template <Operation op, typename Compare, typename Insert, typename Table>
193char* ProbeState::fullProbe(
194 Table& table,
195 int32_t firstKey,
196 Compare compare,
197 Insert insert,
198 int64_t& numTombstones,
199 bool extraCheck,
200 TableInsertPartitionInfo* partitionInfo) {
201 BOLT_DCHECK(partitionInfo == nullptr || op == Operation::kInsert);
202
203 // if firstProbe have load hited group
204 if (group_ && compare(group_, row_)) {
205 if (op == Operation::kErase) {
206 eraseHit(table, numTombstones);
207 }
208 table.incrementHits();
209 return group_;
210 }
211
212 auto* alreadyChecked = group_;
213 if (extraCheck) {
214 tagsInTable_ = table.loadTags(bucketOffset_);
215 hits_ = simd::toBitMask(tagsInTable_ == wantedTags_);
216 }
217
218 const int64_t startBucketOffset = bucketOffset_;
219 int64_t insertBucketOffset = -1;
220 const auto kEmptyGroup = BaseHashTable::TagVector::broadcast(0);
221 const auto kTombstoneGroup =
222 BaseHashTable::TagVector::broadcast(kTombstoneTag);
223 for (int64_t numProbedBuckets = 0; numProbedBuckets < table.numBuckets();
224 ++numProbedBuckets) {
225 if constexpr (op == Operation::kInsert) {
226 if (partitionInfo != nullptr) {
227 if (FOLLY_UNLIKELY(!partitionInfo->inRange(bucketOffset_))) {
228 // If we have passed the partition boundary, then call insert to put
229 // row in overflows.
230 return insert(row_, bucketOffset_);
231 }
232 if (FOLLY_UNLIKELY(
233 (bucketOffset_ <= startBucketOffset) &&
234 (numProbedBuckets > 0))) {
235 // If this is the last bucket and wrap around, then call insert to
236 // put row in overflows.
237 return insert(row_, partitionInfo->end);
238 }
239 }
240 }
241
242 while (hits_ > 0) {
243 loadNextHit<op>(table, firstKey);
244 if (!(extraCheck && group_ == alreadyChecked) && compare(group_, row_)) {
245 if (op == Operation::kErase) {
246 eraseHit(table, numTombstones);
247 }
248 table.incrementHits();
249 return group_;
250 }

Callers

nothing calls this directly

Calls 15

toBitMaskFunction · 0.85
insertFunction · 0.85
getAndClearLastSetBitFunction · 0.85
incrementHitsMethod · 0.80
numBucketsMethod · 0.80
getDecodedVectorsMethod · 0.80
strMethod · 0.80
compareFunction · 0.70
loadTagsMethod · 0.45
inRangeMethod · 0.45
nextBucketOffsetMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected