Avoid call to interposable symbol

This commit is contained in:
2024-05-14 10:30:35 -07:00
parent b3ad250f41
commit 5b90bcb24f

View File

@@ -1019,6 +1019,16 @@ struct VersionedMap::Iterator::Impl {
result.mutations[1] = mutations[1]; result.mutations[1] = mutations[1];
finger.copyTo(result.finger); finger.copyTo(result.finger);
} }
bool equals(const Impl &other) const {
assert(map == other.map);
assert(version == other.version);
if (finger.searchPathSize() == 0 || other.finger.searchPathSize() == 0) {
return finger.searchPathSize() == other.finger.searchPathSize();
}
return finger.backNode() == other.finger.backNode() &&
mutationIndex == other.mutationIndex;
}
}; };
VersionedMap::Iterator::~Iterator() { VersionedMap::Iterator::~Iterator() {
@@ -1173,14 +1183,10 @@ VersionedMap::Iterator VersionedMap::Iterator::operator--(int) {
} }
bool VersionedMap::Iterator::operator==(const Iterator &other) const { bool VersionedMap::Iterator::operator==(const Iterator &other) const {
assert(impl->map == other.impl->map); if (impl == nullptr || other.impl == nullptr) {
assert(impl->version == other.impl->version); return impl == other.impl;
if (impl->finger.searchPathSize() == 0 ||
other.impl->finger.searchPathSize() == 0) {
return impl->finger.searchPathSize() == other.impl->finger.searchPathSize();
} }
return impl->finger.backNode() == other.impl->finger.backNode() && return impl->equals(*other.impl);
impl->mutationIndex == other.impl->mutationIndex;
} }
void VersionedMap::Impl::firstGeq(const Key *key, const int64_t *version, void VersionedMap::Impl::firstGeq(const Key *key, const int64_t *version,
@@ -1242,7 +1248,10 @@ void VersionedMap::Impl::firstGeq(const Key *key, const int64_t *version,
} }
bool VersionedMap::Iterator::operator!=(const Iterator &other) const { bool VersionedMap::Iterator::operator!=(const Iterator &other) const {
return !(*this == other); if (impl == nullptr || other.impl == nullptr) {
return impl != other.impl;
}
return !impl->equals(*other.impl);
} }
int VersionedMap::Iterator::cmp() const { return impl->cmp; } int VersionedMap::Iterator::cmp() const { return impl->cmp; }