mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
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.
16 lines
683 B
Swift
16 lines
683 B
Swift
// RUN: %target-swift-frontend -target %target-swift-5.1-abi-triple -parse-as-library -emit-silgen -DSILGEN %s | %FileCheck %s
|
|
|
|
// REQUIRES: concurrency
|
|
// REQUIRES: OS=macosx
|
|
|
|
|
|
@MainActor
|
|
class C {
|
|
// CHECK-LABEL: sil hidden [ossa] @$s27deinit_isolation_backdeploy1CCfD : $@convention(method) (@owned C) -> ()
|
|
// CHECK: function_ref @swift_task_deinitOnExecutorMainActorBackDeploy
|
|
isolated deinit { }
|
|
}
|
|
|
|
// Make sure this function is available
|
|
// CHECK: sil hidden_external [serialized] [available 12.0.0] @swift_task_deinitOnExecutorMainActorBackDeploy : $@convention(thin) (@owned AnyObject, @convention(thin) (@owned AnyObject) -> (), Builtin.Executor, Builtin.Word) -> ()
|