mirror of
https://github.com/luau-lang/luau.git
synced 2025-01-19 17:28:06 +00:00
Missing sync elements
This commit is contained in:
parent
d414b56acb
commit
5b9344a480
4 changed files with 6 additions and 10 deletions
|
@ -5,7 +5,6 @@
|
||||||
#include "Luau/Id.h"
|
#include "Luau/Id.h"
|
||||||
#include "Luau/Language.h"
|
#include "Luau/Language.h"
|
||||||
#include "Luau/UnionFind.h"
|
#include "Luau/UnionFind.h"
|
||||||
#include "Luau/VecDeque.h"
|
|
||||||
|
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
@ -145,7 +144,7 @@ private:
|
||||||
/// The hashcons 𝐻 is a map from e-nodes to e-class ids.
|
/// The hashcons 𝐻 is a map from e-nodes to e-class ids.
|
||||||
std::unordered_map<L, Id, typename L::Hash> hashcons;
|
std::unordered_map<L, Id, typename L::Hash> hashcons;
|
||||||
|
|
||||||
VecDeque<std::pair<L, Id>> worklist;
|
std::vector<std::pair<L, Id>> worklist;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void canonicalize(L& enode)
|
void canonicalize(L& enode)
|
||||||
|
@ -183,7 +182,7 @@ private:
|
||||||
for (Id operand : enode.operands())
|
for (Id operand : enode.operands())
|
||||||
get(operand).parents.push_back({enode, id});
|
get(operand).parents.push_back({enode, id});
|
||||||
|
|
||||||
worklist.push_back({enode, id});
|
worklist.emplace_back(enode, id);
|
||||||
hashcons.insert_or_assign(enode, id);
|
hashcons.insert_or_assign(enode, id);
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#include "Luau/Variant.h"
|
#include "Luau/Variant.h"
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <algorithm>
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <utility>
|
#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
|
int index() const noexcept
|
||||||
{
|
{
|
||||||
return v.index();
|
return v.index();
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
namespace Luau::EqSat
|
namespace Luau::EqSat
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,6 +11,7 @@ Id UnionFind::makeSet()
|
||||||
Id id{parents.size()};
|
Id id{parents.size()};
|
||||||
parents.push_back(id);
|
parents.push_back(id);
|
||||||
ranks.push_back(0);
|
ranks.push_back(0);
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +33,7 @@ Id UnionFind::find(Id id)
|
||||||
parents[size_t(id)] = set;
|
parents[size_t(id)] = set;
|
||||||
id = parent;
|
id = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,6 +49,7 @@ void UnionFind::merge(Id a, Id b)
|
||||||
std::swap(aSet, bSet);
|
std::swap(aSet, bSet);
|
||||||
|
|
||||||
parents[size_t(bSet)] = aSet;
|
parents[size_t(bSet)] = aSet;
|
||||||
|
|
||||||
if (ranks[size_t(aSet)] == ranks[size_t(bSet)])
|
if (ranks[size_t(aSet)] == ranks[size_t(bSet)])
|
||||||
ranks[size_t(aSet)]++;
|
ranks[size_t(aSet)]++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue