Pass in-tree reference to mergeWithChild

This commit is contained in:
2024-08-15 13:52:06 -07:00
parent 5626cd09d9
commit f93466316a

View File

@@ -1606,6 +1606,7 @@ void rezero(Node *n, InternalVersionT z) {
void mergeWithChild(Node *&self, WriteContext *tls, ConflictSet::Impl *impl,
Node *&dontInvalidate, Node3 *self3) {
assert(!self3->entryPresent);
auto *child = self3->children[0];
int minCapacity = self3->partialKeyLen + 1 + child->partialKeyLen;
@@ -1639,7 +1640,7 @@ void mergeWithChild(Node *&self, WriteContext *tls, ConflictSet::Impl *impl,
// that we have a new parent.
setMaxVersion(child, impl, std::max(childMaxVersion, tls->zero));
getInTree(self, impl) = child;
self = child;
tls->release(self3);
}
@@ -1662,7 +1663,7 @@ void maybeDownsize(Node *self, WriteContext *tls, ConflictSet::Impl *impl,
getInTree(self, impl) = newSelf;
tls->release(self3);
} else if (self->numChildren == 1 && !self->entryPresent) {
mergeWithChild(self, tls, impl, dontInvalidate, self3);
mergeWithChild(getInTree(self, impl), tls, impl, dontInvalidate, self3);
}
} break;
case Type_Node16: