Merge pull request #83346 from gottesmm/pr-df6aafa41c61b9a9a6ee4965a1564ec2946a0dc9

[concurrency] Change #isolated to mask out the TBI bits of the witness pointer of the implicit isolated any Actor pointer so we can do optimizations on TBI supporting platforms in the future.
This commit is contained in:
Michael Gottesman
2025-10-17 17:02:43 -07:00
committed by GitHub
97 changed files with 1484 additions and 666 deletions

View File

@@ -5,16 +5,15 @@ sil_stage raw // CHECK: sil_stage raw
import Builtin
import Swift
actor Actor { }
import _Concurrency
// CHECK-LABEL: sil @test_hop_to_executor
sil @test_hop_to_executor : $@convention(thin) (@guaranteed Actor) -> () {
bb0(%0 : $Actor):
// CHECK: hop_to_executor %0 : $Actor
hop_to_executor %0 : $Actor
// CHECK: hop_to_executor [mandatory] %0 : $Actor
hop_to_executor [mandatory] %0 : $Actor
sil @test_hop_to_executor : $@convention(thin) (@guaranteed any Actor) -> () {
bb0(%0 : $any Actor):
// CHECK: hop_to_executor %0 : $any Actor
hop_to_executor %0 : $any Actor
// CHECK: hop_to_executor [mandatory] %0 : $any Actor
hop_to_executor [mandatory] %0 : $any Actor
%2 = tuple ()
return %2 : $()
}
@@ -32,3 +31,12 @@ bb0:
}
// CHECK-LABEL: sil [ossa] @test_cast_implicitactor_to_opaqueisolation : $@convention(thin) (@guaranteed Builtin.ImplicitActor) -> @owned Optional<any Actor> {
// CHECK: implicitactor_to_opaqueisolation_cast {{%.*}} : $Builtin.ImplicitActor
// CHECK: } // end sil function 'test_cast_implicitactor_to_opaqueisolation'
sil [ossa] @test_cast_implicitactor_to_opaqueisolation : $@convention(thin) (@guaranteed Builtin.ImplicitActor) -> @owned Optional<any Actor> {
bb0(%0 : @guaranteed $Builtin.ImplicitActor):
%1 = implicitactor_to_opaqueisolation_cast %0 : $Builtin.ImplicitActor
%2 = copy_value %1 : $Optional<any Actor>
return %2 : $Optional<any Actor>
}

View File

@@ -389,4 +389,3 @@ bb0(%0 : $*Builtin.NativeObject, %1 : @owned $Builtin.NativeObject):
%9999 = tuple ()
return %9999 : $()
}

View File

@@ -0,0 +1,24 @@
// First parse this and then emit a *.sib. Then read in the *.sib, then recreate
// RUN: %empty-directory(%t)
// RUN: %target-sil-opt -sil-print-types %s -emit-sib -o %t/tmp.sib -module-name basic2
// RUN: %target-sil-opt -sil-print-types %t/tmp.sib -o - -module-name basic2 | %FileCheck %s
// TODO: We need to make it so that we do another trip through serialization. We
// cannot do this today since when we serialize sib into another sib file, we
// seem to lose the import of _Concurrency.
import Builtin
import Swift
import _Concurrency
// REQUIRES: concurrency
// CHECK-LABEL: sil [ossa] @test_cast_implicitactor_to_opaqueisolation : $@convention(thin) (@guaranteed Builtin.ImplicitActor) -> @owned Optional<any Actor> {
// CHECK: implicitactor_to_opaqueisolation_cast {{%.*}} : $Builtin.ImplicitActor
// CHECK: } // end sil function 'test_cast_implicitactor_to_opaqueisolation'
sil [ossa] @test_cast_implicitactor_to_opaqueisolation : $@convention(thin) (@guaranteed Builtin.ImplicitActor) -> @owned Optional<any Actor> {
bb0(%0 : @guaranteed $Builtin.ImplicitActor):
%1 = implicitactor_to_opaqueisolation_cast %0 : $Builtin.ImplicitActor
%2 = copy_value %1 : $Optional<any Actor>
return %2 : $Optional<any Actor>
}