Skip to content

Commit 4201ed3

Browse files
committed
AST: Canonicalize opaque archetype substitution maps in the solver arena
Preserving sugar if we have type variables uses way too much memory. Canonicalize these substitution maps for now, as a (temporary?) workaround. In the future, if we decide preserving sugar is more important than a few dozen Mb of memory usage, we can also bump the arena memory limit, instead. Fixes rdar://166237860. Fixes rdar://165863647.
1 parent c053974 commit 4201ed3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/AST/ASTContext.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6086,6 +6086,11 @@ GenericEnvironment *GenericEnvironment::forPrimary(GenericSignature signature) {
60866086
/// outer substitutions.
60876087
GenericEnvironment *GenericEnvironment::forOpaqueType(
60886088
OpaqueTypeDecl *opaque, SubstitutionMap subs) {
6089+
// Don't preserve sugar if we have type variables, because this leads to
6090+
// excessive solver arena memory usage.
6091+
if (subs.getRecursiveProperties().hasTypeVariable())
6092+
subs = subs.getCanonical();
6093+
60896094
auto &ctx = opaque->getASTContext();
60906095

60916096
auto properties = ArchetypeType::archetypeProperties(

0 commit comments

Comments
 (0)