Skip to content

Commit 0ec4251

Browse files
committed
[Distributed] remove distributed aware emitClassMemberDestruction for now
1 parent b4e8bbb commit 0ec4251

File tree

2 files changed

+2
-122
lines changed

2 files changed

+2
-122
lines changed

lib/SILGen/SILGenDestructor.cpp

Lines changed: 0 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -225,128 +225,6 @@ void SILGenFunction::emitClassMemberDestruction(ManagedValue selfValue,
225225
}
226226
}
227227

228-
//void SILGenFunction::emitClassMemberDestruction(ManagedValue selfValue,
229-
// ClassDecl *cd,
230-
// CleanupLocation cleanupLoc) {
231-
// assert(selfValue.getOwnershipKind() == OwnershipKind::Guaranteed);
232-
// ASTContext &ctx = getASTContext();
233-
// auto normalBB = createBasicBlock();
234-
//
235-
// // TODO(distributed): a remote actor does not have properties,
236-
// // so do not destroy them if the actor is remote
237-
// if (cd->isDistributedActor()) {
238-
// // FIXME(distributed): if remote, do the logic below, otherwise do the normal logic
239-
// auto selfType = cd->getDeclaredInterfaceType();
240-
//
241-
// auto loc = SILLocation(cd);
242-
// loc.markAutoGenerated();
243-
// Scope scope(Cleanups, CleanupLocation(loc));
244-
//
245-
// auto isRemoteBB = createBasicBlock();
246-
// auto isLocalBB = createBasicBlock();
247-
//
248-
// // TODO(distributed): de-duplicate with the thunk logic in SILGenDistributed
249-
// // if __isRemoteActor(self) {
250-
// // ...
251-
// // } else {
252-
// // ...
253-
// // }
254-
// {
255-
// FuncDecl *isRemoteFn = ctx.getIsRemoteDistributedActor();
256-
// assert(isRemoteFn && "Could not find 'is remote' function, is the "
257-
// "'_Distributed' module available?");
258-
//
259-
// ManagedValue selfAnyObject =
260-
// B.createInitExistentialRef(loc, getLoweredType(ctx.getAnyObjectType()),
261-
// CanType(selfType), selfValue, {});
262-
// auto result = emitApplyOfLibraryIntrinsic(
263-
// loc, isRemoteFn, SubstitutionMap(), {selfAnyObject}, SGFContext());
264-
//
265-
// SILValue isRemoteResult =
266-
// std::move(result).forwardAsSingleValue(*this, loc);
267-
// SILValue isRemoteResultUnwrapped =
268-
// emitUnwrapIntegerResult(loc, isRemoteResult);
269-
//
270-
// B.createCondBranch(loc, isRemoteResultUnwrapped, isRemoteBB, isLocalBB);
271-
// }
272-
//
273-
// // // if __isRemoteActor(self)
274-
// // {
275-
// // // nothing
276-
// // }
277-
// {
278-
// B.emitBlock(isRemoteBB);
279-
//
280-
// // TODO: deduplicate in this func, make another bb
281-
// auto builtinName = getASTContext().getIdentifier(
282-
// getBuiltinName(BuiltinValueKind::DestroyDefaultActor));
283-
// auto resultTy = SGM.Types.getEmptyTupleType();
284-
//
285-
// B.createBuiltin(cleanupLoc, builtinName, resultTy, /*subs*/{},
286-
// { selfValue.getValue() });
287-
// }
288-
//
289-
// // // else (local distributed actor)
290-
// // {
291-
// // <continue normal deinit>
292-
// // }
293-
// {
294-
// B.emitBlock(isLocalBB);
295-
//
296-
// B.createBranch(loc, normalBB, {selfValue});
297-
// }
298-
// }
299-
//
300-
// {
301-
// if (cd->isDistributedActor())
302-
// B.emitBlock(normalBB);
303-
//
304-
// for (VarDecl *vd : cd->getStoredProperties()) {
305-
// const TypeLowering &ti = getTypeLowering(vd->getType());
306-
// if (!ti.isTrivial()) {
307-
// SILValue addr =
308-
// B.createRefElementAddr(cleanupLoc, selfValue.getValue(), vd,
309-
// ti.getLoweredType().getAddressType());
310-
// addr = B.createBeginAccess(
311-
// cleanupLoc, addr, SILAccessKind::Deinit, SILAccessEnforcement::Static,
312-
// false /*noNestedConflict*/, false /*fromBuiltin*/);
313-
// B.createDestroyAddr(cleanupLoc, addr);
314-
// B.createEndAccess(cleanupLoc, addr, false /*is aborting*/);
315-
// }
316-
// }
317-
//
318-
// if (cd->isRootDefaultActor()) {
319-
// auto builtinName = getASTContext().getIdentifier(
320-
// getBuiltinName(BuiltinValueKind::DestroyDefaultActor));
321-
// auto resultTy = SGM.Types.getEmptyTupleType();
322-
//
323-
// B.createBuiltin(cleanupLoc, builtinName, resultTy, /*subs*/{},
324-
// { selfValue.getValue() });
325-
// }
326-
// }
327-
//
328-
//
329-
//
330-
//// // Additional destroy logic for actors
331-
//// {
332-
//// llvm::Optional<Identifier> builtinName;
333-
//// if (cd->isDistributedActor()) {
334-
//// builtinName = getASTContext().getIdentifier(
335-
//// getBuiltinName(BuiltinValueKind::DestroyDistributedActor));
336-
//// } else if (cd->isRootDefaultActor()) {
337-
//// builtinName = getASTContext().getIdentifier(
338-
//// getBuiltinName(BuiltinValueKind::DestroyDefaultActor));
339-
//// }
340-
////
341-
//// if (builtinName.hasValue()) {
342-
//// auto resultTy = SGM.Types.getEmptyTupleType();
343-
//// B.createBuiltin(cleanupLoc, *builtinName, resultTy, /*subs*/ {},
344-
//// {selfValue.getValue()});
345-
//// }
346-
//// }
347-
//}
348-
349-
350228
void SILGenFunction::emitObjCDestructor(SILDeclRef dtor) {
351229
auto dd = cast<DestructorDecl>(dtor.getDecl());
352230
auto cd = cast<ClassDecl>(dd->getDeclContext());

lib/Sema/CodeSynthesisDistributedActor.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ using namespace swift;
4545
///
4646
/// factory function in the AST, with an empty body. Its body is
4747
/// expected to be filled-in during SILGen.
48+
// TODO(distributed): move this synthesis to DerivedConformance style
4849
static void addFactoryResolveFunction(ClassDecl *decl) {
4950
assert(decl->isDistributedActor());
5051
auto &C = decl->getASTContext();
@@ -127,6 +128,7 @@ createStoredProperty(ClassDecl *classDecl, ASTContext &ctx,
127128
/// Adds the following, fairly special, properties to each distributed actor:
128129
/// - actorTransport
129130
/// - id
131+
// TODO(distributed): move this synthesis to DerivedConformance style
130132
static void addImplicitDistributedActorStoredProperties(ClassDecl *decl) {
131133
assert(decl->isDistributedActor());
132134

0 commit comments

Comments
 (0)