Skip to content

Commit 5acea84

Browse files
authored
Merge pull request #42025 from ktoso/wip-mini-cleanups
[Distributed] Review followups, cleanups
2 parents 85c82b2 + fa53218 commit 5acea84

11 files changed

+22
-327
lines changed

all.txt

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

include/swift/AST/Decl.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3506,11 +3506,6 @@ class NominalTypeDecl : public GenericTypeDecl, public IterableDeclContext {
35063506
/// Find the 'RemoteCallArgument(label:name:value:)' initializer function.
35073507
ConstructorDecl* getDistributedRemoteCallArgumentInitFunction() const;
35083508

3509-
/// Find the
3510-
/// 'DistributedActorSystem.invokeHandlerOnReturn(handler:value:metatype:)
3511-
/// function.
3512-
FuncDecl *getDistributedActorSystemInvokeHandlerOnReturnFunction() const;
3513-
35143509
/// Collect the set of protocols to which this type should implicitly
35153510
/// conform, such as AnyObject (for classes).
35163511
void getImplicitProtocols(SmallVectorImpl<ProtocolDecl *> &protocols);

include/swift/AST/TypeCheckRequests.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,25 +1269,6 @@ class GetDistributedThunkRequest :
12691269
bool isCached() const { return true; }
12701270
};
12711271

1272-
/// Synthesize and return the 'invokeHandlerOnReturn' method for a concrete
1273-
/// actor system.
1274-
class GetDistributedActorSystemInvokeHandlerOnReturnRequest
1275-
: public SimpleRequest<
1276-
GetDistributedActorSystemInvokeHandlerOnReturnRequest,
1277-
FuncDecl *(NominalTypeDecl *), RequestFlags::Cached> {
1278-
public:
1279-
using SimpleRequest::SimpleRequest;
1280-
1281-
private:
1282-
friend SimpleRequest;
1283-
1284-
FuncDecl *evaluate(Evaluator &evaluator, NominalTypeDecl *system) const;
1285-
1286-
public:
1287-
// Caching
1288-
bool isCached() const { return true; }
1289-
};
1290-
12911272
/// Obtain the 'id' property of a 'distributed actor'.
12921273
class GetDistributedActorIDPropertyRequest :
12931274
public SimpleRequest<GetDistributedActorIDPropertyRequest,

include/swift/AST/TypeCheckerTypeIDZone.def

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,6 @@ SWIFT_REQUEST(TypeChecker, GetDistributedRemoteCallTargetInitFunctionRequest,
148148
SWIFT_REQUEST(TypeChecker, GetDistributedRemoteCallArgumentInitFunctionRequest,
149149
ConstructorDecl *(NominalTypeDecl *),
150150
Cached, NoLocationInfo)
151-
SWIFT_REQUEST(TypeChecker, GetDistributedActorSystemInvokeHandlerOnReturnRequest,
152-
FuncDecl *(NominalTypeDecl *),
153-
Cached, NoLocationInfo)
154151
SWIFT_REQUEST(TypeChecker, GetDistributedActorInvocationDecoderRequest,
155152
NominalTypeDecl *(NominalTypeDecl *),
156153
Cached, NoLocationInfo)

lib/AST/ASTDumper.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2625,11 +2625,11 @@ class PrintExpr : public ExprVisitor<PrintExpr> {
26252625
printCommon(E, name) << ' ';
26262626
if (auto checkedCast = dyn_cast<CheckedCastExpr>(E))
26272627
OS << getCheckedCastKindName(checkedCast->getCastKind()) << ' ';
2628-
OS << "writtenType='";
2629-
if (GetTypeOfTypeRepr)
2630-
GetTypeOfTypeRepr(E->getCastTypeRepr()).print(OS);
2631-
else
2632-
E->getCastType().print(OS);
2628+
OS << "writtenType='";
2629+
if (GetTypeOfTypeRepr)
2630+
GetTypeOfTypeRepr(E->getCastTypeRepr()).print(OS);
2631+
else
2632+
E->getCastType().print(OS);
26332633
OS << "'\n";
26342634
printRec(E->getSubExpr());
26352635
PrintWithColorRAII(OS, ParenthesisColor) << ')';

lib/AST/DistributedDecl.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,16 +1236,6 @@ NominalTypeDecl::getDistributedRemoteCallArgumentInitFunction() const {
12361236
nullptr);
12371237
}
12381238

1239-
FuncDecl *
1240-
NominalTypeDecl::getDistributedActorSystemInvokeHandlerOnReturnFunction()
1241-
const {
1242-
auto mutableThis = const_cast<NominalTypeDecl *>(this);
1243-
return evaluateOrDefault(
1244-
getASTContext().evaluator,
1245-
GetDistributedActorSystemInvokeHandlerOnReturnRequest(mutableThis),
1246-
nullptr);
1247-
}
1248-
12491239
AbstractFunctionDecl *ASTContext::getRemoteCallOnDistributedActorSystem(
12501240
NominalTypeDecl *actorOrSystem, bool isVoidReturn) const {
12511241
assert(actorOrSystem && "distributed actor (or system) decl must be provided");

lib/SILGen/InitializeDistActorIdentity.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414

1515
namespace swift {
1616

17-
class AllocStackInst;
18-
1917
namespace Lowering {
2018

2119
/// A clean-up designed to emit an initialization of a distributed actor's

lib/SILGen/SILGenDistributed.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ void SILGenFunction::emitDistributedActorReady(
330330

331331
// --- load the actor system from the actor instance
332332
ManagedValue actorSystem;
333-
SGFContext sgfCxt; // TODO: is this right?
333+
SGFContext sgfCxt;
334334
{
335335
VarDecl *property = lookupProperty(classDecl, C.Id_actorSystem);
336336
Type formalType = F.mapTypeIntoContext(property->getInterfaceType());

lib/SILGen/SILGenFunction.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2086,8 +2086,6 @@ class LLVM_LIBRARY_VISIBILITY SILGenFunction
20862086
SILValue selfVal,
20872087
SILValue actorSystemVal);
20882088

2089-
void registerDistActorIdentityInit();
2090-
20912089
/// Given a function representing a distributed actor factory, emits the
20922090
/// corresponding SIL function for it.
20932091
void emitDistributedActorFactory(

lib/Sema/CodeSynthesisDistributedActor.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -786,18 +786,6 @@ VarDecl *GetDistributedActorSystemPropertyRequest::evaluate(
786786
return nullptr;
787787
}
788788

789-
FuncDecl *GetDistributedActorSystemInvokeHandlerOnReturnRequest::evaluate(
790-
Evaluator &evaluator, NominalTypeDecl *system) const {
791-
auto &C = system->getASTContext();
792-
793-
// not via `ensureDistributedModuleLoaded` to avoid generating a warning,
794-
// we won't be emitting the offending decl after all.
795-
if (!C.getLoadedModule(C.Id_Distributed))
796-
return nullptr;
797-
798-
return nullptr; // FIXME
799-
}
800-
801789
NormalProtocolConformance *GetDistributedActorImplicitCodableRequest::evaluate(
802790
Evaluator &evaluator, NominalTypeDecl *nominal,
803791
KnownProtocolKind protoKind) const {

lib/Sema/DerivedConformanceDistributedActor.cpp

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -56,25 +56,18 @@ static FuncDecl *deriveDistributedActor_resolve(DerivedConformance &derived) {
5656
assert(decl->isDistributedActor());
5757
auto &C = decl->getASTContext();
5858

59-
auto mkParam = [&](Identifier argName, Identifier paramName, Type ty) -> ParamDecl* {
60-
auto *param = new (C) ParamDecl(SourceLoc(),
61-
SourceLoc(), argName,
62-
SourceLoc(), paramName, decl);
63-
param->setImplicit();
64-
param->setSpecifier(ParamSpecifier::Default);
65-
param->setInterfaceType(ty);
66-
return param;
67-
};
68-
6959
auto idType = getDistributedActorIDType(decl);
7060
auto actorSystemType = getDistributedActorSystemType(decl);
7161

7262
// (id: Self.ID, using system: Self.ActorSystem)
7363
auto *params = ParameterList::create(
7464
C,
7565
/*LParenLoc=*/SourceLoc(),
76-
/*params=*/{ mkParam(C.Id_id, C.Id_id, idType),
77-
mkParam(C.Id_using, C.Id_system, actorSystemType)
66+
/*params=*/{
67+
ParamDecl::createImplicit(
68+
C, C.Id_id, C.Id_id, idType, decl),
69+
ParamDecl::createImplicit(
70+
C, C.Id_using, C.Id_system, actorSystemType, decl)
7871
},
7972
/*RParenLoc=*/SourceLoc()
8073
);
@@ -364,16 +357,6 @@ static FuncDecl *deriveDistributedActorSystem_invokeHandlerOnReturn(
364357
auto system = derived.Nominal;
365358
auto &C = system->getASTContext();
366359

367-
auto mkParam = [&](Identifier argName, Identifier paramName,
368-
Type ty) -> ParamDecl * {
369-
auto *param = new (C) ParamDecl(SourceLoc(), SourceLoc(), argName,
370-
SourceLoc(), paramName, system);
371-
param->setImplicit();
372-
param->setSpecifier(ParamSpecifier::Default);
373-
param->setInterfaceType(ty);
374-
return param;
375-
};
376-
377360
// auto serializationRequirementType = getDistributedActorSystemType(decl);
378361
auto resultHandlerType = getDistributedActorSystemResultHandlerType(system);
379362
auto unsafeRawPointerType = C.getUnsafeRawPointerType();
@@ -390,10 +373,17 @@ static FuncDecl *deriveDistributedActorSystem_invokeHandlerOnReturn(
390373
C,
391374
/*LParenLoc=*/SourceLoc(),
392375
/*params=*/
393-
{mkParam(C.Id_handler, C.Id_handler,
394-
system->mapTypeIntoContext(resultHandlerType)),
395-
mkParam(C.Id_resultBuffer, C.Id_resultBuffer, unsafeRawPointerType),
396-
mkParam(C.Id_metatype, C.Id_metatype, anyTypeType)},
376+
{
377+
ParamDecl::createImplicit(
378+
C, C.Id_handler, C.Id_handler,
379+
system->mapTypeIntoContext(resultHandlerType), system),
380+
ParamDecl::createImplicit(
381+
C, C.Id_resultBuffer, C.Id_resultBuffer,
382+
unsafeRawPointerType, system),
383+
ParamDecl::createImplicit(
384+
C, C.Id_metatype, C.Id_metatype,
385+
anyTypeType, system)
386+
},
397387
/*RParenLoc=*/SourceLoc());
398388

399389
// Func name: invokeHandlerOnReturn(handler:resultBuffer:metatype)

0 commit comments

Comments
 (0)