Skip to content

Commit a8d78db

Browse files
committed
[Distributed] dist actor always has default executor (currently)
1 parent 4453571 commit a8d78db

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/SILOptimizer/Mandatory/LowerHopToActor.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,12 @@ static bool isDefaultActorType(CanType actorType, ModuleDecl *M,
145145
return false;
146146
}
147147

148+
static bool isDefaultDistributedActorType(CanType actorType) {
149+
if (auto cls = actorType.getClassOrBoundGenericClass())
150+
return cls->isDistributedActor();
151+
return false;
152+
}
153+
148154
static AccessorDecl *getUnownedExecutorGetter(ASTContext &ctx,
149155
ProtocolDecl *actorProtocol) {
150156
for (auto member: actorProtocol->getAllMembers()) {
@@ -178,7 +184,8 @@ SILValue LowerHopToActor::emitGetExecutor(SILLocation loc, SILValue actor,
178184
// If the actor type is a default actor, go ahead and devirtualize here.
179185
auto module = F->getModule().getSwiftModule();
180186
SILValue unmarkedExecutor;
181-
if (isDefaultActorType(actorType, module, F->getResilienceExpansion())) {
187+
if (isDefaultActorType(actorType, module, F->getResilienceExpansion()) ||
188+
isDefaultDistributedActorType(actorType)) {
182189
auto builtinName = ctx.getIdentifier(
183190
getBuiltinName(BuiltinValueKind::BuildDefaultActorExecutorRef));
184191
auto builtinDecl = cast<FuncDecl>(getBuiltinValueDecl(ctx, builtinName));

0 commit comments

Comments
 (0)