Skip to content

Commit a613bce

Browse files
authored
Merge pull request #60184 from xedin/rdar-96520492
[IRGen/Distributed] Adjust protocol requirement and witness table to handle distributed thunks
2 parents b044958 + ae0c942 commit a613bce

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

lib/IRGen/GenMeta.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -913,6 +913,10 @@ namespace {
913913
if (entry.getFunction().isAutoDiffDerivativeFunction())
914914
declRef = declRef.asAutoDiffDerivativeFunction(
915915
entry.getFunction().getAutoDiffDerivativeFunctionIdentifier());
916+
if (entry.getFunction().isDistributedThunk()) {
917+
flags = flags.withIsAsync(true);
918+
declRef = declRef.asDistributed();
919+
}
916920
addDiscriminator(flags, schema, declRef);
917921
}
918922

lib/IRGen/GenProto.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,6 +1352,8 @@ class AccessorConformanceInfo : public ConformanceInfo {
13521352
auto &entry = SILEntries.front();
13531353
SILEntries = SILEntries.slice(1);
13541354

1355+
bool isAsyncRequirement = requirement.hasAsync();
1356+
13551357
#ifndef NDEBUG
13561358
assert(entry.getKind() == SILWitnessTable::Method
13571359
&& "sil witness table does not match protocol");
@@ -1364,10 +1366,9 @@ class AccessorConformanceInfo : public ConformanceInfo {
13641366
#endif
13651367

13661368
SILFunction *Func = entry.getMethodWitness().Witness;
1367-
auto *afd = cast<AbstractFunctionDecl>(
1368-
entry.getMethodWitness().Requirement.getDecl());
13691369
llvm::Constant *witness = nullptr;
13701370
if (Func) {
1371+
assert(Func->isAsync() == isAsyncRequirement);
13711372
if (Func->isAsync()) {
13721373
witness = IGM.getAddrOfAsyncFunctionPointer(Func);
13731374
} else {
@@ -1376,7 +1377,7 @@ class AccessorConformanceInfo : public ConformanceInfo {
13761377
} else {
13771378
// The method is removed by dead method elimination.
13781379
// It should be never called. We add a pointer to an error function.
1379-
if (afd->hasAsync()) {
1380+
if (isAsyncRequirement) {
13801381
witness = llvm::ConstantExpr::getBitCast(
13811382
IGM.getDeletedAsyncMethodErrorAsyncFunctionPointer(),
13821383
IGM.FunctionPtrTy);
@@ -1388,8 +1389,9 @@ class AccessorConformanceInfo : public ConformanceInfo {
13881389
witness = llvm::ConstantExpr::getBitCast(witness, IGM.Int8PtrTy);
13891390

13901391
PointerAuthSchema schema =
1391-
afd->hasAsync() ? IGM.getOptions().PointerAuth.AsyncProtocolWitnesses
1392-
: IGM.getOptions().PointerAuth.ProtocolWitnesses;
1392+
isAsyncRequirement
1393+
? IGM.getOptions().PointerAuth.AsyncProtocolWitnesses
1394+
: IGM.getOptions().PointerAuth.ProtocolWitnesses;
13931395
Table.addSignedPointer(witness, schema, requirement);
13941396
return;
13951397
}

test/Distributed/Runtime/distributed_actor_func_calls_remoteCall_through_generic.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
// REQUIRES: concurrency
88
// REQUIRES: distributed
99

10-
// FIXME: rdar://96520492 Test fails on specific config: Tools Opt+Assert, Stdlib Opt+DebInfo+Assert, iOS_arm64e
11-
// UNSUPPORTED: CPU=arm64e
12-
1310
// rdar://76038845
1411
// UNSUPPORTED: use_os_stdlib
1512
// UNSUPPORTED: back_deployment_runtime

test/Distributed/Runtime/distributed_actor_func_calls_remoteCall_through_generic_and_inner.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
// UNSUPPORTED: use_os_stdlib
1212
// UNSUPPORTED: back_deployment_runtime
1313

14-
// FIXME: rdar://96520224 Test fails on specific config: Tools Opt+Assert, Stdlib Opt+DebInfo+Assert, iOS_arm64e
15-
// UNSUPPORTED: CPU=arm64e
16-
1714
// FIXME(distributed): Distributed actors currently have some issues on windows, isRemote always returns false. rdar://82593574
1815
// UNSUPPORTED: OS=windows-msvc
1916

0 commit comments

Comments
 (0)