Remove "next" argument from materializeMutations

This commit is contained in:
2024-06-14 23:40:09 -07:00
parent 2eea70f063
commit edb76feadf

View File

@@ -1208,8 +1208,8 @@ VersionedMap::Iterator::operator*() const {
return impl->mutations[impl->mutationIndex];
}
void materializeMutations(VersionedMap::Iterator::Impl *impl, const Entry *prev,
const Entry *next) {
void materializeMutations(VersionedMap::Iterator::Impl *impl,
const Entry *prev) {
if (prev == nullptr) {
Finger copy;
impl->finger.copyTo(copy);
@@ -1220,14 +1220,6 @@ void materializeMutations(VersionedMap::Iterator::Impl *impl, const Entry *prev,
assert(!impl->map->mm.base[impl->finger.backNode()].entry->clearTo());
}
}
if (next == nullptr) {
Finger copy;
impl->finger.copyTo(copy);
impl->map->move<std::memory_order_acquire, true>(copy, impl->version);
if (copy.searchPathSize() > 0) {
next = impl->map->mm.base[copy.backNode()].entry;
}
}
const auto &entry = *impl->map->mm.base[impl->finger.backNode()].entry;
impl->mutationCount = 0;
@@ -1242,7 +1234,6 @@ void materializeMutations(VersionedMap::Iterator::Impl *impl, const Entry *prev,
}
if (entry.pointMutation()) {
if (entry.valLen < 0 /* pointClear */) {
assert(next == nullptr || !next->clearTo());
impl->mutations[impl->mutationCount++] = {
entry.getKey(), nullptr, entry.keyLen, 0,
VersionedMap::Clear, entry.pointVersion};
@@ -1268,7 +1259,7 @@ VersionedMap::Iterator &VersionedMap::Iterator::operator++() {
if (impl->finger.searchPathSize() == 0) {
break;
}
materializeMutations(impl, &entry, nullptr);
materializeMutations(impl, &entry);
} while (impl->mutationCount == 0);
impl->mutationIndex = 0;
@@ -1302,13 +1293,11 @@ VersionedMap::Iterator &VersionedMap::Iterator::operator--() {
impl->finger.push(c, true);
}
const Entry *next = nullptr;
for (;;) {
materializeMutations(impl, nullptr, next);
materializeMutations(impl, nullptr);
if (impl->mutationCount > 0) {
break;
}
next = impl->map->mm.base[impl->finger.backNode()].entry;
impl->map->move<std::memory_order_acquire, false>(impl->finger,
impl->version);
}
@@ -1317,13 +1306,12 @@ VersionedMap::Iterator &VersionedMap::Iterator::operator--() {
}
do {
const Entry *entry = impl->map->mm.base[impl->finger.backNode()].entry;
impl->map->move<std::memory_order_acquire, false>(impl->finger,
impl->version);
if (impl->finger.searchPathSize() == 0) {
break;
}
materializeMutations(impl, nullptr, entry);
materializeMutations(impl, nullptr);
} while (impl->mutationCount == 0);
impl->mutationIndex = impl->mutationCount - 1;
return *this;
@@ -1398,7 +1386,7 @@ void VersionedMap::Impl::StepwiseFirstGeq::end() {
if (finger.searchPathSize() == 0) {
break;
} else {
materializeMutations(iterator->impl, prev, nullptr);
materializeMutations(iterator->impl, prev);
for (int j = 0; j < iterator->impl->mutationCount; ++j) {
if (geq(iterator->impl->mutations[j], *key)) {
iterator->impl->mutationIndex = j;
@@ -1550,7 +1538,7 @@ VersionedMap::Iterator VersionedMap::begin(int64_t version) const {
const Entry *prev = nullptr;
for (;;) {
if (result.impl->finger.searchPathSize() > 0) {
materializeMutations(result.impl, prev, nullptr);
materializeMutations(result.impl, prev);
if (result.impl->mutationCount > 0) {
break;
}