mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Back-deploy creation of global-actor-qualified function type metadata.
When back-deploying, create global-actor-qualified function types via a separate entrypoint (`swift_getFunctionTypeMetadataGlobalActorBackDeploy`) in the compatibility library, which checks whether it is running with a new-enough runtime to use `swift_getFunctionTypeMetadataGlobalActor`. Failing that, it calls into a separate copy of the implementation that exists only in the back-deployed concurrency library. Fixes rdar://79153988.
This commit is contained in:
@@ -1230,6 +1230,13 @@ static MetadataResponse emitTupleTypeMetadataRef(IRGenFunction &IGF,
|
||||
}
|
||||
}
|
||||
|
||||
/// Determine whether concurrency support is available in the runtime.
|
||||
static bool isConcurrencyAvailable(ASTContext &ctx) {
|
||||
auto deploymentAvailability =
|
||||
AvailabilityContext::forDeploymentTarget(ctx);
|
||||
return deploymentAvailability.isContainedIn(ctx.getConcurrencyAvailability());
|
||||
}
|
||||
|
||||
namespace {
|
||||
/// A visitor class for emitting a reference to a metatype object.
|
||||
/// This implements a "raw" access, useful for implementing cache
|
||||
@@ -1591,7 +1598,9 @@ namespace {
|
||||
}
|
||||
|
||||
auto *getMetadataFn = type->getGlobalActor()
|
||||
? IGF.IGM.getGetFunctionMetadataGlobalActorFn()
|
||||
? (isConcurrencyAvailable(IGF.getSwiftModule()->getASTContext())
|
||||
? IGF.IGM.getGetFunctionMetadataGlobalActorFn()
|
||||
: IGF.IGM.getGetFunctionMetadataGlobalActorBackDeployFn())
|
||||
: type->isDifferentiable()
|
||||
? IGF.IGM.getGetFunctionMetadataDifferentiableFn()
|
||||
: IGF.IGM.getGetFunctionMetadataFn();
|
||||
|
||||
Reference in New Issue
Block a user