Skip to content

Commit 006e2b4

Browse files
committed
Replace destoryDistributedActor builtin with destroyDefaultActor
Currently, they both end up doing the exact same thing, so there's no need for both.
1 parent cecdc80 commit 006e2b4

File tree

13 files changed

+0
-78
lines changed

13 files changed

+0
-78
lines changed

include/swift/AST/Builtins.def

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -737,10 +737,6 @@ BUILTIN_MISC_OPERATION(DestroyDefaultActor, "destroyDefaultActor", "", Special)
737737
BUILTIN_MISC_OPERATION(InitializeDistributedRemoteActor,
738738
"initializeDistributedRemoteActor", "", Special)
739739

740-
/// Destroy the distributed-actor instance in a "proxy" actor object.
741-
BUILTIN_MISC_OPERATION(DestroyDistributedActor,
742-
"destroyDistributedActor", "", Special)
743-
744740
/// Resume a non-throwing continuation normally with the given result.
745741
BUILTIN_MISC_OPERATION(ResumeNonThrowingContinuationReturning,
746742
"resumeNonThrowingContinuationReturning", "", Special)

include/swift/Runtime/Concurrency.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -727,10 +727,6 @@ SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
727727
OpaqueValue*
728728
swift_distributedActor_remote_initialize(const Metadata *actorType);
729729

730-
/// Destroy the runtime storage for a default actor.
731-
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
732-
void swift_distributedActor_destroy(DefaultActor *actor);
733-
734730
/// Enqueue a job on the default actor implementation.
735731
///
736732
/// The job must be ready to run. Notably, if it's a task, that

include/swift/Runtime/RuntimeFunctions.def

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,14 +1725,6 @@ FUNCTION(DistributedActorInitializeRemote,
17251725
ARGS(TypeMetadataPtrTy),
17261726
ATTRS(NoUnwind))
17271727

1728-
// void swift_distributedActor_destroy(DefaultActor *actor);
1729-
FUNCTION(DistributedActorDestroy,
1730-
swift_distributedActor_destroy, SwiftCC,
1731-
ConcurrencyAvailability, // TODO(distributed): Introduce DistributedAvailability once shipping somewhere
1732-
RETURNS(VoidTy),
1733-
ARGS(RefCountedPtrTy),
1734-
ATTRS(NoUnwind))
1735-
17361728
/// void swift_asyncLet_start(
17371729
/// AsyncLet *alet,
17381730
/// TaskOptionRecord *options,

lib/AST/Builtins.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,13 +1480,6 @@ static ValueDecl *getDistributedActorInitializeRemote(ASTContext &ctx,
14801480
_rawPointer);
14811481
}
14821482

1483-
static ValueDecl *getDistributedActorDestroy(ASTContext &ctx,
1484-
Identifier id) {
1485-
return getBuiltinFunction(ctx, id, _thin,
1486-
_parameters(_nativeObject),
1487-
_void);
1488-
}
1489-
14901483
static ValueDecl *getResumeContinuationReturning(ASTContext &ctx,
14911484
Identifier id) {
14921485
return getBuiltinFunction(ctx, id, _thin,
@@ -2842,9 +2835,6 @@ ValueDecl *swift::getBuiltinValueDecl(ASTContext &Context, Identifier Id) {
28422835
case BuiltinValueKind::InitializeDistributedRemoteActor:
28432836
return getDistributedActorInitializeRemote(Context, Id);
28442837

2845-
case BuiltinValueKind::DestroyDistributedActor:
2846-
return getDistributedActorDestroy(Context, Id);
2847-
28482838
case BuiltinValueKind::StartAsyncLet:
28492839
case BuiltinValueKind::StartAsyncLetWithLocalBuffer:
28502840
return getStartAsyncLet(Context, Id);

lib/IRGen/GenBuiltin.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -397,12 +397,6 @@ void irgen::emitBuiltinCall(IRGenFunction &IGF, const BuiltinInfo &Builtin,
397397
return;
398398
}
399399

400-
if (Builtin.ID == BuiltinValueKind::DestroyDistributedActor) {
401-
auto actor = args.claimNext();
402-
emitDistributedActorDestroy(IGF, actor);
403-
return;
404-
}
405-
406400
// If this is an LLVM IR intrinsic, lower it to an intrinsic call.
407401
const IntrinsicInfo &IInfo = IGF.getSILModule().getIntrinsicInfo(FnId);
408402
llvm::Intrinsic::ID IID = IInfo.ID;

lib/IRGen/GenDistributed.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,3 @@ llvm::Value *irgen::emitDistributedActorInitializeRemote(
5353

5454
return result;
5555
}
56-
57-
void irgen::emitDistributedActorDestroy(IRGenFunction &IGF,
58-
llvm::Value *actor) {
59-
auto fn = IGF.IGM.getDistributedActorDestroyFn();
60-
actor = IGF.Builder.CreateBitCast(actor, IGF.IGM.RefCountedPtrTy);
61-
62-
auto call = IGF.Builder.CreateCall(fn, {actor});
63-
call->setCallingConv(IGF.IGM.SwiftCC);
64-
call->setDoesNotThrow();
65-
}

lib/IRGen/GenDistributed.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,6 @@ llvm::Value *emitDistributedActorInitializeRemote(
4747
llvm::Value *actorMetatype,
4848
Explosion &out);
4949

50-
/// Destroy the distributed actor.
51-
/// E.g. a remote actor has to be destroyed differently from a local one.
52-
void emitDistributedActorDestroy(
53-
IRGenFunction &IGF,
54-
llvm::Value *actor);
55-
5650
} // end namespace irgen
5751
} // end namespace swift
5852

lib/SIL/IR/OperandOwnership.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,6 @@ BUILTIN_OPERAND_OWNERSHIP(InteriorPointer, InitializeDefaultActor)
846846
BUILTIN_OPERAND_OWNERSHIP(InteriorPointer, DestroyDefaultActor)
847847

848848
BUILTIN_OPERAND_OWNERSHIP(InteriorPointer, InitializeDistributedRemoteActor)
849-
BUILTIN_OPERAND_OWNERSHIP(InteriorPointer, DestroyDistributedActor)
850849

851850
// FIXME: Why do these reqiuire a borrowed value at all?
852851
BUILTIN_OPERAND_OWNERSHIP(ForwardingBorrow, AutoDiffAllocateSubcontext)

lib/SIL/IR/ValueOwnership.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,6 @@ CONSTANT_OWNERSHIP_BUILTIN(None, ConvertTaskToJob)
538538
CONSTANT_OWNERSHIP_BUILTIN(None, InitializeDefaultActor)
539539
CONSTANT_OWNERSHIP_BUILTIN(None, DestroyDefaultActor)
540540
CONSTANT_OWNERSHIP_BUILTIN(None, InitializeDistributedRemoteActor)
541-
CONSTANT_OWNERSHIP_BUILTIN(None, DestroyDistributedActor)
542541
CONSTANT_OWNERSHIP_BUILTIN(Owned, AutoDiffCreateLinearMapContext)
543542
CONSTANT_OWNERSHIP_BUILTIN(None, AutoDiffProjectTopLevelSubcontext)
544543
CONSTANT_OWNERSHIP_BUILTIN(None, AutoDiffAllocateSubcontext)

lib/SILOptimizer/Mandatory/DefiniteInitialization.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2397,18 +2397,6 @@ static void emitDefaultActorDestroy(SILBuilder &B, SILLocation loc,
23972397
B.createEndBorrow(loc, self);
23982398
}
23992399

2400-
static void emitDistributedActorDestroy(SILBuilder &B, SILLocation loc,
2401-
SILValue self) {
2402-
auto builtinName = B.getASTContext().getIdentifier(
2403-
getBuiltinName(BuiltinValueKind::DestroyDistributedActor));
2404-
auto resultTy = B.getModule().Types.getEmptyTupleType();
2405-
2406-
self = B.createBeginBorrow(loc, self);
2407-
B.createBuiltin(loc, builtinName, resultTy, /*subs*/{},
2408-
{ self });
2409-
B.createEndBorrow(loc, self);
2410-
}
2411-
24122400
void LifetimeChecker::processUninitializedRelease(SILInstruction *Release,
24132401
bool consumed,
24142402
SILBasicBlock::iterator InsertPt) {
@@ -2465,9 +2453,6 @@ void LifetimeChecker::processUninitializedRelease(SILInstruction *Release,
24652453
if (!TheMemory.isDelegatingInit()) {
24662454
auto classDecl = TheMemory.getASTType().getClassOrBoundGenericClass();
24672455
if (classDecl && classDecl->isRootDefaultActor()) {
2468-
if (classDecl->isDistributedActor())
2469-
emitDistributedActorDestroy(B, Loc, Pointer); // FIXME(distributed): this will be different only for if it is 'remote'
2470-
else
24712456
emitDefaultActorDestroy(B, Loc, Pointer);
24722457
}
24732458
}

0 commit comments

Comments
 (0)