Fix two canonicalization bugs

This commit is contained in:
2024-06-14 21:51:59 -07:00
parent a63fd3970b
commit e4a77c88d8

View File

@@ -961,6 +961,8 @@ struct __attribute__((__visibility__("hidden"))) VersionedMap::Impl {
remove(iter); remove(iter);
insert(keyAfter({m.param1, m.param1Len}, arena), {}, insert(keyAfter({m.param1, m.param1Len}, arena), {},
/*endRange*/ true, iter); /*endRange*/ true, iter);
} else if (engulfRight) {
insert({m.param1, m.param1Len}, {}, /*endRange*/ false, iter);
} else { } else {
insert({m.param1, m.param1Len}, {{nullptr, -1}}, /*endRange*/ false, insert({m.param1, m.param1Len}, {{nullptr, -1}}, /*endRange*/ false,
iter); iter);
@@ -992,12 +994,15 @@ struct __attribute__((__visibility__("hidden"))) VersionedMap::Impl {
} }
// Check if we can engulf on the right // Check if we can engulf on the right
bool engulfRight = false;
if (!foundEnd) {
end.copyTo(copy); end.copyTo(copy);
move<std::memory_order_relaxed, true>(copy, latestVersion); move<std::memory_order_relaxed, true>(copy, latestVersion);
const auto *next = copy.searchPathSize() > 0 const auto *next = copy.searchPathSize() > 0
? mm.base[copy.backNode()].entry ? mm.base[copy.backNode()].entry
: nullptr; : nullptr;
const bool engulfRight = next && next->clearTo(); engulfRight = next && next->clearTo();
}
if (engulfLeft && foundBegin) { if (engulfLeft && foundBegin) {
remove(begin); remove(begin);