Prepare to fully canonicalize views
This commit is contained in:
@@ -615,10 +615,9 @@ struct __attribute__((__visibility__("hidden"))) VersionedMap::Impl {
|
||||
|
||||
// If `val` is set, then this is a point mutation at `latestVersion`.
|
||||
// Otherwise it's the end of a range mutation at `latestVersion`.
|
||||
// `finger` becomes the search path of `key`
|
||||
// `finger` is a valid finger to the insertion path of `key` in the latest
|
||||
// version (which can be obtained with `search`)
|
||||
void insert(Key key, std::optional<Val> val, Finger &finger) {
|
||||
|
||||
search<std::memory_order_relaxed>(key, latestRoot, latestVersion, finger);
|
||||
const bool inserted = finger.backNode() == 0;
|
||||
|
||||
int64_t pointVersion, rangeVersion;
|
||||
@@ -878,9 +877,13 @@ struct __attribute__((__visibility__("hidden"))) VersionedMap::Impl {
|
||||
Finger iter;
|
||||
switch (m.type) {
|
||||
case Set: {
|
||||
search<std::memory_order_relaxed>({m.param1, m.param1Len}, latestRoot,
|
||||
latestVersion, iter);
|
||||
insert({m.param1, m.param1Len}, {{m.param2, m.param2Len}}, iter);
|
||||
} break;
|
||||
case Clear: {
|
||||
search<std::memory_order_relaxed>({m.param1, m.param1Len}, latestRoot,
|
||||
latestVersion, iter);
|
||||
insert({m.param1, m.param1Len}, {{nullptr, -1}}, iter);
|
||||
if (m.param2Len > 0) {
|
||||
move<std::memory_order_relaxed, true>(iter, latestVersion);
|
||||
@@ -891,6 +894,8 @@ struct __attribute__((__visibility__("hidden"))) VersionedMap::Impl {
|
||||
}
|
||||
// TODO reuse finger? It should be one rank away from its insertion
|
||||
// point
|
||||
search<std::memory_order_relaxed>({m.param2, m.param2Len}, latestRoot,
|
||||
latestVersion, iter);
|
||||
insert({m.param2, m.param2Len}, {}, iter);
|
||||
}
|
||||
} break;
|
||||
|
Reference in New Issue
Block a user