Fix specialization of class method calls in embedded swift.

Unlike in regular swift, The class_method instruction references the specialized version of a class method.
This must be handled in ReabstractionInfo: it needs to work without a concrete callee SIL function.

Also, the SILVerifier must handle the case that a class_method instruction references a specialized method.
This commit is contained in:
Erik Eckstein
2023-11-06 19:09:46 +01:00
parent 199dcc2a12
commit d6e86a8cd4
5 changed files with 45 additions and 37 deletions

View File

@@ -204,7 +204,7 @@ bool swift::specializeClassMethodInst(ClassMethodInst *cm) {
SILType substitutedType =
funcTy.substGenericArgs(m, subs, TypeExpansionContext::minimal());
ReabstractionInfo reInfo(substitutedType.getAs<SILFunctionType>(), m);
ReabstractionInfo reInfo(substitutedType.getAs<SILFunctionType>(), cm->getMember(), m);
reInfo.createSubstitutedAndSpecializedTypes();
CanSILFunctionType finalFuncTy = reInfo.getSpecializedType();
SILType finalSILTy = SILType::getPrimitiveObjectType(finalFuncTy);