@@ -1222,16 +1222,6 @@ class AccessorConformanceInfo : public ConformanceInfo {
1222
1222
}
1223
1223
return *Fulfillments;
1224
1224
}
1225
-
1226
- void bindArchetypeAccessPathsInConformance (IRGenFunction &IGF) {
1227
- auto declCtx = Conformance.getDeclContext ();
1228
- if (auto generics = declCtx->getGenericSignatureOfContext ()) {
1229
- auto getInContext = [&](CanType type) -> CanType {
1230
- return declCtx->mapTypeIntoContext (type)->getCanonicalType ();
1231
- };
1232
- bindArchetypeAccessPaths (IGF, generics, getInContext);
1233
- }
1234
- }
1235
1225
};
1236
1226
} // end anonymous namespace
1237
1227
@@ -1286,9 +1276,6 @@ getAssociatedTypeMetadataAccessFunction(AssociatedTypeDecl *requirement,
1286
1276
// Bind local type data from the metadata argument.
1287
1277
IGF.bindLocalTypeDataFromTypeMetadata (ConcreteType, IsExact, self);
1288
1278
1289
- // Bind archetype access paths.
1290
- bindArchetypeAccessPathsInConformance (IGF);
1291
-
1292
1279
// For now, assume that an associated type is cheap enough to access
1293
1280
// that it doesn't need a new cache entry.
1294
1281
if (auto archetype = dyn_cast<ArchetypeType>(associatedType)) {
@@ -1426,9 +1413,6 @@ getAssociatedTypeWitnessTableAccessFunction(CanType depAssociatedType,
1426
1413
associatedTypeMetadata);
1427
1414
IGF.bindLocalTypeDataFromTypeMetadata (ConcreteType, IsExact, self);
1428
1415
1429
- // Bind archetype access paths.
1430
- bindArchetypeAccessPathsInConformance (IGF);
1431
-
1432
1416
// For now, assume that finding an abstract conformance is always
1433
1417
// fast enough that it's not worth caching.
1434
1418
// TODO: provide an API to find the best metadata path to the conformance
@@ -1787,58 +1771,6 @@ bool irgen::hasPolymorphicParameters(CanSILFunctionType ty) {
1787
1771
llvm_unreachable (" Not a valid SILFunctionTypeRepresentation." );
1788
1772
}
1789
1773
1790
- static
1791
- void addPotentialArchetypeAccessPath (IRGenFunction &IGF,
1792
- CanType targetDepType,
1793
- CanType sourceDepType,
1794
- GetTypeParameterInContextFn getInContext) {
1795
- assert (targetDepType->isTypeParameter ());
1796
- assert (sourceDepType->isTypeParameter ());
1797
-
1798
- // We can only break down an associated-type path.
1799
- auto sourceDepMemberType = dyn_cast<DependentMemberType>(sourceDepType);
1800
- if (!sourceDepMemberType) return ;
1801
-
1802
- // We only really need to do this when there's a non-trivial set of
1803
- // conformances, but we can't determine that just from this decl:
1804
- // the associated type might gain conformances in a refining protocol.
1805
- auto association = sourceDepMemberType->getAssocType ();
1806
-
1807
- // These can end up as non-archetypes because of multiple levels of
1808
- // equality.
1809
- auto destArchetype =
1810
- dyn_cast<ArchetypeType>(getInContext (targetDepType));
1811
- if (!destArchetype) return ;
1812
- auto srcBaseArchetype =
1813
- dyn_cast<ArchetypeType>(getInContext (sourceDepMemberType.getBase ()));
1814
- if (!srcBaseArchetype) return ;
1815
-
1816
- IGF.addArchetypeAccessPath (destArchetype,
1817
- {srcBaseArchetype, association});
1818
- }
1819
-
1820
- void irgen::bindArchetypeAccessPaths (IRGenFunction &IGF, GenericSignature *Generics,
1821
- GetTypeParameterInContextFn getInContext) {
1822
- // Remember all the extra ways we have of reaching the parameter
1823
- // archetypes due to type equality constraints.
1824
- for (auto reqt : Generics->getRequirements ()) {
1825
- // Ignore non-same-type requirements in this pass.
1826
- if (reqt.getKind () != RequirementKind::SameType) continue ;
1827
-
1828
- // Ignore equality constraints to concrete types. This is really
1829
- // just a fast-path; we still have to handle this case later.
1830
- // TODO: This might be a faster / better-cached way to materialize
1831
- // local type data for the concrete type.
1832
- if (!reqt.getSecondType ()->isTypeParameter ()) continue ;
1833
-
1834
- auto firstType = reqt.getFirstType ()->getCanonicalType ();
1835
- auto secondType = reqt.getSecondType ()->getCanonicalType ();
1836
-
1837
- addPotentialArchetypeAccessPath (IGF, firstType, secondType, getInContext);
1838
- addPotentialArchetypeAccessPath (IGF, secondType, firstType, getInContext);
1839
- }
1840
- }
1841
-
1842
1774
// / Emit a polymorphic parameters clause, binding all the metadata necessary.
1843
1775
void EmitPolymorphicParameters::emit (Explosion &in,
1844
1776
WitnessMetadata *witnessMetadata,
@@ -1860,29 +1792,8 @@ void EmitPolymorphicParameters::emit(Explosion &in,
1860
1792
1861
1793
// Bind all the fulfillments we can from the formal parameters.
1862
1794
bindParameterSources (getParameter);
1863
-
1864
- if (!Generics) return ;
1865
-
1866
- // Bind all the archetype access paths.
1867
- bindArchetypeAccessPaths (IGF, Generics, getInContext);
1868
- }
1869
-
1870
- void IRGenFunction::addArchetypeAccessPath (CanArchetypeType targetArchetype,
1871
- ArchetypeAccessPath accessPath) {
1872
- ArchetypeAccessPaths[targetArchetype].push_back (accessPath);
1873
1795
}
1874
1796
1875
- ArrayRef<IRGenFunction::ArchetypeAccessPath>
1876
- IRGenFunction::getArchetypeAccessPaths (CanArchetypeType targetArchetype) {
1877
- auto it = ArchetypeAccessPaths.find (targetArchetype);
1878
- if (it == ArchetypeAccessPaths.end ()) {
1879
- return {};
1880
- } else {
1881
- return it->second ;
1882
- }
1883
- }
1884
-
1885
-
1886
1797
llvm::Value *
1887
1798
MetadataPath::followFromTypeMetadata (IRGenFunction &IGF,
1888
1799
CanType sourceType,
@@ -2716,12 +2627,6 @@ void GenericTypeRequirements::bindFromBuffer(IRGenFunction &IGF,
2716
2627
Address buffer,
2717
2628
GetTypeParameterInContextFn getInContext) {
2718
2629
bindFromGenericRequirementsBuffer (IGF, Requirements, buffer, getInContext);
2719
-
2720
- auto Generics = TheDecl->getGenericSignature ();
2721
- if (!Generics) return ;
2722
-
2723
- // Bind all the archetype access paths in the signature's requirements.
2724
- bindArchetypeAccessPaths (IGF, Generics, getInContext);
2725
2630
}
2726
2631
2727
2632
void irgen::bindFromGenericRequirementsBuffer (IRGenFunction &IGF,
0 commit comments