Skip to content

Commit 51198e3

Browse files
authored
Merge pull request #41155 from ktoso/wip-fix-asan-dist
2 parents 2b2dd23 + ad14d02 commit 51198e3

14 files changed

+30
-108
lines changed

lib/SIL/Verifier/SILVerifier.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5545,11 +5545,6 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
55455545
if (term->isFunctionExiting()) {
55465546
require(state.Stack.empty(),
55475547
"return with stack allocs that haven't been deallocated");
5548-
if (!state.ActiveOps.empty()) {
5549-
for (auto op : state.ActiveOps) {
5550-
op->dump();
5551-
}
5552-
}
55535548
require(state.ActiveOps.empty(),
55545549
"return with operations still active");
55555550
require(!state.GotAsyncContinuation,

lib/SILGen/SILGenDistributed.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,6 @@ void SILGenFunction::emitDistributedThunk(SILDeclRef thunk) {
10161016
SmallVector<Type, 1> subTypes;
10171017
SmallVector<ProtocolConformanceRef, 2> subConformances;
10181018

1019-
// subTypes.push_back(paramTy.getASTType());
10201019
subTypes.push_back(paramTy);
10211020

10221021
subs = SubstitutionMap::get(recordArgumentGenericSig, subTypes,
@@ -1535,16 +1534,14 @@ void SILGenFunction::emitDistributedThunk(SILDeclRef thunk) {
15351534
}
15361535
{
15371536
// FIXME(distributed): manual since I could not figure out how to NOT destroy_addr in the error path, where the memory is not initialized, so the destroy would fail SIL verification
1538-
// emitThrowWithCleanupBasicBlock(*this, loc, thunk, remoteCallErrorBB, errorBB,
1539-
// /*endAccesses*/{invocationEncoderAccess},
1540-
// /*endLifetimes*/{remoteCallSystemSelf});
1537+
// emitThrowWithCleanupBasicBlock(*this, loc, thunk, remoteCallErrorBB, errorBB,
1538+
// /*endAccesses*/{invocationEncoderAccess},
1539+
// /*endLifetimes*/{remoteCallSystemSelf});
15411540
B.emitBlock(remoteCallErrorBB);
15421541
SILValue error = remoteCallErrorBB->createPhiArgument(
15431542
fnConv.getSILErrorType(getTypeExpansionContext()),
15441543
OwnershipKind::Owned);
15451544

1546-
// auto result = remoteCallReturnValue.getValue();
1547-
15481545
// TODO(distributed): make those into cleanups
15491546
B.createEndAccess(loc, invocationEncoderAccess, /*aborted=*/false);
15501547

lib/Sema/CodeSynthesisDistributedActor.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,19 @@ VarDecl *GetDistributedActorSystemPropertyRequest::evaluate(
145145
if (!C.getLoadedModule(C.Id_Distributed))
146146
return nullptr;
147147

148-
149-
if (auto system = actor->lookupDirect(C.Id_actorSystem).begin()) {
150-
// TODO(distributed): may need to check conformance here?
151-
return dyn_cast<VarDecl>(*system);
148+
auto module = C.getStdlibModule();
149+
auto DistSystemProtocol =
150+
C.getProtocol(KnownProtocolKind::DistributedActorSystem);
151+
152+
for (auto system : actor->lookupDirect(C.Id_actorSystem)) {
153+
if (auto var = dyn_cast<VarDecl>(system)) {
154+
auto conformance = module->conformsToProtocol(var->getInterfaceType(),
155+
DistSystemProtocol);
156+
if (conformance.isInvalid())
157+
continue;
158+
159+
return var;
160+
}
152161
}
153162

154163
return nullptr;

test/Distributed/Inputs/FakeDistributedActorSystems.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,12 +327,12 @@ public class FakeInvocationDecoder : DistributedTargetInvocationDecoder {
327327
}
328328

329329
public func decodeErrorType() throws -> Any.Type? {
330-
print(" > decode return type: \(errorType.map { String(describing: $0) } ?? "nil")")
330+
print(" > decode return type: \(errorType.map { String(reflecting: $0) } ?? "nil")")
331331
return self.errorType
332332
}
333333

334334
public func decodeReturnType() throws -> Any.Type? {
335-
print(" > decode return type: \(returnType.map { String(describing: $0) } ?? "nil")")
335+
print(" > decode return type: \(returnType.map { String(reflecting: $0) } ?? "nil")")
336336
return self.returnType
337337
}
338338
}

test/Distributed/Runtime/distributed_actor_func_calls_remoteCall_echo.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// UNSUPPORTED: OS=watchos && CPU=i386
2222

2323
// rdar://88228867 - remoteCall_* tests have been disabled due to random failures
24-
// REQUIRES: rdar88228867
24+
// OK: rdar88228867
2525

2626
import _Distributed
2727
import FakeDistributedActorSystems

test/Distributed/Runtime/distributed_actor_func_calls_remoteCall_empty.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// UNSUPPORTED: OS=watchos && CPU=i386
2222

2323
// rdar://88228867 - remoteCall_* tests have been disabled due to random failures
24-
// REQUIRES: rdar88228867
24+
// OK: rdar88228867
2525

2626
import _Distributed
2727
import FakeDistributedActorSystems

test/Distributed/Runtime/distributed_actor_func_calls_remoteCall_genericActor.swift

Lines changed: 0 additions & 79 deletions
This file was deleted.

test/Distributed/Runtime/distributed_actor_func_calls_remoteCall_genericFunc.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// UNSUPPORTED: OS=watchos && CPU=i386
2222

2323
// rdar://88228867 - remoteCall_* tests have been disabled due to random failures
24-
// REQUIRES: rdar88228867
24+
// OK: rdar88228867
2525

2626
import _Distributed
2727
import FakeDistributedActorSystems

test/Distributed/Runtime/distributed_actor_func_calls_remoteCall_hello.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// UNSUPPORTED: OS=watchos && CPU=i386
2222

2323
// rdar://88228867 - remoteCall_* tests have been disabled due to random failures
24-
// REQUIRES: rdar88228867
24+
// OK: rdar88228867
2525

2626
import _Distributed
2727
import FakeDistributedActorSystems

test/Distributed/Runtime/distributed_actor_func_calls_remoteCall_take.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// UNSUPPORTED: OS=watchos && CPU=i386
2222

2323
// rdar://88228867 - remoteCall_* tests have been disabled due to random failures
24-
// REQUIRES: rdar88228867
24+
// OK: rdar88228867
2525

2626
import _Distributed
2727
import FakeDistributedActorSystems
@@ -41,7 +41,7 @@ func test() async throws {
4141
let ref = try Greeter.resolve(id: local.id, using: system)
4242

4343
try await ref.take(name: "Caplin")
44-
// CHECK: >> remoteCallVoid: on:main.Greeter), target:RemoteCallTarget(_mangledName: "$s4main7GreeterC4take4nameySS_tFTE"), invocation:FakeInvocationEncoder(genericSubs: [], arguments: ["Caplin"], returnType: nil, errorType: nil), throwing:Swift.Never
44+
// CHECK: >> remoteCallVoid: on:main.Greeter, target:RemoteCallTarget(_mangledName: "$s4main7GreeterC4take4nameySS_tFTE"), invocation:FakeInvocationEncoder(genericSubs: [], arguments: ["Caplin"], returnType: nil, errorType: nil), throwing:Swift.Never
4545
// CHECK: take: Caplin
4646

4747
}

test/Distributed/Runtime/distributed_actor_func_calls_remoteCall_takeThrowReturn.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// UNSUPPORTED: OS=watchos && CPU=i386
2222

2323
// rdar://88228867 - remoteCall_* tests have been disabled due to random failures
24-
// REQUIRES: rdar88228867
24+
// OK: rdar88228867
2525

2626
import _Distributed
2727
import FakeDistributedActorSystems

test/Distributed/Runtime/distributed_actor_func_calls_remoteCall_take_two.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// UNSUPPORTED: OS=watchos && CPU=i386
2222

2323
// rdar://88228867 - remoteCall_* tests have been disabled due to random failures
24-
// REQUIRES: rdar88228867
24+
// OK: rdar88228867
2525

2626
import _Distributed
2727
import FakeDistributedActorSystems

test/Distributed/Runtime/distributed_actor_func_calls_remoteCall_throw.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// UNSUPPORTED: OS=watchos && CPU=i386
2222

2323
// rdar://88228867 - remoteCall_* tests have been disabled due to random failures
24-
// REQUIRES: rdar88228867
24+
// OK: rdar88228867
2525

2626
import _Distributed
2727
import FakeDistributedActorSystems

test/Distributed/Runtime/distributed_actor_remoteCall_roundtrip.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
// UNSUPPORTED: linux
2121

2222
// rdar://88228867 - remoteCall_* tests have been disabled due to random failures
23-
// REQUIRES: rdar88228867
23+
// OK: rdar88228867
2424

2525
import _Distributed
2626
import FakeDistributedActorSystems
@@ -54,10 +54,10 @@ func test() async throws {
5454
let reply = try await ref.echo(name: "Caplin")
5555
// CHECK: > encode argument: Caplin
5656
// CHECK-NOT: > encode error type
57-
// CHECK: > encode return type: String
57+
// CHECK: > encode return type: Swift.String
5858
// CHECK: > done recording
5959
// CHECK: >> remoteCall
60-
// CHECK: > decode return type: String
60+
// CHECK: > decode return type: Swift.String
6161
// CHECK: > decode argument: Caplin
6262
// CHECK: << onReturn: Echo: Caplin (impl on: ActorAddress(address: "<unique-id>"))
6363

0 commit comments

Comments
 (0)