Skip to content

Commit 34a38b5

Browse files
committed
---
yaml --- r: 275423 b: refs/heads/master-next c: a60086f h: refs/heads/master i: 275421: f75b8ab 275419: b5335ec 275415: d79ce5d 275407: 4aabc90 275391: eef4d91
1 parent de8d529 commit 34a38b5

File tree

6 files changed

+66
-25
lines changed

6 files changed

+66
-25
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 65b3164726f2e62dff31e90a5cb5e3fb67cc82bf
3-
refs/heads/master-next: 3bd7f027f8968efa7551aac1f09d54aa78804ad1
3+
refs/heads/master-next: a60086f1ddc822f5c1acd602fc7d23074abfbae8
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea
66
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-b: 66d897bfcf64a82cb9a87f5e663d889189d06d07

branches/master-next/stdlib/public/runtime/Metadata.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2601,7 +2601,12 @@ getSuperclassMetadata(ClassMetadata *self, bool allowDependency) {
26012601
/*non-blocking*/ allowDependency);
26022602
MetadataResponse response =
26032603
swift_getTypeByMangledName(request, superclassName,
2604-
substitutions, substitutions).getResponse();
2604+
[&substitutions](unsigned depth, unsigned index) {
2605+
return substitutions.getMetadata(depth, index);
2606+
},
2607+
[&substitutions](const Metadata *type, unsigned index) {
2608+
return substitutions.getWitnessTable(type, index);
2609+
}).getResponse();
26052610
auto superclass = response.Value;
26062611
if (!superclass) {
26072612
fatalError(0,
@@ -4292,8 +4297,13 @@ swift_getAssociatedTypeWitnessSlowImpl(
42924297
auto originalConformingType = findConformingSuperclass(conformingType,
42934298
conformance);
42944299
SubstGenericParametersFromMetadata substitutions(originalConformingType);
4295-
response = swift_getTypeByMangledName(request, mangledName, substitutions,
4296-
substitutions).getResponse();
4300+
response = swift_getTypeByMangledName(request, mangledName,
4301+
[&substitutions](unsigned depth, unsigned index) {
4302+
return substitutions.getMetadata(depth, index);
4303+
},
4304+
[&substitutions](const Metadata *type, unsigned index) {
4305+
return substitutions.getWitnessTable(type, index);
4306+
}).getResponse();
42974307
}
42984308
auto assocTypeMetadata = response.Value;
42994309

branches/master-next/stdlib/public/runtime/MetadataLookup.cpp

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,8 +1084,13 @@ class DecodedMetadataBuilder {
10841084
genericParamCounts);
10851085
bool failed =
10861086
_checkGenericRequirements(genericContext->getGenericRequirements(),
1087-
allGenericArgsVec, substitutions,
1088-
substitutions);
1087+
allGenericArgsVec,
1088+
[&substitutions](unsigned depth, unsigned index) {
1089+
return substitutions.getMetadata(depth, index);
1090+
},
1091+
[&substitutions](const Metadata *type, unsigned index) {
1092+
return substitutions.getWitnessTable(type, index);
1093+
});
10891094
if (failed)
10901095
return BuiltType();
10911096

@@ -1357,7 +1362,12 @@ swift_getTypeByMangledNameInEnvironment(
13571362
llvm::StringRef typeName(typeNameStart, typeNameLength);
13581363
SubstGenericParametersFromMetadata substitutions(environment, genericArgs);
13591364
return swift_getTypeByMangledName(MetadataState::Complete, typeName,
1360-
substitutions, substitutions).getMetadata();
1365+
[&substitutions](unsigned depth, unsigned index) {
1366+
return substitutions.getMetadata(depth, index);
1367+
},
1368+
[&substitutions](const Metadata *type, unsigned index) {
1369+
return substitutions.getWitnessTable(type, index);
1370+
}).getMetadata();
13611371
}
13621372

13631373
SWIFT_CC(swift) SWIFT_RUNTIME_EXPORT
@@ -1370,7 +1380,12 @@ swift_getTypeByMangledNameInContext(
13701380
llvm::StringRef typeName(typeNameStart, typeNameLength);
13711381
SubstGenericParametersFromMetadata substitutions(context, genericArgs);
13721382
return swift_getTypeByMangledName(MetadataState::Complete, typeName,
1373-
substitutions, substitutions).getMetadata();
1383+
[&substitutions](unsigned depth, unsigned index) {
1384+
return substitutions.getMetadata(depth, index);
1385+
},
1386+
[&substitutions](const Metadata *type, unsigned index) {
1387+
return substitutions.getWitnessTable(type, index);
1388+
}).getMetadata();
13741389
}
13751390

13761391
/// Demangle a mangled name, but don't allow symbolic references.
@@ -1536,7 +1551,7 @@ void SubstGenericParametersFromMetadata::setup() const {
15361551
}
15371552

15381553
const Metadata *
1539-
SubstGenericParametersFromMetadata::operator()(
1554+
SubstGenericParametersFromMetadata::getMetadata(
15401555
unsigned depth, unsigned index) const {
15411556
// On first access, compute the descriptor path.
15421557
setup();
@@ -1577,17 +1592,16 @@ SubstGenericParametersFromMetadata::operator()(
15771592
}
15781593

15791594
const WitnessTable *
1580-
SubstGenericParametersFromMetadata::operator()(const Metadata *type,
1581-
unsigned index) const {
1595+
SubstGenericParametersFromMetadata::getWitnessTable(const Metadata *type,
1596+
unsigned index) const {
15821597
// On first access, compute the descriptor path.
15831598
setup();
15841599

15851600
return (const WitnessTable *)genericArgs[index + numKeyGenericParameters];
15861601
}
15871602

1588-
const Metadata *SubstGenericParametersFromWrittenArgs::operator()(
1589-
unsigned depth,
1590-
unsigned index) const {
1603+
const Metadata *SubstGenericParametersFromWrittenArgs::getMetadata(
1604+
unsigned depth, unsigned index) const {
15911605
if (auto flatIndex =
15921606
_depthIndexToFlatIndex(depth, index, genericParamCounts)) {
15931607
if (*flatIndex < allGenericArgs.size())
@@ -1598,8 +1612,8 @@ const Metadata *SubstGenericParametersFromWrittenArgs::operator()(
15981612
}
15991613

16001614
const WitnessTable *
1601-
SubstGenericParametersFromWrittenArgs::operator()(const Metadata *type,
1602-
unsigned index) const {
1615+
SubstGenericParametersFromWrittenArgs::getWitnessTable(const Metadata *type,
1616+
unsigned index) const {
16031617
return nullptr;
16041618
}
16051619

@@ -1708,8 +1722,13 @@ void swift::gatherWrittenGenericArgs(
17081722
genericParamCounts);
17091723
allGenericArgs[*lhsFlatIndex] =
17101724
swift_getTypeByMangledName(MetadataState::Abstract,
1711-
req.getMangledTypeName(), substitutions,
1712-
substitutions).getMetadata();
1725+
req.getMangledTypeName(),
1726+
[&substitutions](unsigned depth, unsigned index) {
1727+
return substitutions.getMetadata(depth, index);
1728+
},
1729+
[&substitutions](const Metadata *type, unsigned index) {
1730+
return substitutions.getWitnessTable(type, index);
1731+
}).getMetadata();
17131732
continue;
17141733
}
17151734

branches/master-next/stdlib/public/runtime/Private.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,9 @@ class TypeInfo {
318318
: sourceIsMetadata(false), environment(environment),
319319
genericArgs(arguments) { }
320320

321-
const Metadata *operator()(unsigned depth, unsigned index) const;
322-
const WitnessTable *operator()(const Metadata *type, unsigned index) const;
321+
const Metadata *getMetadata(unsigned depth, unsigned index) const;
322+
const WitnessTable *getWitnessTable(const Metadata *type,
323+
unsigned index) const;
323324
};
324325

325326
/// Retrieve the type metadata described by the given demangled type name.
@@ -378,8 +379,9 @@ class TypeInfo {
378379
: allGenericArgs(allGenericArgs), genericParamCounts(genericParamCounts) {
379380
}
380381

381-
const Metadata *operator()(unsigned depth, unsigned index) const;
382-
const WitnessTable *operator()(const Metadata *type, unsigned index) const;
382+
const Metadata *getMetadata(unsigned depth, unsigned index) const;
383+
const WitnessTable *getWitnessTable(const Metadata *type,
384+
unsigned index) const;
383385
};
384386

385387
/// Gather generic parameter counts from a context descriptor.

branches/master-next/stdlib/public/runtime/ProtocolConformance.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,12 @@ ProtocolConformanceDescriptor::getWitnessTable(const Metadata *type) const {
167167
SubstGenericParametersFromMetadata substitutions(type);
168168
bool failed =
169169
_checkGenericRequirements(getConditionalRequirements(), conditionalArgs,
170-
substitutions, substitutions);
170+
[&substitutions](unsigned depth, unsigned index) {
171+
return substitutions.getMetadata(depth, index);
172+
},
173+
[&substitutions](const Metadata *type, unsigned index) {
174+
return substitutions.getWitnessTable(type, index);
175+
});
171176
if (failed) return nullptr;
172177
}
173178

branches/master-next/stdlib/public/runtime/ReflectionMirror.mm

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,13 @@ static bool _shouldReportMissingReflectionMetadataWarnings() {
337337

338338
SubstGenericParametersFromMetadata substitutions(base);
339339
auto typeInfo = swift_getTypeByMangledName(MetadataState::Complete,
340-
typeName, substitutions,
341-
substitutions);
340+
typeName,
341+
[&substitutions](unsigned depth, unsigned index) {
342+
return substitutions.getMetadata(depth, index);
343+
},
344+
[&substitutions](const Metadata *type, unsigned index) {
345+
return substitutions.getWitnessTable(type, index);
346+
});
342347

343348
// If demangling the type failed, pretend it's an empty type instead with
344349
// a log message.

0 commit comments

Comments
 (0)