Vectorize inner page check for Node256

This commit is contained in:
2024-06-27 17:09:45 -07:00
parent 639518bed4
commit c065b185ae

View File

@@ -313,7 +313,7 @@ struct Node256 : Node {
BitSet bitSet;
Node *children[256];
int64_t childMaxVersion[256];
constexpr static int kMaxOfMaxPageSize = 8;
constexpr static int kMaxOfMaxPageSize = 16;
constexpr static int kMaxOfMaxShift =
std::countr_zero(uint32_t(kMaxOfMaxPageSize));
constexpr static int kMaxOfMaxTotalPages = 256 / kMaxOfMaxPageSize;
@@ -1843,13 +1843,17 @@ bool checkMaxBetweenExclusive(Node *n, int begin, int end,
return result;
}
}
// Check inner pages
bool result = true;
for (int i = (begin >> Node256::kMaxOfMaxShift) + 1;
i < ((end - 1) >> Node256::kMaxOfMaxShift); ++i) {
result &= self->maxOfMax[i] <= readVersion;
uint64_t conflict = 0;
// Check all pages
for (int i = 0; i < Node256::kMaxOfMaxTotalPages; ++i) {
conflict |= (self->maxOfMax[i] > readVersion) << i;
}
return result;
// Only keep inner pages
const int pageBegin = (begin >> Node256::kMaxOfMaxShift) + 1;
const int pageEnd = (end - 1) >> Node256::kMaxOfMaxShift;
conflict &= (1 << pageEnd) - 1;
conflict >>= pageBegin;
return !conflict;
}
default: // GCOVR_EXCL_LINE
__builtin_unreachable(); // GCOVR_EXCL_LINE