mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
SIL: Reorient function type lowering toward interface types.
Lower types for SILDeclRefs from the interface types of their referents, dragging the old type along for the ride so we can still offer the context to clients that haven't been weaned off of it. Make SILFunctionType's interface types and generic signature independent arguments of its Derive the context types of SILFunctionType from the interface types, instead of the other way around. Do a bunch of annoying inseparable work in the AST and IRGen to accommodate the switchover. Swift SVN r12536
This commit is contained in:
@@ -1727,8 +1727,11 @@ void Serializer::writeType(Type ty) {
|
||||
|
||||
auto callingConvention = fnTy->getAbstractCC();
|
||||
auto result = fnTy->getResult();
|
||||
auto interfaceResult = fnTy->getInterfaceResult();
|
||||
auto stableResultConvention =
|
||||
getRawStableResultConvention(result.getConvention());
|
||||
auto stableInterfaceResultConvention =
|
||||
getRawStableResultConvention(interfaceResult.getConvention());
|
||||
|
||||
SmallVector<TypeID, 8> paramTypes;
|
||||
for (auto param : fnTy->getParameters()) {
|
||||
@@ -1736,6 +1739,17 @@ void Serializer::writeType(Type ty) {
|
||||
unsigned conv = getRawStableParameterConvention(param.getConvention());
|
||||
paramTypes.push_back(TypeID(conv));
|
||||
}
|
||||
for (auto param : fnTy->getInterfaceParameters()) {
|
||||
paramTypes.push_back(addTypeRef(param.getType()));
|
||||
unsigned conv = getRawStableParameterConvention(param.getConvention());
|
||||
paramTypes.push_back(TypeID(conv));
|
||||
}
|
||||
|
||||
auto sig = fnTy->getGenericSignature();
|
||||
if (sig) {
|
||||
for (auto param : sig->getGenericParams())
|
||||
paramTypes.push_back(addTypeRef(param));
|
||||
}
|
||||
|
||||
auto stableCalleeConvention =
|
||||
getRawStableParameterConvention(fnTy->getCalleeConvention());
|
||||
@@ -1744,6 +1758,8 @@ void Serializer::writeType(Type ty) {
|
||||
SILFunctionTypeLayout::emitRecord(Out, ScratchRecord, abbrCode,
|
||||
addTypeRef(result.getType()),
|
||||
stableResultConvention,
|
||||
addTypeRef(interfaceResult.getType()),
|
||||
stableInterfaceResultConvention,
|
||||
// FIXME: Always serialize a new
|
||||
// GenericParamList for now.
|
||||
// Interface types will kill this soon.
|
||||
@@ -1752,7 +1768,12 @@ void Serializer::writeType(Type ty) {
|
||||
getRawStableCC(callingConvention),
|
||||
fnTy->isThin(),
|
||||
fnTy->isNoReturn(),
|
||||
sig ? sig->getGenericParams().size() : 0,
|
||||
paramTypes);
|
||||
if (sig)
|
||||
writeRequirements(sig->getRequirements());
|
||||
else
|
||||
writeRequirements({});
|
||||
if (genericParams)
|
||||
writeGenericParams(genericParams);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user