Commit Graph

114 Commits

Author SHA1 Message Date
Slava Pestov
2666449aa6 RequirementMachine: Implement AbstractGenericSignatureRequestRQM 2021-11-12 00:32:43 -05:00
Slava Pestov
24bdecdca5 AST: Remove ASTContext::getOrCreateRequirementMachine() in favor of getRewriteContext() 2021-11-11 22:39:20 -05:00
Slava Pestov
952dafad72 RequirementMachine: Preliminary refactoring in preparation for computing top-level generic signatures 2021-11-11 22:39:20 -05:00
Slava Pestov
2c4cfdcb1f RequirementMachine: Generating conformances prefers to delete non-explicit rules
This is a heuristic to ensure that conformance requirements remain in
their original protocol if possible, when the protocol is part of a
connected component consisting of multiple protocols.
2021-11-10 00:18:57 -05:00
Slava Pestov
b30aa22f73 RequirementMachine: Split off RequirementSignatureRequestRQM from RequirementSignatureRequest
This is a refactoring needed to implement 'verify' mode. The
RequirementMachine computes the requirement signature for an
entire connected component of protocols at once, whereas the
GenericSignatureBuilder only does one protocol at a time.

Using the same request for both in 'verify' mode meant that
we would only call the GSB for the first protocol in a
connected component, and then the RequirementMachine would
fill in the rest.

To fix this, split it up into two requests. The original
RequirementSignatureRequest calls into the GSB, and then
kicks off a RequirementSignatureRequestRQM to get the
requirement signature computed by the RequirementMachine
(possibly cached, if this protocol is part of a connected
component with more than one protocol in it).
2021-11-01 22:51:59 -04:00
Slava Pestov
0d167a435c AST: Move GenericSignatureBuilder.h from include/swift/AST/ to lib/AST/ 2021-10-30 00:35:59 -04:00
Slava Pestov
f44926b6b9 RequirementMachine: Tighten up createRequirementFromRule()
Now that the 'identity conformance' [P].[P] => [P] is permanent,
we won't see it here, so we can just assume that any non-permanent,
non-redundant rule maps to a requirement.
2021-10-27 00:38:42 -04:00
Slava Pestov
74d944d511 RequirementMachine: Use llvm::array_pod_sort() to sort requirements 2021-10-27 00:38:26 -04:00
Slava Pestov
0571b65cb8 RequirementMachine: Move protocol linear order from ProtocolGraph to RewriteContext 2021-10-21 19:00:10 -04:00
Slava Pestov
cd8692466d RequirementMachine: Better simulation of GSB's 'connected components' malarkey 2021-10-15 15:13:22 -04:00
Slava Pestov
25718c7d8f RequirementMachine: Preliminary support for minimizing layout, superclass and concrete type requirements 2021-10-14 15:03:28 -04:00
Slava Pestov
85dfbcdedb RequirementMachine: Move some code from RequirementMachine.cpp to RequirementMachineRequests.cpp 2021-10-09 19:11:14 -04:00
Slava Pestov
7244102b4d RequirementMachine: Wire up protocol requirement signature minimization 2021-10-09 19:11:14 -04:00
Slava Pestov
14708adf5c RequirementMachine: Move implementation of RequirementSignatureRequest out of Sema
For now, this still uses the GSB.
2021-10-08 14:28:27 -04:00