Missing sync elements

This commit is contained in:
Vyacheslav Egorov 2024-08-23 17:58:14 +03:00
parent d414b56acb
commit 5b9344a480
4 changed files with 6 additions and 10 deletions

View file

@ -5,7 +5,6 @@
#include "Luau/Id.h"
#include "Luau/Language.h"
#include "Luau/UnionFind.h"
#include "Luau/VecDeque.h"
#include <optional>
#include <unordered_map>
@ -145,7 +144,7 @@ private:
/// The hashcons 𝐻 is a map from e-nodes to e-class ids.
std::unordered_map<L, Id, typename L::Hash> hashcons;
VecDeque<std::pair<L, Id>> worklist;
std::vector<std::pair<L, Id>> worklist;
private:
void canonicalize(L& enode)
@ -183,7 +182,7 @@ private:
for (Id operand : enode.operands())
get(operand).parents.push_back({enode, id});
worklist.push_back({enode, id});
worklist.emplace_back(enode, id);
hashcons.insert_or_assign(enode, id);
return id;

View file

@ -7,7 +7,6 @@
#include "Luau/Variant.h"
#include <array>
#include <algorithm>
#include <type_traits>
#include <utility>
@ -233,12 +232,6 @@ struct Language final
{
}
Language(const Language&) noexcept = default;
Language& operator=(const Language&) noexcept = default;
Language(Language&&) noexcept = default;
Language& operator=(Language&&) noexcept = default;
int index() const noexcept
{
return v.index();

View file

@ -3,6 +3,7 @@
#include <cstddef>
#include <functional>
#include <vector>
namespace Luau::EqSat
{

View file

@ -11,6 +11,7 @@ Id UnionFind::makeSet()
Id id{parents.size()};
parents.push_back(id);
ranks.push_back(0);
return id;
}
@ -32,6 +33,7 @@ Id UnionFind::find(Id id)
parents[size_t(id)] = set;
id = parent;
}
return set;
}
@ -47,6 +49,7 @@ void UnionFind::merge(Id a, Id b)
std::swap(aSet, bSet);
parents[size_t(bSet)] = aSet;
if (ranks[size_t(aSet)] == ranks[size_t(bSet)])
ranks[size_t(aSet)]++;
}