Sema: Recycle ConstraintGraphNode

This commit is contained in:
Slava Pestov
2024-09-27 00:01:36 -04:00
parent cab698216f
commit 4ef30a4b47
2 changed files with 37 additions and 2 deletions

View File

@@ -57,6 +57,13 @@ public:
/// Retrieve the type variable this node represents.
TypeVariableType *getTypeVariable() const { return TypeVar; }
void reset();
void initTypeVariable(TypeVariableType *typeVar) {
ASSERT(!TypeVar);
TypeVar = typeVar;
}
/// Retrieve the set of constraints that mention this type variable.
///
/// These are the hyperedges of the graph, connecting this node to
@@ -435,6 +442,9 @@ private:
/// Constraints that are "orphaned" because they contain no type variables.
SmallVector<Constraint *, 4> OrphanedConstraints;
/// Unused nodes.
SmallVector<ConstraintGraphNode *> FreeList;
/// Increment the number of constraints considered per attempt
/// to contract constraint graph edges.
void incrementConstraintsPerContractionCounter();