mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[SE-0371] Back-deploy support for main-actor-isolated deinit
When targeting a platform that predates the introduction of isolated deinit, make a narrow exception that allows main-actor-isolated deinit to work through a special, inlineable entrypoint that is back-deployed. This implementation 1. Calls into the real implementation when available, otherwise 2. Checks if we're on the main thread, destroying immediately when we are, otherwise 3. Creates a new task on the main actor to handle destruction. This implementation is less efficient than the implementation in the runtime, but allows us to back-deploy this functionality as far back as concurrency goes. Fixes rdar://151029118.
This commit is contained in:
@@ -982,6 +982,14 @@ namespace RuntimeConstants {
|
||||
return RuntimeAvailability::AlwaysAvailable;
|
||||
}
|
||||
|
||||
RuntimeAvailability IsolatedDeinitAvailability(ASTContext &context) {
|
||||
auto featureAvailability = context.getIsolatedDeinitAvailability();
|
||||
if (!isDeploymentAvailabilityContainedIn(context, featureAvailability)) {
|
||||
return RuntimeAvailability::ConditionallyAvailable;
|
||||
}
|
||||
return RuntimeAvailability::AlwaysAvailable;
|
||||
}
|
||||
|
||||
RuntimeAvailability
|
||||
MultiPayloadEnumTagSinglePayloadAvailability(ASTContext &context) {
|
||||
auto featureAvailability = context.getMultiPayloadEnumTagSinglePayload();
|
||||
|
||||
Reference in New Issue
Block a user