[ABI] Pass requirement base descriptor to swift_getAssociatedTypeWitness().

Have clients pass the requirement base descriptor to
swift_getAssociatedTypeWitness(), so that the witness index is just one
subtraction away, avoiding several dependent loads (witness table ->
conformance descriptor -> protocol descriptor -> requirement offset)
in the hot path.
This commit is contained in:
Doug Gregor
2018-10-10 22:35:24 -07:00
parent 1fc57ad667
commit aba018c1e8
11 changed files with 47 additions and 18 deletions

View File

@@ -2550,8 +2550,10 @@ MetadataResponse _getBridgedObjectiveCType(
assert(assocTypeRequirement->Flags.getKind() ==
ProtocolRequirementFlags::Kind::AssociatedTypeAccessFunction);
auto mutableWTable = (WitnessTable *)wtable;
return swift_getAssociatedTypeWitness(request, mutableWTable, conformingType,
assocTypeRequirement);
return swift_getAssociatedTypeWitness(
request, mutableWTable, conformingType,
protocol->getRequirementBaseDescriptor(),
assocTypeRequirement);
}
} // unnamed namespace