@@ -280,31 +280,6 @@ static void convertOwnershipConventionsGivenParamInfos(
280
280
});
281
281
}
282
282
283
- static bool shouldApplyBackDeploymentThunk (ValueDecl *decl, ASTContext &ctx,
284
- ResilienceExpansion expansion) {
285
- auto backDeployBeforeVersion = decl->getBackDeployedBeforeOSVersion (ctx);
286
- if (!backDeployBeforeVersion)
287
- return false ;
288
-
289
- // If the context of the application is inlinable then we must always call the
290
- // back deployment thunk since we can't predict the deployment targets of
291
- // other modules.
292
- if (expansion != ResilienceExpansion::Maximal)
293
- return true ;
294
-
295
- // In resilient function bodies skip calling the back deployment thunk when
296
- // the deployment target is high enough that the ABI implementation of the
297
- // back deployed function is guaranteed to be available.
298
- auto deploymentAvailability = AvailabilityContext::forDeploymentTarget (ctx);
299
- auto declAvailability =
300
- AvailabilityContext (VersionRange::allGTE (*backDeployBeforeVersion));
301
-
302
- if (deploymentAvailability.isContainedIn (declAvailability))
303
- return false ;
304
-
305
- return true ;
306
- }
307
-
308
283
// ===----------------------------------------------------------------------===//
309
284
// Callee
310
285
// ===----------------------------------------------------------------------===//
@@ -1155,7 +1130,6 @@ class SILGenApply : public Lowering::ExprVisitor<SILGenApply> {
1155
1130
1156
1131
SILDeclRef getDeclRefForStaticDispatchApply (DeclRefExpr *e) {
1157
1132
auto *afd = cast<AbstractFunctionDecl>(e->getDecl ());
1158
- auto &ctx = SGF.getASTContext ();
1159
1133
1160
1134
// A call to a `distributed` function may need to go through a thunk.
1161
1135
if (callSite && callSite->shouldApplyDistributedThunk ()) {
@@ -1164,8 +1138,9 @@ class SILGenApply : public Lowering::ExprVisitor<SILGenApply> {
1164
1138
}
1165
1139
1166
1140
// A call to `@backDeployed` function may need to go through a thunk.
1167
- if (shouldApplyBackDeploymentThunk (afd, ctx,
1168
- SGF.F .getResilienceExpansion ())) {
1141
+
1142
+ if (SGF.SGM .requiresBackDeploymentThunk (afd,
1143
+ SGF.F .getResilienceExpansion ())) {
1169
1144
return SILDeclRef (afd).asBackDeploymentKind (
1170
1145
SILDeclRef::BackDeploymentKind::Thunk);
1171
1146
}
@@ -6711,7 +6686,7 @@ SILDeclRef SILGenModule::getAccessorDeclRef(AccessorDecl *accessor,
6711
6686
ResilienceExpansion expansion) {
6712
6687
auto declRef = SILDeclRef (accessor, SILDeclRef::Kind::Func);
6713
6688
6714
- if (shouldApplyBackDeploymentThunk (accessor, getASTContext () , expansion))
6689
+ if (requiresBackDeploymentThunk (accessor, expansion))
6715
6690
return declRef.asBackDeploymentKind (SILDeclRef::BackDeploymentKind::Thunk);
6716
6691
6717
6692
return declRef.asForeign (requiresForeignEntryPoint (accessor));
0 commit comments