Skip to content

Commit 63d5cf1

Browse files
authored
Merge pull request swiftlang#36624 from rjmccall/executor-serialization
Fix executor serialization
2 parents d0551d9 + 5867219 commit 63d5cf1

File tree

5 files changed

+18
-12
lines changed

5 files changed

+18
-12
lines changed

include/swift/ABI/Task.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -519,17 +519,12 @@ class YieldingAsyncContext : public AsyncContext {
519519
TaskContinuationFunction * __ptrauth_swift_async_context_yield
520520
YieldToParent;
521521

522-
/// The executor that the parent context needs to be yielded to on.
523-
ExecutorRef YieldToParentExecutor;
524-
525522
YieldingAsyncContext(AsyncContextFlags flags,
526523
TaskContinuationFunction *resumeParent,
527524
TaskContinuationFunction *yieldToParent,
528-
ExecutorRef yieldToParentExecutor,
529525
AsyncContext *parent)
530526
: AsyncContext(flags, resumeParent, parent),
531-
YieldToParent(yieldToParent),
532-
YieldToParentExecutor(yieldToParentExecutor) {}
527+
YieldToParent(yieldToParent) {}
533528

534529
static bool classof(const AsyncContext *context) {
535530
return context->Flags.getKind() == AsyncContextKind::Yielding;

include/swift/Strings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ constexpr static BuiltinNameStringLiteral BUILTIN_TYPE_NAME_JOB = {
124124
"Builtin.Job"};
125125
/// The name of the Builtin type for ExecutorRef
126126
constexpr static BuiltinNameStringLiteral BUILTIN_TYPE_NAME_EXECUTOR = {
127-
"Builtin.ExecutorRef"};
127+
"Builtin.Executor"};
128128
/// The name of the Builtin type for DefaultActorStorage
129129
constexpr static BuiltinNameStringLiteral BUILTIN_TYPE_NAME_DEFAULTACTORSTORAGE = {
130130
"Builtin.DefaultActorStorage"};

lib/AST/Builtins.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ Type swift::getBuiltinType(ASTContext &Context, StringRef Name) {
8585
return Context.TheJobType;
8686
if (Name == "DefaultActorStorage")
8787
return Context.TheDefaultActorStorageType;
88+
if (Name == "Executor")
89+
return Context.TheExecutorType;
8890
if (Name == "NativeObject")
8991
return Context.TheNativeObjectType;
9092
if (Name == "BridgeObject")

lib/IRGen/IRGenModule.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,8 +630,7 @@ IRGenModule::IRGenModule(IRGenerator &irgen,
630630
SwiftJobPtrTy = SwiftJobTy->getPointerTo(DefaultAS);
631631

632632
// using TaskContinuationFunction =
633-
// SWIFT_CC(swift)
634-
// void (AsyncTask *, ExecutorRef, AsyncContext *);
633+
// SWIFT_CC(swift) void (SWIFT_ASYNC_CONTEXT AsyncContext *);
635634
TaskContinuationFunctionTy = llvm::FunctionType::get(
636635
VoidTy, {SwiftContextPtrTy}, /*isVarArg*/ false);
637636
TaskContinuationFunctionPtrTy = TaskContinuationFunctionTy->getPointerTo();

test/Serialization/Inputs/def_concurrency.sil

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,28 @@ actor Act { }
88
@_transparent public func serialize_all() {
99
}
1010

11-
// CHECK-LABEL: sil public_external [transparent] [serialized] @test_hop_to_executor
12-
sil [transparent] [serialized] @test_hop_to_executor : $@convention(thin) (@guaranteed Act) -> () {
11+
// CHECK-LABEL: sil public_external [transparent] [serialized] @test_hop_to_executor_actor
12+
sil [transparent] [serialized] @test_hop_to_executor_actor : $@convention(thin) (@guaranteed Act) -> () {
1313
bb0(%0 : $Act):
1414
// CHECK: hop_to_executor %0 : $Act
1515
hop_to_executor %0 : $Act
1616
%2 = tuple ()
1717
return %2 : $()
1818
}
1919

20+
// CHECK-LABEL: sil public_external [transparent] [serialized] @test_hop_to_executor_builtin
21+
sil [transparent] [serialized] @test_hop_to_executor_builtin : $@convention(thin) (@guaranteed Builtin.Executor) -> () {
22+
bb0(%0 : $Builtin.Executor):
23+
// CHECK: hop_to_executor %0 : $Builtin.Executor
24+
hop_to_executor %0 : $Builtin.Executor
25+
%2 = tuple ()
26+
return %2 : $()
27+
}
28+
2029
sil [transparent] [serialized] @$s15def_concurrency13serialize_allyyF : $@convention(thin) () -> () {
2130
bb0:
22-
%91 = function_ref @test_hop_to_executor : $@convention(thin) (@guaranteed Act) -> ()
31+
%0 = function_ref @test_hop_to_executor_actor : $@convention(thin) (@guaranteed Act) -> ()
32+
%1 = function_ref @test_hop_to_executor_builtin : $@convention(thin) (@guaranteed Builtin.Executor) -> ()
2333

2434
%r = tuple ()
2535
return %r : $()

0 commit comments

Comments
 (0)