Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bae2b22e95 |
@@ -549,6 +549,7 @@ inline void Node48::copyChildrenAndKeyFrom(const Node16 &other) {
|
||||
assert(numChildren == Node16::kMaxNodes);
|
||||
memset(index, -1, sizeof(index));
|
||||
memset(children, 0, sizeof(children));
|
||||
memset(reverseIndex, 0, sizeof(reverseIndex));
|
||||
const auto z = InternalVersionT::zero;
|
||||
for (auto &v : childMaxVersion) {
|
||||
v = z;
|
||||
@@ -568,6 +569,13 @@ inline void Node48::copyChildrenAndKeyFrom(const Node16 &other) {
|
||||
std::max(maxOfMax[i >> Node48::kMaxOfMaxShift], childMaxVersion[i]);
|
||||
++i;
|
||||
}
|
||||
// The reverseIndex bytes beyond numChildren are initialized so that the
|
||||
// SIMD loads of a full 16-byte page in scan16 are well-defined (reading
|
||||
// indeterminate bytes is UB in C++). valgrind then treats them as undefined
|
||||
// so that it can still flag any read that relies on them.
|
||||
VALGRIND_MAKE_MEM_UNDEFINED(reverseIndex + numChildren,
|
||||
sizeof(reverseIndex) -
|
||||
numChildren * sizeof(reverseIndex[0]));
|
||||
}
|
||||
|
||||
inline void Node48::copyChildrenAndKeyFrom(const Node48 &other) {
|
||||
@@ -594,6 +602,7 @@ inline void Node48::copyChildrenAndKeyFrom(const Node256 &other) {
|
||||
copyCommon(*this, other);
|
||||
memset(index, -1, sizeof(index));
|
||||
memset(children, 0, sizeof(children));
|
||||
memset(reverseIndex, 0, sizeof(reverseIndex));
|
||||
const auto z = InternalVersionT::zero;
|
||||
for (auto &v : childMaxVersion) {
|
||||
v = z;
|
||||
@@ -615,6 +624,13 @@ inline void Node48::copyChildrenAndKeyFrom(const Node256 &other) {
|
||||
++i;
|
||||
});
|
||||
memcpy(partialKey(), &other + 1, partialKeyLen);
|
||||
// The reverseIndex bytes beyond numChildren are initialized so that the
|
||||
// SIMD loads of a full 16-byte page in scan16 are well-defined (reading
|
||||
// indeterminate bytes is UB in C++). valgrind then treats them as undefined
|
||||
// so that it can still flag any read that relies on them.
|
||||
VALGRIND_MAKE_MEM_UNDEFINED(reverseIndex + numChildren,
|
||||
sizeof(reverseIndex) -
|
||||
numChildren * sizeof(reverseIndex[0]));
|
||||
}
|
||||
|
||||
inline void Node256::copyChildrenAndKeyFrom(const Node48 &other) {
|
||||
|
||||
Reference in New Issue
Block a user