forked from weaselab/conflict-set
Skip "dontInvalidate" check in erase from gc
This commit is contained in:
+16
-6
@@ -1747,6 +1747,7 @@ void maybeDownsize(Node *self, WriteContext *tls, ConflictSet::Impl *impl,
|
||||
// path to self. May invalidate children of self->parent. Returns a pointer to
|
||||
// the node after self. If erase invalidates the pointee of `dontInvalidate`, it
|
||||
// will update it to its new pointee as well. Precondition: `self->entryPresent`
|
||||
template <bool kCheckDontInvalidate = true>
|
||||
Node *erase(Node *self, WriteContext *tls, ConflictSet::Impl *impl,
|
||||
bool logical, Node *&dontInvalidate) {
|
||||
++tls->accum.entries_erased;
|
||||
@@ -1768,8 +1769,10 @@ Node *erase(Node *self, WriteContext *tls, ConflictSet::Impl *impl,
|
||||
if (self->numChildren != 0) {
|
||||
const bool update = result == dontInvalidate;
|
||||
maybeDownsize(self, tls, impl, result);
|
||||
if (update) {
|
||||
dontInvalidate = result;
|
||||
if constexpr (kCheckDontInvalidate) {
|
||||
if (update) {
|
||||
dontInvalidate = result;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -1852,13 +1855,21 @@ Node *erase(Node *self, WriteContext *tls, ConflictSet::Impl *impl,
|
||||
|
||||
const bool update = result == dontInvalidate;
|
||||
maybeDownsize(parent, tls, impl, result);
|
||||
if (update) {
|
||||
dontInvalidate = result;
|
||||
if constexpr (kCheckDontInvalidate) {
|
||||
if (update) {
|
||||
dontInvalidate = result;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Node *erase(Node *self, WriteContext *tls, ConflictSet::Impl *impl,
|
||||
bool logical) {
|
||||
Node *dummy;
|
||||
return erase<false>(self, tls, impl, logical, dummy);
|
||||
}
|
||||
|
||||
Node *nextSibling(Node *node) {
|
||||
for (;;) {
|
||||
if (node->parent == nullptr) {
|
||||
@@ -3262,8 +3273,7 @@ struct __attribute__((visibility("hidden"))) ConflictSet::Impl {
|
||||
// There's no way to insert a range such that range version of the right
|
||||
// node is greater than the point version of the left node
|
||||
assert(n->entry.rangeVersion <= oldestVersion);
|
||||
Node *dummy = nullptr;
|
||||
n = erase(n, &tls, this, /*logical*/ false, dummy);
|
||||
n = erase(n, &tls, this, /*logical*/ false);
|
||||
} else {
|
||||
maybeDecreaseCapacity(n, &tls, this);
|
||||
n = nextPhysical(n);
|
||||
|
||||
Reference in New Issue
Block a user