Only search backward for materializing clear range

This commit is contained in:
2024-06-19 12:16:09 -07:00
parent c4c269ab94
commit 39273424c1

View File

@@ -1220,20 +1220,20 @@ VersionedMap::Iterator::operator*() const {
void materializeMutations(VersionedMap::Iterator::Impl *impl, void materializeMutations(VersionedMap::Iterator::Impl *impl,
const Entry *prev) { const Entry *prev) {
if (prev == nullptr) {
Finger copy;
impl->finger.copyTo(copy);
impl->map->move<std::memory_order_acquire, false>(copy, impl->version);
if (copy.searchPathSize() > 0) {
prev = impl->map->mm.base[copy.backNode()].entry;
} else {
assert(!impl->map->mm.base[impl->finger.backNode()].entry->clearTo());
}
}
const auto &entry = *impl->map->mm.base[impl->finger.backNode()].entry; const auto &entry = *impl->map->mm.base[impl->finger.backNode()].entry;
impl->mutationCount = 0; impl->mutationCount = 0;
if (entry.clearTo()) { if (entry.clearTo()) {
if (prev == nullptr) {
Finger copy;
impl->finger.copyTo(copy);
impl->map->move<std::memory_order_acquire, false>(copy, impl->version);
if (copy.searchPathSize() > 0) {
prev = impl->map->mm.base[copy.backNode()].entry;
} else {
assert(!impl->map->mm.base[impl->finger.backNode()].entry->clearTo());
}
}
impl->mutations[impl->mutationCount++] = { impl->mutations[impl->mutationCount++] = {
prev->getKey(), prev->getKey(),
entry.getKey(), entry.getKey(),