mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SIL: support specialized witness_method instructions
In Embedded Swift, witness method lookup is done from specialized witness tables. For this to work, the type of witness_method must be specialized as well. Otherwise the method call would be done with wrong parameter conventions (indirect instead of direct).
This commit is contained in:
@@ -531,6 +531,7 @@ SerializedSILLoader *SILModule::getSILLoader() {
|
||||
std::pair<SILFunction *, SILWitnessTable *>
|
||||
SILModule::lookUpFunctionInWitnessTable(ProtocolConformanceRef C,
|
||||
SILDeclRef Requirement,
|
||||
bool lookupInSpecializedWitnessTable,
|
||||
SILModule::LinkingMode linkingMode) {
|
||||
if (!C.isConcrete())
|
||||
return {nullptr, nullptr};
|
||||
@@ -539,7 +540,12 @@ SILModule::lookUpFunctionInWitnessTable(ProtocolConformanceRef C,
|
||||
SILLinkerVisitor linker(*this, linkingMode);
|
||||
linker.processConformance(C);
|
||||
}
|
||||
SILWitnessTable *wt = lookUpWitnessTable(C.getConcrete()->getRootConformance());
|
||||
ProtocolConformance *conf = C.getConcrete();
|
||||
if (!isa<SpecializedProtocolConformance>(conf) || !lookupInSpecializedWitnessTable) {
|
||||
conf = conf->getRootConformance();
|
||||
}
|
||||
|
||||
SILWitnessTable *wt = lookUpWitnessTable(conf);
|
||||
|
||||
if (!wt) {
|
||||
LLVM_DEBUG(llvm::dbgs() << " Failed speculative lookup of "
|
||||
|
||||
Reference in New Issue
Block a user