Commit Graph

33 Commits

Author SHA1 Message Date
Slava Pestov
fbe3d71b19 RequirementMachine: Small cleanup 2024-09-14 23:33:11 -04:00
Holly Borla
2ea4586580 [Requirement Machine] Implement same-element requirements. 2024-07-15 10:19:32 -07:00
Slava Pestov
f34e57c016 RequirementMachine: Use ProtocolDecl::getAllInheritedProtocols() 2024-06-25 15:20:42 -04:00
Holly Borla
c7c1a2074e [RequirementMachine] Store the singleton 'Storage' instance for shape
symbols in RewriteContext.
2022-10-07 10:35:49 -07:00
Slava Pestov
3cfbe037ee RequirementMachine: Simplify getTypeForSymbolRange() a bit 2022-03-29 00:43:41 -04:00
Slava Pestov
4d097da73c RequirementMachine: Re-use requirement machines constructed by minimization for queries
Fixes rdar://problem/88135641.
2022-03-26 00:56:41 -04:00
Slava Pestov
af99ac55de RequirementMachine: Add -debug-requirement-machine=timers 2022-03-26 00:56:41 -04:00
Slava Pestov
3fe4aaae5a RequirementMachine: Fix subtle bug in isRecursivelyConstructingRequirementMachine()
I don't have a reduced test case. It was possible for computing the requirement
signatures of a connected component to have finished, and yet for the
ProtocolDecl::hasComputedRequirementSignature() method to return false, if
we had evaluated a RequirementSignatureRequestRQM but not the top-level
RequirementSignatureRequest.

Instead, track whether we've computed the signatures for a component directly.

I don't have a reduced test case. It would arise with associated type inference,
which uses this predicate to break nasty cycles.
2022-03-24 23:45:32 -04:00
Slava Pestov
af443bee0a RequirementMachine: Implement RewriteContext::getRequirementMachine(ProtocolDecl *) 2022-03-16 00:58:30 -04:00
Slava Pestov
f59ffbb94d RequirementMachine: Remove unused field from RewriteContext 2022-03-11 17:28:01 -05:00
Slava Pestov
0d0bcb2ff1 RequirementMachine: Simplify the Symbol API for removal of merged associated types 2022-02-07 18:57:45 -05:00
Slava Pestov
e2e088e082 RequirementMachine: Remove merged associated types from completion 2022-02-07 18:57:45 -05:00
Slava Pestov
1539128dc4 RequirementMachine: Move getGenericParamIndex() to RewriteContext 2022-02-04 22:47:19 -05:00
Slava Pestov
c46c7773ed RequirementMachine: Rename remapConcreteSubstitutionSchema() to getRelativeSubstitutionSchemaFromType() 2022-01-25 00:32:25 -05:00
Slava Pestov
01ba790ccf RequirementMachine: Move remapConcreteSubstitutionSchema() to RewriteContext 2022-01-25 00:32:25 -05:00
Slava Pestov
f480eeaf53 RequirementMachine: Factor out getRuleForRequirement() from RuleBuilder::addRequirement() 2022-01-25 00:32:25 -05:00
Slava Pestov
fa30159130 RequirementMachine: Move term to type methods from RewriteContext to PropertyMap 2022-01-20 00:18:47 -05:00
Slava Pestov
317743a487 RequirementMachine: Rename GeneratingConformances => MinimalConformances 2021-12-17 10:04:52 -05:00
Slava Pestov
d7b5dfc644 RequirementMachine: Don't keep protocol requirement machines around 2021-12-10 00:49:45 -05:00
Slava Pestov
044611dddc RequirementMachine: Another cycle-breaking hack for associated type inference 2021-12-08 00:53:35 -05:00
Slava Pestov
8e7a9b0f9f RequirementMachine: Add a couple of histograms 2021-12-07 15:31:47 -05:00
Slava Pestov
0571b65cb8 RequirementMachine: Move protocol linear order from ProtocolGraph to RewriteContext 2021-10-21 19:00:10 -04:00
Slava Pestov
56439726ab RequirementMachine: Move some code from PropertyMap.cpp to RewriteContext.cpp 2021-10-14 15:03:26 -04:00
Slava Pestov
c3270742dc RequirementMachine: Compute strongly connected components from the protocol dependency graph 2021-10-05 21:30:57 -04:00
Slava Pestov
47ab4a9f28 AST: GenericSignatures point directly to their RequirementMachine
This avoids a hashtable lookup when performing queries.
2021-09-27 21:36:45 -04:00
Slava Pestov
399a600e32 RequirementMachine: Add -debug-requirement-machine= flag to control debug output 2021-08-20 01:29:22 -04:00
Slava Pestov
0935952038 RequirementMachine: Cache result of mergeAssociatedTypes() 2021-08-19 22:14:58 -04:00
Slava Pestov
eec233507b RequirementMachine: Cache the mapping from associated type symbols to associated type declarations 2021-08-13 17:27:49 -04:00
Slava Pestov
47fc3d87ad RequirementMachine: Speed up PropertyMap lookups with a suffix trie
Whereas term simplification uses a prefix trie with shortest matching,
the PropertyMap uses a suffix trie with longest matching.
2021-08-06 14:17:20 -04:00
Slava Pestov
156fa2cc04 RequirementMachine: Speed up term simplification with a prefix trie
Previously RewriteSystem::simplify() would attempt to apply every
rewrite rule at every position in the original term, which was
obviously a source of overhead.

The trie itself is somewhat unoptimized; for example, with a bit of
effort it could merge a node with its only child, if nodes stored
a range of elements to compare rather than a single element.
2021-08-05 21:42:50 -04:00
Slava Pestov
ed966e7337 RequirementMachine: Add histograms for symbol kinds and term length 2021-08-05 21:42:50 -04:00
Slava Pestov
cfb1595ec5 RequirementMachine: Rename Atom => Symbol 2021-07-23 15:58:50 -04:00
Slava Pestov
4184ebd0a8 RequirementMachine: Split off RewriteContext.{h,cpp} from RewriteSystem.{h,cpp} 2021-07-14 00:16:06 -04:00